diff --git a/README.md b/README.md index eceb040fe9..a2e8da75f6 100644 --- a/README.md +++ b/README.md @@ -11,86 +11,85 @@ There are several things we require from **all developers** for the moment. 3. Please study our [**security guidelines**](https://core.telegram.org/mtproto/security_guidelines) and take good care of your users' data and privacy. 4. Please remember to publish **your** code too in order to comply with the licences. -# Compilation Guide +# Quick Compilation Guide -1. Install Xcode (directly from https://developer.apple.com/download/more or using the App Store). -2. Clone the project from GitHub: +## Get the Code ``` git clone --recursive -j8 https://github.com/TelegramMessenger/Telegram-iOS.git ``` -3. Adjust configuration parameters +## Setup Xcode + +Install Xcode (directly from https://developer.apple.com/download/applications or using the App Store). + +## Adjust Configuration + +1. Generate a random identifier: +``` +openssl rand -hex 8 +``` +2. Create a new Xcode project. Use `Telegram` as the Product Name. Use `org.{identifier from step 1}` as the Organization Identifier. +3. In Signing & Capabilities click on the `i` next to `Xcode Managed Profile` and copy the team ID (`ABCDEFG123`). +4. Edit `build-system/template_minimal_development_configuration.json`. Use data from the previous steps. + +## Generate an Xcode project ``` -mkdir -p $HOME/telegram-configuration -mkdir -p $HOME/telegram-provisioning -cp build-system/appstore-configuration.json $HOME/telegram-configuration/configuration.json -cp -R build-system/fake-codesigning $HOME/telegram-provisioning/ +python3 build-system/Make/Make.py \ + --cacheDir="$HOME/telegram-bazel-cache" \ + generateProject \ + --configurationPath=build-system/template_minimal_development_configuration.json \ + --xcodeManagedCodesigning ``` -- Modify the values in `configuration.json` -- Replace the provisioning profiles in `profiles` with valid files +# Advanced Compilation Guide -4. (Optional) Create a build cache directory to speed up rebuilds +## Xcode +1. Copy and edit `build-system/appstore-configuration.json`. +2. Copy `build-system/fake-codesigning`. Create and download provisioning profiles, using the `profiles` folder as a reference for the entitlements. +3. Generate an Xcode project: ``` -mkdir -p "$HOME/telegram-bazel-cache" +python3 build-system/Make/Make.py \ + --cacheDir="$HOME/telegram-bazel-cache" \ + generateProject \ + --configurationPath=configuration_from_step_1.json \ + --codesigningInformationPath=directory_from_step_2 ``` -5. Build the app +## IPA +1. Repeat the steps from the previous section. Use distribution provisioning profiles. +2. Run: ``` python3 build-system/Make/Make.py \ --cacheDir="$HOME/telegram-bazel-cache" \ build \ - --configurationPath=path-to-configuration.json \ - --codesigningInformationPath=path-to-provisioning-data \ + --configurationPath=...see previous section... \ + --codesigningInformationPath=...see previous section... \ --buildNumber=100001 \ - --configuration=release_universal + --configuration=release_arm64 ``` -6. (Optional) Generate an Xcode project +## Tips +## Codesigning is not required for simulator-only builds + +Add `--disableProvisioningProfiles`: ``` python3 build-system/Make/Make.py \ --cacheDir="$HOME/telegram-bazel-cache" \ generateProject \ --configurationPath=path-to-configuration.json \ --codesigningInformationPath=path-to-provisioning-data \ - --disableExtensions -``` - -It is possible to generate a project that does not require any codesigning certificates to be installed: add `--disableProvisioningProfiles` flag: -``` -python3 build-system/Make/Make.py \ - --cacheDir="$HOME/telegram-bazel-cache" \ - generateProject \ - --configurationPath=path-to-configuration.json \ - --codesigningInformationPath=path-to-provisioning-data \ - --disableExtensions \ --disableProvisioningProfiles ``` +## Versions -Tip: use `--disableExtensions` when developing to speed up development by not building application extensions and the WatchOS app. - - -# Tips - -Bazel is used to build the app. To simplify the development setup a helper script is provided (`build-system/Make/Make.py`). See help: +Each release is built using a specific Xcode version (see `versions.json`). The helper script checks the versions of the installed software and reports an error if they don't match the ones specified in `versions.json`. It is possible to bypass these checks: ``` -python3 build-system/Make/Make.py --help -python3 build-system/Make/Make.py build --help -python3 build-system/Make/Make.py generateProject --help -``` - -Bazel is automatically downloaded when running Make.py for the first time. If you wish to use your own build of Bazel, pass `--bazel=path-to-bazel`. If your Bazel version differs from that in `versions.json`, you may use `--overrideBazelVersion` to skip the version check. - -Each release is built using specific Xcode and Bazel versions (see `versions.json`). The helper script checks the versions of installed software and reports an error if they don't match the ones specified in `versions.json`. There are flags that allow to bypass these checks: - -``` -python3 build-system/Make/Make.py --overrideBazelVersion build ... # Don't check the version of Bazel python3 build-system/Make/Make.py --overrideXcodeVersion build ... # Don't check the version of Xcode ``` diff --git a/Telegram/BUILD b/Telegram/BUILD index d737ee8ced..8449b491b1 100644 --- a/Telegram/BUILD +++ b/Telegram/BUILD @@ -30,8 +30,11 @@ load( "top_level_target", "top_level_targets", "xcodeproj", + "xcode_provisioning_profile", ) +load("@build_bazel_rules_apple//apple:apple.bzl", "local_provisioning_profile") + load("//build-system/bazel-utils:plist_fragment.bzl", "plist_fragment", ) @@ -39,6 +42,7 @@ load("//build-system/bazel-utils:plist_fragment.bzl", load( "@build_configuration//:variables.bzl", "telegram_bazel_path", + "telegram_use_xcode_managed_codesigning", "telegram_bundle_id", "telegram_aps_environment", "telegram_team_id", @@ -510,10 +514,11 @@ app_groups_fragment = """ telegram_bundle_id=telegram_bundle_id ) -communication_notifications_fragment = """ +official_communication_notifications_fragment = """ com.apple.developer.usernotifications.communication """ +communication_notifications_fragment = official_communication_notifications_fragment if telegram_bundle_id in official_bundle_ids else "" store_signin_fragment = """ com.apple.developer.applesignin @@ -1920,6 +1925,18 @@ plist_fragment( ) ) +local_provisioning_profile( + name = "Telegram_local_profile", + profile_name = "iOS Team Provisioning Profile: {}".format(telegram_bundle_id), + team_id = telegram_team_id, +) + +xcode_provisioning_profile( + name = "Telegram_xcode_profile", + managed_by_xcode = True, + provisioning_profile = ":Telegram_local_profile", +) + ios_application( name = "Telegram", bundle_id = "{telegram_bundle_id}".format( @@ -1929,7 +1946,7 @@ ios_application( minimum_os_version = minimum_os_version, provisioning_profile = select({ ":disableProvisioningProfilesSetting": None, - "//conditions:default": "@build_configuration//provisioning:Telegram.mobileprovision", + "//conditions:default": ":Telegram_xcode_profile" if telegram_use_xcode_managed_codesigning else "@build_configuration//provisioning:Telegram.mobileprovision", }), entitlements = ":TelegramEntitlements.entitlements", infoplists = [ diff --git a/Telegram/NotificationService/Sources/NotificationService.swift b/Telegram/NotificationService/Sources/NotificationService.swift index f3a1f0d7f5..bb521192d2 100644 --- a/Telegram/NotificationService/Sources/NotificationService.swift +++ b/Telegram/NotificationService/Sources/NotificationService.swift @@ -680,7 +680,7 @@ private final class NotificationServiceHandler { Logger.shared.logToConsole = loggingSettings.logToConsole Logger.shared.redactSensitiveData = loggingSettings.redactSensitiveData - let networkArguments = NetworkInitializationArguments(apiId: apiId, apiHash: apiHash, languagesCategory: languagesCategory, appVersion: appVersion, voipMaxLayer: 0, voipVersions: [], appData: .single(buildConfig.bundleData(withAppToken: nil, signatureDict: nil)), autolockDeadine: .single(nil), encryptionProvider: OpenSSLEncryptionProvider(), deviceModelName: nil, useBetaFeatures: !buildConfig.isAppStoreBuild) + let networkArguments = NetworkInitializationArguments(apiId: apiId, apiHash: apiHash, languagesCategory: languagesCategory, appVersion: appVersion, voipMaxLayer: 0, voipVersions: [], appData: .single(buildConfig.bundleData(withAppToken: nil, signatureDict: nil)), autolockDeadine: .single(nil), encryptionProvider: OpenSSLEncryptionProvider(), deviceModelName: nil, useBetaFeatures: !buildConfig.isAppStoreBuild, isICloudEnabled: false) let isLockedMessage: String? if let data = try? Data(contentsOf: URL(fileURLWithPath: appLockStatePath(rootPath: rootPath))), let state = try? JSONDecoder().decode(LockState.self, from: data), isAppLocked(state: state) { diff --git a/Telegram/SiriIntents/IntentHandler.swift b/Telegram/SiriIntents/IntentHandler.swift index 17641dfdfd..09fab9493b 100644 --- a/Telegram/SiriIntents/IntentHandler.swift +++ b/Telegram/SiriIntents/IntentHandler.swift @@ -174,7 +174,7 @@ class DefaultIntentHandler: INExtension, INSendMessageIntentHandling, INSearchFo if let accountCache = accountCache { account = .single(accountCache) } else { - account = currentAccount(allocateIfNotExists: false, networkArguments: NetworkInitializationArguments(apiId: apiId, apiHash: apiHash, languagesCategory: languagesCategory, appVersion: appVersion, voipMaxLayer: 0, voipVersions: [], appData: .single(buildConfig.bundleData(withAppToken: nil, signatureDict: nil)), autolockDeadine: .single(nil), encryptionProvider: OpenSSLEncryptionProvider(), deviceModelName: nil, useBetaFeatures: !buildConfig.isAppStoreBuild), supplementary: true, manager: accountManager, rootPath: rootPath, auxiliaryMethods: accountAuxiliaryMethods, encryptionParameters: encryptionParameters) + account = currentAccount(allocateIfNotExists: false, networkArguments: NetworkInitializationArguments(apiId: apiId, apiHash: apiHash, languagesCategory: languagesCategory, appVersion: appVersion, voipMaxLayer: 0, voipVersions: [], appData: .single(buildConfig.bundleData(withAppToken: nil, signatureDict: nil)), autolockDeadine: .single(nil), encryptionProvider: OpenSSLEncryptionProvider(), deviceModelName: nil, useBetaFeatures: !buildConfig.isAppStoreBuild, isICloudEnabled: false), supplementary: true, manager: accountManager, rootPath: rootPath, auxiliaryMethods: accountAuxiliaryMethods, encryptionParameters: encryptionParameters) |> mapToSignal { account -> Signal in if let account = account { switch account { diff --git a/WORKSPACE b/WORKSPACE index fa23cf7b1a..330d06cb04 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -75,3 +75,9 @@ http_archive( sha256 = "032907801dc7784744a1ca8fd40d3eecc34a2e27a93a4b3993f617cca204a9f3", build_file = "@//third-party/AppCenter:AppCenter.BUILD", ) + +load("@build_bazel_rules_apple//apple:apple.bzl", "provisioning_profile_repository") + +provisioning_profile_repository( + name = "local_provisioning_profiles", +) diff --git a/build-system/Make/BuildConfiguration.py b/build-system/Make/BuildConfiguration.py index 92f85d8f2b..8407dad9c5 100644 --- a/build-system/Make/BuildConfiguration.py +++ b/build-system/Make/BuildConfiguration.py @@ -35,9 +35,10 @@ class BuildConfiguration: self.enable_siri = enable_siri self.enable_icloud = enable_icloud - def write_to_variables_file(self, bazel_path, aps_environment, path): + def write_to_variables_file(self, bazel_path, use_xcode_managed_codesigning, aps_environment, path): string = '' string += 'telegram_bazel_path = "{}"\n'.format(bazel_path) + string += 'telegram_use_xcode_managed_codesigning = {}\n'.format('True' if use_xcode_managed_codesigning else 'False') string += 'telegram_bundle_id = "{}"\n'.format(self.bundle_id) string += 'telegram_api_id = "{}"\n'.format(self.api_id) string += 'telegram_api_hash = "{}"\n'.format(self.api_hash) @@ -240,6 +241,9 @@ class CodesigningSource: raise Exception('Not implemented') def resolve_aps_environment(self): + raise Exception('Not implemented') + + def use_xcode_managed_codesigning(self): raise Exception('Not implemented') def copy_certificates_to_destination(self, destination_path): @@ -280,6 +284,9 @@ class GitCodesigningSource(CodesigningSource): source_path = self.working_dir + '/decrypted/profiles/{}'.format(self.codesigning_type) return resolve_aps_environment_from_directory(source_path=source_path, team_id=self.team_id, bundle_id=self.bundle_id) + def use_xcode_managed_codesigning(self): + return False + def copy_certificates_to_destination(self, destination_path): source_path = None if self.codesigning_type in ['adhoc', 'appstore']: @@ -308,5 +315,28 @@ class DirectoryCodesigningSource(CodesigningSource): def resolve_aps_environment(self): return resolve_aps_environment_from_directory(source_path=self.directory_path + '/profiles', team_id=self.team_id, bundle_id=self.bundle_id) + def use_xcode_managed_codesigning(self): + return False + def copy_certificates_to_destination(self, destination_path): copy_certificates_from_directory(source_path=self.directory_path + '/certs', destination_path=destination_path) + + +class XcodeManagedCodesigningSource(CodesigningSource): + def __init__(self): + pass + + def load_data(self, working_dir): + pass + + def copy_profiles_to_destination(self, destination_path): + pass + + def resolve_aps_environment(self): + return "" + + def use_xcode_managed_codesigning(self): + return True + + def copy_certificates_to_destination(self, destination_path): + pass diff --git a/build-system/Make/Make.py b/build-system/Make/Make.py index 6506859acb..2fc8f25a7f 100644 --- a/build-system/Make/Make.py +++ b/build-system/Make/Make.py @@ -12,14 +12,15 @@ import glob from BuildEnvironment import resolve_executable, call_executable, run_executable_with_output, BuildEnvironment from ProjectGeneration import generate from BazelLocation import locate_bazel -from BuildConfiguration import CodesigningSource, GitCodesigningSource, DirectoryCodesigningSource, BuildConfiguration, build_configuration_from_json +from BuildConfiguration import CodesigningSource, GitCodesigningSource, DirectoryCodesigningSource, XcodeManagedCodesigningSource, BuildConfiguration, build_configuration_from_json import RemoteBuild import GenerateProfiles class ResolvedCodesigningData: - def __init__(self, aps_environment): + def __init__(self, aps_environment, use_xcode_managed_codesigning): self.aps_environment = aps_environment + self.use_xcode_managed_codesigning = use_xcode_managed_codesigning class BazelCommandLine: @@ -446,11 +447,9 @@ def resolve_codesigning(arguments, base_path, build_configuration, provisioning_ always_fetch=not arguments.gitCodesigningUseCurrent ) elif arguments.codesigningInformationPath is not None: - profile_source = DirectoryCodesigningSource( - directory_path=arguments.codesigningInformationPath, - team_id=build_configuration.team_id, - bundle_id=build_configuration.bundle_id - ) + profile_source = DirectoryCodesigningSource() + elif arguments.xcodeManagedCodesigning is not None and arguments.xcodeManagedCodesigning == True: + profile_source = XcodeManagedCodesigningSource() elif arguments.noCodesigning is not None: return ResolvedCodesigningData(aps_environment='production') else: @@ -467,7 +466,10 @@ def resolve_codesigning(arguments, base_path, build_configuration, provisioning_ profile_source.copy_profiles_to_destination(destination_path=additional_codesigning_output_path + '/profiles') profile_source.copy_certificates_to_destination(destination_path=additional_codesigning_output_path + '/certs') - return ResolvedCodesigningData(aps_environment=profile_source.resolve_aps_environment()) + return ResolvedCodesigningData( + aps_environment=profile_source.resolve_aps_environment(), + use_xcode_managed_codesigning=profile_source.use_xcode_managed_codesigning() + ) def resolve_configuration(base_path, bazel_command_line: BazelCommandLine, arguments, additional_codesigning_output_path): @@ -499,7 +501,7 @@ def resolve_configuration(base_path, bazel_command_line: BazelCommandLine, argum sys.exit(1) if bazel_command_line is not None: - build_configuration.write_to_variables_file(bazel_path=bazel_command_line.bazel, aps_environment=codesigning_data.aps_environment, path=configuration_repository_path + '/variables.bzl') + build_configuration.write_to_variables_file(bazel_path=bazel_command_line.bazel, use_xcode_managed_codesigning=codesigning_data.use_xcode_managed_codesigning, aps_environment=codesigning_data.aps_environment, path=configuration_repository_path + '/variables.bzl') provisioning_profile_files = [] for file_name in os.listdir(provisioning_path): @@ -549,6 +551,8 @@ def generate_project(bazel, arguments): disable_extensions = arguments.disableExtensions if arguments.disableProvisioningProfiles is not None: disable_provisioning_profiles = arguments.disableProvisioningProfiles + if arguments.xcodeManagedCodesigning is not None and arguments.xcodeManagedCodesigning == True: + disable_extensions = True if arguments.generateDsym is not None: generate_dsym = arguments.generateDsym if arguments.target is not None: @@ -688,12 +692,11 @@ def add_codesigning_common_arguments(current_parser: argparse.ArgumentParser): metavar='command' ) codesigning_group.add_argument( - '--noCodesigning', - type=bool, + '--xcodeManagedCodesigning', + action='store_true', help=''' - Use signing certificates and provisioning profiles from a local directory. + Let Xcode manage your certificates and provisioning profiles. ''', - metavar='command' ) current_parser.add_argument( diff --git a/build-system/Make/ProjectGeneration.py b/build-system/Make/ProjectGeneration.py index 8d021208cd..046ee4d9bd 100644 --- a/build-system/Make/ProjectGeneration.py +++ b/build-system/Make/ProjectGeneration.py @@ -10,21 +10,27 @@ def remove_directory(path): shutil.rmtree(path) def generate_xcodeproj(build_environment: BuildEnvironment, disable_extensions, disable_provisioning_profiles, generate_dsym, configuration_path, bazel_app_arguments, target_name): + if '/' in target_name: + app_target_spec = target_name.split('/')[0] + '/' + target_name.split('/')[1] + ':' + target_name.split('/')[1] + app_target = target_name + app_target_clean = app_target.replace('/', '_') + else: + app_target_spec = '{target}:{target}'.format(target=target_name) + app_target = target_name + app_target_clean = app_target.replace('/', '_') + bazel_generate_arguments = [build_environment.bazel_path] bazel_generate_arguments += ['run', '//Telegram:Telegram_xcodeproj'] bazel_generate_arguments += ['--override_repository=build_configuration={}'.format(configuration_path)] - #if disable_extensions: - # bazel_generate_arguments += ['--//{}:disableExtensions'.format(app_target)] - #if disable_provisioning_profiles: - # bazel_generate_arguments += ['--//{}:disableProvisioningProfiles'.format(app_target)] - #if generate_dsym: - # bazel_generate_arguments += ['--apple_generate_dsym'] - #bazel_generate_arguments += ['--//{}:disableStripping'.format('Telegram')] + if disable_extensions: + bazel_generate_arguments += ['--//{}:disableExtensions'.format(app_target)] project_bazel_arguments = [] for argument in bazel_app_arguments: project_bazel_arguments.append(argument) project_bazel_arguments += ['--override_repository=build_configuration={}'.format(configuration_path)] + if disable_extensions: + project_bazel_arguments += ['--//{}:disableExtensions'.format(app_target)] xcodeproj_bazelrc = os.path.join(build_environment.base_path, 'xcodeproj.bazelrc') if os.path.isfile(xcodeproj_bazelrc): diff --git a/build-system/template_minimal_development_configuration.json b/build-system/template_minimal_development_configuration.json new file mode 100755 index 0000000000..1aad0aed95 --- /dev/null +++ b/build-system/template_minimal_development_configuration.json @@ -0,0 +1,14 @@ +{ + "bundle_id": "org.{! a random string !}.Telegram", + "api_id": "{! get one at https://my.telegram.org/apps !}", + "api_hash": "{! get one at https://my.telegram.org/apps !}", + "team_id": "{! check README.md !}", + "app_center_id": "0", + "is_internal_build": "true", + "is_appstore_build": "false", + "appstore_id": "0", + "app_specific_url_scheme": "tg", + "premium_iap_product_id": "", + "enable_siri": false, + "enable_icloud": false +} \ No newline at end of file diff --git a/submodules/BuildConfig/BUILD b/submodules/BuildConfig/BUILD index 10c5c92dbb..7ac35f1be8 100644 --- a/submodules/BuildConfig/BUILD +++ b/submodules/BuildConfig/BUILD @@ -7,6 +7,8 @@ load( "telegram_is_appstore_build", "telegram_appstore_id", "telegram_app_specific_url_scheme", + "telegram_enable_icloud", + "telegram_enable_siri", ) objc_library( @@ -25,6 +27,8 @@ objc_library( "-DAPP_CONFIG_IS_APPSTORE_BUILD={}".format(telegram_is_appstore_build), "-DAPP_CONFIG_APPSTORE_ID={}".format(telegram_appstore_id), "-DAPP_SPECIFIC_URL_SCHEME=\\\"{}\\\"".format(telegram_app_specific_url_scheme), + "-DAPP_CONFIG_IS_ICLOUD_ENABLED={}".format("true" if telegram_enable_icloud else "false"), + "-DAPP_CONFIG_IS_SIRI_ENABLED={}".format("true" if telegram_enable_siri else "false"), ], hdrs = glob([ "PublicHeaders/**/*.h", diff --git a/submodules/BuildConfig/PublicHeaders/BuildConfig/BuildConfig.h b/submodules/BuildConfig/PublicHeaders/BuildConfig/BuildConfig.h index d735dd74bc..f37dd5ebce 100644 --- a/submodules/BuildConfig/PublicHeaders/BuildConfig/BuildConfig.h +++ b/submodules/BuildConfig/PublicHeaders/BuildConfig/BuildConfig.h @@ -18,6 +18,8 @@ @property (nonatomic, readonly) bool isAppStoreBuild; @property (nonatomic, readonly) int64_t appStoreId; @property (nonatomic, strong, readonly) NSString * _Nonnull appSpecificUrlScheme; +@property (nonatomic, readonly) bool isICloudEnabled; +@property (nonatomic, readonly) bool isSiriEnabled; + (DeviceSpecificEncryptionParameters * _Nonnull)deviceSpecificEncryptionParameters:(NSString * _Nonnull)rootPath baseAppBundleId:(NSString * _Nonnull)baseAppBundleId; - (NSData * _Nullable)bundleDataWithAppToken:(NSData * _Nullable)appToken signatureDict:(NSDictionary * _Nullable)signatureDict; diff --git a/submodules/BuildConfig/Sources/BuildConfig.m b/submodules/BuildConfig/Sources/BuildConfig.m index 3dde1749ae..ba2637e202 100644 --- a/submodules/BuildConfig/Sources/BuildConfig.m +++ b/submodules/BuildConfig/Sources/BuildConfig.m @@ -185,6 +185,14 @@ API_AVAILABLE(ios(10)) return @(APP_SPECIFIC_URL_SCHEME); } +- (bool)isICloudEnabled { + return APP_CONFIG_IS_ICLOUD_ENABLED; +} + +- (bool)isSiriEnabled { + return APP_CONFIG_IS_SIRI_ENABLED; +} + + (NSString * _Nullable)bundleSeedId { NSDictionary *query = [NSDictionary dictionaryWithObjectsAndKeys: (__bridge NSString *)kSecClassGenericPassword, (__bridge NSString *)kSecClass, diff --git a/submodules/TelegramCore/Sources/Network/Network.swift b/submodules/TelegramCore/Sources/Network/Network.swift index 23b71f1ef2..61ccf91ab4 100644 --- a/submodules/TelegramCore/Sources/Network/Network.swift +++ b/submodules/TelegramCore/Sources/Network/Network.swift @@ -434,8 +434,9 @@ public struct NetworkInitializationArguments { public let encryptionProvider: EncryptionProvider public let deviceModelName:String? public let useBetaFeatures: Bool + public let isICloudEnabled: Bool - public init(apiId: Int32, apiHash: String, languagesCategory: String, appVersion: String, voipMaxLayer: Int32, voipVersions: [CallSessionManagerImplementationVersion], appData: Signal, autolockDeadine: Signal, encryptionProvider: EncryptionProvider, deviceModelName: String?, useBetaFeatures: Bool) { + public init(apiId: Int32, apiHash: String, languagesCategory: String, appVersion: String, voipMaxLayer: Int32, voipVersions: [CallSessionManagerImplementationVersion], appData: Signal, autolockDeadine: Signal, encryptionProvider: EncryptionProvider, deviceModelName: String?, useBetaFeatures: Bool, isICloudEnabled: Bool) { self.apiId = apiId self.apiHash = apiHash self.languagesCategory = languagesCategory @@ -447,6 +448,7 @@ public struct NetworkInitializationArguments { self.encryptionProvider = encryptionProvider self.deviceModelName = deviceModelName self.useBetaFeatures = useBetaFeatures + self.isICloudEnabled = isICloudEnabled } } #if os(iOS) @@ -541,7 +543,7 @@ func initializedNetwork(accountId: AccountRecordId, arguments: NetworkInitializa context.keychain = keychain var wrappedAdditionalSource: MTSignal? #if os(iOS) - if #available(iOS 10.0, *), !supplementary { + if #available(iOS 10.0, *), !supplementary, arguments.isICloudEnabled { var cloudDataContextValue: CloudDataContext? if let value = cloudDataContext.with({ $0 }) { cloudDataContextValue = value diff --git a/submodules/TelegramUI/Sources/AppDelegate.swift b/submodules/TelegramUI/Sources/AppDelegate.swift index d77804fefc..78a5260652 100644 --- a/submodules/TelegramUI/Sources/AppDelegate.swift +++ b/submodules/TelegramUI/Sources/AppDelegate.swift @@ -483,7 +483,7 @@ private func extractAccountManagerState(records: AccountRecordsView