mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Merge branch 'master' of gitlab.com:peter-iakovlev/telegram-ios
This commit is contained in:
commit
d9f2f844d0
@ -108,7 +108,7 @@ verifysanity_beta_testflight:
|
|||||||
artifacts:
|
artifacts:
|
||||||
when: on_failure
|
when: on_failure
|
||||||
paths:
|
paths:
|
||||||
- build/verifysanity_artifacts
|
- build/artifacts
|
||||||
expire_in: 1 week
|
expire_in: 1 week
|
||||||
|
|
||||||
verify_beta_testflight:
|
verify_beta_testflight:
|
||||||
@ -126,5 +126,5 @@ verify_beta_testflight:
|
|||||||
artifacts:
|
artifacts:
|
||||||
when: on_failure
|
when: on_failure
|
||||||
paths:
|
paths:
|
||||||
- build/verify_artifacts
|
- build/artifacts
|
||||||
expire_in: 1 week
|
expire_in: 1 week
|
||||||
|
11
Makefile
11
Makefile
@ -46,7 +46,10 @@ BUCK_OPTIONS=\
|
|||||||
|
|
||||||
BAZEL=$(shell which bazel)
|
BAZEL=$(shell which bazel)
|
||||||
|
|
||||||
ifneq ($(BAZEL_CACHE_DIR),)
|
ifneq ($(BAZEL_HTTP_CACHE_URL),)
|
||||||
|
export BAZEL_CACHE_FLAGS=\
|
||||||
|
--remote_cache="$(BAZEL_HTTP_CACHE_URL)"
|
||||||
|
else ifneq ($(BAZEL_CACHE_DIR),)
|
||||||
export BAZEL_CACHE_FLAGS=\
|
export BAZEL_CACHE_FLAGS=\
|
||||||
--disk_cache="${BAZEL_CACHE_DIR}"
|
--disk_cache="${BAZEL_CACHE_DIR}"
|
||||||
endif
|
endif
|
||||||
@ -59,12 +62,14 @@ BAZEL_DEBUG_FLAGS=\
|
|||||||
--features=swift.enable_batch_mode \
|
--features=swift.enable_batch_mode \
|
||||||
--swiftcopt=-j${CORE_COUNT_MINUS_ONE} \
|
--swiftcopt=-j${CORE_COUNT_MINUS_ONE} \
|
||||||
|
|
||||||
|
# --num-threads 0 forces swiftc to generate one object file per module; it:
|
||||||
|
# 1. resolves issues with the linker caused by swift-objc mixing.
|
||||||
|
# 2. makes the resulting binaries significantly smaller (up to 9% for this project).
|
||||||
BAZEL_OPT_FLAGS=\
|
BAZEL_OPT_FLAGS=\
|
||||||
--features=swift.opt_uses_wmo \
|
--features=swift.opt_uses_wmo \
|
||||||
--features=swift.opt_uses_osize \
|
--features=swift.opt_uses_osize \
|
||||||
--swiftcopt='-num-threads' --swiftcopt='16' \
|
--swiftcopt='-num-threads' --swiftcopt='0' \
|
||||||
--objc_enable_binary_stripping \
|
--objc_enable_binary_stripping \
|
||||||
-s \
|
|
||||||
|
|
||||||
|
|
||||||
build_arm64: check_env
|
build_arm64: check_env
|
||||||
|
@ -1250,10 +1250,10 @@ ios_application(
|
|||||||
":AppStringResources",
|
":AppStringResources",
|
||||||
],
|
],
|
||||||
extensions = [
|
extensions = [
|
||||||
#":ShareExtension",
|
":ShareExtension",
|
||||||
#":NotificationServiceExtension",
|
#":NotificationServiceExtension",
|
||||||
],
|
],
|
||||||
#watch_application = ":TelegramWatchApp",
|
watch_application = ":TelegramWatchApp",
|
||||||
deps = [
|
deps = [
|
||||||
":Main",
|
":Main",
|
||||||
":Lib",
|
":Lib",
|
||||||
|
@ -2,6 +2,13 @@
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
COMMIT_COMMENT="$(git log -1 --pretty=%B)"
|
||||||
|
case "$COMMIT_COMMENT" in
|
||||||
|
*"[nodeploy]"*)
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
CONFIGURATION="$1"
|
CONFIGURATION="$1"
|
||||||
|
|
||||||
if [ -z "$CONFIGURATION" ]; then
|
if [ -z "$CONFIGURATION" ]; then
|
||||||
|
@ -9,9 +9,9 @@ public enum DeviceLocationMode: Int32 {
|
|||||||
private final class DeviceLocationSubscriber {
|
private final class DeviceLocationSubscriber {
|
||||||
let id: Int32
|
let id: Int32
|
||||||
let mode: DeviceLocationMode
|
let mode: DeviceLocationMode
|
||||||
let update: (CLLocationCoordinate2D) -> Void
|
let update: (CLLocationCoordinate2D, Double, Double?) -> Void
|
||||||
|
|
||||||
init(id: Int32, mode: DeviceLocationMode, update: @escaping (CLLocationCoordinate2D) -> Void) {
|
init(id: Int32, mode: DeviceLocationMode, update: @escaping (CLLocationCoordinate2D, Double, Double?) -> Void) {
|
||||||
self.id = id
|
self.id = id
|
||||||
self.mode = mode
|
self.mode = mode
|
||||||
self.update = update
|
self.update = update
|
||||||
@ -39,7 +39,8 @@ public final class DeviceLocationManager: NSObject {
|
|||||||
private var subscribers: [DeviceLocationSubscriber] = []
|
private var subscribers: [DeviceLocationSubscriber] = []
|
||||||
private var currentTopMode: DeviceLocationMode?
|
private var currentTopMode: DeviceLocationMode?
|
||||||
|
|
||||||
private var currentLocation: CLLocationCoordinate2D?
|
private var currentLocation: (CLLocationCoordinate2D, Double)?
|
||||||
|
private var currentHeading: CLHeading?
|
||||||
|
|
||||||
public init(queue: Queue, log: ((String) -> Void)? = nil) {
|
public init(queue: Queue, log: ((String) -> Void)? = nil) {
|
||||||
assert(queue.isCurrent())
|
assert(queue.isCurrent())
|
||||||
@ -60,7 +61,7 @@ public final class DeviceLocationManager: NSObject {
|
|||||||
self.manager.pausesLocationUpdatesAutomatically = false
|
self.manager.pausesLocationUpdatesAutomatically = false
|
||||||
}
|
}
|
||||||
|
|
||||||
public func push(mode: DeviceLocationMode, updated: @escaping (CLLocationCoordinate2D) -> Void) -> Disposable {
|
public func push(mode: DeviceLocationMode, updated: @escaping (CLLocationCoordinate2D, Double, Double?) -> Void) -> Disposable {
|
||||||
assert(self.queue.isCurrent())
|
assert(self.queue.isCurrent())
|
||||||
|
|
||||||
let id = self.nextSubscriberId
|
let id = self.nextSubscriberId
|
||||||
@ -68,7 +69,7 @@ public final class DeviceLocationManager: NSObject {
|
|||||||
self.subscribers.append(DeviceLocationSubscriber(id: id, mode: mode, update: updated))
|
self.subscribers.append(DeviceLocationSubscriber(id: id, mode: mode, update: updated))
|
||||||
|
|
||||||
if let currentLocation = self.currentLocation {
|
if let currentLocation = self.currentLocation {
|
||||||
updated(currentLocation)
|
updated(currentLocation.0, currentLocation.1, self.currentHeading?.magneticHeading)
|
||||||
}
|
}
|
||||||
|
|
||||||
self.updateTopMode()
|
self.updateTopMode()
|
||||||
@ -107,6 +108,7 @@ public final class DeviceLocationManager: NSObject {
|
|||||||
self.manager.requestAlwaysAuthorization()
|
self.manager.requestAlwaysAuthorization()
|
||||||
}
|
}
|
||||||
self.manager.startUpdatingLocation()
|
self.manager.startUpdatingLocation()
|
||||||
|
self.manager.startUpdatingHeading()
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
self.currentLocation = nil
|
self.currentLocation = nil
|
||||||
@ -123,9 +125,22 @@ extension DeviceLocationManager: CLLocationManagerDelegate {
|
|||||||
|
|
||||||
if let location = locations.first {
|
if let location = locations.first {
|
||||||
if self.currentTopMode != nil {
|
if self.currentTopMode != nil {
|
||||||
self.currentLocation = location.coordinate
|
self.currentLocation = (location.coordinate, location.horizontalAccuracy)
|
||||||
for subscriber in self.subscribers {
|
for subscriber in self.subscribers {
|
||||||
subscriber.update(location.coordinate)
|
subscriber.update(location.coordinate, location.horizontalAccuracy, self.currentHeading?.magneticHeading)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public func locationManager(_ manager: CLLocationManager, didUpdateHeading newHeading: CLHeading) {
|
||||||
|
assert(self.queue.isCurrent())
|
||||||
|
|
||||||
|
if self.currentTopMode != nil {
|
||||||
|
self.currentHeading = newHeading
|
||||||
|
if let currentLocation = self.currentLocation {
|
||||||
|
for subscriber in self.subscribers {
|
||||||
|
subscriber.update(currentLocation.0, currentLocation.1, newHeading.magneticHeading)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -135,7 +150,7 @@ extension DeviceLocationManager: CLLocationManagerDelegate {
|
|||||||
public func currentLocationManagerCoordinate(manager: DeviceLocationManager, timeout timeoutValue: Double) -> Signal<CLLocationCoordinate2D?, NoError> {
|
public func currentLocationManagerCoordinate(manager: DeviceLocationManager, timeout timeoutValue: Double) -> Signal<CLLocationCoordinate2D?, NoError> {
|
||||||
return (
|
return (
|
||||||
Signal { subscriber in
|
Signal { subscriber in
|
||||||
let disposable = manager.push(mode: .precise, updated: { coordinate in
|
let disposable = manager.push(mode: .precise, updated: { coordinate, _, _ in
|
||||||
subscriber.putNext(coordinate)
|
subscriber.putNext(coordinate)
|
||||||
subscriber.putCompletion()
|
subscriber.putCompletion()
|
||||||
})
|
})
|
||||||
|
@ -14,7 +14,6 @@ swift_library(
|
|||||||
"//submodules/Markdown:Markdown",
|
"//submodules/Markdown:Markdown",
|
||||||
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
|
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
|
||||||
],
|
],
|
||||||
alwayslink = True,
|
|
||||||
visibility = [
|
visibility = [
|
||||||
"//visibility:public",
|
"//visibility:public",
|
||||||
],
|
],
|
||||||
|
@ -816,7 +816,7 @@ func layoutInstantPageBlock(webpage: TelegramMediaWebpage, rtl: Bool, block: Ins
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let map = TelegramMediaMap(latitude: latitude, longitude: longitude, geoPlace: nil, venue: nil, liveBroadcastingTimeout: nil)
|
let map = TelegramMediaMap(latitude: latitude, longitude: longitude, heading: nil, accuracyRadius: nil, geoPlace: nil, venue: nil, liveBroadcastingTimeout: nil)
|
||||||
let attributes: [InstantPageImageAttribute] = [InstantPageMapAttribute(zoom: zoom, dimensions: dimensions.cgSize)]
|
let attributes: [InstantPageImageAttribute] = [InstantPageMapAttribute(zoom: zoom, dimensions: dimensions.cgSize)]
|
||||||
|
|
||||||
var contentSize = CGSize(width: boundingWidth - safeInset * 2.0, height: 0.0)
|
var contentSize = CGSize(width: boundingWidth - safeInset * 2.0, height: 0.0)
|
||||||
|
@ -553,7 +553,7 @@ private func loadLegacyMessages(account: TemporaryAccount, basePath: String, acc
|
|||||||
if let v = item.venue {
|
if let v = item.venue {
|
||||||
venue = MapVenue(title: v.title ?? "", address: v.address ?? "", provider: v.provider == "" ? nil : v.provider, id: v.venueId == "" ? nil : v.venueId, type: v.type == "" ? nil : v.type)
|
venue = MapVenue(title: v.title ?? "", address: v.address ?? "", provider: v.provider == "" ? nil : v.provider, id: v.venueId == "" ? nil : v.venueId, type: v.type == "" ? nil : v.type)
|
||||||
}
|
}
|
||||||
parsedMedia.append(TelegramMediaMap(latitude: item.latitude, longitude: item.longitude, geoPlace: nil, venue: venue, liveBroadcastingTimeout: nil))
|
parsedMedia.append(TelegramMediaMap(latitude: item.latitude, longitude: item.longitude, heading: nil, accuracyRadius: nil, geoPlace: nil, venue: venue, liveBroadcastingTimeout: nil))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -107,9 +107,9 @@ public final class LiveLocationManagerImpl: LiveLocationManager {
|
|||||||
if let strongSelf = self {
|
if let strongSelf = self {
|
||||||
if value {
|
if value {
|
||||||
let queue = strongSelf.queue
|
let queue = strongSelf.queue
|
||||||
strongSelf.deviceLocationDisposable.set(strongSelf.locationManager.push(mode: .precise, updated: { coordinate in
|
strongSelf.deviceLocationDisposable.set(strongSelf.locationManager.push(mode: .precise, updated: { coordinate, accuracyRadius, heading in
|
||||||
queue.async {
|
queue.async {
|
||||||
self?.updateDeviceCoordinate(coordinate)
|
self?.updateDeviceCoordinate(coordinate, accuracyRadius: accuracyRadius, heading: heading)
|
||||||
}
|
}
|
||||||
}))
|
}))
|
||||||
} else {
|
} else {
|
||||||
@ -158,7 +158,7 @@ public final class LiveLocationManagerImpl: LiveLocationManager {
|
|||||||
let addedStopped = stopMessageIds.subtracting(self.stopMessageIds)
|
let addedStopped = stopMessageIds.subtracting(self.stopMessageIds)
|
||||||
self.stopMessageIds = stopMessageIds
|
self.stopMessageIds = stopMessageIds
|
||||||
for id in addedStopped {
|
for id in addedStopped {
|
||||||
self.editMessageDisposables.set((requestEditLiveLocation(postbox: self.postbox, network: self.network, stateManager: self.stateManager, messageId: id, coordinate: nil)
|
self.editMessageDisposables.set((requestEditLiveLocation(postbox: self.postbox, network: self.network, stateManager: self.stateManager, messageId: id, coordinate: nil, heading: nil)
|
||||||
|> deliverOn(self.queue)).start(completed: { [weak self] in
|
|> deliverOn(self.queue)).start(completed: { [weak self] in
|
||||||
if let strongSelf = self {
|
if let strongSelf = self {
|
||||||
strongSelf.editMessageDisposables.set(nil, forKey: id)
|
strongSelf.editMessageDisposables.set(nil, forKey: id)
|
||||||
@ -207,13 +207,13 @@ public final class LiveLocationManagerImpl: LiveLocationManager {
|
|||||||
self.update(broadcastToMessageIds: updatedBroadcastToMessageIds, stopMessageIds: updatedStopMessageIds)
|
self.update(broadcastToMessageIds: updatedBroadcastToMessageIds, stopMessageIds: updatedStopMessageIds)
|
||||||
}
|
}
|
||||||
|
|
||||||
private func updateDeviceCoordinate(_ coordinate: CLLocationCoordinate2D) {
|
private func updateDeviceCoordinate(_ coordinate: CLLocationCoordinate2D, accuracyRadius: Double, heading: Double?) {
|
||||||
assert(self.queue.isCurrent())
|
assert(self.queue.isCurrent())
|
||||||
|
|
||||||
let ids = self.broadcastToMessageIds
|
let ids = self.broadcastToMessageIds
|
||||||
let remainingIds = Atomic<Set<MessageId>>(value: Set(ids.keys))
|
let remainingIds = Atomic<Set<MessageId>>(value: Set(ids.keys))
|
||||||
for id in ids.keys {
|
for id in ids.keys {
|
||||||
self.editMessageDisposables.set((requestEditLiveLocation(postbox: self.postbox, network: self.network, stateManager: self.stateManager, messageId: id, coordinate: (latitude: coordinate.latitude, longitude: coordinate.longitude))
|
self.editMessageDisposables.set((requestEditLiveLocation(postbox: self.postbox, network: self.network, stateManager: self.stateManager, messageId: id, coordinate: (latitude: coordinate.latitude, longitude: coordinate.longitude, accuracyRadius: Int32(accuracyRadius)), heading: Int32(heading ?? 0))
|
||||||
|> deliverOn(self.queue)).start(completed: { [weak self] in
|
|> deliverOn(self.queue)).start(completed: { [weak self] in
|
||||||
if let strongSelf = self {
|
if let strongSelf = self {
|
||||||
strongSelf.editMessageDisposables.set(nil, forKey: id)
|
strongSelf.editMessageDisposables.set(nil, forKey: id)
|
||||||
@ -247,7 +247,7 @@ public final class LiveLocationManagerImpl: LiveLocationManager {
|
|||||||
let timestamp = Int32(CFAbsoluteTimeGetCurrent() + kCFAbsoluteTimeIntervalSince1970)
|
let timestamp = Int32(CFAbsoluteTimeGetCurrent() + kCFAbsoluteTimeIntervalSince1970)
|
||||||
for i in 0 ..< updatedMedia.count {
|
for i in 0 ..< updatedMedia.count {
|
||||||
if let media = updatedMedia[i] as? TelegramMediaMap, let _ = media.liveBroadcastingTimeout {
|
if let media = updatedMedia[i] as? TelegramMediaMap, let _ = media.liveBroadcastingTimeout {
|
||||||
updatedMedia[i] = TelegramMediaMap(latitude: media.latitude, longitude: media.longitude, geoPlace: media.geoPlace, venue: media.venue, liveBroadcastingTimeout: max(0, timestamp - currentMessage.timestamp - 1))
|
updatedMedia[i] = TelegramMediaMap(latitude: media.latitude, longitude: media.longitude, heading: media.heading, accuracyRadius: media.accuracyRadius, geoPlace: media.geoPlace, venue: media.venue, liveBroadcastingTimeout: max(0, timestamp - currentMessage.timestamp - 1))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return .update(StoreMessage(id: currentMessage.id, globallyUniqueId: currentMessage.globallyUniqueId, groupingKey: currentMessage.groupingKey, threadId: currentMessage.threadId, timestamp: currentMessage.timestamp, flags: StoreMessageFlags(currentMessage.flags), tags: currentMessage.tags, globalTags: currentMessage.globalTags, localTags: currentMessage.localTags, forwardInfo: storeForwardInfo, authorId: currentMessage.author?.id, text: currentMessage.text, attributes: currentMessage.attributes, media: updatedMedia))
|
return .update(StoreMessage(id: currentMessage.id, globallyUniqueId: currentMessage.globallyUniqueId, groupingKey: currentMessage.groupingKey, threadId: currentMessage.threadId, timestamp: currentMessage.timestamp, flags: StoreMessageFlags(currentMessage.flags), tags: currentMessage.tags, globalTags: currentMessage.globalTags, localTags: currentMessage.localTags, forwardInfo: storeForwardInfo, authorId: currentMessage.author?.id, text: currentMessage.text, attributes: currentMessage.attributes, media: updatedMedia))
|
||||||
|
@ -120,7 +120,7 @@ private func telegramMap(for location: TGLocationMediaAttachment) -> TelegramMed
|
|||||||
} else {
|
} else {
|
||||||
mapVenue = nil
|
mapVenue = nil
|
||||||
}
|
}
|
||||||
return TelegramMediaMap(latitude: location.latitude, longitude: location.longitude, geoPlace: nil, venue: mapVenue, liveBroadcastingTimeout: nil)
|
return TelegramMediaMap(latitude: location.latitude, longitude: location.longitude, heading: nil, accuracyRadius: nil, geoPlace: nil, venue: mapVenue, liveBroadcastingTimeout: nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
func legacyLocationPalette(from theme: PresentationTheme) -> TGLocationPallete {
|
func legacyLocationPalette(from theme: PresentationTheme) -> TGLocationPallete {
|
||||||
|
@ -103,7 +103,7 @@ public final class LocationPickerController: ViewController {
|
|||||||
})
|
})
|
||||||
|
|
||||||
let locationWithTimeout: (CLLocationCoordinate2D, Int32?) -> TelegramMediaMap = { coordinate, timeout in
|
let locationWithTimeout: (CLLocationCoordinate2D, Int32?) -> TelegramMediaMap = { coordinate, timeout in
|
||||||
return TelegramMediaMap(latitude: coordinate.latitude, longitude: coordinate.longitude, geoPlace: nil, venue: nil, liveBroadcastingTimeout: timeout)
|
return TelegramMediaMap(latitude: coordinate.latitude, longitude: coordinate.longitude, heading: nil, accuracyRadius: nil, geoPlace: nil, venue: nil, liveBroadcastingTimeout: timeout)
|
||||||
}
|
}
|
||||||
|
|
||||||
self.interaction = LocationPickerInteraction(sendLocation: { [weak self] coordinate in
|
self.interaction = LocationPickerInteraction(sendLocation: { [weak self] coordinate in
|
||||||
@ -168,7 +168,7 @@ public final class LocationPickerController: ViewController {
|
|||||||
}
|
}
|
||||||
let venueType = venue.venue?.type ?? ""
|
let venueType = venue.venue?.type ?? ""
|
||||||
if ["home", "work"].contains(venueType) {
|
if ["home", "work"].contains(venueType) {
|
||||||
completion(TelegramMediaMap(latitude: venue.latitude, longitude: venue.longitude, geoPlace: nil, venue: nil, liveBroadcastingTimeout: nil), nil)
|
completion(TelegramMediaMap(latitude: venue.latitude, longitude: venue.longitude, heading: nil, accuracyRadius: nil, geoPlace: nil, venue: nil, liveBroadcastingTimeout: nil), nil)
|
||||||
} else {
|
} else {
|
||||||
completion(venue, nil)
|
completion(venue, nil)
|
||||||
}
|
}
|
||||||
|
@ -386,10 +386,10 @@ final class LocationPickerControllerNode: ViewControllerTracingNode, CLLocationM
|
|||||||
|> map { homeCoordinate, workCoordinate -> [TelegramMediaMap]? in
|
|> map { homeCoordinate, workCoordinate -> [TelegramMediaMap]? in
|
||||||
var venues: [TelegramMediaMap] = []
|
var venues: [TelegramMediaMap] = []
|
||||||
if let (latitude, longitude) = homeCoordinate, let address = homeAddress {
|
if let (latitude, longitude) = homeCoordinate, let address = homeAddress {
|
||||||
venues.append(TelegramMediaMap(latitude: latitude, longitude: longitude, geoPlace: nil, venue: MapVenue(title: presentationData.strings.Map_Home, address: address.displayString, provider: nil, id: "home", type: "home"), liveBroadcastingTimeout: nil))
|
venues.append(TelegramMediaMap(latitude: latitude, longitude: longitude, heading: nil, accuracyRadius: nil, geoPlace: nil, venue: MapVenue(title: presentationData.strings.Map_Home, address: address.displayString, provider: nil, id: "home", type: "home"), liveBroadcastingTimeout: nil))
|
||||||
}
|
}
|
||||||
if let (latitude, longitude) = workCoordinate, let address = workAddress {
|
if let (latitude, longitude) = workCoordinate, let address = workAddress {
|
||||||
venues.append(TelegramMediaMap(latitude: latitude, longitude: longitude, geoPlace: nil, venue: MapVenue(title: presentationData.strings.Map_Work, address: address.displayString, provider: nil, id: "work", type: "work"), liveBroadcastingTimeout: nil))
|
venues.append(TelegramMediaMap(latitude: latitude, longitude: longitude, heading: nil, accuracyRadius: nil, geoPlace: nil, venue: MapVenue(title: presentationData.strings.Map_Work, address: address.displayString, provider: nil, id: "work", type: "work"), liveBroadcastingTimeout: nil))
|
||||||
}
|
}
|
||||||
return venues
|
return venues
|
||||||
}
|
}
|
||||||
|
@ -179,7 +179,7 @@ final class LocationSearchContainerNode: ASDisplayNode {
|
|||||||
guard let placemarkLocation = placemark.location else {
|
guard let placemarkLocation = placemark.location else {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
let location = TelegramMediaMap(latitude: placemarkLocation.coordinate.latitude, longitude: placemarkLocation.coordinate.longitude, geoPlace: nil, venue: nil, liveBroadcastingTimeout: nil)
|
let location = TelegramMediaMap(latitude: placemarkLocation.coordinate.latitude, longitude: placemarkLocation.coordinate.longitude, heading: nil, accuracyRadius: nil, geoPlace: nil, venue: nil, liveBroadcastingTimeout: nil)
|
||||||
|
|
||||||
entries.append(LocationSearchEntry(index: index, theme: themeAndStrings.0, location: location, title: placemark.name ?? "Name", distance: placemarkLocation.distance(from: currentLocation)))
|
entries.append(LocationSearchEntry(index: index, theme: themeAndStrings.0, location: location, title: placemark.name ?? "Name", distance: placemarkLocation.distance(from: currentLocation)))
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ import MapKit
|
|||||||
|
|
||||||
extension TelegramMediaMap {
|
extension TelegramMediaMap {
|
||||||
convenience init(coordinate: CLLocationCoordinate2D, liveBroadcastingTimeout: Int32? = nil) {
|
convenience init(coordinate: CLLocationCoordinate2D, liveBroadcastingTimeout: Int32? = nil) {
|
||||||
self.init(latitude: coordinate.latitude, longitude: coordinate.longitude, geoPlace: nil, venue: nil, liveBroadcastingTimeout: liveBroadcastingTimeout)
|
self.init(latitude: coordinate.latitude, longitude: coordinate.longitude, heading: nil, accuracyRadius: nil, geoPlace: nil, venue: nil, liveBroadcastingTimeout: liveBroadcastingTimeout)
|
||||||
}
|
}
|
||||||
|
|
||||||
var coordinate: CLLocationCoordinate2D {
|
var coordinate: CLLocationCoordinate2D {
|
||||||
|
@ -2112,7 +2112,7 @@ public func groupInfoController(context: AccountContext, peerId originalPeerId:
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||||
let mapMedia = TelegramMediaMap(latitude: location.latitude, longitude: location.longitude, geoPlace: nil, venue: MapVenue(title: peer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder), address: location.address, provider: nil, id: nil, type: nil), liveBroadcastingTimeout: nil)
|
let mapMedia = TelegramMediaMap(latitude: location.latitude, longitude: location.longitude, heading: nil, accuracyRadius: nil, geoPlace: nil, venue: MapVenue(title: peer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder), address: location.address, provider: nil, id: nil, type: nil), liveBroadcastingTimeout: nil)
|
||||||
let controller = legacyLocationController(message: nil, mapMedia: mapMedia, context: context, openPeer: { _ in }, sendLiveLocation: { _, _ in }, stopLiveLocation: {}, openUrl: { url in
|
let controller = legacyLocationController(message: nil, mapMedia: mapMedia, context: context, openPeer: { _ in }, sendLiveLocation: { _, _ in }, stopLiveLocation: {}, openUrl: { url in
|
||||||
context.sharedContext.applicationBindings.openUrl(url)
|
context.sharedContext.applicationBindings.openUrl(url)
|
||||||
})
|
})
|
||||||
|
@ -385,7 +385,7 @@ public func themeAutoNightSettingsController(context: AccountContext) -> ViewCon
|
|||||||
|
|
||||||
let forceUpdateLocation: () -> Void = {
|
let forceUpdateLocation: () -> Void = {
|
||||||
let locationCoordinates = Signal<(Double, Double), NoError> { subscriber in
|
let locationCoordinates = Signal<(Double, Double), NoError> { subscriber in
|
||||||
return context.sharedContext.locationManager!.push(mode: DeviceLocationMode.precise, updated: { coordinate in
|
return context.sharedContext.locationManager!.push(mode: DeviceLocationMode.precise, updated: { coordinate, _, _ in
|
||||||
subscriber.putNext((coordinate.latitude, coordinate.longitude))
|
subscriber.putNext((coordinate.latitude, coordinate.longitude))
|
||||||
subscriber.putCompletion()
|
subscriber.putCompletion()
|
||||||
})
|
})
|
||||||
|
@ -260,9 +260,9 @@ private func preparedShareItem(account: Account, to peerId: PeerId, value: [Stri
|
|||||||
let disposable = TGShareLocationSignals.locationMessageContent(for: url).start(next: { value in
|
let disposable = TGShareLocationSignals.locationMessageContent(for: url).start(next: { value in
|
||||||
if let value = value as? TGShareLocationResult {
|
if let value = value as? TGShareLocationResult {
|
||||||
if let title = value.title {
|
if let title = value.title {
|
||||||
subscriber.putNext(.done(.media(.media(.standalone(media: TelegramMediaMap(latitude: value.latitude, longitude: value.longitude, geoPlace: nil, venue: MapVenue(title: title, address: value.address, provider: value.provider, id: value.venueId, type: value.venueType), liveBroadcastingTimeout: nil))))))
|
subscriber.putNext(.done(.media(.media(.standalone(media: TelegramMediaMap(latitude: value.latitude, longitude: value.longitude, heading: nil, accuracyRadius: nil, geoPlace: nil, venue: MapVenue(title: title, address: value.address, provider: value.provider, id: value.venueId, type: value.venueType), liveBroadcastingTimeout: nil))))))
|
||||||
} else {
|
} else {
|
||||||
subscriber.putNext(.done(.media(.media(.standalone(media: TelegramMediaMap(latitude: value.latitude, longitude: value.longitude, geoPlace: nil, venue: nil, liveBroadcastingTimeout: nil))))))
|
subscriber.putNext(.done(.media(.media(.standalone(media: TelegramMediaMap(latitude: value.latitude, longitude: value.longitude, heading: nil, accuracyRadius: nil, geoPlace: nil, venue: nil, liveBroadcastingTimeout: nil))))))
|
||||||
}
|
}
|
||||||
subscriber.putCompletion()
|
subscriber.putCompletion()
|
||||||
} else if let value = value as? String {
|
} else if let value = value as? String {
|
||||||
|
@ -45,6 +45,7 @@ public enum TelegramMediaActionType: PostboxCoding, Equatable {
|
|||||||
case botSentSecureValues(types: [SentSecureValueType])
|
case botSentSecureValues(types: [SentSecureValueType])
|
||||||
case peerJoined
|
case peerJoined
|
||||||
case phoneNumberRequest
|
case phoneNumberRequest
|
||||||
|
case geoProximityReached(distance: Int32)
|
||||||
|
|
||||||
public init(decoder: PostboxDecoder) {
|
public init(decoder: PostboxDecoder) {
|
||||||
let rawValue: Int32 = decoder.decodeInt32ForKey("_rawValue", orElse: 0)
|
let rawValue: Int32 = decoder.decodeInt32ForKey("_rawValue", orElse: 0)
|
||||||
@ -95,6 +96,8 @@ public enum TelegramMediaActionType: PostboxCoding, Equatable {
|
|||||||
self = .peerJoined
|
self = .peerJoined
|
||||||
case 20:
|
case 20:
|
||||||
self = .phoneNumberRequest
|
self = .phoneNumberRequest
|
||||||
|
case 21:
|
||||||
|
self = .geoProximityReached(distance: (decoder.decodeInt32ForKey("dst", orElse: 0)))
|
||||||
default:
|
default:
|
||||||
self = .unknown
|
self = .unknown
|
||||||
}
|
}
|
||||||
@ -180,6 +183,9 @@ public enum TelegramMediaActionType: PostboxCoding, Equatable {
|
|||||||
encoder.encodeInt32(19, forKey: "_rawValue")
|
encoder.encodeInt32(19, forKey: "_rawValue")
|
||||||
case .phoneNumberRequest:
|
case .phoneNumberRequest:
|
||||||
encoder.encodeInt32(20, forKey: "_rawValue")
|
encoder.encodeInt32(20, forKey: "_rawValue")
|
||||||
|
case let .geoProximityReached(distance):
|
||||||
|
encoder.encodeInt32(21, forKey: "_rawValue")
|
||||||
|
encoder.encodeInt32(distance, forKey: "dst")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,6 +133,8 @@ public final class MapVenue: PostboxCoding, Equatable {
|
|||||||
public final class TelegramMediaMap: Media {
|
public final class TelegramMediaMap: Media {
|
||||||
public let latitude: Double
|
public let latitude: Double
|
||||||
public let longitude: Double
|
public let longitude: Double
|
||||||
|
public let heading: Double?
|
||||||
|
public let accuracyRadius: Double?
|
||||||
public let geoPlace: NamedGeoPlace?
|
public let geoPlace: NamedGeoPlace?
|
||||||
public let venue: MapVenue?
|
public let venue: MapVenue?
|
||||||
public let liveBroadcastingTimeout: Int32?
|
public let liveBroadcastingTimeout: Int32?
|
||||||
@ -140,9 +142,11 @@ public final class TelegramMediaMap: Media {
|
|||||||
public let id: MediaId? = nil
|
public let id: MediaId? = nil
|
||||||
public let peerIds: [PeerId] = []
|
public let peerIds: [PeerId] = []
|
||||||
|
|
||||||
public init(latitude: Double, longitude: Double, geoPlace: NamedGeoPlace?, venue: MapVenue?, liveBroadcastingTimeout: Int32?) {
|
public init(latitude: Double, longitude: Double, heading: Double?, accuracyRadius: Double?, geoPlace: NamedGeoPlace?, venue: MapVenue?, liveBroadcastingTimeout: Int32?) {
|
||||||
self.latitude = latitude
|
self.latitude = latitude
|
||||||
self.longitude = longitude
|
self.longitude = longitude
|
||||||
|
self.heading = heading
|
||||||
|
self.accuracyRadius = accuracyRadius
|
||||||
self.geoPlace = geoPlace
|
self.geoPlace = geoPlace
|
||||||
self.venue = venue
|
self.venue = venue
|
||||||
self.liveBroadcastingTimeout = liveBroadcastingTimeout
|
self.liveBroadcastingTimeout = liveBroadcastingTimeout
|
||||||
@ -151,6 +155,8 @@ public final class TelegramMediaMap: Media {
|
|||||||
public init(decoder: PostboxDecoder) {
|
public init(decoder: PostboxDecoder) {
|
||||||
self.latitude = decoder.decodeDoubleForKey("la", orElse: 0.0)
|
self.latitude = decoder.decodeDoubleForKey("la", orElse: 0.0)
|
||||||
self.longitude = decoder.decodeDoubleForKey("lo", orElse: 0.0)
|
self.longitude = decoder.decodeDoubleForKey("lo", orElse: 0.0)
|
||||||
|
self.heading = decoder.decodeOptionalDoubleForKey("hdg")
|
||||||
|
self.accuracyRadius = decoder.decodeOptionalDoubleForKey("acc")
|
||||||
self.geoPlace = decoder.decodeObjectForKey("gp", decoder: { NamedGeoPlace(decoder: $0) }) as? NamedGeoPlace
|
self.geoPlace = decoder.decodeObjectForKey("gp", decoder: { NamedGeoPlace(decoder: $0) }) as? NamedGeoPlace
|
||||||
self.venue = decoder.decodeObjectForKey("ve", decoder: { MapVenue(decoder: $0) }) as? MapVenue
|
self.venue = decoder.decodeObjectForKey("ve", decoder: { MapVenue(decoder: $0) }) as? MapVenue
|
||||||
self.liveBroadcastingTimeout = decoder.decodeOptionalInt32ForKey("bt")
|
self.liveBroadcastingTimeout = decoder.decodeOptionalInt32ForKey("bt")
|
||||||
@ -159,6 +165,16 @@ public final class TelegramMediaMap: Media {
|
|||||||
public func encode(_ encoder: PostboxEncoder) {
|
public func encode(_ encoder: PostboxEncoder) {
|
||||||
encoder.encodeDouble(self.latitude, forKey: "la")
|
encoder.encodeDouble(self.latitude, forKey: "la")
|
||||||
encoder.encodeDouble(self.longitude, forKey: "lo")
|
encoder.encodeDouble(self.longitude, forKey: "lo")
|
||||||
|
if let heading = self.heading {
|
||||||
|
encoder.encodeDouble(heading, forKey: "hdg")
|
||||||
|
} else {
|
||||||
|
encoder.encodeNil(forKey: "hdg")
|
||||||
|
}
|
||||||
|
if let accuracyRadius = self.accuracyRadius {
|
||||||
|
encoder.encodeDouble(accuracyRadius, forKey: "acc")
|
||||||
|
} else {
|
||||||
|
encoder.encodeNil(forKey: "acc")
|
||||||
|
}
|
||||||
if let geoPlace = self.geoPlace {
|
if let geoPlace = self.geoPlace {
|
||||||
encoder.encodeObject(geoPlace, forKey: "gp")
|
encoder.encodeObject(geoPlace, forKey: "gp")
|
||||||
} else {
|
} else {
|
||||||
@ -181,6 +197,12 @@ public final class TelegramMediaMap: Media {
|
|||||||
if self.latitude != other.latitude || self.longitude != other.longitude {
|
if self.latitude != other.latitude || self.longitude != other.longitude {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
if self.heading != other.heading {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if self.accuracyRadius != other.accuracyRadius {
|
||||||
|
return false
|
||||||
|
}
|
||||||
if self.geoPlace != other.geoPlace {
|
if self.geoPlace != other.geoPlace {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
|
|||||||
dict[-1255641564] = { return parseString($0) }
|
dict[-1255641564] = { return parseString($0) }
|
||||||
dict[-1240849242] = { return Api.messages.StickerSet.parse_stickerSet($0) }
|
dict[-1240849242] = { return Api.messages.StickerSet.parse_stickerSet($0) }
|
||||||
dict[-457104426] = { return Api.InputGeoPoint.parse_inputGeoPointEmpty($0) }
|
dict[-457104426] = { return Api.InputGeoPoint.parse_inputGeoPointEmpty($0) }
|
||||||
dict[-206066487] = { return Api.InputGeoPoint.parse_inputGeoPoint($0) }
|
dict[1210199983] = { return Api.InputGeoPoint.parse_inputGeoPoint($0) }
|
||||||
dict[-784000893] = { return Api.payments.ValidatedRequestedInfo.parse_validatedRequestedInfo($0) }
|
dict[-784000893] = { return Api.payments.ValidatedRequestedInfo.parse_validatedRequestedInfo($0) }
|
||||||
dict[461151667] = { return Api.ChatFull.parse_chatFull($0) }
|
dict[461151667] = { return Api.ChatFull.parse_chatFull($0) }
|
||||||
dict[-253335766] = { return Api.ChatFull.parse_channelFull($0) }
|
dict[-253335766] = { return Api.ChatFull.parse_channelFull($0) }
|
||||||
@ -209,7 +209,6 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
|
|||||||
dict[1417832080] = { return Api.Update.parse_updateBotInlineQuery($0) }
|
dict[1417832080] = { return Api.Update.parse_updateBotInlineQuery($0) }
|
||||||
dict[239663460] = { return Api.Update.parse_updateBotInlineSend($0) }
|
dict[239663460] = { return Api.Update.parse_updateBotInlineSend($0) }
|
||||||
dict[457133559] = { return Api.Update.parse_updateEditChannelMessage($0) }
|
dict[457133559] = { return Api.Update.parse_updateEditChannelMessage($0) }
|
||||||
dict[-1738988427] = { return Api.Update.parse_updateChannelPinnedMessage($0) }
|
|
||||||
dict[-415938591] = { return Api.Update.parse_updateBotCallbackQuery($0) }
|
dict[-415938591] = { return Api.Update.parse_updateBotCallbackQuery($0) }
|
||||||
dict[-469536605] = { return Api.Update.parse_updateEditMessage($0) }
|
dict[-469536605] = { return Api.Update.parse_updateEditMessage($0) }
|
||||||
dict[-103646630] = { return Api.Update.parse_updateInlineBotCallbackQuery($0) }
|
dict[-103646630] = { return Api.Update.parse_updateInlineBotCallbackQuery($0) }
|
||||||
@ -373,9 +372,9 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
|
|||||||
dict[-440664550] = { return Api.InputMedia.parse_inputMediaPhotoExternal($0) }
|
dict[-440664550] = { return Api.InputMedia.parse_inputMediaPhotoExternal($0) }
|
||||||
dict[-78455655] = { return Api.InputMedia.parse_inputMediaDocumentExternal($0) }
|
dict[-78455655] = { return Api.InputMedia.parse_inputMediaDocumentExternal($0) }
|
||||||
dict[-122978821] = { return Api.InputMedia.parse_inputMediaContact($0) }
|
dict[-122978821] = { return Api.InputMedia.parse_inputMediaContact($0) }
|
||||||
dict[-833715459] = { return Api.InputMedia.parse_inputMediaGeoLive($0) }
|
|
||||||
dict[261416433] = { return Api.InputMedia.parse_inputMediaPoll($0) }
|
dict[261416433] = { return Api.InputMedia.parse_inputMediaPoll($0) }
|
||||||
dict[-428884101] = { return Api.InputMedia.parse_inputMediaDice($0) }
|
dict[-428884101] = { return Api.InputMedia.parse_inputMediaDice($0) }
|
||||||
|
dict[-1574158066] = { return Api.InputMedia.parse_inputMediaGeoLive($0) }
|
||||||
dict[2134579434] = { return Api.InputPeer.parse_inputPeerEmpty($0) }
|
dict[2134579434] = { return Api.InputPeer.parse_inputPeerEmpty($0) }
|
||||||
dict[2107670217] = { return Api.InputPeer.parse_inputPeerSelf($0) }
|
dict[2107670217] = { return Api.InputPeer.parse_inputPeerSelf($0) }
|
||||||
dict[396093539] = { return Api.InputPeer.parse_inputPeerChat($0) }
|
dict[396093539] = { return Api.InputPeer.parse_inputPeerChat($0) }
|
||||||
@ -569,13 +568,13 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
|
|||||||
dict[-1557277184] = { return Api.MessageMedia.parse_messageMediaWebPage($0) }
|
dict[-1557277184] = { return Api.MessageMedia.parse_messageMediaWebPage($0) }
|
||||||
dict[-38694904] = { return Api.MessageMedia.parse_messageMediaGame($0) }
|
dict[-38694904] = { return Api.MessageMedia.parse_messageMediaGame($0) }
|
||||||
dict[-2074799289] = { return Api.MessageMedia.parse_messageMediaInvoice($0) }
|
dict[-2074799289] = { return Api.MessageMedia.parse_messageMediaInvoice($0) }
|
||||||
dict[2084316681] = { return Api.MessageMedia.parse_messageMediaGeoLive($0) }
|
|
||||||
dict[784356159] = { return Api.MessageMedia.parse_messageMediaVenue($0) }
|
dict[784356159] = { return Api.MessageMedia.parse_messageMediaVenue($0) }
|
||||||
dict[1766936791] = { return Api.MessageMedia.parse_messageMediaPhoto($0) }
|
dict[1766936791] = { return Api.MessageMedia.parse_messageMediaPhoto($0) }
|
||||||
dict[-1666158377] = { return Api.MessageMedia.parse_messageMediaDocument($0) }
|
dict[-1666158377] = { return Api.MessageMedia.parse_messageMediaDocument($0) }
|
||||||
dict[-873313984] = { return Api.MessageMedia.parse_messageMediaContact($0) }
|
dict[-873313984] = { return Api.MessageMedia.parse_messageMediaContact($0) }
|
||||||
dict[1272375192] = { return Api.MessageMedia.parse_messageMediaPoll($0) }
|
dict[1272375192] = { return Api.MessageMedia.parse_messageMediaPoll($0) }
|
||||||
dict[1065280907] = { return Api.MessageMedia.parse_messageMediaDice($0) }
|
dict[1065280907] = { return Api.MessageMedia.parse_messageMediaDice($0) }
|
||||||
|
dict[-967079536] = { return Api.MessageMedia.parse_messageMediaGeoLive($0) }
|
||||||
dict[-842892769] = { return Api.PaymentSavedCredentials.parse_paymentSavedCredentialsCard($0) }
|
dict[-842892769] = { return Api.PaymentSavedCredentials.parse_paymentSavedCredentialsCard($0) }
|
||||||
dict[1450380236] = { return Api.Null.parse_null($0) }
|
dict[1450380236] = { return Api.Null.parse_null($0) }
|
||||||
dict[1923290508] = { return Api.auth.CodeType.parse_codeTypeSms($0) }
|
dict[1923290508] = { return Api.auth.CodeType.parse_codeTypeSms($0) }
|
||||||
@ -624,7 +623,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
|
|||||||
dict[668375447] = { return Api.InputFileLocation.parse_inputPeerPhotoFileLocation($0) }
|
dict[668375447] = { return Api.InputFileLocation.parse_inputPeerPhotoFileLocation($0) }
|
||||||
dict[230353641] = { return Api.InputFileLocation.parse_inputStickerSetThumb($0) }
|
dict[230353641] = { return Api.InputFileLocation.parse_inputStickerSetThumb($0) }
|
||||||
dict[286776671] = { return Api.GeoPoint.parse_geoPointEmpty($0) }
|
dict[286776671] = { return Api.GeoPoint.parse_geoPointEmpty($0) }
|
||||||
dict[43446532] = { return Api.GeoPoint.parse_geoPoint($0) }
|
dict[-1297942941] = { return Api.GeoPoint.parse_geoPoint($0) }
|
||||||
dict[506920429] = { return Api.InputPhoneCall.parse_inputPhoneCall($0) }
|
dict[506920429] = { return Api.InputPhoneCall.parse_inputPhoneCall($0) }
|
||||||
dict[-1551583367] = { return Api.ReceivedNotifyMessage.parse_receivedNotifyMessage($0) }
|
dict[-1551583367] = { return Api.ReceivedNotifyMessage.parse_receivedNotifyMessage($0) }
|
||||||
dict[-57668565] = { return Api.ChatParticipants.parse_chatParticipantsForbidden($0) }
|
dict[-57668565] = { return Api.ChatParticipants.parse_chatParticipantsForbidden($0) }
|
||||||
@ -777,6 +776,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
|
|||||||
dict[455635795] = { return Api.MessageAction.parse_messageActionSecureValuesSentMe($0) }
|
dict[455635795] = { return Api.MessageAction.parse_messageActionSecureValuesSentMe($0) }
|
||||||
dict[-648257196] = { return Api.MessageAction.parse_messageActionSecureValuesSent($0) }
|
dict[-648257196] = { return Api.MessageAction.parse_messageActionSecureValuesSent($0) }
|
||||||
dict[-202219658] = { return Api.MessageAction.parse_messageActionContactSignUp($0) }
|
dict[-202219658] = { return Api.MessageAction.parse_messageActionContactSignUp($0) }
|
||||||
|
dict[-1730095465] = { return Api.MessageAction.parse_messageActionGeoProximityReached($0) }
|
||||||
dict[1399245077] = { return Api.PhoneCall.parse_phoneCallEmpty($0) }
|
dict[1399245077] = { return Api.PhoneCall.parse_phoneCallEmpty($0) }
|
||||||
dict[462375633] = { return Api.PhoneCall.parse_phoneCallWaiting($0) }
|
dict[462375633] = { return Api.PhoneCall.parse_phoneCallWaiting($0) }
|
||||||
dict[-2014659757] = { return Api.PhoneCall.parse_phoneCallRequested($0) }
|
dict[-2014659757] = { return Api.PhoneCall.parse_phoneCallRequested($0) }
|
||||||
|
@ -1903,7 +1903,7 @@ public struct messages {
|
|||||||
public extension Api {
|
public extension Api {
|
||||||
public enum InputGeoPoint: TypeConstructorDescription {
|
public enum InputGeoPoint: TypeConstructorDescription {
|
||||||
case inputGeoPointEmpty
|
case inputGeoPointEmpty
|
||||||
case inputGeoPoint(lat: Double, long: Double)
|
case inputGeoPoint(flags: Int32, lat: Double, long: Double, accuracyRadius: Int32?)
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
switch self {
|
switch self {
|
||||||
@ -1913,12 +1913,14 @@ public extension Api {
|
|||||||
}
|
}
|
||||||
|
|
||||||
break
|
break
|
||||||
case .inputGeoPoint(let lat, let long):
|
case .inputGeoPoint(let flags, let lat, let long, let accuracyRadius):
|
||||||
if boxed {
|
if boxed {
|
||||||
buffer.appendInt32(-206066487)
|
buffer.appendInt32(1210199983)
|
||||||
}
|
}
|
||||||
|
serializeInt32(flags, buffer: buffer, boxed: false)
|
||||||
serializeDouble(lat, buffer: buffer, boxed: false)
|
serializeDouble(lat, buffer: buffer, boxed: false)
|
||||||
serializeDouble(long, buffer: buffer, boxed: false)
|
serializeDouble(long, buffer: buffer, boxed: false)
|
||||||
|
if Int(flags) & Int(1 << 0) != 0 {serializeInt32(accuracyRadius!, buffer: buffer, boxed: false)}
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1927,8 +1929,8 @@ public extension Api {
|
|||||||
switch self {
|
switch self {
|
||||||
case .inputGeoPointEmpty:
|
case .inputGeoPointEmpty:
|
||||||
return ("inputGeoPointEmpty", [])
|
return ("inputGeoPointEmpty", [])
|
||||||
case .inputGeoPoint(let lat, let long):
|
case .inputGeoPoint(let flags, let lat, let long, let accuracyRadius):
|
||||||
return ("inputGeoPoint", [("lat", lat), ("long", long)])
|
return ("inputGeoPoint", [("flags", flags), ("lat", lat), ("long", long), ("accuracyRadius", accuracyRadius)])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1936,14 +1938,20 @@ public extension Api {
|
|||||||
return Api.InputGeoPoint.inputGeoPointEmpty
|
return Api.InputGeoPoint.inputGeoPointEmpty
|
||||||
}
|
}
|
||||||
public static func parse_inputGeoPoint(_ reader: BufferReader) -> InputGeoPoint? {
|
public static func parse_inputGeoPoint(_ reader: BufferReader) -> InputGeoPoint? {
|
||||||
var _1: Double?
|
var _1: Int32?
|
||||||
_1 = reader.readDouble()
|
_1 = reader.readInt32()
|
||||||
var _2: Double?
|
var _2: Double?
|
||||||
_2 = reader.readDouble()
|
_2 = reader.readDouble()
|
||||||
|
var _3: Double?
|
||||||
|
_3 = reader.readDouble()
|
||||||
|
var _4: Int32?
|
||||||
|
if Int(_1!) & Int(1 << 0) != 0 {_4 = reader.readInt32() }
|
||||||
let _c1 = _1 != nil
|
let _c1 = _1 != nil
|
||||||
let _c2 = _2 != nil
|
let _c2 = _2 != nil
|
||||||
if _c1 && _c2 {
|
let _c3 = _3 != nil
|
||||||
return Api.InputGeoPoint.inputGeoPoint(lat: _1!, long: _2!)
|
let _c4 = (Int(_1!) & Int(1 << 0) == 0) || _4 != nil
|
||||||
|
if _c1 && _c2 && _c3 && _c4 {
|
||||||
|
return Api.InputGeoPoint.inputGeoPoint(flags: _1!, lat: _2!, long: _3!, accuracyRadius: _4)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return nil
|
return nil
|
||||||
@ -6128,7 +6136,6 @@ public extension Api {
|
|||||||
case updateBotInlineQuery(flags: Int32, queryId: Int64, userId: Int32, query: String, geo: Api.GeoPoint?, offset: String)
|
case updateBotInlineQuery(flags: Int32, queryId: Int64, userId: Int32, query: String, geo: Api.GeoPoint?, offset: String)
|
||||||
case updateBotInlineSend(flags: Int32, userId: Int32, query: String, geo: Api.GeoPoint?, id: String, msgId: Api.InputBotInlineMessageID?)
|
case updateBotInlineSend(flags: Int32, userId: Int32, query: String, geo: Api.GeoPoint?, id: String, msgId: Api.InputBotInlineMessageID?)
|
||||||
case updateEditChannelMessage(message: Api.Message, pts: Int32, ptsCount: Int32)
|
case updateEditChannelMessage(message: Api.Message, pts: Int32, ptsCount: Int32)
|
||||||
case updateChannelPinnedMessage(channelId: Int32, id: Int32)
|
|
||||||
case updateBotCallbackQuery(flags: Int32, queryId: Int64, userId: Int32, peer: Api.Peer, msgId: Int32, chatInstance: Int64, data: Buffer?, gameShortName: String?)
|
case updateBotCallbackQuery(flags: Int32, queryId: Int64, userId: Int32, peer: Api.Peer, msgId: Int32, chatInstance: Int64, data: Buffer?, gameShortName: String?)
|
||||||
case updateEditMessage(message: Api.Message, pts: Int32, ptsCount: Int32)
|
case updateEditMessage(message: Api.Message, pts: Int32, ptsCount: Int32)
|
||||||
case updateInlineBotCallbackQuery(flags: Int32, queryId: Int64, userId: Int32, msgId: Api.InputBotInlineMessageID, chatInstance: Int64, data: Buffer?, gameShortName: String?)
|
case updateInlineBotCallbackQuery(flags: Int32, queryId: Int64, userId: Int32, msgId: Api.InputBotInlineMessageID, chatInstance: Int64, data: Buffer?, gameShortName: String?)
|
||||||
@ -6491,13 +6498,6 @@ public extension Api {
|
|||||||
serializeInt32(pts, buffer: buffer, boxed: false)
|
serializeInt32(pts, buffer: buffer, boxed: false)
|
||||||
serializeInt32(ptsCount, buffer: buffer, boxed: false)
|
serializeInt32(ptsCount, buffer: buffer, boxed: false)
|
||||||
break
|
break
|
||||||
case .updateChannelPinnedMessage(let channelId, let id):
|
|
||||||
if boxed {
|
|
||||||
buffer.appendInt32(-1738988427)
|
|
||||||
}
|
|
||||||
serializeInt32(channelId, buffer: buffer, boxed: false)
|
|
||||||
serializeInt32(id, buffer: buffer, boxed: false)
|
|
||||||
break
|
|
||||||
case .updateBotCallbackQuery(let flags, let queryId, let userId, let peer, let msgId, let chatInstance, let data, let gameShortName):
|
case .updateBotCallbackQuery(let flags, let queryId, let userId, let peer, let msgId, let chatInstance, let data, let gameShortName):
|
||||||
if boxed {
|
if boxed {
|
||||||
buffer.appendInt32(-415938591)
|
buffer.appendInt32(-415938591)
|
||||||
@ -6999,8 +6999,6 @@ public extension Api {
|
|||||||
return ("updateBotInlineSend", [("flags", flags), ("userId", userId), ("query", query), ("geo", geo), ("id", id), ("msgId", msgId)])
|
return ("updateBotInlineSend", [("flags", flags), ("userId", userId), ("query", query), ("geo", geo), ("id", id), ("msgId", msgId)])
|
||||||
case .updateEditChannelMessage(let message, let pts, let ptsCount):
|
case .updateEditChannelMessage(let message, let pts, let ptsCount):
|
||||||
return ("updateEditChannelMessage", [("message", message), ("pts", pts), ("ptsCount", ptsCount)])
|
return ("updateEditChannelMessage", [("message", message), ("pts", pts), ("ptsCount", ptsCount)])
|
||||||
case .updateChannelPinnedMessage(let channelId, let id):
|
|
||||||
return ("updateChannelPinnedMessage", [("channelId", channelId), ("id", id)])
|
|
||||||
case .updateBotCallbackQuery(let flags, let queryId, let userId, let peer, let msgId, let chatInstance, let data, let gameShortName):
|
case .updateBotCallbackQuery(let flags, let queryId, let userId, let peer, let msgId, let chatInstance, let data, let gameShortName):
|
||||||
return ("updateBotCallbackQuery", [("flags", flags), ("queryId", queryId), ("userId", userId), ("peer", peer), ("msgId", msgId), ("chatInstance", chatInstance), ("data", data), ("gameShortName", gameShortName)])
|
return ("updateBotCallbackQuery", [("flags", flags), ("queryId", queryId), ("userId", userId), ("peer", peer), ("msgId", msgId), ("chatInstance", chatInstance), ("data", data), ("gameShortName", gameShortName)])
|
||||||
case .updateEditMessage(let message, let pts, let ptsCount):
|
case .updateEditMessage(let message, let pts, let ptsCount):
|
||||||
@ -7737,20 +7735,6 @@ public extension Api {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static func parse_updateChannelPinnedMessage(_ reader: BufferReader) -> Update? {
|
|
||||||
var _1: Int32?
|
|
||||||
_1 = reader.readInt32()
|
|
||||||
var _2: Int32?
|
|
||||||
_2 = reader.readInt32()
|
|
||||||
let _c1 = _1 != nil
|
|
||||||
let _c2 = _2 != nil
|
|
||||||
if _c1 && _c2 {
|
|
||||||
return Api.Update.updateChannelPinnedMessage(channelId: _1!, id: _2!)
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public static func parse_updateBotCallbackQuery(_ reader: BufferReader) -> Update? {
|
public static func parse_updateBotCallbackQuery(_ reader: BufferReader) -> Update? {
|
||||||
var _1: Int32?
|
var _1: Int32?
|
||||||
_1 = reader.readInt32()
|
_1 = reader.readInt32()
|
||||||
@ -11191,9 +11175,9 @@ public extension Api {
|
|||||||
case inputMediaPhotoExternal(flags: Int32, url: String, ttlSeconds: Int32?)
|
case inputMediaPhotoExternal(flags: Int32, url: String, ttlSeconds: Int32?)
|
||||||
case inputMediaDocumentExternal(flags: Int32, url: String, ttlSeconds: Int32?)
|
case inputMediaDocumentExternal(flags: Int32, url: String, ttlSeconds: Int32?)
|
||||||
case inputMediaContact(phoneNumber: String, firstName: String, lastName: String, vcard: String)
|
case inputMediaContact(phoneNumber: String, firstName: String, lastName: String, vcard: String)
|
||||||
case inputMediaGeoLive(flags: Int32, geoPoint: Api.InputGeoPoint, period: Int32?)
|
|
||||||
case inputMediaPoll(flags: Int32, poll: Api.Poll, correctAnswers: [Buffer]?, solution: String?, solutionEntities: [Api.MessageEntity]?)
|
case inputMediaPoll(flags: Int32, poll: Api.Poll, correctAnswers: [Buffer]?, solution: String?, solutionEntities: [Api.MessageEntity]?)
|
||||||
case inputMediaDice(emoticon: String)
|
case inputMediaDice(emoticon: String)
|
||||||
|
case inputMediaGeoLive(flags: Int32, geoPoint: Api.InputGeoPoint, heading: Int32, period: Int32?)
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
switch self {
|
switch self {
|
||||||
@ -11321,14 +11305,6 @@ public extension Api {
|
|||||||
serializeString(lastName, buffer: buffer, boxed: false)
|
serializeString(lastName, buffer: buffer, boxed: false)
|
||||||
serializeString(vcard, buffer: buffer, boxed: false)
|
serializeString(vcard, buffer: buffer, boxed: false)
|
||||||
break
|
break
|
||||||
case .inputMediaGeoLive(let flags, let geoPoint, let period):
|
|
||||||
if boxed {
|
|
||||||
buffer.appendInt32(-833715459)
|
|
||||||
}
|
|
||||||
serializeInt32(flags, buffer: buffer, boxed: false)
|
|
||||||
geoPoint.serialize(buffer, true)
|
|
||||||
if Int(flags) & Int(1 << 1) != 0 {serializeInt32(period!, buffer: buffer, boxed: false)}
|
|
||||||
break
|
|
||||||
case .inputMediaPoll(let flags, let poll, let correctAnswers, let solution, let solutionEntities):
|
case .inputMediaPoll(let flags, let poll, let correctAnswers, let solution, let solutionEntities):
|
||||||
if boxed {
|
if boxed {
|
||||||
buffer.appendInt32(261416433)
|
buffer.appendInt32(261416433)
|
||||||
@ -11353,6 +11329,15 @@ public extension Api {
|
|||||||
}
|
}
|
||||||
serializeString(emoticon, buffer: buffer, boxed: false)
|
serializeString(emoticon, buffer: buffer, boxed: false)
|
||||||
break
|
break
|
||||||
|
case .inputMediaGeoLive(let flags, let geoPoint, let heading, let period):
|
||||||
|
if boxed {
|
||||||
|
buffer.appendInt32(-1574158066)
|
||||||
|
}
|
||||||
|
serializeInt32(flags, buffer: buffer, boxed: false)
|
||||||
|
geoPoint.serialize(buffer, true)
|
||||||
|
serializeInt32(heading, buffer: buffer, boxed: false)
|
||||||
|
if Int(flags) & Int(1 << 1) != 0 {serializeInt32(period!, buffer: buffer, boxed: false)}
|
||||||
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -11384,12 +11369,12 @@ public extension Api {
|
|||||||
return ("inputMediaDocumentExternal", [("flags", flags), ("url", url), ("ttlSeconds", ttlSeconds)])
|
return ("inputMediaDocumentExternal", [("flags", flags), ("url", url), ("ttlSeconds", ttlSeconds)])
|
||||||
case .inputMediaContact(let phoneNumber, let firstName, let lastName, let vcard):
|
case .inputMediaContact(let phoneNumber, let firstName, let lastName, let vcard):
|
||||||
return ("inputMediaContact", [("phoneNumber", phoneNumber), ("firstName", firstName), ("lastName", lastName), ("vcard", vcard)])
|
return ("inputMediaContact", [("phoneNumber", phoneNumber), ("firstName", firstName), ("lastName", lastName), ("vcard", vcard)])
|
||||||
case .inputMediaGeoLive(let flags, let geoPoint, let period):
|
|
||||||
return ("inputMediaGeoLive", [("flags", flags), ("geoPoint", geoPoint), ("period", period)])
|
|
||||||
case .inputMediaPoll(let flags, let poll, let correctAnswers, let solution, let solutionEntities):
|
case .inputMediaPoll(let flags, let poll, let correctAnswers, let solution, let solutionEntities):
|
||||||
return ("inputMediaPoll", [("flags", flags), ("poll", poll), ("correctAnswers", correctAnswers), ("solution", solution), ("solutionEntities", solutionEntities)])
|
return ("inputMediaPoll", [("flags", flags), ("poll", poll), ("correctAnswers", correctAnswers), ("solution", solution), ("solutionEntities", solutionEntities)])
|
||||||
case .inputMediaDice(let emoticon):
|
case .inputMediaDice(let emoticon):
|
||||||
return ("inputMediaDice", [("emoticon", emoticon)])
|
return ("inputMediaDice", [("emoticon", emoticon)])
|
||||||
|
case .inputMediaGeoLive(let flags, let geoPoint, let heading, let period):
|
||||||
|
return ("inputMediaGeoLive", [("flags", flags), ("geoPoint", geoPoint), ("heading", heading), ("period", period)])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -11658,25 +11643,6 @@ public extension Api {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static func parse_inputMediaGeoLive(_ reader: BufferReader) -> InputMedia? {
|
|
||||||
var _1: Int32?
|
|
||||||
_1 = reader.readInt32()
|
|
||||||
var _2: Api.InputGeoPoint?
|
|
||||||
if let signature = reader.readInt32() {
|
|
||||||
_2 = Api.parse(reader, signature: signature) as? Api.InputGeoPoint
|
|
||||||
}
|
|
||||||
var _3: Int32?
|
|
||||||
if Int(_1!) & Int(1 << 1) != 0 {_3 = reader.readInt32() }
|
|
||||||
let _c1 = _1 != nil
|
|
||||||
let _c2 = _2 != nil
|
|
||||||
let _c3 = (Int(_1!) & Int(1 << 1) == 0) || _3 != nil
|
|
||||||
if _c1 && _c2 && _c3 {
|
|
||||||
return Api.InputMedia.inputMediaGeoLive(flags: _1!, geoPoint: _2!, period: _3)
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public static func parse_inputMediaPoll(_ reader: BufferReader) -> InputMedia? {
|
public static func parse_inputMediaPoll(_ reader: BufferReader) -> InputMedia? {
|
||||||
var _1: Int32?
|
var _1: Int32?
|
||||||
_1 = reader.readInt32()
|
_1 = reader.readInt32()
|
||||||
@ -11717,6 +11683,28 @@ public extension Api {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public static func parse_inputMediaGeoLive(_ reader: BufferReader) -> InputMedia? {
|
||||||
|
var _1: Int32?
|
||||||
|
_1 = reader.readInt32()
|
||||||
|
var _2: Api.InputGeoPoint?
|
||||||
|
if let signature = reader.readInt32() {
|
||||||
|
_2 = Api.parse(reader, signature: signature) as? Api.InputGeoPoint
|
||||||
|
}
|
||||||
|
var _3: Int32?
|
||||||
|
_3 = reader.readInt32()
|
||||||
|
var _4: Int32?
|
||||||
|
if Int(_1!) & Int(1 << 1) != 0 {_4 = reader.readInt32() }
|
||||||
|
let _c1 = _1 != nil
|
||||||
|
let _c2 = _2 != nil
|
||||||
|
let _c3 = _3 != nil
|
||||||
|
let _c4 = (Int(_1!) & Int(1 << 1) == 0) || _4 != nil
|
||||||
|
if _c1 && _c2 && _c3 && _c4 {
|
||||||
|
return Api.InputMedia.inputMediaGeoLive(flags: _1!, geoPoint: _2!, heading: _3!, period: _4)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public enum InputPeer: TypeConstructorDescription {
|
public enum InputPeer: TypeConstructorDescription {
|
||||||
@ -16448,13 +16436,13 @@ public extension Api {
|
|||||||
case messageMediaWebPage(webpage: Api.WebPage)
|
case messageMediaWebPage(webpage: Api.WebPage)
|
||||||
case messageMediaGame(game: Api.Game)
|
case messageMediaGame(game: Api.Game)
|
||||||
case messageMediaInvoice(flags: Int32, title: String, description: String, photo: Api.WebDocument?, receiptMsgId: Int32?, currency: String, totalAmount: Int64, startParam: String)
|
case messageMediaInvoice(flags: Int32, title: String, description: String, photo: Api.WebDocument?, receiptMsgId: Int32?, currency: String, totalAmount: Int64, startParam: String)
|
||||||
case messageMediaGeoLive(geo: Api.GeoPoint, period: Int32)
|
|
||||||
case messageMediaVenue(geo: Api.GeoPoint, title: String, address: String, provider: String, venueId: String, venueType: String)
|
case messageMediaVenue(geo: Api.GeoPoint, title: String, address: String, provider: String, venueId: String, venueType: String)
|
||||||
case messageMediaPhoto(flags: Int32, photo: Api.Photo?, ttlSeconds: Int32?)
|
case messageMediaPhoto(flags: Int32, photo: Api.Photo?, ttlSeconds: Int32?)
|
||||||
case messageMediaDocument(flags: Int32, document: Api.Document?, ttlSeconds: Int32?)
|
case messageMediaDocument(flags: Int32, document: Api.Document?, ttlSeconds: Int32?)
|
||||||
case messageMediaContact(phoneNumber: String, firstName: String, lastName: String, vcard: String, userId: Int32)
|
case messageMediaContact(phoneNumber: String, firstName: String, lastName: String, vcard: String, userId: Int32)
|
||||||
case messageMediaPoll(poll: Api.Poll, results: Api.PollResults)
|
case messageMediaPoll(poll: Api.Poll, results: Api.PollResults)
|
||||||
case messageMediaDice(value: Int32, emoticon: String)
|
case messageMediaDice(value: Int32, emoticon: String)
|
||||||
|
case messageMediaGeoLive(geo: Api.GeoPoint, heading: Int32, period: Int32)
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
switch self {
|
switch self {
|
||||||
@ -16501,13 +16489,6 @@ public extension Api {
|
|||||||
serializeInt64(totalAmount, buffer: buffer, boxed: false)
|
serializeInt64(totalAmount, buffer: buffer, boxed: false)
|
||||||
serializeString(startParam, buffer: buffer, boxed: false)
|
serializeString(startParam, buffer: buffer, boxed: false)
|
||||||
break
|
break
|
||||||
case .messageMediaGeoLive(let geo, let period):
|
|
||||||
if boxed {
|
|
||||||
buffer.appendInt32(2084316681)
|
|
||||||
}
|
|
||||||
geo.serialize(buffer, true)
|
|
||||||
serializeInt32(period, buffer: buffer, boxed: false)
|
|
||||||
break
|
|
||||||
case .messageMediaVenue(let geo, let title, let address, let provider, let venueId, let venueType):
|
case .messageMediaVenue(let geo, let title, let address, let provider, let venueId, let venueType):
|
||||||
if boxed {
|
if boxed {
|
||||||
buffer.appendInt32(784356159)
|
buffer.appendInt32(784356159)
|
||||||
@ -16559,6 +16540,14 @@ public extension Api {
|
|||||||
serializeInt32(value, buffer: buffer, boxed: false)
|
serializeInt32(value, buffer: buffer, boxed: false)
|
||||||
serializeString(emoticon, buffer: buffer, boxed: false)
|
serializeString(emoticon, buffer: buffer, boxed: false)
|
||||||
break
|
break
|
||||||
|
case .messageMediaGeoLive(let geo, let heading, let period):
|
||||||
|
if boxed {
|
||||||
|
buffer.appendInt32(-967079536)
|
||||||
|
}
|
||||||
|
geo.serialize(buffer, true)
|
||||||
|
serializeInt32(heading, buffer: buffer, boxed: false)
|
||||||
|
serializeInt32(period, buffer: buffer, boxed: false)
|
||||||
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -16576,8 +16565,6 @@ public extension Api {
|
|||||||
return ("messageMediaGame", [("game", game)])
|
return ("messageMediaGame", [("game", game)])
|
||||||
case .messageMediaInvoice(let flags, let title, let description, let photo, let receiptMsgId, let currency, let totalAmount, let startParam):
|
case .messageMediaInvoice(let flags, let title, let description, let photo, let receiptMsgId, let currency, let totalAmount, let startParam):
|
||||||
return ("messageMediaInvoice", [("flags", flags), ("title", title), ("description", description), ("photo", photo), ("receiptMsgId", receiptMsgId), ("currency", currency), ("totalAmount", totalAmount), ("startParam", startParam)])
|
return ("messageMediaInvoice", [("flags", flags), ("title", title), ("description", description), ("photo", photo), ("receiptMsgId", receiptMsgId), ("currency", currency), ("totalAmount", totalAmount), ("startParam", startParam)])
|
||||||
case .messageMediaGeoLive(let geo, let period):
|
|
||||||
return ("messageMediaGeoLive", [("geo", geo), ("period", period)])
|
|
||||||
case .messageMediaVenue(let geo, let title, let address, let provider, let venueId, let venueType):
|
case .messageMediaVenue(let geo, let title, let address, let provider, let venueId, let venueType):
|
||||||
return ("messageMediaVenue", [("geo", geo), ("title", title), ("address", address), ("provider", provider), ("venueId", venueId), ("venueType", venueType)])
|
return ("messageMediaVenue", [("geo", geo), ("title", title), ("address", address), ("provider", provider), ("venueId", venueId), ("venueType", venueType)])
|
||||||
case .messageMediaPhoto(let flags, let photo, let ttlSeconds):
|
case .messageMediaPhoto(let flags, let photo, let ttlSeconds):
|
||||||
@ -16590,6 +16577,8 @@ public extension Api {
|
|||||||
return ("messageMediaPoll", [("poll", poll), ("results", results)])
|
return ("messageMediaPoll", [("poll", poll), ("results", results)])
|
||||||
case .messageMediaDice(let value, let emoticon):
|
case .messageMediaDice(let value, let emoticon):
|
||||||
return ("messageMediaDice", [("value", value), ("emoticon", emoticon)])
|
return ("messageMediaDice", [("value", value), ("emoticon", emoticon)])
|
||||||
|
case .messageMediaGeoLive(let geo, let heading, let period):
|
||||||
|
return ("messageMediaGeoLive", [("geo", geo), ("heading", heading), ("period", period)])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -16672,22 +16661,6 @@ public extension Api {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static func parse_messageMediaGeoLive(_ reader: BufferReader) -> MessageMedia? {
|
|
||||||
var _1: Api.GeoPoint?
|
|
||||||
if let signature = reader.readInt32() {
|
|
||||||
_1 = Api.parse(reader, signature: signature) as? Api.GeoPoint
|
|
||||||
}
|
|
||||||
var _2: Int32?
|
|
||||||
_2 = reader.readInt32()
|
|
||||||
let _c1 = _1 != nil
|
|
||||||
let _c2 = _2 != nil
|
|
||||||
if _c1 && _c2 {
|
|
||||||
return Api.MessageMedia.messageMediaGeoLive(geo: _1!, period: _2!)
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public static func parse_messageMediaVenue(_ reader: BufferReader) -> MessageMedia? {
|
public static func parse_messageMediaVenue(_ reader: BufferReader) -> MessageMedia? {
|
||||||
var _1: Api.GeoPoint?
|
var _1: Api.GeoPoint?
|
||||||
if let signature = reader.readInt32() {
|
if let signature = reader.readInt32() {
|
||||||
@ -16809,6 +16782,25 @@ public extension Api {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public static func parse_messageMediaGeoLive(_ reader: BufferReader) -> MessageMedia? {
|
||||||
|
var _1: Api.GeoPoint?
|
||||||
|
if let signature = reader.readInt32() {
|
||||||
|
_1 = Api.parse(reader, signature: signature) as? Api.GeoPoint
|
||||||
|
}
|
||||||
|
var _2: Int32?
|
||||||
|
_2 = reader.readInt32()
|
||||||
|
var _3: Int32?
|
||||||
|
_3 = reader.readInt32()
|
||||||
|
let _c1 = _1 != nil
|
||||||
|
let _c2 = _2 != nil
|
||||||
|
let _c3 = _3 != nil
|
||||||
|
if _c1 && _c2 && _c3 {
|
||||||
|
return Api.MessageMedia.messageMediaGeoLive(geo: _1!, heading: _2!, period: _3!)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public enum PaymentSavedCredentials: TypeConstructorDescription {
|
public enum PaymentSavedCredentials: TypeConstructorDescription {
|
||||||
@ -18093,7 +18085,7 @@ public extension Api {
|
|||||||
}
|
}
|
||||||
public enum GeoPoint: TypeConstructorDescription {
|
public enum GeoPoint: TypeConstructorDescription {
|
||||||
case geoPointEmpty
|
case geoPointEmpty
|
||||||
case geoPoint(long: Double, lat: Double, accessHash: Int64)
|
case geoPoint(flags: Int32, long: Double, lat: Double, accessHash: Int64, accuracyRadius: Int32?)
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
switch self {
|
switch self {
|
||||||
@ -18103,13 +18095,15 @@ public extension Api {
|
|||||||
}
|
}
|
||||||
|
|
||||||
break
|
break
|
||||||
case .geoPoint(let long, let lat, let accessHash):
|
case .geoPoint(let flags, let long, let lat, let accessHash, let accuracyRadius):
|
||||||
if boxed {
|
if boxed {
|
||||||
buffer.appendInt32(43446532)
|
buffer.appendInt32(-1297942941)
|
||||||
}
|
}
|
||||||
|
serializeInt32(flags, buffer: buffer, boxed: false)
|
||||||
serializeDouble(long, buffer: buffer, boxed: false)
|
serializeDouble(long, buffer: buffer, boxed: false)
|
||||||
serializeDouble(lat, buffer: buffer, boxed: false)
|
serializeDouble(lat, buffer: buffer, boxed: false)
|
||||||
serializeInt64(accessHash, buffer: buffer, boxed: false)
|
serializeInt64(accessHash, buffer: buffer, boxed: false)
|
||||||
|
if Int(flags) & Int(1 << 0) != 0 {serializeInt32(accuracyRadius!, buffer: buffer, boxed: false)}
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -18118,8 +18112,8 @@ public extension Api {
|
|||||||
switch self {
|
switch self {
|
||||||
case .geoPointEmpty:
|
case .geoPointEmpty:
|
||||||
return ("geoPointEmpty", [])
|
return ("geoPointEmpty", [])
|
||||||
case .geoPoint(let long, let lat, let accessHash):
|
case .geoPoint(let flags, let long, let lat, let accessHash, let accuracyRadius):
|
||||||
return ("geoPoint", [("long", long), ("lat", lat), ("accessHash", accessHash)])
|
return ("geoPoint", [("flags", flags), ("long", long), ("lat", lat), ("accessHash", accessHash), ("accuracyRadius", accuracyRadius)])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -18127,17 +18121,23 @@ public extension Api {
|
|||||||
return Api.GeoPoint.geoPointEmpty
|
return Api.GeoPoint.geoPointEmpty
|
||||||
}
|
}
|
||||||
public static func parse_geoPoint(_ reader: BufferReader) -> GeoPoint? {
|
public static func parse_geoPoint(_ reader: BufferReader) -> GeoPoint? {
|
||||||
var _1: Double?
|
var _1: Int32?
|
||||||
_1 = reader.readDouble()
|
_1 = reader.readInt32()
|
||||||
var _2: Double?
|
var _2: Double?
|
||||||
_2 = reader.readDouble()
|
_2 = reader.readDouble()
|
||||||
var _3: Int64?
|
var _3: Double?
|
||||||
_3 = reader.readInt64()
|
_3 = reader.readDouble()
|
||||||
|
var _4: Int64?
|
||||||
|
_4 = reader.readInt64()
|
||||||
|
var _5: Int32?
|
||||||
|
if Int(_1!) & Int(1 << 0) != 0 {_5 = reader.readInt32() }
|
||||||
let _c1 = _1 != nil
|
let _c1 = _1 != nil
|
||||||
let _c2 = _2 != nil
|
let _c2 = _2 != nil
|
||||||
let _c3 = _3 != nil
|
let _c3 = _3 != nil
|
||||||
if _c1 && _c2 && _c3 {
|
let _c4 = _4 != nil
|
||||||
return Api.GeoPoint.geoPoint(long: _1!, lat: _2!, accessHash: _3!)
|
let _c5 = (Int(_1!) & Int(1 << 0) == 0) || _5 != nil
|
||||||
|
if _c1 && _c2 && _c3 && _c4 && _c5 {
|
||||||
|
return Api.GeoPoint.geoPoint(flags: _1!, long: _2!, lat: _3!, accessHash: _4!, accuracyRadius: _5)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return nil
|
return nil
|
||||||
@ -21141,6 +21141,7 @@ public extension Api {
|
|||||||
case messageActionSecureValuesSentMe(values: [Api.SecureValue], credentials: Api.SecureCredentialsEncrypted)
|
case messageActionSecureValuesSentMe(values: [Api.SecureValue], credentials: Api.SecureCredentialsEncrypted)
|
||||||
case messageActionSecureValuesSent(types: [Api.SecureValueType])
|
case messageActionSecureValuesSent(types: [Api.SecureValueType])
|
||||||
case messageActionContactSignUp
|
case messageActionContactSignUp
|
||||||
|
case messageActionGeoProximityReached(fromId: Api.Peer, toId: Api.Peer, distance: Int32)
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
switch self {
|
switch self {
|
||||||
@ -21311,6 +21312,14 @@ public extension Api {
|
|||||||
buffer.appendInt32(-202219658)
|
buffer.appendInt32(-202219658)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
break
|
||||||
|
case .messageActionGeoProximityReached(let fromId, let toId, let distance):
|
||||||
|
if boxed {
|
||||||
|
buffer.appendInt32(-1730095465)
|
||||||
|
}
|
||||||
|
fromId.serialize(buffer, true)
|
||||||
|
toId.serialize(buffer, true)
|
||||||
|
serializeInt32(distance, buffer: buffer, boxed: false)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -21363,6 +21372,8 @@ public extension Api {
|
|||||||
return ("messageActionSecureValuesSent", [("types", types)])
|
return ("messageActionSecureValuesSent", [("types", types)])
|
||||||
case .messageActionContactSignUp:
|
case .messageActionContactSignUp:
|
||||||
return ("messageActionContactSignUp", [])
|
return ("messageActionContactSignUp", [])
|
||||||
|
case .messageActionGeoProximityReached(let fromId, let toId, let distance):
|
||||||
|
return ("messageActionGeoProximityReached", [("fromId", fromId), ("toId", toId), ("distance", distance)])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -21631,6 +21642,27 @@ public extension Api {
|
|||||||
public static func parse_messageActionContactSignUp(_ reader: BufferReader) -> MessageAction? {
|
public static func parse_messageActionContactSignUp(_ reader: BufferReader) -> MessageAction? {
|
||||||
return Api.MessageAction.messageActionContactSignUp
|
return Api.MessageAction.messageActionContactSignUp
|
||||||
}
|
}
|
||||||
|
public static func parse_messageActionGeoProximityReached(_ reader: BufferReader) -> MessageAction? {
|
||||||
|
var _1: Api.Peer?
|
||||||
|
if let signature = reader.readInt32() {
|
||||||
|
_1 = Api.parse(reader, signature: signature) as? Api.Peer
|
||||||
|
}
|
||||||
|
var _2: Api.Peer?
|
||||||
|
if let signature = reader.readInt32() {
|
||||||
|
_2 = Api.parse(reader, signature: signature) as? Api.Peer
|
||||||
|
}
|
||||||
|
var _3: Int32?
|
||||||
|
_3 = reader.readInt32()
|
||||||
|
let _c1 = _1 != nil
|
||||||
|
let _c2 = _2 != nil
|
||||||
|
let _c3 = _3 != nil
|
||||||
|
if _c1 && _c2 && _c3 {
|
||||||
|
return Api.MessageAction.messageActionGeoProximityReached(fromId: _1!, toId: _2!, distance: _3!)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public enum PhoneCall: TypeConstructorDescription {
|
public enum PhoneCall: TypeConstructorDescription {
|
||||||
|
@ -2963,6 +2963,22 @@ public extension Api {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static func updatePinnedMessage(flags: Int32, peer: Api.InputPeer, id: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
|
||||||
|
let buffer = Buffer()
|
||||||
|
buffer.appendInt32(-760547348)
|
||||||
|
serializeInt32(flags, buffer: buffer, boxed: false)
|
||||||
|
peer.serialize(buffer, true)
|
||||||
|
serializeInt32(id, buffer: buffer, boxed: false)
|
||||||
|
return (FunctionDescription(name: "messages.updatePinnedMessage", parameters: [("flags", flags), ("peer", peer), ("id", id)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in
|
||||||
|
let reader = BufferReader(buffer)
|
||||||
|
var result: Api.Updates?
|
||||||
|
if let signature = reader.readInt32() {
|
||||||
|
result = Api.parse(reader, signature: signature) as? Api.Updates
|
||||||
|
}
|
||||||
|
return result
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
public static func sendVote(peer: Api.InputPeer, msgId: Int32, options: [Buffer]) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
|
public static func sendVote(peer: Api.InputPeer, msgId: Int32, options: [Buffer]) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
|
||||||
let buffer = Buffer()
|
let buffer = Buffer()
|
||||||
buffer.appendInt32(283795844)
|
buffer.appendInt32(283795844)
|
||||||
@ -3765,17 +3781,19 @@ public extension Api {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
public static func updatePinnedMessage(flags: Int32, peer: Api.InputPeer, id: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
|
public static func requestProximityNotification(flags: Int32, peer: Api.InputPeer, msgId: Int32, ownLocation: Api.InputGeoPoint?, maxDistance: Int32?) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
|
||||||
let buffer = Buffer()
|
let buffer = Buffer()
|
||||||
buffer.appendInt32(-760547348)
|
buffer.appendInt32(-699657935)
|
||||||
serializeInt32(flags, buffer: buffer, boxed: false)
|
serializeInt32(flags, buffer: buffer, boxed: false)
|
||||||
peer.serialize(buffer, true)
|
peer.serialize(buffer, true)
|
||||||
serializeInt32(id, buffer: buffer, boxed: false)
|
serializeInt32(msgId, buffer: buffer, boxed: false)
|
||||||
return (FunctionDescription(name: "messages.updatePinnedMessage", parameters: [("flags", flags), ("peer", peer), ("id", id)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in
|
if Int(flags) & Int(1 << 0) != 0 {ownLocation!.serialize(buffer, true)}
|
||||||
|
if Int(flags) & Int(1 << 0) != 0 {serializeInt32(maxDistance!, buffer: buffer, boxed: false)}
|
||||||
|
return (FunctionDescription(name: "messages.requestProximityNotification", parameters: [("flags", flags), ("peer", peer), ("msgId", msgId), ("ownLocation", ownLocation), ("maxDistance", maxDistance)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
|
||||||
let reader = BufferReader(buffer)
|
let reader = BufferReader(buffer)
|
||||||
var result: Api.Updates?
|
var result: Api.Bool?
|
||||||
if let signature = reader.readInt32() {
|
if let signature = reader.readInt32() {
|
||||||
result = Api.parse(reader, signature: signature) as? Api.Updates
|
result = Api.parse(reader, signature: signature) as? Api.Bool
|
||||||
}
|
}
|
||||||
return result
|
return result
|
||||||
})
|
})
|
||||||
|
@ -18,7 +18,6 @@ swift_library(
|
|||||||
"//submodules/NetworkLogging:NetworkLogging",
|
"//submodules/NetworkLogging:NetworkLogging",
|
||||||
"//submodules/Reachability:Reachability",
|
"//submodules/Reachability:Reachability",
|
||||||
],
|
],
|
||||||
alwayslink = True,
|
|
||||||
visibility = [
|
visibility = [
|
||||||
"//visibility:public",
|
"//visibility:public",
|
||||||
],
|
],
|
||||||
|
@ -1115,19 +1115,6 @@ private func finalStateWithUpdatesAndServerTime(postbox: Postbox, network: Netwo
|
|||||||
return peer
|
return peer
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
case let .updateChannelPinnedMessage(channelId, id):
|
|
||||||
let channelPeerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: channelId)
|
|
||||||
updatedState.updateMessagesPinned(ids: [MessageId(peerId: channelPeerId, namespace: Namespaces.Message.Cloud, id: id)], pinned: true)
|
|
||||||
|
|
||||||
/*updatedState.updateCachedPeerData(channelPeerId, { current in
|
|
||||||
let previous: CachedChannelData
|
|
||||||
if let current = current as? CachedChannelData {
|
|
||||||
previous = current
|
|
||||||
} else {
|
|
||||||
previous = CachedChannelData()
|
|
||||||
}
|
|
||||||
return previous.withUpdatedPinnedMessageId(id == 0 ? nil : MessageId(peerId: channelPeerId, namespace: Namespaces.Message.Cloud, id: id))
|
|
||||||
})*/
|
|
||||||
case let .updatePinnedChannelMessages(flags, channelId, messages, pts, ptsCount):
|
case let .updatePinnedChannelMessages(flags, channelId, messages, pts, ptsCount):
|
||||||
let peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: channelId)
|
let peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: channelId)
|
||||||
if let previousState = updatedState.channelStates[peerId] {
|
if let previousState = updatedState.channelStates[peerId] {
|
||||||
@ -1934,16 +1921,6 @@ private func pollChannel(network: Network, peer: Peer, state: AccountMutableStat
|
|||||||
} else {
|
} else {
|
||||||
Logger.shared.log("State", "Invalid updateEditChannelMessage")
|
Logger.shared.log("State", "Invalid updateEditChannelMessage")
|
||||||
}
|
}
|
||||||
case let .updateChannelPinnedMessage(_, id):
|
|
||||||
updatedState.updateCachedPeerData(peer.id, { current in
|
|
||||||
let previous: CachedChannelData
|
|
||||||
if let current = current as? CachedChannelData {
|
|
||||||
previous = current
|
|
||||||
} else {
|
|
||||||
previous = CachedChannelData()
|
|
||||||
}
|
|
||||||
return previous.withUpdatedPinnedMessageId(id == 0 ? nil : MessageId(peerId: peer.id, namespace: Namespaces.Message.Cloud, id: id))
|
|
||||||
})
|
|
||||||
case let .updatePinnedChannelMessages(flags, channelId, messages, _, _):
|
case let .updatePinnedChannelMessages(flags, channelId, messages, _, _):
|
||||||
let channelPeerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: channelId)
|
let channelPeerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: channelId)
|
||||||
updatedState.updateMessagesPinned(ids: messages.map { id in
|
updatedState.updateMessagesPinned(ids: messages.map { id in
|
||||||
|
@ -8,7 +8,7 @@ extension PeerGeoLocation {
|
|||||||
init?(apiLocation: Api.ChannelLocation) {
|
init?(apiLocation: Api.ChannelLocation) {
|
||||||
switch apiLocation {
|
switch apiLocation {
|
||||||
case let .channelLocation(geopoint, address):
|
case let .channelLocation(geopoint, address):
|
||||||
if case let .geoPoint(longitude, latitude, _) = geopoint {
|
if case let .geoPoint(_, longitude, latitude, _, _) = geopoint {
|
||||||
self.init(latitude: latitude, longitude: longitude, address: address)
|
self.init(latitude: latitude, longitude: longitude, address: address)
|
||||||
} else {
|
} else {
|
||||||
return nil
|
return nil
|
||||||
|
@ -3,6 +3,10 @@ import Postbox
|
|||||||
|
|
||||||
import SyncCore
|
import SyncCore
|
||||||
|
|
||||||
|
// Incuding at least one Objective-C class in a swift file ensures that it doesn't get stripped by the linker
|
||||||
|
private final class LinkHelperClass: NSObject {
|
||||||
|
}
|
||||||
|
|
||||||
public func canSendMessagesToPeer(_ peer: Peer) -> Bool {
|
public func canSendMessagesToPeer(_ peer: Peer) -> Bool {
|
||||||
if peer is TelegramUser || peer is TelegramGroup {
|
if peer is TelegramUser || peer is TelegramGroup {
|
||||||
return !peer.isDeleted
|
return !peer.isDeleted
|
||||||
|
@ -25,7 +25,7 @@ private func createChannel(account: Account, title: String, description: String?
|
|||||||
var address: String?
|
var address: String?
|
||||||
if let location = location {
|
if let location = location {
|
||||||
flags |= (1 << 2)
|
flags |= (1 << 2)
|
||||||
geoPoint = .inputGeoPoint(lat: location.latitude, long: location.longitude)
|
geoPoint = .inputGeoPoint(flags: 0, lat: location.latitude, long: location.longitude, accuracyRadius: nil)
|
||||||
address = location.address
|
address = location.address
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -424,14 +424,14 @@ extension ChatContextResultMessage {
|
|||||||
}
|
}
|
||||||
self = .text(text: message, entities: parsedEntities, disableUrlPreview: (flags & (1 << 0)) != 0, replyMarkup: parsedReplyMarkup)
|
self = .text(text: message, entities: parsedEntities, disableUrlPreview: (flags & (1 << 0)) != 0, replyMarkup: parsedReplyMarkup)
|
||||||
case let .botInlineMessageMediaGeo(_, geo, period, replyMarkup):
|
case let .botInlineMessageMediaGeo(_, geo, period, replyMarkup):
|
||||||
let media = telegramMediaMapFromApiGeoPoint(geo, title: nil, address: nil, provider: nil, venueId: nil, venueType: nil, liveBroadcastingTimeout: period)
|
let media = telegramMediaMapFromApiGeoPoint(geo, title: nil, address: nil, provider: nil, venueId: nil, venueType: nil, liveBroadcastingTimeout: period, heading: nil)
|
||||||
var parsedReplyMarkup: ReplyMarkupMessageAttribute?
|
var parsedReplyMarkup: ReplyMarkupMessageAttribute?
|
||||||
if let replyMarkup = replyMarkup {
|
if let replyMarkup = replyMarkup {
|
||||||
parsedReplyMarkup = ReplyMarkupMessageAttribute(apiMarkup: replyMarkup)
|
parsedReplyMarkup = ReplyMarkupMessageAttribute(apiMarkup: replyMarkup)
|
||||||
}
|
}
|
||||||
self = .mapLocation(media: media, replyMarkup: parsedReplyMarkup)
|
self = .mapLocation(media: media, replyMarkup: parsedReplyMarkup)
|
||||||
case let .botInlineMessageMediaVenue(_, geo, title, address, provider, venueId, venueType, replyMarkup):
|
case let .botInlineMessageMediaVenue(_, geo, title, address, provider, venueId, venueType, replyMarkup):
|
||||||
let media = telegramMediaMapFromApiGeoPoint(geo, title: title, address: address, provider: provider, venueId: venueId, venueType: venueType, liveBroadcastingTimeout: nil)
|
let media = telegramMediaMapFromApiGeoPoint(geo, title: title, address: address, provider: provider, venueId: venueId, venueType: venueType, liveBroadcastingTimeout: nil, heading: nil)
|
||||||
var parsedReplyMarkup: ReplyMarkupMessageAttribute?
|
var parsedReplyMarkup: ReplyMarkupMessageAttribute?
|
||||||
if let replyMarkup = replyMarkup {
|
if let replyMarkup = replyMarkup {
|
||||||
parsedReplyMarkup = ReplyMarkupMessageAttribute(apiMarkup: replyMarkup)
|
parsedReplyMarkup = ReplyMarkupMessageAttribute(apiMarkup: replyMarkup)
|
||||||
|
@ -158,7 +158,7 @@ extension InstantPageBlock {
|
|||||||
self = .relatedArticles(title: RichText(apiText: title), articles: articles.map({ InstantPageRelatedArticle(apiRelatedArticle: $0) }))
|
self = .relatedArticles(title: RichText(apiText: title), articles: articles.map({ InstantPageRelatedArticle(apiRelatedArticle: $0) }))
|
||||||
case let .pageBlockMap(geo, zoom, w, h, caption):
|
case let .pageBlockMap(geo, zoom, w, h, caption):
|
||||||
switch geo {
|
switch geo {
|
||||||
case let .geoPoint(long, lat, _):
|
case let .geoPoint(_, long, lat, _, _):
|
||||||
self = .map(latitude: lat, longitude: long, zoom: zoom, dimensions: PixelDimensions(width: w, height: h), caption: InstantPageCaption(apiCaption: caption))
|
self = .map(latitude: lat, longitude: long, zoom: zoom, dimensions: PixelDimensions(width: w, height: h), caption: InstantPageCaption(apiCaption: caption))
|
||||||
default:
|
default:
|
||||||
self = .unsupported
|
self = .unsupported
|
||||||
|
@ -2,6 +2,10 @@ import Foundation
|
|||||||
import Postbox
|
import Postbox
|
||||||
import CryptoUtils
|
import CryptoUtils
|
||||||
|
|
||||||
|
// Incuding at least one Objective-C class in a swift file ensures that it doesn't get stripped by the linker
|
||||||
|
private final class LinkHelperClass: NSObject {
|
||||||
|
}
|
||||||
|
|
||||||
public extension MemoryBuffer {
|
public extension MemoryBuffer {
|
||||||
func md5Digest() -> Data {
|
func md5Digest() -> Data {
|
||||||
return CryptoMD5(self.memory, Int32(self.length))
|
return CryptoMD5(self.memory, Int32(self.length))
|
||||||
|
@ -33,10 +33,10 @@ public func updatePeersNearbyVisibility(account: Account, update: PeerNearbyVisi
|
|||||||
switch update {
|
switch update {
|
||||||
case let .visible(latitude, longitude):
|
case let .visible(latitude, longitude):
|
||||||
flags |= (1 << 0)
|
flags |= (1 << 0)
|
||||||
geoPoint = .inputGeoPoint(lat: latitude, long: longitude)
|
geoPoint = .inputGeoPoint(flags: 0, lat: latitude, long: longitude, accuracyRadius: nil)
|
||||||
selfExpires = 0x7fffffff
|
selfExpires = 0x7fffffff
|
||||||
case let .location(latitude, longitude):
|
case let .location(latitude, longitude):
|
||||||
geoPoint = .inputGeoPoint(lat: latitude, long: longitude)
|
geoPoint = .inputGeoPoint(flags: 0, lat: latitude, long: longitude, accuracyRadius: nil)
|
||||||
case .invisible:
|
case .invisible:
|
||||||
flags |= (1 << 0)
|
flags |= (1 << 0)
|
||||||
geoPoint = .inputGeoPointEmpty
|
geoPoint = .inputGeoPointEmpty
|
||||||
@ -87,7 +87,7 @@ public final class PeersNearbyContext {
|
|||||||
public init(network: Network, stateManager: AccountStateManager, coordinate: (latitude: Double, longitude: Double)) {
|
public init(network: Network, stateManager: AccountStateManager, coordinate: (latitude: Double, longitude: Double)) {
|
||||||
let expiryExtension: Double = 10.0
|
let expiryExtension: Double = 10.0
|
||||||
|
|
||||||
let poll = network.request(Api.functions.contacts.getLocated(flags: 0, geoPoint: .inputGeoPoint(lat: coordinate.latitude, long: coordinate.longitude), selfExpires: nil))
|
let poll = network.request(Api.functions.contacts.getLocated(flags: 0, geoPoint: .inputGeoPoint(flags: 0, lat: coordinate.latitude, long: coordinate.longitude, accuracyRadius: nil), selfExpires: nil))
|
||||||
|> map(Optional.init)
|
|> map(Optional.init)
|
||||||
|> `catch` { _ -> Signal<Api.Updates?, NoError> in
|
|> `catch` { _ -> Signal<Api.Updates?, NoError> in
|
||||||
return .single(nil)
|
return .single(nil)
|
||||||
@ -234,7 +234,7 @@ public func updateChannelGeoLocation(postbox: Postbox, network: Network, channel
|
|||||||
|
|
||||||
let geoPoint: Api.InputGeoPoint
|
let geoPoint: Api.InputGeoPoint
|
||||||
if let (latitude, longitude) = coordinate, let _ = address {
|
if let (latitude, longitude) = coordinate, let _ = address {
|
||||||
geoPoint = .inputGeoPoint(lat: latitude, long: longitude)
|
geoPoint = .inputGeoPoint(flags: 0, lat: latitude, long: longitude, accuracyRadius: nil)
|
||||||
} else {
|
} else {
|
||||||
geoPoint = .inputGeoPointEmpty
|
geoPoint = .inputGeoPointEmpty
|
||||||
}
|
}
|
||||||
|
@ -142,12 +142,16 @@ func mediaContentToUpload(network: Network, postbox: Postbox, auxiliaryMethods:
|
|||||||
return .single(.content(PendingMessageUploadedContentAndReuploadInfo(content: .media(input, text), reuploadInfo: nil)))
|
return .single(.content(PendingMessageUploadedContentAndReuploadInfo(content: .media(input, text), reuploadInfo: nil)))
|
||||||
} else if let map = media as? TelegramMediaMap {
|
} else if let map = media as? TelegramMediaMap {
|
||||||
let input: Api.InputMedia
|
let input: Api.InputMedia
|
||||||
|
var geoFlags: Int32 = 0
|
||||||
|
if let _ = map.accuracyRadius {
|
||||||
|
geoFlags |= 1 << 0
|
||||||
|
}
|
||||||
if let liveBroadcastingTimeout = map.liveBroadcastingTimeout {
|
if let liveBroadcastingTimeout = map.liveBroadcastingTimeout {
|
||||||
input = .inputMediaGeoLive(flags: 1 << 1, geoPoint: Api.InputGeoPoint.inputGeoPoint(lat: map.latitude, long: map.longitude), period: liveBroadcastingTimeout)
|
input = .inputMediaGeoLive(flags: 1 << 1, geoPoint: Api.InputGeoPoint.inputGeoPoint(flags: geoFlags, lat: map.latitude, long: map.longitude, accuracyRadius: map.accuracyRadius.flatMap({ Int32($0) })), heading: 0, period: liveBroadcastingTimeout)
|
||||||
} else if let venue = map.venue {
|
} else if let venue = map.venue {
|
||||||
input = .inputMediaVenue(geoPoint: Api.InputGeoPoint.inputGeoPoint(lat: map.latitude, long: map.longitude), title: venue.title, address: venue.address ?? "", provider: venue.provider ?? "", venueId: venue.id ?? "", venueType: venue.type ?? "")
|
input = .inputMediaVenue(geoPoint: Api.InputGeoPoint.inputGeoPoint(flags: geoFlags, lat: map.latitude, long: map.longitude, accuracyRadius: map.accuracyRadius.flatMap({ Int32($0) })), title: venue.title, address: venue.address ?? "", provider: venue.provider ?? "", venueId: venue.id ?? "", venueType: venue.type ?? "")
|
||||||
} else {
|
} else {
|
||||||
input = .inputMediaGeoPoint(geoPoint: Api.InputGeoPoint.inputGeoPoint(lat: map.latitude, long: map.longitude))
|
input = .inputMediaGeoPoint(geoPoint: Api.InputGeoPoint.inputGeoPoint(flags: geoFlags, lat: map.latitude, long: map.longitude, accuracyRadius: map.accuracyRadius.flatMap({ Int32($0) })))
|
||||||
}
|
}
|
||||||
return .single(.content(PendingMessageUploadedContentAndReuploadInfo(content: .media(input, text), reuploadInfo: nil)))
|
return .single(.content(PendingMessageUploadedContentAndReuploadInfo(content: .media(input, text), reuploadInfo: nil)))
|
||||||
} else if let poll = media as? TelegramMediaPoll {
|
} else if let poll = media as? TelegramMediaPoll {
|
||||||
|
@ -794,11 +794,11 @@ private func parseMessage(peerId: PeerId, authorId: PeerId, tagLocalIndex: Int32
|
|||||||
case let .decryptedMessageMediaWebPage(url):
|
case let .decryptedMessageMediaWebPage(url):
|
||||||
parsedMedia.append(TelegramMediaWebpage(webpageId: MediaId(namespace: Namespaces.Media.LocalWebpage, id: arc4random64()), content: .Pending(0, url)))
|
parsedMedia.append(TelegramMediaWebpage(webpageId: MediaId(namespace: Namespaces.Media.LocalWebpage, id: arc4random64()), content: .Pending(0, url)))
|
||||||
case let .decryptedMessageMediaGeoPoint(lat, long):
|
case let .decryptedMessageMediaGeoPoint(lat, long):
|
||||||
parsedMedia.append(TelegramMediaMap(latitude: lat, longitude: long, geoPlace: nil, venue: nil, liveBroadcastingTimeout: nil))
|
parsedMedia.append(TelegramMediaMap(latitude: lat, longitude: long, heading: nil, accuracyRadius: nil, geoPlace: nil, venue: nil, liveBroadcastingTimeout: nil))
|
||||||
case let .decryptedMessageMediaContact(phoneNumber, firstName, lastName, userId):
|
case let .decryptedMessageMediaContact(phoneNumber, firstName, lastName, userId):
|
||||||
parsedMedia.append(TelegramMediaContact(firstName: firstName, lastName: lastName, phoneNumber: phoneNumber, peerId: userId == 0 ? nil : PeerId(namespace: Namespaces.Peer.CloudUser, id: userId), vCardData: nil))
|
parsedMedia.append(TelegramMediaContact(firstName: firstName, lastName: lastName, phoneNumber: phoneNumber, peerId: userId == 0 ? nil : PeerId(namespace: Namespaces.Peer.CloudUser, id: userId), vCardData: nil))
|
||||||
case let .decryptedMessageMediaVenue(lat, long, title, address, provider, venueId):
|
case let .decryptedMessageMediaVenue(lat, long, title, address, provider, venueId):
|
||||||
parsedMedia.append(TelegramMediaMap(latitude: lat, longitude: long, geoPlace: nil, venue: MapVenue(title: title, address: address, provider: provider, id: venueId, type: nil), liveBroadcastingTimeout: nil))
|
parsedMedia.append(TelegramMediaMap(latitude: lat, longitude: long, heading: nil, accuracyRadius: nil, geoPlace: nil, venue: MapVenue(title: title, address: address, provider: provider, id: venueId, type: nil), liveBroadcastingTimeout: nil))
|
||||||
case .decryptedMessageMediaEmpty:
|
case .decryptedMessageMediaEmpty:
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
@ -1013,11 +1013,11 @@ private func parseMessage(peerId: PeerId, authorId: PeerId, tagLocalIndex: Int32
|
|||||||
case let .decryptedMessageMediaWebPage(url):
|
case let .decryptedMessageMediaWebPage(url):
|
||||||
parsedMedia.append(TelegramMediaWebpage(webpageId: MediaId(namespace: Namespaces.Media.LocalWebpage, id: arc4random64()), content: .Pending(0, url)))
|
parsedMedia.append(TelegramMediaWebpage(webpageId: MediaId(namespace: Namespaces.Media.LocalWebpage, id: arc4random64()), content: .Pending(0, url)))
|
||||||
case let .decryptedMessageMediaGeoPoint(lat, long):
|
case let .decryptedMessageMediaGeoPoint(lat, long):
|
||||||
parsedMedia.append(TelegramMediaMap(latitude: lat, longitude: long, geoPlace: nil, venue: nil, liveBroadcastingTimeout: nil))
|
parsedMedia.append(TelegramMediaMap(latitude: lat, longitude: long, heading: nil, accuracyRadius: nil, geoPlace: nil, venue: nil, liveBroadcastingTimeout: nil))
|
||||||
case let .decryptedMessageMediaContact(phoneNumber, firstName, lastName, userId):
|
case let .decryptedMessageMediaContact(phoneNumber, firstName, lastName, userId):
|
||||||
parsedMedia.append(TelegramMediaContact(firstName: firstName, lastName: lastName, phoneNumber: phoneNumber, peerId: userId == 0 ? nil : PeerId(namespace: Namespaces.Peer.CloudUser, id: userId), vCardData: nil))
|
parsedMedia.append(TelegramMediaContact(firstName: firstName, lastName: lastName, phoneNumber: phoneNumber, peerId: userId == 0 ? nil : PeerId(namespace: Namespaces.Peer.CloudUser, id: userId), vCardData: nil))
|
||||||
case let .decryptedMessageMediaVenue(lat, long, title, address, provider, venueId):
|
case let .decryptedMessageMediaVenue(lat, long, title, address, provider, venueId):
|
||||||
parsedMedia.append(TelegramMediaMap(latitude: lat, longitude: long, geoPlace: nil, venue: MapVenue(title: title, address: address, provider: provider, id: venueId, type: nil), liveBroadcastingTimeout: nil))
|
parsedMedia.append(TelegramMediaMap(latitude: lat, longitude: long, heading: nil, accuracyRadius: nil, geoPlace: nil, venue: MapVenue(title: title, address: address, provider: provider, id: venueId, type: nil), liveBroadcastingTimeout: nil))
|
||||||
case .decryptedMessageMediaEmpty:
|
case .decryptedMessageMediaEmpty:
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
@ -1251,11 +1251,11 @@ private func parseMessage(peerId: PeerId, authorId: PeerId, tagLocalIndex: Int32
|
|||||||
case let .decryptedMessageMediaWebPage(url):
|
case let .decryptedMessageMediaWebPage(url):
|
||||||
parsedMedia.append(TelegramMediaWebpage(webpageId: MediaId(namespace: Namespaces.Media.LocalWebpage, id: arc4random64()), content: .Pending(0, url)))
|
parsedMedia.append(TelegramMediaWebpage(webpageId: MediaId(namespace: Namespaces.Media.LocalWebpage, id: arc4random64()), content: .Pending(0, url)))
|
||||||
case let .decryptedMessageMediaGeoPoint(lat, long):
|
case let .decryptedMessageMediaGeoPoint(lat, long):
|
||||||
parsedMedia.append(TelegramMediaMap(latitude: lat, longitude: long, geoPlace: nil, venue: nil, liveBroadcastingTimeout: nil))
|
parsedMedia.append(TelegramMediaMap(latitude: lat, longitude: long, heading: nil, accuracyRadius: nil, geoPlace: nil, venue: nil, liveBroadcastingTimeout: nil))
|
||||||
case let .decryptedMessageMediaContact(phoneNumber, firstName, lastName, userId):
|
case let .decryptedMessageMediaContact(phoneNumber, firstName, lastName, userId):
|
||||||
parsedMedia.append(TelegramMediaContact(firstName: firstName, lastName: lastName, phoneNumber: phoneNumber, peerId: userId == 0 ? nil : PeerId(namespace: Namespaces.Peer.CloudUser, id: userId), vCardData: nil))
|
parsedMedia.append(TelegramMediaContact(firstName: firstName, lastName: lastName, phoneNumber: phoneNumber, peerId: userId == 0 ? nil : PeerId(namespace: Namespaces.Peer.CloudUser, id: userId), vCardData: nil))
|
||||||
case let .decryptedMessageMediaVenue(lat, long, title, address, provider, venueId):
|
case let .decryptedMessageMediaVenue(lat, long, title, address, provider, venueId):
|
||||||
parsedMedia.append(TelegramMediaMap(latitude: lat, longitude: long, geoPlace: nil, venue: MapVenue(title: title, address: address, provider: provider, id: venueId, type: nil), liveBroadcastingTimeout: nil))
|
parsedMedia.append(TelegramMediaMap(latitude: lat, longitude: long, heading: nil, accuracyRadius: nil, geoPlace: nil, venue: MapVenue(title: title, address: address, provider: provider, id: venueId, type: nil), liveBroadcastingTimeout: nil))
|
||||||
case .decryptedMessageMediaEmpty:
|
case .decryptedMessageMediaEmpty:
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
@ -116,7 +116,8 @@ public func requestChatContextResults(account: Account, botId: PeerId, peerId: P
|
|||||||
}
|
}
|
||||||
if let (latitude, longitude) = location {
|
if let (latitude, longitude) = location {
|
||||||
flags |= (1 << 0)
|
flags |= (1 << 0)
|
||||||
geoPoint = Api.InputGeoPoint.inputGeoPoint(lat: latitude, long: longitude)
|
var geoPointFlags: Int32 = 0
|
||||||
|
geoPoint = Api.InputGeoPoint.inputGeoPoint(flags: geoPointFlags, lat: latitude, long: longitude, accuracyRadius: nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
var signal: Signal<RequestChatContextResultsResult?, RequestChatContextResultsError> = account.network.request(Api.functions.messages.getInlineBotResults(flags: flags, bot: inputBot, peer: inputPeer, geoPoint: geoPoint, query: query, offset: offset))
|
var signal: Signal<RequestChatContextResultsResult?, RequestChatContextResultsError> = account.network.request(Api.functions.messages.getInlineBotResults(flags: flags, bot: inputBot, peer: inputPeer, geoPoint: geoPoint, query: query, offset: offset))
|
||||||
|
@ -252,7 +252,7 @@ private func requestEditMessageInternal(postbox: Postbox, network: Network, stat
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public func requestEditLiveLocation(postbox: Postbox, network: Network, stateManager: AccountStateManager, messageId: MessageId, coordinate: (latitude: Double, longitude: Double)?) -> Signal<Void, NoError> {
|
public func requestEditLiveLocation(postbox: Postbox, network: Network, stateManager: AccountStateManager, messageId: MessageId, coordinate: (latitude: Double, longitude: Double, accuracyRadius: Int32?)?, heading: Int32?) -> Signal<Void, NoError> {
|
||||||
return postbox.transaction { transaction -> (Api.InputPeer, TelegramMediaMap)? in
|
return postbox.transaction { transaction -> (Api.InputPeer, TelegramMediaMap)? in
|
||||||
guard let inputPeer = transaction.getPeer(messageId.peerId).flatMap(apiInputPeer) else {
|
guard let inputPeer = transaction.getPeer(messageId.peerId).flatMap(apiInputPeer) else {
|
||||||
return nil
|
return nil
|
||||||
@ -273,9 +273,13 @@ public func requestEditLiveLocation(postbox: Postbox, network: Network, stateMan
|
|||||||
}
|
}
|
||||||
let inputMedia: Api.InputMedia
|
let inputMedia: Api.InputMedia
|
||||||
if let coordinate = coordinate, let liveBroadcastingTimeout = media.liveBroadcastingTimeout {
|
if let coordinate = coordinate, let liveBroadcastingTimeout = media.liveBroadcastingTimeout {
|
||||||
inputMedia = .inputMediaGeoLive(flags: 1 << 1, geoPoint: .inputGeoPoint(lat: coordinate.latitude, long: coordinate.longitude), period: liveBroadcastingTimeout)
|
var geoFlags: Int32 = 0
|
||||||
|
if let _ = coordinate.accuracyRadius {
|
||||||
|
geoFlags |= 1 << 0
|
||||||
|
}
|
||||||
|
inputMedia = .inputMediaGeoLive(flags: 1 << 1, geoPoint: .inputGeoPoint(flags: geoFlags, lat: coordinate.latitude, long: coordinate.longitude, accuracyRadius: coordinate.accuracyRadius.flatMap({ Int32($0) })), heading: heading ?? 0, period: liveBroadcastingTimeout)
|
||||||
} else {
|
} else {
|
||||||
inputMedia = .inputMediaGeoLive(flags: 1 << 0, geoPoint: .inputGeoPoint(lat: media.latitude, long: media.longitude), period: nil)
|
inputMedia = .inputMediaGeoLive(flags: 1 << 0, geoPoint: .inputGeoPoint(flags: 0, lat: media.latitude, long: media.longitude, accuracyRadius: nil), heading: 0, period: nil)
|
||||||
}
|
}
|
||||||
return network.request(Api.functions.messages.editMessage(flags: 1 << 14, peer: inputPeer, id: messageId.id, message: nil, media: inputMedia, replyMarkup: nil, entities: nil, scheduleDate: nil))
|
return network.request(Api.functions.messages.editMessage(flags: 1 << 14, peer: inputPeer, id: messageId.id, message: nil, media: inputMedia, replyMarkup: nil, entities: nil, scheduleDate: nil))
|
||||||
|> map(Optional.init)
|
|> map(Optional.init)
|
||||||
@ -305,3 +309,45 @@ public func requestEditLiveLocation(postbox: Postbox, network: Network, stateMan
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public func requestProximityNotification(postbox: Postbox, network: Network, messageId: MessageId, distance: Int32, coordinate: (latitude: Double, longitude: Double, accuracyRadius: Int32?)) -> Signal<Void, NoError> {
|
||||||
|
return postbox.transaction { transaction -> Api.InputPeer? in
|
||||||
|
return transaction.getPeer(messageId.peerId).flatMap(apiInputPeer)
|
||||||
|
}
|
||||||
|
|> mapToSignal { inputPeer -> Signal<Void, NoError> in
|
||||||
|
guard let inputPeer = inputPeer else {
|
||||||
|
return .complete()
|
||||||
|
}
|
||||||
|
let flags: Int32 = 1 << 0
|
||||||
|
var geoFlags: Int32 = 0
|
||||||
|
if let _ = coordinate.accuracyRadius {
|
||||||
|
geoFlags |= 1 << 0
|
||||||
|
}
|
||||||
|
return network.request(Api.functions.messages.requestProximityNotification(flags: flags, peer: inputPeer, msgId: messageId.id, ownLocation: .inputGeoPoint(flags: geoFlags, lat: coordinate.latitude, long: coordinate.longitude, accuracyRadius: coordinate.accuracyRadius), maxDistance: distance))
|
||||||
|
|> map(Optional.init)
|
||||||
|
|> `catch` { _ -> Signal<Api.Bool?, NoError> in
|
||||||
|
return .single(nil)
|
||||||
|
}
|
||||||
|
|> mapToSignal { _ -> Signal<Void, NoError> in
|
||||||
|
return .complete()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public func cancelProximityNotification(postbox: Postbox, network: Network, messageId: MessageId) -> Signal<Void, NoError> {
|
||||||
|
return postbox.transaction { transaction -> Api.InputPeer? in
|
||||||
|
return transaction.getPeer(messageId.peerId).flatMap(apiInputPeer)
|
||||||
|
}
|
||||||
|
|> mapToSignal { inputPeer -> Signal<Void, NoError> in
|
||||||
|
guard let inputPeer = inputPeer else {
|
||||||
|
return .complete()
|
||||||
|
}
|
||||||
|
return network.request(Api.functions.messages.requestProximityNotification(flags: 1 << 1, peer: inputPeer, msgId: messageId.id, ownLocation: nil, maxDistance: nil))
|
||||||
|
|> map(Optional.init)
|
||||||
|
|> `catch` { _ -> Signal<Api.Bool?, NoError> in
|
||||||
|
return .single(nil)
|
||||||
|
}
|
||||||
|
|> mapToSignal { _ -> Signal<Void, NoError> in
|
||||||
|
return .complete()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -206,6 +206,9 @@ func apiMessagePeerIds(_ message: Api.Message) -> [PeerId] {
|
|||||||
result.append(PeerId(namespace: Namespaces.Peer.CloudUser, id: inviterId))
|
result.append(PeerId(namespace: Namespaces.Peer.CloudUser, id: inviterId))
|
||||||
case let .messageActionChatMigrateTo(channelId):
|
case let .messageActionChatMigrateTo(channelId):
|
||||||
result.append(PeerId(namespace: Namespaces.Peer.CloudChannel, id: channelId))
|
result.append(PeerId(namespace: Namespaces.Peer.CloudChannel, id: channelId))
|
||||||
|
case let .messageActionGeoProximityReached(fromId, toId, _):
|
||||||
|
result.append(fromId.peerId)
|
||||||
|
result.append(toId.peerId)
|
||||||
}
|
}
|
||||||
|
|
||||||
return result
|
return result
|
||||||
@ -252,13 +255,13 @@ func textMediaAndExpirationTimerFromApiMedia(_ media: Api.MessageMedia?, _ peerI
|
|||||||
let mediaContact = TelegramMediaContact(firstName: firstName, lastName: lastName, phoneNumber: phoneNumber, peerId: contactPeerId, vCardData: vcard.isEmpty ? nil : vcard)
|
let mediaContact = TelegramMediaContact(firstName: firstName, lastName: lastName, phoneNumber: phoneNumber, peerId: contactPeerId, vCardData: vcard.isEmpty ? nil : vcard)
|
||||||
return (mediaContact, nil)
|
return (mediaContact, nil)
|
||||||
case let .messageMediaGeo(geo):
|
case let .messageMediaGeo(geo):
|
||||||
let mediaMap = telegramMediaMapFromApiGeoPoint(geo, title: nil, address: nil, provider: nil, venueId: nil, venueType: nil, liveBroadcastingTimeout: nil)
|
let mediaMap = telegramMediaMapFromApiGeoPoint(geo, title: nil, address: nil, provider: nil, venueId: nil, venueType: nil, liveBroadcastingTimeout: nil, heading: nil)
|
||||||
return (mediaMap, nil)
|
return (mediaMap, nil)
|
||||||
case let .messageMediaVenue(geo, title, address, provider, venueId, venueType):
|
case let .messageMediaVenue(geo, title, address, provider, venueId, venueType):
|
||||||
let mediaMap = telegramMediaMapFromApiGeoPoint(geo, title: title, address: address, provider: provider, venueId: venueId, venueType: venueType, liveBroadcastingTimeout: nil)
|
let mediaMap = telegramMediaMapFromApiGeoPoint(geo, title: title, address: address, provider: provider, venueId: venueId, venueType: venueType, liveBroadcastingTimeout: nil, heading: nil)
|
||||||
return (mediaMap, nil)
|
return (mediaMap, nil)
|
||||||
case let .messageMediaGeoLive(geo, period):
|
case let .messageMediaGeoLive(geo, heading, period):
|
||||||
let mediaMap = telegramMediaMapFromApiGeoPoint(geo, title: nil, address: nil, provider: nil, venueId: nil, venueType: nil, liveBroadcastingTimeout: period)
|
let mediaMap = telegramMediaMapFromApiGeoPoint(geo, title: nil, address: nil, provider: nil, venueId: nil, venueType: nil, liveBroadcastingTimeout: period, heading: heading)
|
||||||
return (mediaMap, nil)
|
return (mediaMap, nil)
|
||||||
case let .messageMediaDocument(_, document, ttlSeconds):
|
case let .messageMediaDocument(_, document, ttlSeconds):
|
||||||
if let document = document {
|
if let document = document {
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
import Foundation
|
||||||
|
|
||||||
|
// Incuding at least one Objective-C class in a swift file ensures that it doesn't get stripped by the linker
|
||||||
|
private final class LinkHelperClass: NSObject {
|
||||||
|
}
|
||||||
|
|
||||||
public func dataSizeString(_ size: Int, forceDecimal: Bool = false, decimalSeparator: String = ".") -> String {
|
public func dataSizeString(_ size: Int, forceDecimal: Bool = false, decimalSeparator: String = ".") -> String {
|
||||||
return dataSizeString(Int64(size), forceDecimal: forceDecimal, decimalSeparator: decimalSeparator)
|
return dataSizeString(Int64(size), forceDecimal: forceDecimal, decimalSeparator: decimalSeparator)
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,10 @@ import Postbox
|
|||||||
|
|
||||||
import SyncCore
|
import SyncCore
|
||||||
|
|
||||||
|
// Incuding at least one Objective-C class in a swift file ensures that it doesn't get stripped by the linker
|
||||||
|
private final class LinkHelperClass: NSObject {
|
||||||
|
}
|
||||||
|
|
||||||
public extension TelegramGroup {
|
public extension TelegramGroup {
|
||||||
func hasBannedPermission(_ rights: TelegramChatBannedRightsFlags) -> Bool {
|
func hasBannedPermission(_ rights: TelegramChatBannedRightsFlags) -> Bool {
|
||||||
switch self.role {
|
switch self.role {
|
||||||
|
@ -57,6 +57,8 @@ func telegramMediaActionFromApiAction(_ action: Api.MessageAction) -> TelegramMe
|
|||||||
return TelegramMediaAction(action: .botSentSecureValues(types: types.map(SentSecureValueType.init)))
|
return TelegramMediaAction(action: .botSentSecureValues(types: types.map(SentSecureValueType.init)))
|
||||||
case .messageActionContactSignUp:
|
case .messageActionContactSignUp:
|
||||||
return TelegramMediaAction(action: .peerJoined)
|
return TelegramMediaAction(action: .peerJoined)
|
||||||
|
case let .messageActionGeoProximityReached(fromId, toId, distance):
|
||||||
|
return TelegramMediaAction(action: .geoProximityReached(distance: distance))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,15 +4,15 @@ import TelegramApi
|
|||||||
|
|
||||||
import SyncCore
|
import SyncCore
|
||||||
|
|
||||||
func telegramMediaMapFromApiGeoPoint(_ geo: Api.GeoPoint, title: String?, address: String?, provider: String?, venueId: String?, venueType: String?, liveBroadcastingTimeout: Int32?) -> TelegramMediaMap {
|
func telegramMediaMapFromApiGeoPoint(_ geo: Api.GeoPoint, title: String?, address: String?, provider: String?, venueId: String?, venueType: String?, liveBroadcastingTimeout: Int32?, heading: Int32?) -> TelegramMediaMap {
|
||||||
var venue: MapVenue?
|
var venue: MapVenue?
|
||||||
if let title = title {
|
if let title = title {
|
||||||
venue = MapVenue(title: title, address: address, provider: provider, id: venueId, type: venueType)
|
venue = MapVenue(title: title, address: address, provider: provider, id: venueId, type: venueType)
|
||||||
}
|
}
|
||||||
switch geo {
|
switch geo {
|
||||||
case let .geoPoint(long, lat, _):
|
case let .geoPoint(_, long, lat, accessHash, accuracyRadius):
|
||||||
return TelegramMediaMap(latitude: lat, longitude: long, geoPlace: nil, venue: venue, liveBroadcastingTimeout: liveBroadcastingTimeout)
|
return TelegramMediaMap(latitude: lat, longitude: long, heading: heading.flatMap { Double($0) }, accuracyRadius: accuracyRadius.flatMap { Double($0) }, geoPlace: nil, venue: venue, liveBroadcastingTimeout: liveBroadcastingTimeout)
|
||||||
case .geoPointEmpty:
|
case .geoPointEmpty:
|
||||||
return TelegramMediaMap(latitude: 0.0, longitude: 0.0, geoPlace: nil, venue: venue, liveBroadcastingTimeout: liveBroadcastingTimeout)
|
return TelegramMediaMap(latitude: 0.0, longitude: 0.0, heading: nil, accuracyRadius: nil, geoPlace: nil, venue: venue, liveBroadcastingTimeout: liveBroadcastingTimeout)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -442,6 +442,8 @@ public func universalServiceMessageString(presentationData: (PresentationTheme,
|
|||||||
attributedString = addAttributesToStringWithRanges(strings.Notification_Joined(authorName), body: bodyAttributes, argumentAttributes: peerMentionsAttributes(primaryTextColor: primaryTextColor, peerIds: [(0, message.author?.id)]))
|
attributedString = addAttributesToStringWithRanges(strings.Notification_Joined(authorName), body: bodyAttributes, argumentAttributes: peerMentionsAttributes(primaryTextColor: primaryTextColor, peerIds: [(0, message.author?.id)]))
|
||||||
case .phoneNumberRequest:
|
case .phoneNumberRequest:
|
||||||
attributedString = nil
|
attributedString = nil
|
||||||
|
case .geoProximityReached:
|
||||||
|
attributedString = nil
|
||||||
case .unknown:
|
case .unknown:
|
||||||
attributedString = nil
|
attributedString = nil
|
||||||
}
|
}
|
||||||
|
@ -1088,7 +1088,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
|||||||
|> deliverOnMainQueue).start(next: { coordinate in
|
|> deliverOnMainQueue).start(next: { coordinate in
|
||||||
if let strongSelf = self {
|
if let strongSelf = self {
|
||||||
if let coordinate = coordinate {
|
if let coordinate = coordinate {
|
||||||
strongSelf.sendMessages([.message(text: "", attributes: [], mediaReference: .standalone(media: TelegramMediaMap(latitude: coordinate.latitude, longitude: coordinate.longitude, geoPlace: nil, venue: nil, liveBroadcastingTimeout: nil)), replyToMessageId: nil, localGroupingKey: nil)])
|
strongSelf.sendMessages([.message(text: "", attributes: [], mediaReference: .standalone(media: TelegramMediaMap(latitude: coordinate.latitude, longitude: coordinate.longitude, heading: nil, accuracyRadius: nil, geoPlace: nil, venue: nil, liveBroadcastingTimeout: nil)), replyToMessageId: nil, localGroupingKey: nil)])
|
||||||
} else {
|
} else {
|
||||||
strongSelf.present(textAlertController(context: strongSelf.context, title: nil, text: strongSelf.presentationData.strings.Login_UnknownError, actions: [TextAlertAction(type: .genericAction, title: strongSelf.presentationData.strings.Common_Cancel, action: {})]), in: .window(.root))
|
strongSelf.present(textAlertController(context: strongSelf.context, title: nil, text: strongSelf.presentationData.strings.Login_UnknownError, actions: [TextAlertAction(type: .genericAction, title: strongSelf.presentationData.strings.Common_Cancel, action: {})]), in: .window(.root))
|
||||||
}
|
}
|
||||||
@ -3268,20 +3268,25 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
|||||||
case .Loading:
|
case .Loading:
|
||||||
break
|
break
|
||||||
case let .HistoryView(view, _, _, _, _, _, _):
|
case let .HistoryView(view, _, _, _, _, _, _):
|
||||||
|
let topMessageId: MessageId
|
||||||
|
if view.entries.isEmpty {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
topMessageId = view.entries[view.entries.count - 1].message.id
|
||||||
for i in 0 ..< view.entries.count {
|
for i in 0 ..< view.entries.count {
|
||||||
let entry = view.entries[i]
|
let entry = view.entries[i]
|
||||||
var matches = false
|
var matches = false
|
||||||
if message == nil {
|
if message == nil {
|
||||||
matches = true
|
matches = true
|
||||||
} else if let topVisibleMessageRange = topVisibleMessageRange {
|
} else if let topVisibleMessageRange = topVisibleMessageRange {
|
||||||
if entry.message.id < topVisibleMessageRange.upperBound {
|
if entry.message.id <= topVisibleMessageRange.upperBound {
|
||||||
matches = true
|
matches = true
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
matches = true
|
matches = true
|
||||||
}
|
}
|
||||||
if matches {
|
if matches {
|
||||||
message = ChatPinnedMessage(message: entry.message, isLatest: i == view.entries.count - 1)
|
message = ChatPinnedMessage(message: entry.message, topMessageId: topMessageId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
@ -3352,7 +3357,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
|||||||
if let pinnedMessageId = pinnedMessageId {
|
if let pinnedMessageId = pinnedMessageId {
|
||||||
if let cachedDataMessages = combinedInitialData.cachedDataMessages {
|
if let cachedDataMessages = combinedInitialData.cachedDataMessages {
|
||||||
if let message = cachedDataMessages[pinnedMessageId] {
|
if let message = cachedDataMessages[pinnedMessageId] {
|
||||||
pinnedMessage = ChatPinnedMessage(message: message, isLatest: true)
|
pinnedMessage = ChatPinnedMessage(message: message, topMessageId: message.id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3504,7 +3509,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
|||||||
}
|
}
|
||||||
if let pinnedMessageId = pinnedMessageId {
|
if let pinnedMessageId = pinnedMessageId {
|
||||||
if let message = messages?[pinnedMessageId] {
|
if let message = messages?[pinnedMessageId] {
|
||||||
pinnedMessage = ChatPinnedMessage(message: message, isLatest: true)
|
pinnedMessage = ChatPinnedMessage(message: message, topMessageId: message.id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case let .peer(peerId):
|
case let .peer(peerId):
|
||||||
@ -3514,7 +3519,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
|||||||
} else {
|
} else {
|
||||||
if let pinnedMessageId = pinnedMessageId {
|
if let pinnedMessageId = pinnedMessageId {
|
||||||
if let message = messages?[pinnedMessageId] {
|
if let message = messages?[pinnedMessageId] {
|
||||||
pinnedMessage = ChatPinnedMessage(message: message, isLatest: true)
|
pinnedMessage = ChatPinnedMessage(message: message, topMessageId: message.id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4864,11 +4869,11 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if let pinnedMessageId = strongSelf.presentationInterfaceState.pinnedMessage?.message.id {
|
if let topPinnedMessageId = strongSelf.presentationInterfaceState.pinnedMessage?.topMessageId {
|
||||||
strongSelf.updateChatPresentationInterfaceState(animated: true, interactive: true, {
|
strongSelf.updateChatPresentationInterfaceState(animated: true, interactive: true, {
|
||||||
return $0.updatedInterfaceState({ $0.withUpdatedMessageActionsState({ value in
|
return $0.updatedInterfaceState({ $0.withUpdatedMessageActionsState({ value in
|
||||||
var value = value
|
var value = value
|
||||||
value.closedPinnedMessageId = pinnedMessageId
|
value.closedPinnedMessageId = topPinnedMessageId
|
||||||
return value
|
return value
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@ -4916,7 +4921,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
|||||||
strongSelf.updateChatPresentationInterfaceState(animated: true, interactive: true, {
|
strongSelf.updateChatPresentationInterfaceState(animated: true, interactive: true, {
|
||||||
return $0.updatedInterfaceState({ $0.withUpdatedMessageActionsState({ value in
|
return $0.updatedInterfaceState({ $0.withUpdatedMessageActionsState({ value in
|
||||||
var value = value
|
var value = value
|
||||||
value.closedPinnedMessageId = pinnedMessage.message.id
|
value.closedPinnedMessageId = pinnedMessage.topMessageId
|
||||||
return value
|
return value
|
||||||
}) })
|
}) })
|
||||||
})
|
})
|
||||||
|
@ -19,7 +19,7 @@ func titlePanelForChatPresentationInterfaceState(_ chatPresentationInterfaceStat
|
|||||||
loop: for context in chatPresentationInterfaceState.titlePanelContexts.reversed() {
|
loop: for context in chatPresentationInterfaceState.titlePanelContexts.reversed() {
|
||||||
switch context {
|
switch context {
|
||||||
case .pinnedMessage:
|
case .pinnedMessage:
|
||||||
if let pinnedMessage = chatPresentationInterfaceState.pinnedMessage, pinnedMessage.message.id != chatPresentationInterfaceState.interfaceState.messageActionsState.closedPinnedMessageId {
|
if let pinnedMessage = chatPresentationInterfaceState.pinnedMessage, pinnedMessage.topMessageId != chatPresentationInterfaceState.interfaceState.messageActionsState.closedPinnedMessageId {
|
||||||
selectedContext = context
|
selectedContext = context
|
||||||
break loop
|
break loop
|
||||||
}
|
}
|
||||||
|
@ -281,10 +281,7 @@ final class ChatMessageInteractiveFileNode: ASDisplayNode {
|
|||||||
var consumableContentIcon: UIImage?
|
var consumableContentIcon: UIImage?
|
||||||
for attribute in message.attributes {
|
for attribute in message.attributes {
|
||||||
if let attribute = attribute as? ConsumableContentMessageAttribute {
|
if let attribute = attribute as? ConsumableContentMessageAttribute {
|
||||||
var isConsumed = attribute.consumed
|
let isConsumed = attribute.consumed
|
||||||
if let channel = message.peers[message.id.peerId] as? TelegramChannel, case .broadcast = channel.info {
|
|
||||||
isConsumed = true
|
|
||||||
}
|
|
||||||
if !isConsumed {
|
if !isConsumed {
|
||||||
if incoming {
|
if incoming {
|
||||||
consumableContentIcon = PresentationResourcesChat.chatBubbleConsumableContentIncomingIcon(presentationData.theme.theme)
|
consumableContentIcon = PresentationResourcesChat.chatBubbleConsumableContentIncomingIcon(presentationData.theme.theme)
|
||||||
|
@ -241,7 +241,7 @@ final class ChatPinnedMessageTitlePanelNode: ChatTitleAccessoryPanelNode {
|
|||||||
var imageDimensions: CGSize?
|
var imageDimensions: CGSize?
|
||||||
|
|
||||||
var titleString: String
|
var titleString: String
|
||||||
if pinnedMessage.isLatest {
|
if pinnedMessage.topMessageId == pinnedMessage.message.id {
|
||||||
titleString = strings.Conversation_PinnedMessage
|
titleString = strings.Conversation_PinnedMessage
|
||||||
} else {
|
} else {
|
||||||
titleString = strings.Conversation_PinnedPreviousMessage
|
titleString = strings.Conversation_PinnedPreviousMessage
|
||||||
|
@ -259,11 +259,11 @@ struct ChatSlowmodeState: Equatable {
|
|||||||
|
|
||||||
final class ChatPinnedMessage: Equatable {
|
final class ChatPinnedMessage: Equatable {
|
||||||
let message: Message
|
let message: Message
|
||||||
let isLatest: Bool
|
let topMessageId: MessageId
|
||||||
|
|
||||||
init(message: Message, isLatest: Bool) {
|
init(message: Message, topMessageId: MessageId) {
|
||||||
self.message = message
|
self.message = message
|
||||||
self.isLatest = isLatest
|
self.topMessageId = topMessageId
|
||||||
}
|
}
|
||||||
|
|
||||||
static func ==(lhs: ChatPinnedMessage, rhs: ChatPinnedMessage) -> Bool {
|
static func ==(lhs: ChatPinnedMessage, rhs: ChatPinnedMessage) -> Bool {
|
||||||
@ -276,7 +276,7 @@ final class ChatPinnedMessage: Equatable {
|
|||||||
if lhs.message.stableVersion != rhs.message.stableVersion {
|
if lhs.message.stableVersion != rhs.message.stableVersion {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
if lhs.isLatest != rhs.isLatest {
|
if lhs.topMessageId != rhs.topMessageId {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
|
@ -1037,7 +1037,7 @@ struct ChatRecentActionsEntry: Comparable, Identifiable {
|
|||||||
return []
|
return []
|
||||||
}, to: &text, entities: &entities)
|
}, to: &text, entities: &entities)
|
||||||
|
|
||||||
let mediaMap = TelegramMediaMap(latitude: updated.latitude, longitude: updated.longitude, geoPlace: nil, venue: nil, liveBroadcastingTimeout: nil)
|
let mediaMap = TelegramMediaMap(latitude: updated.latitude, longitude: updated.longitude, heading: nil, accuracyRadius: nil, geoPlace: nil, venue: nil, liveBroadcastingTimeout: nil)
|
||||||
|
|
||||||
let message = Message(stableId: self.entry.stableId, stableVersion: 0, id: MessageId(peerId: peer.id, namespace: Namespaces.Message.Cloud, id: Int32(bitPattern: self.entry.stableId)), globallyUniqueId: self.entry.event.id, groupingKey: nil, groupInfo: nil, threadId: nil, timestamp: self.entry.event.date, flags: [.Incoming], tags: [], globalTags: [], localTags: [], forwardInfo: nil, author: author, text: text, attributes: [], media: [mediaMap], peers: peers, associatedMessages: SimpleDictionary(), associatedMessageIds: [])
|
let message = Message(stableId: self.entry.stableId, stableVersion: 0, id: MessageId(peerId: peer.id, namespace: Namespaces.Message.Cloud, id: Int32(bitPattern: self.entry.stableId)), globallyUniqueId: self.entry.event.id, groupingKey: nil, groupInfo: nil, threadId: nil, timestamp: self.entry.event.date, flags: [.Incoming], tags: [], globalTags: [], localTags: [], forwardInfo: nil, author: author, text: text, attributes: [], media: [mediaMap], peers: peers, associatedMessages: SimpleDictionary(), associatedMessageIds: [])
|
||||||
return ChatMessageItem(presentationData: self.presentationData, context: context, chatLocation: .peer(peer.id), associatedData: ChatMessageItemAssociatedData(automaticDownloadPeerType: .channel, automaticDownloadNetworkType: .cellular, isRecentActions: true), controllerInteraction: controllerInteraction, content: .message(message: message, read: true, selection: .none, attributes: ChatMessageEntryAttributes()))
|
return ChatMessageItem(presentationData: self.presentationData, context: context, chatLocation: .peer(peer.id), associatedData: ChatMessageItemAssociatedData(automaticDownloadPeerType: .channel, automaticDownloadNetworkType: .cellular, isRecentActions: true), controllerInteraction: controllerInteraction, content: .message(message: message, read: true, selection: .none, attributes: ChatMessageEntryAttributes()))
|
||||||
|
@ -82,7 +82,7 @@ func openChatMessageImpl(_ params: OpenChatMessageParams) -> Bool {
|
|||||||
let controller = legacyLocationController(message: params.message, mapMedia: mapMedia, context: params.context, openPeer: { peer in
|
let controller = legacyLocationController(message: params.message, mapMedia: mapMedia, context: params.context, openPeer: { peer in
|
||||||
params.openPeer(peer, .info)
|
params.openPeer(peer, .info)
|
||||||
}, sendLiveLocation: { coordinate, period in
|
}, sendLiveLocation: { coordinate, period in
|
||||||
let outMessage: EnqueueMessage = .message(text: "", attributes: [], mediaReference: .standalone(media: TelegramMediaMap(latitude: coordinate.latitude, longitude: coordinate.longitude, geoPlace: nil, venue: nil, liveBroadcastingTimeout: period)), replyToMessageId: nil, localGroupingKey: nil)
|
let outMessage: EnqueueMessage = .message(text: "", attributes: [], mediaReference: .standalone(media: TelegramMediaMap(latitude: coordinate.latitude, longitude: coordinate.longitude, heading: nil, accuracyRadius: nil, geoPlace: nil, venue: nil, liveBroadcastingTimeout: period)), replyToMessageId: nil, localGroupingKey: nil)
|
||||||
params.enqueueMessage(outMessage)
|
params.enqueueMessage(outMessage)
|
||||||
}, stopLiveLocation: {
|
}, stopLiveLocation: {
|
||||||
params.context.liveLocationManager?.cancelLiveLocation(peerId: params.message.id.peerId)
|
params.context.liveLocationManager?.cancelLiveLocation(peerId: params.message.id.peerId)
|
||||||
|
@ -3641,7 +3641,7 @@ private final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewD
|
|||||||
}
|
}
|
||||||
let context = self.context
|
let context = self.context
|
||||||
let presentationData = self.presentationData
|
let presentationData = self.presentationData
|
||||||
let mapMedia = TelegramMediaMap(latitude: location.latitude, longitude: location.longitude, geoPlace: nil, venue: MapVenue(title: peer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder), address: location.address, provider: nil, id: nil, type: nil), liveBroadcastingTimeout: nil)
|
let mapMedia = TelegramMediaMap(latitude: location.latitude, longitude: location.longitude, heading: nil, accuracyRadius: nil, geoPlace: nil, venue: MapVenue(title: peer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder), address: location.address, provider: nil, id: nil, type: nil), liveBroadcastingTimeout: nil)
|
||||||
let locationController = legacyLocationController(message: nil, mapMedia: mapMedia, context: context, openPeer: { _ in }, sendLiveLocation: { _, _ in }, stopLiveLocation: {}, openUrl: { url in
|
let locationController = legacyLocationController(message: nil, mapMedia: mapMedia, context: context, openPeer: { _ in }, sendLiveLocation: { _, _ in }, stopLiveLocation: {}, openUrl: { url in
|
||||||
context.sharedContext.applicationBindings.openUrl(url)
|
context.sharedContext.applicationBindings.openUrl(url)
|
||||||
})
|
})
|
||||||
|
@ -203,7 +203,7 @@ final class WatchSendMessageHandler: WatchRequestHandler {
|
|||||||
messageSignal = .single((.message(text: args.text, attributes: [], mediaReference: nil, replyToMessageId: replyMessageId, localGroupingKey: nil), peerId))
|
messageSignal = .single((.message(text: args.text, attributes: [], mediaReference: nil, replyToMessageId: replyMessageId, localGroupingKey: nil), peerId))
|
||||||
} else if let args = subscription as? TGBridgeSendLocationMessageSubscription, let location = args.location {
|
} else if let args = subscription as? TGBridgeSendLocationMessageSubscription, let location = args.location {
|
||||||
let peerId = makePeerIdFromBridgeIdentifier(args.peerId)
|
let peerId = makePeerIdFromBridgeIdentifier(args.peerId)
|
||||||
let map = TelegramMediaMap(latitude: location.latitude, longitude: location.longitude, geoPlace: nil, venue: makeVenue(from: location.venue), liveBroadcastingTimeout: nil)
|
let map = TelegramMediaMap(latitude: location.latitude, longitude: location.longitude, heading: nil, accuracyRadius: nil, geoPlace: nil, venue: makeVenue(from: location.venue), liveBroadcastingTimeout: nil)
|
||||||
messageSignal = .single((.message(text: "", attributes: [], mediaReference: .standalone(media: map), replyToMessageId: nil, localGroupingKey: nil), peerId))
|
messageSignal = .single((.message(text: "", attributes: [], mediaReference: .standalone(media: map), replyToMessageId: nil, localGroupingKey: nil), peerId))
|
||||||
} else if let args = subscription as? TGBridgeSendStickerMessageSubscription {
|
} else if let args = subscription as? TGBridgeSendStickerMessageSubscription {
|
||||||
let peerId = makePeerIdFromBridgeIdentifier(args.peerId)
|
let peerId = makePeerIdFromBridgeIdentifier(args.peerId)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user