From 04c6b6d7cf26c604fe1dadce882748260b2c96e2 Mon Sep 17 00:00:00 2001 From: Ali <> Date: Sun, 13 Jun 2021 16:38:02 +0400 Subject: [PATCH] Integrate AppCenter for internal builds --- WORKSPACE | 7 +++++++ submodules/TelegramUI/BUILD | 12 ++++++++++- .../TelegramUI/Sources/AppDelegate.swift | 21 +++++++++++-------- third-party/AppCenter/AppCenter.BUILD | 15 +++++++++++++ third-party/AppCenter/BUILD | 0 5 files changed, 45 insertions(+), 10 deletions(-) create mode 100644 third-party/AppCenter/AppCenter.BUILD create mode 100644 third-party/AppCenter/BUILD diff --git a/WORKSPACE b/WORKSPACE index a270359be7..a41ed5cce6 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -56,3 +56,10 @@ http_file( urls = ["https://github.com/Kitware/CMake/releases/download/v3.19.2/cmake-3.19.2-macos-universal.tar.gz"], sha256 = "50afa2cb66bea6a0314ef28034f3ff1647325e30cf5940f97906a56fd9640bd8", ) + +http_archive( + name = "appcenter_sdk", + urls = ["https://github.com/microsoft/appcenter-sdk-apple/releases/download/4.1.1/AppCenter-SDK-Apple-4.1.1.zip"], + sha256 = "032907801dc7784744a1ca8fd40d3eecc34a2e27a93a4b3993f617cca204a9f3", + build_file = "@//third-party/AppCenter:AppCenter.BUILD", +) diff --git a/submodules/TelegramUI/BUILD b/submodules/TelegramUI/BUILD index f7374f2208..6e18969ca6 100644 --- a/submodules/TelegramUI/BUILD +++ b/submodules/TelegramUI/BUILD @@ -15,6 +15,11 @@ filegroup( visibility = ["//visibility:public"], ) +appcenter_targets = [ + "@appcenter_sdk//:AppCenter", + "@appcenter_sdk//:AppCenterCrashes", +] + swift_library( name = "TelegramUI", module_name = "TelegramUI", @@ -223,7 +228,12 @@ swift_library( "//submodules/ImportStickerPackUI:ImportStickerPackUI", "//submodules/GradientBackground:GradientBackground", "//submodules/WallpaperBackgroundNode:WallpaperBackgroundNode", - ], + ] + select({ + "@build_bazel_rules_apple//apple:ios_armv7": [], + "@build_bazel_rules_apple//apple:ios_arm64": appcenter_targets, + "//build-system:ios_sim_arm64": [], + "@build_bazel_rules_apple//apple:ios_x86_64": [], + }), visibility = [ "//visibility:public", ], diff --git a/submodules/TelegramUI/Sources/AppDelegate.swift b/submodules/TelegramUI/Sources/AppDelegate.swift index 77e0fd8672..e5f3393fb2 100644 --- a/submodules/TelegramUI/Sources/AppDelegate.swift +++ b/submodules/TelegramUI/Sources/AppDelegate.swift @@ -34,9 +34,11 @@ import CoreSpotlight import LightweightAccountData import TelegramAudio import DebugSettingsUI - -#if canImport(BackgroundTasks) import BackgroundTasks + +#if os(iOS) +import AppCenter +import AppCenterCrashes #endif private let handleVoipNotifications = false @@ -486,14 +488,7 @@ final class SharedApplicationContext { telegramUIDeclareEncodables() GlobalExperimentalSettings.isAppStoreBuild = buildConfig.isAppStoreBuild - GlobalExperimentalSettings.enableFeed = false - #if DEBUG - //GlobalExperimentalSettings.enableFeed = true - #if targetEnvironment(simulator) - //GlobalTelegramCoreConfiguration.readMessages = false - #endif - #endif self.window?.makeKeyAndVisible() @@ -1335,6 +1330,14 @@ final class SharedApplicationContext { }*/ self.maybeCheckForUpdates() + + #if os(iOS) + if !buildConfig.isAppStoreBuild, let appCenterId = buildConfig.appCenterId, !appCenterId.isEmpty { + AppCenter.start(withAppSecret: buildConfig.appCenterId, services: [ + Crashes.self + ]) + } + #endif return true } diff --git a/third-party/AppCenter/AppCenter.BUILD b/third-party/AppCenter/AppCenter.BUILD new file mode 100644 index 0000000000..ce677b8e72 --- /dev/null +++ b/third-party/AppCenter/AppCenter.BUILD @@ -0,0 +1,15 @@ +load("@build_bazel_rules_apple//apple:apple.bzl", + "apple_static_framework_import", +) + +apple_static_framework_import( + name = "AppCenter", + framework_imports = glob(["AppCenter-SDK-Apple/iOS/AppCenter.framework/**"]), + visibility = ["//visibility:public"], +) + +apple_static_framework_import( + name = "AppCenterCrashes", + framework_imports = glob(["AppCenter-SDK-Apple/iOS/AppCenterCrashes.framework/**"]), + visibility = ["//visibility:public"], +) diff --git a/third-party/AppCenter/BUILD b/third-party/AppCenter/BUILD new file mode 100644 index 0000000000..e69de29bb2