Various improvements

This commit is contained in:
Ilya Laktyushin
2020-10-21 02:29:08 +04:00
parent 047a0085c7
commit 8ca5750cb9
35 changed files with 4773 additions and 4441 deletions

View File

@@ -45,7 +45,7 @@ public enum TelegramMediaActionType: PostboxCoding, Equatable {
case botSentSecureValues(types: [SentSecureValueType])
case peerJoined
case phoneNumberRequest
case geoProximityReached(distance: Int32)
case geoProximityReached(from: PeerId, to: PeerId, distance: Int32)
public init(decoder: PostboxDecoder) {
let rawValue: Int32 = decoder.decodeInt32ForKey("_rawValue", orElse: 0)
@@ -97,7 +97,7 @@ public enum TelegramMediaActionType: PostboxCoding, Equatable {
case 20:
self = .phoneNumberRequest
case 21:
self = .geoProximityReached(distance: (decoder.decodeInt32ForKey("dst", orElse: 0)))
self = .geoProximityReached(from: PeerId(decoder.decodeInt64ForKey("fromId", orElse: 0)), to: PeerId(decoder.decodeInt64ForKey("toId", orElse: 0)), distance: (decoder.decodeInt32ForKey("dst", orElse: 0)))
default:
self = .unknown
}
@@ -183,8 +183,10 @@ public enum TelegramMediaActionType: PostboxCoding, Equatable {
encoder.encodeInt32(19, forKey: "_rawValue")
case .phoneNumberRequest:
encoder.encodeInt32(20, forKey: "_rawValue")
case let .geoProximityReached(distance):
case let .geoProximityReached(from, to, distance):
encoder.encodeInt32(21, forKey: "_rawValue")
encoder.encodeInt64(from.toInt64(), forKey: "fromId")
encoder.encodeInt64(to.toInt64(), forKey: "toId")
encoder.encodeInt32(distance, forKey: "dst")
}
}
@@ -201,6 +203,8 @@ public enum TelegramMediaActionType: PostboxCoding, Equatable {
return [groupId]
case let .groupMigratedToChannel(channelId):
return [channelId]
case let .geoProximityReached(from, to, _):
return [from, to]
default:
return []
}