From deddf0dd0b696b5420ff164f10d515ffcadfc715 Mon Sep 17 00:00:00 2001 From: Peter <> Date: Fri, 10 May 2019 22:01:40 +0200 Subject: [PATCH] Updated project --- Telegram-iOS.xcodeproj/project.pbxproj | 30 ----------- Telegram-iOS/BuildConfig.m | 62 ++--------------------- Telegram-iOS/Config-AppStore.xcconfig | 1 - Telegram-iOS/LegacyDataImportSplash.swift | 13 +++-- Telegram-iOS/en.lproj/Localizable.strings | 5 +- submodules/TelegramUI | 2 +- 6 files changed, 17 insertions(+), 96 deletions(-) delete mode 100644 Telegram-iOS/Config-AppStore.xcconfig diff --git a/Telegram-iOS.xcodeproj/project.pbxproj b/Telegram-iOS.xcodeproj/project.pbxproj index b21490350b..710923bae2 100644 --- a/Telegram-iOS.xcodeproj/project.pbxproj +++ b/Telegram-iOS.xcodeproj/project.pbxproj @@ -1048,7 +1048,6 @@ D073E51F21FF7CE900742DDD /* Crypto.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Crypto.m; sourceTree = ""; }; D073E52122003E1E00742DDD /* Data.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Data.swift; sourceTree = ""; }; D079FD001F06BBD10038FADE /* Telegram-iOS-AppStore.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = "Telegram-iOS-AppStore.entitlements"; sourceTree = ""; }; - D079FD021F06BBD60038FADE /* Config-AppStore.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = "Config-AppStore.xcconfig"; sourceTree = ""; }; D084023120E1883500065674 /* ApplicationShortcutItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ApplicationShortcutItem.swift; sourceTree = ""; }; D08410431FABDC5B008FFE92 /* TGItemProviderSignals.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TGItemProviderSignals.h; sourceTree = ""; }; D08410441FABDC5C008FFE92 /* TGItemProviderSignals.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TGItemProviderSignals.m; sourceTree = ""; }; @@ -2136,7 +2135,6 @@ isa = PBXGroup; children = ( D0338734223A9A7E007A2CE4 /* Hockeyapp-Internal */, - D033872B223A835E007A2CE4 /* AppStore */, D033872A223A834F007A2CE4 /* AppStoreLLC */, ); name = Config; @@ -2150,14 +2148,6 @@ name = AppStoreLLC; sourceTree = ""; }; - D033872B223A835E007A2CE4 /* AppStore */ = { - isa = PBXGroup; - children = ( - D079FD021F06BBD60038FADE /* Config-AppStore.xcconfig */, - ); - name = AppStore; - sourceTree = ""; - }; D0338734223A9A7E007A2CE4 /* Hockeyapp-Internal */ = { isa = PBXGroup; children = ( @@ -3812,7 +3802,6 @@ }; 09C56FA72172797500BDF00F /* DebugAppStore */ = { isa = XCBuildConfiguration; - baseConfigurationReference = D079FD021F06BBD60038FADE /* Config-AppStore.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; @@ -3962,7 +3951,6 @@ }; 09C56FA92172797500BDF00F /* ReleaseAppStore */ = { isa = XCBuildConfiguration; - baseConfigurationReference = D079FD021F06BBD60038FADE /* Config-AppStore.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; @@ -4242,7 +4230,6 @@ }; 09C56FAE2172797500BDF00F /* DebugAppStore */ = { isa = XCBuildConfiguration; - baseConfigurationReference = D079FD021F06BBD60038FADE /* Config-AppStore.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; ASSETCATALOG_COMPILER_COMPLICATION_NAME = Complication; @@ -4394,7 +4381,6 @@ }; 09C56FB02172797500BDF00F /* ReleaseAppStore */ = { isa = XCBuildConfiguration; - baseConfigurationReference = D079FD021F06BBD60038FADE /* Config-AppStore.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; ASSETCATALOG_COMPILER_COMPLICATION_NAME = Complication; @@ -4753,7 +4739,6 @@ }; D000CAD321FB6E380011B15D /* DebugAppStore */ = { isa = XCBuildConfiguration; - baseConfigurationReference = D079FD021F06BBD60038FADE /* Config-AppStore.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; BUILD_NUMBER = 99999; @@ -4905,7 +4890,6 @@ }; D000CAD521FB6E380011B15D /* ReleaseAppStore */ = { isa = XCBuildConfiguration; - baseConfigurationReference = D079FD021F06BBD60038FADE /* Config-AppStore.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; BUILD_NUMBER = 99999; @@ -5164,7 +5148,6 @@ }; D00859BA1B28189D00EAF753 /* ReleaseAppStore */ = { isa = XCBuildConfiguration; - baseConfigurationReference = D079FD021F06BBD60038FADE /* Config-AppStore.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; BUILD_NUMBER = 9999; @@ -5250,7 +5233,6 @@ }; D00859BD1B28189D00EAF753 /* ReleaseAppStore */ = { isa = XCBuildConfiguration; - baseConfigurationReference = D079FD021F06BBD60038FADE /* Config-AppStore.xcconfig */; buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; @@ -5894,7 +5876,6 @@ }; D02CF60A215D9ABF00E0F56A /* DebugAppStore */ = { isa = XCBuildConfiguration; - baseConfigurationReference = D079FD021F06BBD60038FADE /* Config-AppStore.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; BUILD_NUMBER = 99999; @@ -6046,7 +6027,6 @@ }; D02CF60C215D9ABF00E0F56A /* ReleaseAppStore */ = { isa = XCBuildConfiguration; - baseConfigurationReference = D079FD021F06BBD60038FADE /* Config-AppStore.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; BUILD_NUMBER = 99999; @@ -6285,7 +6265,6 @@ }; D03B0E851D63484500955575 /* ReleaseAppStore */ = { isa = XCBuildConfiguration; - baseConfigurationReference = D079FD021F06BBD60038FADE /* Config-AppStore.xcconfig */; buildSettings = { BITCODE_GENERATION_MODE = bitcode; BUILD_NUMBER = 99999; @@ -6316,7 +6295,6 @@ }; D079FCF91F06BBA40038FADE /* DebugAppStore */ = { isa = XCBuildConfiguration; - baseConfigurationReference = D079FD021F06BBD60038FADE /* Config-AppStore.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; BUILD_NUMBER = 9999; @@ -6368,7 +6346,6 @@ }; D079FCFA1F06BBA40038FADE /* DebugAppStore */ = { isa = XCBuildConfiguration; - baseConfigurationReference = D079FD021F06BBD60038FADE /* Config-AppStore.xcconfig */; buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; @@ -6411,7 +6388,6 @@ }; D079FCFD1F06BBA40038FADE /* DebugAppStore */ = { isa = XCBuildConfiguration; - baseConfigurationReference = D079FD021F06BBD60038FADE /* Config-AppStore.xcconfig */; buildSettings = { BITCODE_GENERATION_MODE = marker; BUILD_NUMBER = 99999; @@ -6444,7 +6420,6 @@ }; D079FCFE1F06BBA40038FADE /* DebugAppStore */ = { isa = XCBuildConfiguration; - baseConfigurationReference = D079FD021F06BBD60038FADE /* Config-AppStore.xcconfig */; buildSettings = { BITCODE_GENERATION_MODE = marker; BUILD_NUMBER = 99999; @@ -6993,7 +6968,6 @@ }; D0B2F744204F4C9900D3BFB9 /* DebugAppStore */ = { isa = XCBuildConfiguration; - baseConfigurationReference = D079FD021F06BBD60038FADE /* Config-AppStore.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; BUILD_NUMBER = 99999; @@ -7065,7 +7039,6 @@ }; D0B2F745204F4C9900D3BFB9 /* ReleaseAppStore */ = { isa = XCBuildConfiguration; - baseConfigurationReference = D079FD021F06BBD60038FADE /* Config-AppStore.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; BUILD_NUMBER = 99999; @@ -7501,7 +7474,6 @@ }; D0D268901D79A70B00C422DA /* ReleaseAppStore */ = { isa = XCBuildConfiguration; - baseConfigurationReference = D079FD021F06BBD60038FADE /* Config-AppStore.xcconfig */; buildSettings = { BITCODE_GENERATION_MODE = bitcode; BUILD_NUMBER = 99999; @@ -7599,7 +7571,6 @@ }; D0ECCB841FE9C38500609802 /* DebugAppStore */ = { isa = XCBuildConfiguration; - baseConfigurationReference = D079FD021F06BBD60038FADE /* Config-AppStore.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_NONNULL = YES; @@ -7668,7 +7639,6 @@ }; D0ECCB851FE9C38500609802 /* ReleaseAppStore */ = { isa = XCBuildConfiguration; - baseConfigurationReference = D079FD021F06BBD60038FADE /* Config-AppStore.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_NONNULL = YES; diff --git a/Telegram-iOS/BuildConfig.m b/Telegram-iOS/BuildConfig.m index 05041fed1a..de6c59c690 100644 --- a/Telegram-iOS/BuildConfig.m +++ b/Telegram-iOS/BuildConfig.m @@ -342,65 +342,11 @@ API_AVAILABLE(ios(10)) - (instancetype)init { self = [super init]; if (self != nil) { - char buf[3]; - buf[2] = '\0'; - NSString *hex = @(APP_CONFIG_DATA); - assert(0 == [hex length] % 2); - unsigned char *bytes = malloc([hex length]/2); - unsigned char *bp = bytes; - for (CFIndex i = 0; i < [hex length]; i += 2) { - buf[0] = [hex characterAtIndex:i]; - buf[1] = [hex characterAtIndex:i+1]; - char *b2 = NULL; - *bp++ = strtol(buf, &b2, 16); - assert(b2 == buf + 2); - } + _apiId = APP_CONFIG_API_ID; + _apiHash = @(APP_CONFIG_API_HASH); + _hockeyAppId = @(APP_CONFIG_HOCKEYAPP_ID); - NSMutableData *data = [NSMutableData dataWithBytesNoCopy:bytes length:[hex length]/2 freeWhenDone:YES]; - if ([data length] == 0) { - assert(false); - } - - const char *streamCode = "Cypher"; - int keyLength = (int)strlen(streamCode); - int keyOffset = 0; - for (NSUInteger i = 0; i < data.length; i++) { - ((uint8_t *)data.mutableBytes)[i] ^= ((uint8_t *)streamCode)[keyOffset % keyLength]; - keyOffset += 1; - } - - int offset = 0; - uint32_t header = 0; - [data getBytes:&header range:NSMakeRange(offset, 4)]; - offset += 4; - if (header != 0xabcdef01U) { - assert(false); - } - - [data getBytes:&_apiId range:NSMakeRange(offset, 4)]; - offset += 4; - - int32_t apiHashLength = 0; - [data getBytes:&apiHashLength range:NSMakeRange(offset, 4)]; - offset += 4; - - if (apiHashLength > 0) { - _apiHash = [[NSString alloc] initWithData:[data subdataWithRange:NSMakeRange(offset, apiHashLength)] encoding:NSUTF8StringEncoding]; - offset += apiHashLength; - } else { - assert(false); - } - - int32_t hockeyappIdLength = 0; - [data getBytes:&hockeyappIdLength range:NSMakeRange(offset, 4)]; - offset += 4; - - if (hockeyappIdLength > 0) { - _hockeyAppId = [[NSString alloc] initWithData:[data subdataWithRange:NSMakeRange(offset, hockeyappIdLength)] encoding:NSUTF8StringEncoding]; - offset += hockeyappIdLength; - } - - NSString *bundleId = [BuildConfig bundleId]; + NSString *bundleId = [NSBundle mainBundle].bundleIdentifier; MTPKCS *signature = checkSignature([[[NSBundle mainBundle] executablePath] UTF8String]); NSMutableDictionary *dataDict = [[NSMutableDictionary alloc] init]; diff --git a/Telegram-iOS/Config-AppStore.xcconfig b/Telegram-iOS/Config-AppStore.xcconfig deleted file mode 100644 index d714178e63..0000000000 --- a/Telegram-iOS/Config-AppStore.xcconfig +++ /dev/null @@ -1 +0,0 @@ -#include "../../Telegram-iOS-Shared/Config/AppStore/Config.xcconfig" diff --git a/Telegram-iOS/LegacyDataImportSplash.swift b/Telegram-iOS/LegacyDataImportSplash.swift index 4db218b648..2f349190d5 100644 --- a/Telegram-iOS/LegacyDataImportSplash.swift +++ b/Telegram-iOS/LegacyDataImportSplash.swift @@ -13,7 +13,7 @@ final class LegacyDataImportSplash: WindowCoveringView { if let size = self.validSize { switch self.progress.0 { case .generic: - self.textNode.attributedText = NSAttributedString(string: self.strings?.DataUpgrade_Running ?? "Optimizing...", font: Font.regular(17.0), textColor: self.theme?.list.itemPrimaryTextColor ?? .black) + self.textNode.attributedText = NSAttributedString(string: self.strings?.AppUpgrade_Running ?? "Optimizing...", font: Font.regular(17.0), textColor: self.theme?.list.itemPrimaryTextColor ?? .black) case .media: self.textNode.attributedText = NSAttributedString(string: "Optimizing cache", font: Font.regular(17.0), textColor: self.theme?.list.itemPrimaryTextColor ?? .black) case .messages: @@ -39,7 +39,9 @@ final class LegacyDataImportSplash: WindowCoveringView { self.progressNode = RadialStatusNode(backgroundNodeColor: theme?.list.plainBackgroundColor ?? .white) self.textNode = ImmediateTextNode() - self.textNode.attributedText = NSAttributedString(string: self.strings?.DataUpgrade_Running ?? "Optimizing...", font: Font.regular(17.0), textColor: self.theme?.list.itemPrimaryTextColor ?? .black) + self.textNode.maximumNumberOfLines = 0 + self.textNode.textAlignment = .center + self.textNode.attributedText = NSAttributedString(string: self.strings?.AppUpgrade_Running ?? "Optimizing...", font: Font.regular(17.0), textColor: self.theme?.list.itemPrimaryTextColor ?? .black) super.init(frame: CGRect()) @@ -61,10 +63,11 @@ final class LegacyDataImportSplash: WindowCoveringView { self.validSize = size let progressSize = CGSize(width: 60.0, height: 60.0) - let progressFrame = CGRect(origin: CGPoint(x: floor((size.width - progressSize.width) / 2.0), y: floor((size.height - progressSize.height) / 2.0) - 8.0), size: progressSize) - self.progressNode.frame = progressFrame - let textSize = self.textNode.updateLayout(size) + let textSize = self.textNode.updateLayout(CGSize(width: size.width - 20.0, height: .greatestFiniteMagnitude)) + + let progressFrame = CGRect(origin: CGPoint(x: floor((size.width - progressSize.width) / 2.0), y: floor((size.height - progressSize.height - 15.0 - textSize.height) / 2.0)), size: progressSize) + self.progressNode.frame = progressFrame self.textNode.frame = CGRect(origin: CGPoint(x: floor((size.width - textSize.width) / 2.0), y: progressFrame.maxY + 15.0), size: textSize) } diff --git a/Telegram-iOS/en.lproj/Localizable.strings b/Telegram-iOS/en.lproj/Localizable.strings index a6852a9731..ef6fdc7b30 100644 --- a/Telegram-iOS/en.lproj/Localizable.strings +++ b/Telegram-iOS/en.lproj/Localizable.strings @@ -4212,7 +4212,10 @@ Unused sets are archived when you add more."; "Undo.ChatDeletedForBothSides" = "Chat deleted for both sides"; -"DataUpgrade.Running" = "Optimizing Telegram..."; +"AppUpgrade.Running" = "Optimizing Telegram... +This may take a while, depending on the size of the database. Please keep the app open until the process is finished. + +Sorry for the inconvenience."; "Call.Mute" = "mute"; "Call.Camera" = "camera"; diff --git a/submodules/TelegramUI b/submodules/TelegramUI index f02d98f2c1..e6df9015dd 160000 --- a/submodules/TelegramUI +++ b/submodules/TelegramUI @@ -1 +1 @@ -Subproject commit f02d98f2c17550c131a9571e684a2441f92a5474 +Subproject commit e6df9015ddd291910a1d914b9255237193f36704