Merge branch 'master' of gitlab.com:peter-iakovlev/telegram-ios

This commit is contained in:
Ilya Laktyushin 2025-02-18 10:12:16 +04:00
commit 18f2d91ccd
6 changed files with 128 additions and 1 deletions

View File

@ -1 +1 @@
a9952f2d5730b71bcafb90f6fc0d0bed
b599f892960d4e1dfd3aef9d345df434

View File

@ -0,0 +1,61 @@
#!/bin/sh
# Default directories
OUTPUT_DIR=""
INPUT_DIR=""
# Parse command line arguments
while [ "$#" -gt 0 ]; do
case "$1" in
--output)
OUTPUT_DIR="$2"
shift 2
;;
--input)
INPUT_DIR="$2"
shift 2
;;
*)
echo "Unknown parameter: $1"
exit 1
;;
esac
done
# Validate output directory
if [ -z "$OUTPUT_DIR" ]; then
echo "Error: --output argument is required"
exit 1
fi
if [ ! -d "$OUTPUT_DIR" ]; then
echo "Error: Output directory does not exist: $OUTPUT_DIR"
exit 1
fi
# Validate input directory
if [ -z "$INPUT_DIR" ]; then
echo "Error: --input argument is required"
exit 1
fi
if [ ! -d "$INPUT_DIR" ]; then
echo "Error: Input directory does not exist: $INPUT_DIR"
exit 1
fi
# Remove existing Swift files from output directory
rm -f "$OUTPUT_DIR"/*.swift
# Get all .fbs files in Models directory
models=$(ls "$INPUT_DIR"/*.fbs)
# Initialize empty flatc_input
flatc_input=""
# Build space-separated list of model paths
for model in $models; do
flatc_input="$flatc_input $model"
done
flatc --require-explicit-ids --swift -o "$OUTPUT_DIR" ${flatc_input}

View File

@ -43,6 +43,18 @@ func _internal_addNoPaidMessagesException(account: Account, peerId: PeerId, refu
return account.network.request(Api.functions.account.addNoPaidMessagesException(flags: flags, userId: inputUser))
|> `catch` { _ -> Signal<Api.Bool, NoError> in
return .single(.boolFalse)
} |> mapToSignal { _ in
return account.postbox.transaction { transaction -> Void in
transaction.updatePeerCachedData(peerIds: Set([peerId]), update: { _, cachedData in
if let cachedData = cachedData as? CachedUserData {
var settings = cachedData.peerStatusSettings ?? .init()
settings.paidMessageStars = nil
return cachedData.withUpdatedPeerStatusSettings(settings)
}
return cachedData
})
}
|> ignoreValues
}
|> ignoreValues
}

View File

@ -361,6 +361,40 @@ public extension TelegramEngine.EngineData.Item {
}
}
}
public struct SendPaidMessageStars: TelegramEngineDataItem, TelegramEngineMapKeyDataItem, PostboxViewDataItem {
public typealias Result = Optional<StarsAmount>
fileprivate var id: EnginePeer.Id
public var mapKey: EnginePeer.Id {
return self.id
}
public init(id: EnginePeer.Id) {
self.id = id
}
var key: PostboxViewKey {
return .cachedPeerData(peerId: self.id)
}
func extract(view: PostboxView) -> Result {
guard let view = view as? CachedPeerDataView else {
preconditionFailure()
}
guard let cachedPeerData = view.cachedPeerData else {
return nil
}
switch cachedPeerData {
case let user as CachedUserData:
return user.sendPaidMessageStars
case let channel as CachedChannelData:
return channel.sendPaidMessageStars
default:
return nil
}
}
}
public struct GroupCallDescription: TelegramEngineDataItem, TelegramEngineMapKeyDataItem, PostboxViewDataItem {
public typealias Result = Optional<EngineGroupCallDescription>

View File

@ -470,6 +470,24 @@ public extension Message {
}
return nil
}
var derivedDataAttribute: DerivedDataMessageAttribute? {
for attribute in self.attributes {
if let attribute = attribute as? DerivedDataMessageAttribute {
return attribute
}
}
return nil
}
var forwardVideoTimestampAttribute: ForwardVideoTimestampAttribute? {
for attribute in self.attributes {
if let attribute = attribute as? ForwardVideoTimestampAttribute {
return attribute
}
}
return nil
}
}
public extension Message {
var reactionsAttribute: ReactionsMessageAttribute? {

View File

@ -1088,7 +1088,9 @@ public final class OngoingGroupCallContext {
}
func activateIncomingAudio() {
#if os(iOS)
self.context.activateIncomingAudio()
#endif
}
}