From 2fadeebbfa53a2cc046c3af27bf967afc28d4baf Mon Sep 17 00:00:00 2001
From: Ali <>
Date: Sat, 21 Mar 2020 23:11:21 +0400
Subject: [PATCH] Temp
---
Telegram/BUILD | 57 ++++++++++++++
.../NotificationServiceNext.swift | 8 ++
Telegram/telegram_info_plist.bzl | 77 -------------------
3 files changed, 65 insertions(+), 77 deletions(-)
create mode 100644 Telegram/NotificationServiceNext/NotificationServiceNext.swift
delete mode 100644 Telegram/telegram_info_plist.bzl
diff --git a/Telegram/BUILD b/Telegram/BUILD
index e365cc9c3a..50b2dcff7d 100644
--- a/Telegram/BUILD
+++ b/Telegram/BUILD
@@ -624,6 +624,62 @@ ios_extension(
],
)
+swift_library(
+ name = "NotificationServiceExtensionLib",
+ module_name = "NotificationServiceExtensionLib",
+ srcs = glob([
+ "NotificationServiceNext/**/*.swift",
+ ]),
+ deps = [
+ ],
+)
+
+plist_fragment(
+ name = "NotificationServiceInfoPlist",
+ extension = "plist",
+ template =
+ """
+ CFBundleDevelopmentRegion
+ en
+ CFBundleIdentifier
+ {telegram_bundle_id}.NotificationService
+ CFBundleName
+ Telegram
+ CFBundlePackageType
+ XPC!
+ NSExtension
+
+ NSExtensionPointIdentifier
+ com.apple.usernotifications.service
+ NSExtensionPrincipalClass
+ NotificationService
+
+ """.format(
+ telegram_bundle_id = telegram_bundle_id,
+ )
+)
+
+ios_extension(
+ name = "NotificationServiceExtension",
+ bundle_id = "{telegram_bundle_id}.NotificationService".format(
+ telegram_bundle_id = telegram_bundle_id,
+ ),
+ families = [
+ "iphone",
+ "ipad",
+ ],
+ infoplists = [
+ ":NotificationServiceInfoPlist",
+ ":VersionInfoPlist",
+ ":AppNameInfoPlist",
+ ],
+ minimum_os_version = "10.0",
+ provisioning_profile = "//build-input/data/provisioning-profiles:NotificationService.mobileprovision",
+ deps = [":NotificationServiceExtensionLib"],
+ frameworks = [
+ ],
+)
+
plist_fragment(
name = "TelegramInfoPlist",
extension = "plist",
@@ -813,6 +869,7 @@ ios_application(
],
extensions = [
":ShareExtension",
+ ":NotificationServiceExtension",
],
watch_application = ":TelegramWatchApp",
deps = [
diff --git a/Telegram/NotificationServiceNext/NotificationServiceNext.swift b/Telegram/NotificationServiceNext/NotificationServiceNext.swift
new file mode 100644
index 0000000000..cbf5c7df64
--- /dev/null
+++ b/Telegram/NotificationServiceNext/NotificationServiceNext.swift
@@ -0,0 +1,8 @@
+import Foundation
+import UserNotifications
+
+@available(iOSApplicationExtension 10.0, *)
+@objc(NotificationService)
+public final class NotificationService: UNNotificationServiceExtension {
+
+}
diff --git a/Telegram/telegram_info_plist.bzl b/Telegram/telegram_info_plist.bzl
deleted file mode 100644
index 6e38968e65..0000000000
--- a/Telegram/telegram_info_plist.bzl
+++ /dev/null
@@ -1,77 +0,0 @@
-load("//build-system:defines.bzl",
- "string_value",
-)
-
-def _telegram_info_plist(ctx):
- output = ctx.outputs.out
-
- plist_string = """
-
-
-
-
- CFBundleShortVersionString
- {app_version}
- CFBundleVersion
- {build_number}
- CFBundleURLTypes
-
-
- CFBundleTypeRole
- Viewer
- CFBundleURLName
- {bundle_id}
- CFBundleURLSchemes
-
- telegram
-
-
-
- CFBundleTypeRole
- Viewer
- CFBundleURLName
- {bundle_id}.ton
- CFBundleURLSchemes
-
- ton
-
-
-
- CFBundleTypeRole
- Viewer
- CFBundleURLName
- {app_name}.compatibility
- CFBundleURLSchemes
-
- {url_scheme}
-
-
-
-
-
- """.format(
- app_version = string_value(ctx, ctx.attr.app_version_define),
- build_number = string_value(ctx, ctx.attr.build_number_define),
- bundle_id = string_value(ctx, ctx.attr.bundle_id_define),
- app_name = ctx.attr.app_name,
- url_scheme = ctx.attr.url_scheme,
- )
-
- ctx.actions.write(
- output = output,
- content = plist_string,
- )
-
-telegram_info_plist = rule(
- implementation = _telegram_info_plist,
- attrs = {
- "app_name": attr.string(mandatory = True),
- "url_scheme": attr.string(mandatory = True),
- "bundle_id_define": attr.string(mandatory = True),
- "app_version_define": attr.string(mandatory = True),
- "build_number_define": attr.string(mandatory = True),
- },
- outputs = {
- "out": "%{name}.plist"
- },
-)