mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-15 13:35:19 +00:00
Experimental min OS version patching
This commit is contained in:
parent
bd07b85c83
commit
28f220cbab
108
Telegram/BUILD
108
Telegram/BUILD
@ -32,6 +32,7 @@ load(
|
||||
"telegram_team_id",
|
||||
"telegram_enable_icloud",
|
||||
"telegram_enable_siri",
|
||||
"telegram_enable_watch",
|
||||
)
|
||||
|
||||
load("@build_bazel_rules_apple//apple:resources.bzl",
|
||||
@ -1134,6 +1135,25 @@ swift_library(
|
||||
],
|
||||
)
|
||||
|
||||
genrule(
|
||||
name = "SetMinOsVersionNotificationContentExtension",
|
||||
cmd_bash =
|
||||
"""
|
||||
name=NotificationContentExtension.appex
|
||||
cat $(location PatchMinOSVersion.source.sh) | sed -e "s/<<<MIN_OS_VERSION>>>/10\\.0/g" | sed -e "s/<<<NAME>>>/$$name/g" > $(location SetMinOsVersionNotificationContentExtension.sh)
|
||||
""",
|
||||
srcs = [
|
||||
"PatchMinOSVersion.source.sh",
|
||||
],
|
||||
outs = [
|
||||
"SetMinOsVersionNotificationContentExtension.sh",
|
||||
],
|
||||
executable = True,
|
||||
visibility = [
|
||||
"//visibility:public",
|
||||
]
|
||||
)
|
||||
|
||||
ios_extension(
|
||||
name = "NotificationContentExtension",
|
||||
bundle_id = "{telegram_bundle_id}.NotificationContent".format(
|
||||
@ -1149,7 +1169,8 @@ ios_extension(
|
||||
":BuildNumberInfoPlist",
|
||||
":AppNameInfoPlist",
|
||||
],
|
||||
minimum_os_version = "10.0",
|
||||
minimum_os_version = "9.0", # maintain the same minimum OS version across extensions
|
||||
ipa_post_processor = ":SetMinOsVersionNotificationContentExtension",
|
||||
provisioning_profile = select({
|
||||
":disableProvisioningProfilesSetting": None,
|
||||
"//conditions:default": "@build_configuration//provisioning:NotificationContent.mobileprovision",
|
||||
@ -1216,6 +1237,25 @@ swift_library(
|
||||
],
|
||||
)
|
||||
|
||||
genrule(
|
||||
name = "SetMinOsVersionWidgetExtension",
|
||||
cmd_bash =
|
||||
"""
|
||||
name=WidgetExtension.appex
|
||||
cat $(location PatchMinOSVersion.source.sh) | sed -e "s/<<<MIN_OS_VERSION>>>/14\\.0/g" | sed -e "s/<<<NAME>>>/$$name/g" > $(location SetMinOsVersionWidgetExtension.sh)
|
||||
""",
|
||||
srcs = [
|
||||
"PatchMinOSVersion.source.sh",
|
||||
],
|
||||
outs = [
|
||||
"SetMinOsVersionWidgetExtension.sh",
|
||||
],
|
||||
executable = True,
|
||||
visibility = [
|
||||
"//visibility:public",
|
||||
]
|
||||
)
|
||||
|
||||
ios_extension(
|
||||
name = "WidgetExtension",
|
||||
bundle_id = "{telegram_bundle_id}.Widget".format(
|
||||
@ -1231,26 +1271,16 @@ ios_extension(
|
||||
":BuildNumberInfoPlist",
|
||||
":AppNameInfoPlist",
|
||||
],
|
||||
minimum_os_version = "14.0",
|
||||
minimum_os_version = "9.0", # maintain the same minimum OS version across extensions
|
||||
ipa_post_processor = ":SetMinOsVersionWidgetExtension",
|
||||
provides_main = True,
|
||||
provisioning_profile = select({
|
||||
":disableProvisioningProfilesSetting": None,
|
||||
"//conditions:default": "@build_configuration//provisioning:Widget.mobileprovision",
|
||||
}),
|
||||
deps = select({
|
||||
"@build_bazel_rules_apple//apple:ios_arm64": [
|
||||
":WidgetExtensionLib",
|
||||
],
|
||||
"//build-system:ios_sim_arm64": [
|
||||
":WidgetExtensionLib",
|
||||
],
|
||||
"@build_bazel_rules_apple//apple:ios_x86_64": [
|
||||
":WidgetExtensionLib",
|
||||
],
|
||||
"@build_bazel_rules_apple//apple:ios_armv7": [
|
||||
":WidgetExtensionLib",
|
||||
],
|
||||
}),
|
||||
deps = [
|
||||
":WidgetExtensionLib",
|
||||
],
|
||||
frameworks = [
|
||||
":SwiftSignalKitFramework",
|
||||
":PostboxFramework",
|
||||
@ -1329,6 +1359,25 @@ swift_library(
|
||||
],
|
||||
)
|
||||
|
||||
genrule(
|
||||
name = "SetMinOsVersionIntentsExtension",
|
||||
cmd_bash =
|
||||
"""
|
||||
name=IntentsExtension.appex
|
||||
cat $(location PatchMinOSVersion.source.sh) | sed -e "s/<<<MIN_OS_VERSION>>>/10\\.0/g" | sed -e "s/<<<NAME>>>/$$name/g" > $(location SetMinOsVersionIntentsExtension.sh)
|
||||
""",
|
||||
srcs = [
|
||||
"PatchMinOSVersion.source.sh",
|
||||
],
|
||||
outs = [
|
||||
"SetMinOsVersionIntentsExtension.sh",
|
||||
],
|
||||
executable = True,
|
||||
visibility = [
|
||||
"//visibility:public",
|
||||
]
|
||||
)
|
||||
|
||||
ios_extension(
|
||||
name = "IntentsExtension",
|
||||
bundle_id = "{telegram_bundle_id}.SiriIntents".format(
|
||||
@ -1344,7 +1393,8 @@ ios_extension(
|
||||
":BuildNumberInfoPlist",
|
||||
":AppNameInfoPlist",
|
||||
],
|
||||
minimum_os_version = "10.0",
|
||||
minimum_os_version = "9.0", # maintain the same minimum OS version across extensions
|
||||
ipa_post_processor = ":SetMinOsVersionIntentsExtension",
|
||||
provisioning_profile = select({
|
||||
":disableProvisioningProfilesSetting": None,
|
||||
"//conditions:default": "@build_configuration//provisioning:Intents.mobileprovision",
|
||||
@ -1383,6 +1433,25 @@ plist_fragment(
|
||||
)
|
||||
)
|
||||
|
||||
genrule(
|
||||
name = "SetMinOsVersionNotificationServiceExtension",
|
||||
cmd_bash =
|
||||
"""
|
||||
name=NotificationServiceExtension.appex
|
||||
cat $(location PatchMinOSVersion.source.sh) | sed -e "s/<<<MIN_OS_VERSION>>>/10\\.0/g" | sed -e "s/<<<NAME>>>/$$name/g" > $(location SetMinOsVersionNotificationServiceExtension.sh)
|
||||
""",
|
||||
srcs = [
|
||||
"PatchMinOSVersion.source.sh",
|
||||
],
|
||||
outs = [
|
||||
"SetMinOsVersionNotificationServiceExtension.sh",
|
||||
],
|
||||
executable = True,
|
||||
visibility = [
|
||||
"//visibility:public",
|
||||
]
|
||||
)
|
||||
|
||||
ios_extension(
|
||||
name = "NotificationServiceExtension",
|
||||
bundle_id = "{telegram_bundle_id}.NotificationService".format(
|
||||
@ -1398,7 +1467,8 @@ ios_extension(
|
||||
":BuildNumberInfoPlist",
|
||||
":AppNameInfoPlist",
|
||||
],
|
||||
minimum_os_version = "10.0",
|
||||
minimum_os_version = "9.0", # maintain the same minimum OS version across extensions
|
||||
ipa_post_processor = ":SetMinOsVersionNotificationServiceExtension",
|
||||
provisioning_profile = select({
|
||||
":disableProvisioningProfilesSetting": None,
|
||||
"//conditions:default": "@build_configuration//provisioning:NotificationService.mobileprovision",
|
||||
@ -1631,7 +1701,7 @@ ios_application(
|
||||
watch_application = select({
|
||||
":disableExtensionsSetting": None,
|
||||
"//conditions:default": ":TelegramWatchApp",
|
||||
}),
|
||||
}) if telegram_enable_watch else None,
|
||||
deps = [
|
||||
":Main",
|
||||
":Lib",
|
||||
|
@ -5,7 +5,7 @@ import NotificationServiceObjC
|
||||
|
||||
private let queue = Queue()
|
||||
|
||||
@available(iOSApplicationExtension 10.0, *)
|
||||
@available(iOSApplicationExtension 10.0, iOS 10.0, *)
|
||||
@objc(NotificationService)
|
||||
final class NotificationService: UNNotificationServiceExtension {
|
||||
private let impl: QueueLocalObject<NotificationServiceImpl>
|
||||
|
15
Telegram/PatchMinOSVersion.source.sh
Normal file
15
Telegram/PatchMinOSVersion.source.sh
Normal file
@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
name=<<<NAME>>>
|
||||
version=<<<MIN_OS_VERSION>>>
|
||||
|
||||
f="$1/$name"
|
||||
|
||||
plist_path="$f/Info.plist"
|
||||
plutil -replace MinimumOSVersion -string $version "$plist_path"
|
||||
if [ "$version" == "14.0" ]; then
|
||||
binary_path="$f/$(basename $f | sed -e s/\.appex//g)"
|
||||
xcrun lipo "$binary_path" -remove armv7 -o "$binary_path" 2>/dev/null || true
|
||||
fi
|
@ -65,6 +65,7 @@ private func rootPathForBasePath(_ appGroupPath: String) -> String {
|
||||
return appGroupPath + "/telegram-data"
|
||||
}
|
||||
|
||||
@available(iOSApplicationExtension 14.0, iOS 14.0, *)
|
||||
struct Provider: IntentTimelineProvider {
|
||||
public typealias Entry = SimpleEntry
|
||||
|
||||
@ -223,6 +224,7 @@ struct Provider: IntentTimelineProvider {
|
||||
}
|
||||
}
|
||||
|
||||
@available(iOSApplicationExtension 14.0, iOS 14.0, *)
|
||||
struct AvatarsProvider: IntentTimelineProvider {
|
||||
public typealias Entry = SimpleEntry
|
||||
|
||||
@ -381,6 +383,7 @@ struct AvatarsProvider: IntentTimelineProvider {
|
||||
}
|
||||
}
|
||||
|
||||
@available(iOSApplicationExtension 14.0, iOS 14.0, *)
|
||||
struct SimpleEntry: TimelineEntry {
|
||||
enum Contents {
|
||||
case recent
|
||||
@ -398,6 +401,7 @@ enum PeersWidgetData {
|
||||
case peers(ParsedPeers)
|
||||
}
|
||||
|
||||
@available(iOSApplicationExtension 14.0, iOS 14.0, *)
|
||||
struct AvatarItemView: View {
|
||||
var peer: ParsedPeer?
|
||||
var itemSize: CGFloat
|
||||
@ -417,6 +421,7 @@ struct AvatarItemView: View {
|
||||
}
|
||||
}
|
||||
|
||||
@available(iOSApplicationExtension 14.0, iOS 14.0, *)
|
||||
struct WidgetView: View {
|
||||
@Environment(\.widgetFamily) private var widgetFamily
|
||||
@Environment(\.colorScheme) private var colorScheme
|
||||
@ -855,6 +860,7 @@ struct WidgetView: View {
|
||||
}
|
||||
}
|
||||
|
||||
@available(iOSApplicationExtension 14.0, iOS 14.0, *)
|
||||
struct AvatarsWidgetView: View {
|
||||
@Environment(\.widgetFamily) private var widgetFamily
|
||||
@Environment(\.colorScheme) private var colorScheme
|
||||
@ -954,6 +960,7 @@ private let buildConfig: BuildConfig = {
|
||||
return buildConfig
|
||||
}()
|
||||
|
||||
@available(iOSApplicationExtension 14.0, iOS 14.0, *)
|
||||
func getWidgetData(contents: SimpleEntry.Contents) -> PeersWidgetData {
|
||||
switch contents {
|
||||
case .recent:
|
||||
@ -965,6 +972,7 @@ func getWidgetData(contents: SimpleEntry.Contents) -> PeersWidgetData {
|
||||
}
|
||||
}
|
||||
|
||||
@available(iOSApplicationExtension 14.0, iOS 14.0, *)
|
||||
struct Static_Widget: Widget {
|
||||
private let kind: String = "Static_Widget"
|
||||
|
||||
@ -980,6 +988,7 @@ struct Static_Widget: Widget {
|
||||
}
|
||||
}
|
||||
|
||||
@available(iOSApplicationExtension 14.0, iOS 14.0, *)
|
||||
struct Static_AvatarsWidget: Widget {
|
||||
private let kind: String = "Static_AvatarsWidget"
|
||||
|
||||
@ -996,6 +1005,17 @@ struct Static_AvatarsWidget: Widget {
|
||||
}
|
||||
|
||||
@main
|
||||
struct AllWidgetsEntryPoint {
|
||||
static func main() {
|
||||
if #available(iOS 14.0, *) {
|
||||
AllWidgets.main()
|
||||
} else {
|
||||
preconditionFailure()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@available(iOSApplicationExtension 14.0, iOS 14.0, *)
|
||||
struct AllWidgets: WidgetBundle {
|
||||
var body: some Widget {
|
||||
Static_Widget()
|
||||
@ -1003,4 +1023,13 @@ struct AllWidgets: WidgetBundle {
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
@main
|
||||
class MyApp {
|
||||
static func main() {
|
||||
preconditionFailure("Not supported")
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -114,7 +114,18 @@ class BazelCommandLine:
|
||||
self.configuration_path = path
|
||||
|
||||
def set_configuration(self, configuration):
|
||||
if configuration == 'debug_arm64':
|
||||
if configuration == 'debug_universal':
|
||||
self.configuration_args = [
|
||||
# bazel debug build configuration
|
||||
'-c', 'dbg',
|
||||
|
||||
# Build universal binaries.
|
||||
'--ios_multi_cpus=armv7,arm64',
|
||||
|
||||
# Always build universal Watch binaries.
|
||||
'--watchos_cpus=armv7k,arm64_32'
|
||||
] + self.common_debug_args
|
||||
elif configuration == 'debug_arm64':
|
||||
self.configuration_args = [
|
||||
# bazel debug build configuration
|
||||
'-c', 'dbg',
|
||||
@ -528,6 +539,7 @@ if __name__ == '__main__':
|
||||
buildParser.add_argument(
|
||||
'--configuration',
|
||||
choices=[
|
||||
'debug_universal',
|
||||
'debug_arm64',
|
||||
'debug_armv7',
|
||||
'release_arm64',
|
||||
|
@ -11,3 +11,4 @@ telegram_app_specific_url_scheme = "tg"
|
||||
telegram_aps_environment = "production"
|
||||
telegram_enable_siri = True
|
||||
telegram_enable_icloud = True
|
||||
telegram_enable_watch = True
|
Loading…
x
Reference in New Issue
Block a user