From 70ebab5a6859e3031e6324d52bb0396d3bd8c4a0 Mon Sep 17 00:00:00 2001 From: Peter <> Date: Mon, 28 Jan 2019 14:04:03 +0400 Subject: [PATCH] Temporary changes --- NotificationService/Info.plist | 6 +- NotificationService/MiniAccount.swift | 6 - .../NotificationService-AppStore.entitlements | 10 + ...tificationService-AppStoreLLC.entitlements | 10 + .../NotificationService-Fork.entitlements | 10 + ...otificationService-HockeyApp.entitlements} | 0 NotificationService/NotificationService.swift | 212 +----- Telegram-iOS.xcodeproj/project.pbxproj | 664 +++++++++++++++++- Telegram-iOS/AppDelegate.swift | 6 +- Telegram-iOS/ApplicationContext.swift | 1 - Telegram-iOS/WakeupManager.swift | 42 +- 11 files changed, 720 insertions(+), 247 deletions(-) delete mode 100644 NotificationService/MiniAccount.swift create mode 100644 NotificationService/NotificationService-AppStore.entitlements create mode 100644 NotificationService/NotificationService-AppStoreLLC.entitlements create mode 100644 NotificationService/NotificationService-Fork.entitlements rename NotificationService/{NotificationService.entitlements => NotificationService-HockeyApp.entitlements} (100%) diff --git a/NotificationService/Info.plist b/NotificationService/Info.plist index cb1c2bad9b..1d4d66d4fd 100644 --- a/NotificationService/Info.plist +++ b/NotificationService/Info.plist @@ -3,7 +3,7 @@ CFBundleDevelopmentRegion - en + $(DEVELOPMENT_LANGUAGE) CFBundleDisplayName NotificationService CFBundleExecutable @@ -19,13 +19,13 @@ CFBundleShortVersionString 1.0 CFBundleVersion - 55 + 1 NSExtension NSExtensionPointIdentifier com.apple.usernotifications.service NSExtensionPrincipalClass - NotificationService + $(PRODUCT_MODULE_NAME).NotificationService diff --git a/NotificationService/MiniAccount.swift b/NotificationService/MiniAccount.swift deleted file mode 100644 index 191ab4f280..0000000000 --- a/NotificationService/MiniAccount.swift +++ /dev/null @@ -1,6 +0,0 @@ -import Foundation -import Postbox -import SwiftSignalKit -import MtProtoKitDynamic - - diff --git a/NotificationService/NotificationService-AppStore.entitlements b/NotificationService/NotificationService-AppStore.entitlements new file mode 100644 index 0000000000..5e963c4f0f --- /dev/null +++ b/NotificationService/NotificationService-AppStore.entitlements @@ -0,0 +1,10 @@ + + + + + com.apple.security.application-groups + + group.org.telegram.TelegramHD + + + diff --git a/NotificationService/NotificationService-AppStoreLLC.entitlements b/NotificationService/NotificationService-AppStoreLLC.entitlements new file mode 100644 index 0000000000..c9a9054223 --- /dev/null +++ b/NotificationService/NotificationService-AppStoreLLC.entitlements @@ -0,0 +1,10 @@ + + + + + com.apple.security.application-groups + + group.ph.telegra.Telegraph + + + diff --git a/NotificationService/NotificationService-Fork.entitlements b/NotificationService/NotificationService-Fork.entitlements new file mode 100644 index 0000000000..eb39a047f1 --- /dev/null +++ b/NotificationService/NotificationService-Fork.entitlements @@ -0,0 +1,10 @@ + + + + + com.apple.security.application-groups + + group.fork.telegram.Telegram-iOS + + + diff --git a/NotificationService/NotificationService.entitlements b/NotificationService/NotificationService-HockeyApp.entitlements similarity index 100% rename from NotificationService/NotificationService.entitlements rename to NotificationService/NotificationService-HockeyApp.entitlements diff --git a/NotificationService/NotificationService.swift b/NotificationService/NotificationService.swift index af1f28f21c..b31f25c7b1 100644 --- a/NotificationService/NotificationService.swift +++ b/NotificationService/NotificationService.swift @@ -1,212 +1,26 @@ import UserNotifications -import Postbox -import SwiftSignalKit -import TelegramCore -private func reportMemory() { - // constant - let MACH_TASK_BASIC_INFO_COUNT = (MemoryLayout.size / MemoryLayout.size) - - // prepare parameters - let name = mach_task_self_ - let flavor = task_flavor_t(MACH_TASK_BASIC_INFO) - var size = mach_msg_type_number_t(MACH_TASK_BASIC_INFO_COUNT) - - // allocate pointer to mach_task_basic_info - let infoPointer = UnsafeMutablePointer.allocate(capacity: 1) - - // call task_info - note extra UnsafeMutablePointer(...) call - let kerr = infoPointer.withMemoryRebound(to: Int32.self, capacity: 1, { pointer in - return task_info(name, flavor, pointer, &size) - }) - - // get mach_task_basic_info struct out of pointer - let info = infoPointer.move() - - // deallocate pointer - infoPointer.deallocate(capacity: 1) - - // check return value for success / failure - if kerr == KERN_SUCCESS { - NSLog("Memory in use (in MB): \(info.resident_size/1000000)") - } -} - -private struct ResolvedNotificationContent { - let text: String - let attachment: UNNotificationAttachment? -} - -@objc(NotificationService) class NotificationService: UNNotificationServiceExtension { - private let disposable = MetaDisposable() + var contentHandler: ((UNNotificationContent) -> Void)? + var bestAttemptContent: UNMutableNotificationContent? - private var bestEffortContent: UNMutableNotificationContent? - private var currentContentHandler: ((UNNotificationContent) -> Void)? - - var timer: SwiftSignalKit.Timer? - - deinit { - self.disposable.dispose() + override init() { + super.init() } - + override func didReceive(_ request: UNNotificationRequest, withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void) { - contentHandler(request.content) + self.contentHandler = contentHandler + self.bestAttemptContent = request.content.mutableCopy() as? UNMutableNotificationContent - /*self.timer?.invalidate() - - reportMemory() - - self.timer = SwiftSignalKit.Timer(timeout: 0.01, repeat: true, completion: { - reportMemory() - }, queue: Queue.mainQueue()) - self.timer?.start() - - NSLog("before api") - reportMemory() - let a = TelegramCore.Api.User.userEmpty(id: 1) - NSLog("after api \(a)") - reportMemory() - - - - if let content = request.content.mutableCopy() as? UNMutableNotificationContent { - var peerId: PeerId? - if let fromId = request.content.userInfo["from_id"] { - var idValue: Int32? - if let id = fromId as? NSNumber { - idValue = Int32(id.intValue) - } else if let id = fromId as? NSString { - idValue = id.intValue - } - if let idValue = idValue { - if idValue > 0 { - peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: idValue) - } else { - - } - } - } else if let fromId = request.content.userInfo["chat_id"] { - var idValue: Int32? - if let id = fromId as? NSNumber { - idValue = Int32(id.intValue) - } else if let id = fromId as? NSString { - idValue = id.intValue - } - if let idValue = idValue { - if idValue > 0 { - peerId = PeerId(namespace: Namespaces.Peer.CloudGroup, id: idValue) - } - } - } else if let fromId = request.content.userInfo["channel_id"] { - var idValue: Int32? - if let id = fromId as? NSNumber { - idValue = Int32(id.intValue) - } else if let id = fromId as? NSString { - idValue = id.intValue - } - if let idValue = idValue { - if idValue > 0 { - peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: idValue) - } - } - } - - var messageId: MessageId? - if let peerId = peerId, let mid = request.content.userInfo["msg_id"] { - var idValue: Int32? - if let id = mid as? NSNumber { - idValue = Int32(id.intValue) - } else if let id = mid as? NSString { - idValue = id.intValue - } - - if let idValue = idValue { - messageId = MessageId(peerId: peerId, namespace: Namespaces.Message.Cloud, id: idValue) - } - } - - content.body = "[timeout] \(messageId) \(content.body)" - - self.bestEffortContent = content - self.currentContentHandler = contentHandler - - var signal: Signal = .complete() - if let messageId = messageId { - let appBundleIdentifier = Bundle.main.bundleIdentifier! - guard let lastDotRange = appBundleIdentifier.range(of: ".", options: [.backwards]) else { - return - } - - let appGroupName = "group.\(appBundleIdentifier.substring(to: lastDotRange.lowerBound))" - let maybeAppGroupUrl = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: appGroupName) - - guard let appGroupUrl = maybeAppGroupUrl else { - return - } - - let authorizedAccount = accountWithId(currentAccountId(appGroupPath: appGroupUrl.path), appGroupPath: appGroupUrl.path) |> mapToSignal { account -> Signal in - switch account { - case .left: - return .complete() - case let .right(authorizedAccount): - return .single(authorizedAccount) - } - } - - - signal = (authorizedAccount - |> take(1) - |> mapToSignal { account -> Signal in - setupAccount(account) - return downloadMessage(account: account, message: messageId) - } - |> mapToSignal { message -> Signal in - Queue.mainQueue().async { - content.body = "[timeout5] \(message) \(content.body)" - contentHandler(content) - } - - if let message = message { - return .single(ResolvedNotificationContent(text: "R " + message.text, attachment: nil)) - } else { - return .complete() - } - } - |> deliverOnMainQueue - |> mapToSignal { [weak self] resolvedContent -> Signal in - if let strongSelf = self, let resolvedContent = resolvedContent { - content.body = resolvedContent.text - if let attachment = resolvedContent.attachment { - content.attachments = [attachment] - } - contentHandler(content) - strongSelf.bestEffortContent = nil - } - return .complete() - }) - |> afterDisposed { [weak self] in - Queue.mainQueue().async { - if let strongSelf = self { - if let bestEffortContent = strongSelf.bestEffortContent { - contentHandler(bestEffortContent) - } - } - } - } - } - - self.disposable.set(signal.start()) - } else { - contentHandler(request.content) - }*/ + if let bestAttemptContent = self.bestAttemptContent { + bestAttemptContent.title = "\(bestAttemptContent.title) [modified]" + contentHandler(bestAttemptContent) + } } override func serviceExtensionTimeWillExpire() { - self.disposable.dispose() - - if let currentContentHandler = self.currentContentHandler, let bestEffortContent = self.bestEffortContent { - currentContentHandler(bestEffortContent) + if let contentHandler = self.contentHandler, let bestAttemptContent = self.bestAttemptContent { + contentHandler(bestAttemptContent) } } } diff --git a/Telegram-iOS.xcodeproj/project.pbxproj b/Telegram-iOS.xcodeproj/project.pbxproj index da8c66d127..47e842ce6d 100644 --- a/Telegram-iOS.xcodeproj/project.pbxproj +++ b/Telegram-iOS.xcodeproj/project.pbxproj @@ -213,6 +213,8 @@ 09D304382174344900C00567 /* TGBridgeWebPageMediaAttachment.m in Sources */ = {isa = PBXBuildFile; fileRef = 09C572F52172953500BDF00F /* TGBridgeWebPageMediaAttachment.m */; }; 09D304392174344900C00567 /* TGBridgeMessageEntities.m in Sources */ = {isa = PBXBuildFile; fileRef = 09C572F42172953500BDF00F /* TGBridgeMessageEntities.m */; }; 09FDAEE62140477F00BF856F /* MtProtoKitDynamic.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 09FDAEE52140477F00BF856F /* MtProtoKitDynamic.framework */; }; + D000CACB21FB6E380011B15D /* NotificationService.swift in Sources */ = {isa = PBXBuildFile; fileRef = D000CACA21FB6E380011B15D /* NotificationService.swift */; }; + D000CACF21FB6E380011B15D /* NotificationService.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = D000CAC821FB6E370011B15D /* NotificationService.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; D001D5AA1F878DA300DF975A /* PhoneCountries.txt in Resources */ = {isa = PBXBuildFile; fileRef = D001D5A91F878DA300DF975A /* PhoneCountries.txt */; }; D006CF9F21A8D11B00FDCD32 /* ModernProto.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D006CF9E21A8D11B00FDCD32 /* ModernProto.framework */; }; D006CFA021A8D11B00FDCD32 /* ModernProto.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = D006CF9E21A8D11B00FDCD32 /* ModernProto.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; @@ -436,6 +438,13 @@ remoteGlobalIDString = 09C56F8A2172797200BDF00F; remoteInfo = Watch; }; + D000CACD21FB6E380011B15D /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = D00859941B28189D00EAF753 /* Project object */; + proxyType = 1; + remoteGlobalIDString = D000CAC721FB6E370011B15D; + remoteInfo = NotificationService; + }; D00859B21B28189D00EAF753 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = D00859941B28189D00EAF753 /* Project object */; @@ -530,6 +539,7 @@ dstSubfolderSpec = 13; files = ( D03B0E821D63484500955575 /* Share.appex in Embed App Extensions */, + D000CACF21FB6E380011B15D /* NotificationService.appex in Embed App Extensions */, D0B2F742204F4C9900D3BFB9 /* Widget.appex in Embed App Extensions */, D0D2688E1D79A70B00C422DA /* SiriIntents.appex in Embed App Extensions */, D02CF608215D9ABF00E0F56A /* NotificationContent.appex in Embed App Extensions */, @@ -884,6 +894,13 @@ 09CFB211217299E80083F7A3 /* CoreLocation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreLocation.framework; path = Platforms/WatchOS.platform/Developer/SDKs/WatchOS5.0.sdk/System/Library/Frameworks/CoreLocation.framework; sourceTree = DEVELOPER_DIR; }; 09D304212174335F00C00567 /* WatchBridge.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WatchBridge.swift; sourceTree = ""; }; 09FDAEE52140477F00BF856F /* MtProtoKitDynamic.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = MtProtoKitDynamic.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + D000CAC021FB6E160011B15D /* NotificationService-HockeyApp.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = "NotificationService-HockeyApp.entitlements"; sourceTree = ""; }; + D000CAC121FB6E160011B15D /* NotificationService-Fork.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = "NotificationService-Fork.entitlements"; sourceTree = ""; }; + D000CAC221FB6E170011B15D /* NotificationService-AppStore.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = "NotificationService-AppStore.entitlements"; sourceTree = ""; }; + D000CAC321FB6E170011B15D /* NotificationService-AppStoreLLC.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = "NotificationService-AppStoreLLC.entitlements"; sourceTree = ""; }; + D000CAC821FB6E370011B15D /* NotificationService.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = NotificationService.appex; sourceTree = BUILT_PRODUCTS_DIR; }; + D000CACA21FB6E380011B15D /* NotificationService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationService.swift; sourceTree = ""; }; + D000CACC21FB6E380011B15D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; D001D5A91F878DA300DF975A /* PhoneCountries.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = PhoneCountries.txt; path = "Telegram-iOS/Resources/PhoneCountries.txt"; sourceTree = ""; }; D006CF9E21A8D11B00FDCD32 /* ModernProto.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = ModernProto.framework; sourceTree = BUILT_PRODUCTS_DIR; }; D006CFA121A8D12600FDCD32 /* ModernProto.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ModernProto.framework; path = "../../../Library/Developer/Xcode/DerivedData/Telegram-iOS-ffbqcdyqpehxdvcwhyaorlehrrdc/Build/Products/Debug Hockeyapp-iphoneos/ModernProto.framework"; sourceTree = ""; }; @@ -933,7 +950,6 @@ D0400ED81D5B8F97007931CE /* TelegramUI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = TelegramUI.framework; sourceTree = BUILT_PRODUCTS_DIR; }; D0400EE41D5B912E007931CE /* NotificationService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationService.swift; sourceTree = ""; }; D0400EE61D5B912E007931CE /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - D0400EEE1D5B9540007931CE /* NotificationService.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = NotificationService.entitlements; sourceTree = ""; }; D04DCC0B1F71C80000B021D7 /* 0.m4a */ = {isa = PBXFileReference; lastKnownFileType = file; path = 0.m4a; sourceTree = ""; }; D04DCC0C1F71C80000B021D7 /* 1.m4a */ = {isa = PBXFileReference; lastKnownFileType = file; path = 1.m4a; sourceTree = ""; }; D04DCC0D1F71C80000B021D7 /* 100.m4a */ = {isa = PBXFileReference; lastKnownFileType = file; path = 100.m4a; sourceTree = ""; }; @@ -1052,7 +1068,6 @@ D0AA1A691D568BA400152314 /* UserNotificationsUI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UserNotificationsUI.framework; path = System/Library/Frameworks/UserNotificationsUI.framework; sourceTree = SDKROOT; }; D0AB0B9F1D6708B9002C78E7 /* Postbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Postbox.framework; path = "submodules/Postbox/build/Debug-iphoneos/Postbox.framework"; sourceTree = ""; }; D0AB0BA01D6708B9002C78E7 /* TelegramCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = TelegramCore.framework; path = /TelegramCore.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - D0AC49461D7095A100AA55DA /* MiniAccount.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MiniAccount.swift; sourceTree = ""; }; D0ADF913212B398000310BBC /* Telegram-iOS-AppStoreLLC.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = "Telegram-iOS-AppStoreLLC.entitlements"; sourceTree = ""; }; D0ADF914212B399A00310BBC /* Config-AppStoreLLC.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Config-AppStoreLLC.xcconfig"; sourceTree = ""; }; D0ADF953212B3B4700310BBC /* Share-AppStoreLLC.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = "Share-AppStoreLLC.entitlements"; sourceTree = ""; }; @@ -1166,6 +1181,13 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + D000CAC521FB6E370011B15D /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; D00859991B28189D00EAF753 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; @@ -1877,6 +1899,15 @@ name = Media; sourceTree = ""; }; + D000CAC921FB6E380011B15D /* NotificationService */ = { + isa = PBXGroup; + children = ( + D000CACA21FB6E380011B15D /* NotificationService.swift */, + D000CACC21FB6E380011B15D /* Info.plist */, + ); + path = NotificationService; + sourceTree = ""; + }; D00859931B28189D00EAF753 = { isa = PBXGroup; children = ( @@ -1888,6 +1919,7 @@ D0D268821D79A70A00C422DA /* SiriIntentsUI */, D02CF5FF215D9ABF00E0F56A /* NotificationContent */, 09C56F8C2172797200BDF00F /* Watch */, + D000CAC921FB6E380011B15D /* NotificationService */, D00859C21B281E0000EAF753 /* Frameworks */, D008599E1B28189D00EAF753 /* Telegram-iOS */, D0400EE31D5B912E007931CE /* NotificationService */, @@ -1910,6 +1942,7 @@ D02CF5FC215D9ABE00E0F56A /* NotificationContent.appex */, 09C56F8B2172797200BDF00F /* Watch.app */, 09C56F972172797400BDF00F /* Watch Extension.appex */, + D000CAC821FB6E370011B15D /* NotificationService.appex */, ); name = Products; sourceTree = ""; @@ -2113,10 +2146,12 @@ D0400EE31D5B912E007931CE /* NotificationService */ = { isa = PBXGroup; children = ( - D0400EEE1D5B9540007931CE /* NotificationService.entitlements */, + D000CAC221FB6E170011B15D /* NotificationService-AppStore.entitlements */, + D000CAC321FB6E170011B15D /* NotificationService-AppStoreLLC.entitlements */, + D000CAC121FB6E160011B15D /* NotificationService-Fork.entitlements */, + D000CAC021FB6E160011B15D /* NotificationService-HockeyApp.entitlements */, D0400EE41D5B912E007931CE /* NotificationService.swift */, D0400EE61D5B912E007931CE /* Info.plist */, - D0AC49461D7095A100AA55DA /* MiniAccount.swift */, ); path = NotificationService; sourceTree = ""; @@ -2491,6 +2526,23 @@ productReference = 09C56F972172797400BDF00F /* Watch Extension.appex */; productType = "com.apple.product-type.watchkit2-extension"; }; + D000CAC721FB6E370011B15D /* NotificationService */ = { + isa = PBXNativeTarget; + buildConfigurationList = D000CAD021FB6E380011B15D /* Build configuration list for PBXNativeTarget "NotificationService" */; + buildPhases = ( + D000CAC421FB6E370011B15D /* Sources */, + D000CAC521FB6E370011B15D /* Frameworks */, + D000CAC621FB6E370011B15D /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = NotificationService; + productName = NotificationService; + productReference = D000CAC821FB6E370011B15D /* NotificationService.appex */; + productType = "com.apple.product-type.app-extension"; + }; D008599B1B28189D00EAF753 /* Telegram-iOS */ = { isa = PBXNativeTarget; buildConfigurationList = D00859BB1B28189D00EAF753 /* Build configuration list for PBXNativeTarget "Telegram-iOS" */; @@ -2510,6 +2562,7 @@ D0B2F741204F4C9900D3BFB9 /* PBXTargetDependency */, D02CF607215D9ABF00E0F56A /* PBXTargetDependency */, 09C56FA42172797500BDF00F /* PBXTargetDependency */, + D000CACE21FB6E380011B15D /* PBXTargetDependency */, ); name = "Telegram-iOS"; productName = "Telegram-iOS"; @@ -2628,7 +2681,7 @@ attributes = { DefaultBuildSystemTypeForWorkspace = Latest; LastSwiftMigration = 0700; - LastSwiftUpdateCheck = 1000; + LastSwiftUpdateCheck = 1010; LastUpgradeCheck = 0820; ORGANIZATIONNAME = Telegram; TargetAttributes = { @@ -2642,6 +2695,11 @@ DevelopmentTeam = X834Q8SBVP; ProvisioningStyle = Manual; }; + D000CAC721FB6E370011B15D = { + CreatedOnToolsVersion = 10.1; + DevelopmentTeam = X834Q8SBVP; + ProvisioningStyle = Manual; + }; D008599B1B28189D00EAF753 = { CreatedOnToolsVersion = 6.3.1; DevelopmentTeam = X834Q8SBVP; @@ -2746,6 +2804,7 @@ D02CF5FB215D9ABE00E0F56A /* NotificationContent */, 09C56F8A2172797200BDF00F /* Watch */, 09C56F962172797400BDF00F /* Watch Extension */, + D000CAC721FB6E370011B15D /* NotificationService */, ); }; /* End PBXProject section */ @@ -2776,6 +2835,13 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + D000CAC621FB6E370011B15D /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; D008599A1B28189D00EAF753 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; @@ -3102,6 +3168,14 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + D000CAC421FB6E370011B15D /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + D000CACB21FB6E380011B15D /* NotificationService.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; D00859981B28189D00EAF753 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -3240,6 +3314,11 @@ target = 09C56F8A2172797200BDF00F /* Watch */; targetProxy = 09C56FA32172797500BDF00F /* PBXContainerItemProxy */; }; + D000CACE21FB6E380011B15D /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = D000CAC721FB6E370011B15D /* NotificationService */; + targetProxy = D000CACD21FB6E380011B15D /* PBXContainerItemProxy */; + }; D00859B31B28189D00EAF753 /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = D008599B1B28189D00EAF753 /* Telegram-iOS */; @@ -4619,6 +4698,562 @@ }; name = ReleaseHockeyappInternal; }; + D000CAD121FB6E380011B15D /* DebugHockeyapp */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_ENTITLEMENTS = "NotificationService/NotificationService-Hockeyapp.entitlements"; + CODE_SIGN_IDENTITY = "iPhone Developer"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + CODE_SIGN_STYLE = Manual; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + DEVELOPMENT_TEAM = X834Q8SBVP; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + INFOPLIST_FILE = NotificationService/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 10.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + PRODUCT_BUNDLE_IDENTIFIER = "$(APP_BUNDLE_ID).NotificationService"; + PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = "match Development org.telegram.Telegram-iOS.NotificationService"; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 4.2; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = DebugHockeyapp; + }; + D000CAD221FB6E380011B15D /* DebugFork */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_ENTITLEMENTS = "NotificationService/NotificationService-Fork.entitlements"; + CODE_SIGN_IDENTITY = "iPhone Developer"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + CODE_SIGN_STYLE = Manual; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + DEVELOPMENT_TEAM = ""; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + INFOPLIST_FILE = NotificationService/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 10.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + PRODUCT_BUNDLE_IDENTIFIER = "$(APP_BUNDLE_ID).NotificationService"; + PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = ""; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 4.2; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = DebugFork; + }; + D000CAD321FB6E380011B15D /* DebugAppStore */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_ENTITLEMENTS = "NotificationService/NotificationService-AppStore.entitlements"; + CODE_SIGN_IDENTITY = "iPhone Developer"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + CODE_SIGN_STYLE = Manual; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + DEVELOPMENT_TEAM = ""; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + INFOPLIST_FILE = NotificationService/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 10.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + PRODUCT_BUNDLE_IDENTIFIER = "$(APP_BUNDLE_ID).NotificationService"; + PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = ""; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 4.2; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = DebugAppStore; + }; + D000CAD421FB6E380011B15D /* DebugAppStoreLLC */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_ENTITLEMENTS = "NotificationService/NotificationService-AppStoreLLC.entitlements"; + CODE_SIGN_IDENTITY = "iPhone Developer"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + CODE_SIGN_STYLE = Manual; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + DEVELOPMENT_TEAM = C67CF9S4VU; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + INFOPLIST_FILE = NotificationService/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 10.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + PRODUCT_BUNDLE_IDENTIFIER = "$(APP_BUNDLE_ID).NotificationService"; + PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = "match Development ph.telegra.Telegraph.NotificationService"; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 4.2; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = DebugAppStoreLLC; + }; + D000CAD521FB6E380011B15D /* ReleaseAppStore */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_ENTITLEMENTS = "NotificationService/NotificationService-AppStore.entitlements"; + CODE_SIGN_IDENTITY = "iPhone Distribution: TELEGRAM MESSENGER LLP (6N38VWS5BX)"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution: TELEGRAM MESSENGER LLP (6N38VWS5BX)"; + CODE_SIGN_STYLE = Manual; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + DEVELOPMENT_TEAM = 6N38VWS5BX; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + INFOPLIST_FILE = NotificationService/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 10.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + PRODUCT_BUNDLE_IDENTIFIER = "$(APP_BUNDLE_ID).NotificationService"; + PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = "match AppStore org.telegram.TelegramHD.NotificationService"; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_VERSION = 4.2; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = ReleaseAppStore; + }; + D000CAD621FB6E380011B15D /* ReleaseAppStoreLLC */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_ENTITLEMENTS = "NotificationService/NotificationService-AppStoreLLC.entitlements"; + CODE_SIGN_IDENTITY = "iPhone Distribution: Digital Fortress LLC (C67CF9S4VU)"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution: Digital Fortress LLC (C67CF9S4VU)"; + CODE_SIGN_STYLE = Manual; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + DEVELOPMENT_TEAM = C67CF9S4VU; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + INFOPLIST_FILE = NotificationService/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 10.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + PRODUCT_BUNDLE_IDENTIFIER = "$(APP_BUNDLE_ID).NotificationService"; + PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = "match AppStore ph.telegra.Telegraph.NotificationService"; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_VERSION = 4.2; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = ReleaseAppStoreLLC; + }; + D000CAD721FB6E380011B15D /* ReleaseHockeyapp */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_ENTITLEMENTS = "NotificationService/NotificationService-Hockeyapp.entitlements"; + CODE_SIGN_IDENTITY = "iPhone Distribution: TELEGRAM MESSENGER LLP"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution: TELEGRAM MESSENGER LLP"; + CODE_SIGN_STYLE = Manual; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + DEVELOPMENT_TEAM = X834Q8SBVP; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + INFOPLIST_FILE = NotificationService/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 10.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + PRODUCT_BUNDLE_IDENTIFIER = "$(APP_BUNDLE_ID).NotificationService"; + PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = "match InHouse org.telegram.Telegram-iOS.NotificationService"; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_VERSION = 4.2; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = ReleaseHockeyapp; + }; + D000CAD821FB6E380011B15D /* ReleaseHockeyappInternal */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_ENTITLEMENTS = "NotificationService/NotificationService-Hockeyapp.entitlements"; + CODE_SIGN_IDENTITY = "iPhone Distribution: TELEGRAM MESSENGER LLP"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution: TELEGRAM MESSENGER LLP"; + CODE_SIGN_STYLE = Manual; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + DEVELOPMENT_TEAM = X834Q8SBVP; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + INFOPLIST_FILE = NotificationService/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 10.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + PRODUCT_BUNDLE_IDENTIFIER = "$(APP_BUNDLE_ID).NotificationService"; + PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = "match InHouse org.telegram.Telegram-iOS.NotificationService"; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_VERSION = 4.2; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = ReleaseHockeyappInternal; + }; D00859B91B28189D00EAF753 /* DebugHockeyapp */ = { isa = XCBuildConfiguration; baseConfigurationReference = D079FD011F06BBD60038FADE /* Config-Hockeyapp.xcconfig */; @@ -6763,8 +7398,8 @@ CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CODE_SIGN_ENTITLEMENTS = "Widget/Widget-AppStore.entitlements"; - CODE_SIGN_IDENTITY = "iPhone Developer: Peter Iakovlev (88P695A564)"; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer: Peter Iakovlev (88P695A564)"; + CODE_SIGN_IDENTITY = "iPhone Developer"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Manual; COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = dwarf; @@ -7847,6 +8482,21 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = ReleaseAppStore; }; + D000CAD021FB6E380011B15D /* Build configuration list for PBXNativeTarget "NotificationService" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + D000CAD121FB6E380011B15D /* DebugHockeyapp */, + D000CAD221FB6E380011B15D /* DebugFork */, + D000CAD321FB6E380011B15D /* DebugAppStore */, + D000CAD421FB6E380011B15D /* DebugAppStoreLLC */, + D000CAD521FB6E380011B15D /* ReleaseAppStore */, + D000CAD621FB6E380011B15D /* ReleaseAppStoreLLC */, + D000CAD721FB6E380011B15D /* ReleaseHockeyapp */, + D000CAD821FB6E380011B15D /* ReleaseHockeyappInternal */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = ReleaseAppStore; + }; D00859971B28189D00EAF753 /* Build configuration list for PBXProject "Telegram-iOS" */ = { isa = XCConfigurationList; buildConfigurations = ( diff --git a/Telegram-iOS/AppDelegate.swift b/Telegram-iOS/AppDelegate.swift index 61160a9e0c..d7ca449e83 100644 --- a/Telegram-iOS/AppDelegate.swift +++ b/Telegram-iOS/AppDelegate.swift @@ -1610,7 +1610,7 @@ private enum QueuedWakeup: Int32 { context.notificationManager.enqueueRemoteNotification(title: title, text: body, apnsSound: apnsSound, requestId: requestId, strings: strings, accessChallengeData: accessChallengeData) } - context.wakeupManager.wakeupForIncomingMessages(completion: { messageIds -> Signal in + context.wakeupManager.wakeupForIncomingMessages(account: context.context.account, completion: { messageIds -> Signal in if let contextValue = self.contextValue, case let .authorized(context) = contextValue { if handleVoipNotifications { return context.notificationManager.commitRemoteNotification(context: context.context, originalRequestId: requestId, messageIds: messageIds) @@ -1624,7 +1624,7 @@ private enum QueuedWakeup: Int32 { }) } if queuedMutePolling { - context.wakeupManager.wakeupForIncomingMessages(completion: { messageIds -> Signal in + context.wakeupManager.wakeupForIncomingMessages(account: context.context.account, completion: { messageIds -> Signal in if let contextValue = self.contextValue, case .authorized = contextValue { return .single(Void()) } else { @@ -1681,7 +1681,7 @@ private enum QueuedWakeup: Int32 { switch wakeup { case .call: if let contextValue = self.contextValue, case let .authorized(context) = contextValue { - context.wakeupManager.wakeupForIncomingMessages() + context.wakeupManager.wakeupForIncomingMessages(account: context.context.account) } case .backgroundLocation: if UIApplication.shared.applicationState == .background { diff --git a/Telegram-iOS/ApplicationContext.swift b/Telegram-iOS/ApplicationContext.swift index c8f9397c1c..f599a2e68a 100644 --- a/Telegram-iOS/ApplicationContext.swift +++ b/Telegram-iOS/ApplicationContext.swift @@ -237,7 +237,6 @@ final class AuthorizedApplicationContext { |> distinctUntilChanged self.wakeupManager = WakeupManager(inForeground: context.sharedContext.applicationBindings.applicationInForeground, runningServiceTasks: context.account.importantTasksRunning, runningBackgroundLocationTasks: runningBackgroundLocationTasks, runningWatchTasks: runningWatchTasksPromise.get(), runningDownloadTasks: runningDownloadTasks) - self.wakeupManager.account = context.account self.showCallsTab = showCallsTab diff --git a/Telegram-iOS/WakeupManager.swift b/Telegram-iOS/WakeupManager.swift index 8342e6f92e..5785ef6720 100644 --- a/Telegram-iOS/WakeupManager.swift +++ b/Telegram-iOS/WakeupManager.swift @@ -42,21 +42,11 @@ private struct CombinedRunningImportantTasks: Equatable { } return self.serviceTasks.isEmpty && !self.backgroundLocation && !hasWatchTask && !self.downloadTasks } - - static func ==(lhs: CombinedRunningImportantTasks, rhs: CombinedRunningImportantTasks) -> Bool { - return lhs.serviceTasks == rhs.serviceTasks && lhs.backgroundLocation == rhs.backgroundLocation && lhs.watchTasks == rhs.watchTasks && lhs.downloadTasks == rhs.downloadTasks - } } final class WakeupManager { private var state = WakeupManagerState() - var account: Account? { - didSet { - assert(Queue.mainQueue().isCurrent()) - } - } - private let isProcessingNotificationsValue = ValuePromise(false, ignoreRepeated: true) private let isProcessingServiceTasksValue = ValuePromise(false, ignoreRepeated: true) var isWokenUp: Signal { @@ -134,7 +124,7 @@ final class WakeupManager { self.wakeupDisposable.dispose() } - private func reportCompletionToSubscribersAndGetUnreadCount(maxId: Int32, messageIds: [MessageId]) -> Signal { + private func reportCompletionToSubscribersAndGetUnreadCount(account: Account, maxId: Int32, messageIds: [MessageId]) -> Signal { var collectedSignals: [Signal] = [] while !self.wakeupResultSubscribers.isEmpty { let first = self.wakeupResultSubscribers[0] @@ -144,18 +134,18 @@ final class WakeupManager { } } return combineLatest(collectedSignals) - |> map { _ -> Void in - return Void() - } |> mapToSignal { [weak self] _ -> Signal in - if let strongSelf = self, let account = strongSelf.account, !messageIds.isEmpty { - return account.postbox.transaction { transaction -> Int32? in - let (unreadCount, _) = renderedTotalUnreadCount(transaction: transaction) - return unreadCount - } - } else { - return .single(nil) + |> map { _ -> Void in + return Void() + } |> mapToSignal { _ -> Signal in + if !messageIds.isEmpty { + return account.postbox.transaction { transaction -> Int32? in + let (unreadCount, _) = renderedTotalUnreadCount(transaction: transaction) + return unreadCount } + } else { + return .single(nil) } + } } private func wakeupForServiceTasks(timeout: Double = 25.0) { @@ -223,12 +213,8 @@ final class WakeupManager { } } - func wakeupForIncomingMessages(timeout: Double = 25.0, completion: (([MessageId]) -> Signal)? = nil) { + func wakeupForIncomingMessages(account: Account, timeout: Double = 25.0, completion: (([MessageId]) -> Signal)? = nil) { assert(Queue.mainQueue().isCurrent()) - guard let account = self.account else { - return - } - var endTask: WakeupManagerTask? let updatedId: Int32 = self.state.nextTaskId self.state.nextTaskId += 1 @@ -245,7 +231,7 @@ final class WakeupManager { strongSelf.state.currentTask = nil currentTask.timer.invalidate() strongSelf.isProcessingNotificationsValue.set(false) - let _ = strongSelf.reportCompletionToSubscribersAndGetUnreadCount(maxId: updatedId, messageIds: []).start() + let _ = strongSelf.reportCompletionToSubscribersAndGetUnreadCount(account: account, maxId: updatedId, messageIds: []).start() UIApplication.shared.endBackgroundTask(currentTask.nativeId) } else { Logger.shared.log("WakeupManager", "handleExpiration(by timer: \(byTimer)) invoked, current task doesn't match") @@ -282,7 +268,7 @@ final class WakeupManager { self.wakeupDisposable.set((account.stateManager.pollStateUpdateCompletion() |> deliverOnMainQueue |> mapToSignal { [weak self] messageIds -> Signal in if let strongSelf = self { Logger.shared.log("WakeupManager", "pollStateUpdateCompletion messageIds: \(messageIds)") - return strongSelf.reportCompletionToSubscribersAndGetUnreadCount(maxId: updatedId, messageIds: messageIds) + return strongSelf.reportCompletionToSubscribersAndGetUnreadCount(account: account, maxId: updatedId, messageIds: messageIds) } else { return .complete() }