mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Update submodules
This commit is contained in:
parent
0a9216d639
commit
6d7207bd06
@ -130,7 +130,7 @@ class ShareRootController: UIViewController {
|
||||
}, applicationInForeground: .single(false), applicationIsActive: .single(false), clearMessageNotifications: { _ in
|
||||
}, pushIdleTimerExtension: {
|
||||
return EmptyDisposable
|
||||
}, openSettings: {}, openAppStorePage: {}, registerForNotifications: { _ in }, getWindowHost: {
|
||||
}, openSettings: {}, openAppStorePage: {}, registerForNotifications: { _ in }, requestSiriAuthorization: { _ in }, siriAuthorization: { return .notDetermined }, getWindowHost: {
|
||||
return nil
|
||||
}, presentNativeController: { _ in
|
||||
}, dismissNativeController: {
|
||||
|
@ -602,6 +602,31 @@ private enum QueuedWakeup: Int32 {
|
||||
self.registerForNotifications(account: context.account, authorize: true, completion: completion)
|
||||
}
|
||||
})
|
||||
}, requestSiriAuthorization: { completion in
|
||||
if #available(iOS 10, *) {
|
||||
INPreferences.requestSiriAuthorization { status in
|
||||
if case .authorized = status {
|
||||
completion(true)
|
||||
} else {
|
||||
completion(false)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
completion(false)
|
||||
}
|
||||
}, siriAuthorization: {
|
||||
if #available(iOS 10, *) {
|
||||
switch INPreferences.siriAuthorizationStatus() {
|
||||
case .authorized:
|
||||
return .allowed
|
||||
case .denied, .restricted:
|
||||
return .denied
|
||||
case .notDetermined:
|
||||
return .notDetermined
|
||||
}
|
||||
} else {
|
||||
return .denied
|
||||
}
|
||||
}, getWindowHost: {
|
||||
return self.nativeWindow
|
||||
}, presentNativeController: { controller in
|
||||
|
@ -588,8 +588,6 @@ final class AuthorizedApplicationContext {
|
||||
}
|
||||
|
||||
if #available(iOS 10.0, *) {
|
||||
INPreferences.requestSiriAuthorization { _ in
|
||||
}
|
||||
} else {
|
||||
DeviceAccess.authorizeAccess(to: .contacts, presentationData: strongSelf.account.telegramApplicationContext.currentPresentationData.with { $0 }, present: { c, a in
|
||||
}, openSettings: {}, { _ in })
|
||||
@ -805,24 +803,28 @@ final class AuthorizedApplicationContext {
|
||||
|
||||
let permissionsPosition = ValuePromise(0, ignoreRepeated: true)
|
||||
self.permissionsDisposable.set((combineLatest(requiredPermissions(account: account), permissionUISplitTest(postbox: account.postbox), permissionsPosition.get(), account.postbox.combinedView(keys: [.noticeEntry(ApplicationSpecificNotice.contactsPermissionWarningKey()), .noticeEntry(ApplicationSpecificNotice.notificationsPermissionWarningKey())]))
|
||||
|> deliverOnMainQueue).start(next: { [weak self] contactsAndNotifications, splitTest, position, combined in
|
||||
|> deliverOnMainQueue).start(next: { [weak self] required, splitTest, position, combined in
|
||||
guard let strongSelf = self else {
|
||||
return
|
||||
}
|
||||
|
||||
let contactsTimestamp = (combined.views[.noticeEntry(ApplicationSpecificNotice.contactsPermissionWarningKey())] as? NoticeEntryView)?.value.flatMap({ ApplicationSpecificNotice.getTimestampValue($0) })
|
||||
let notificationsTimestamp = (combined.views[.noticeEntry(ApplicationSpecificNotice.notificationsPermissionWarningKey())] as? NoticeEntryView)?.value.flatMap({ ApplicationSpecificNotice.getTimestampValue($0) })
|
||||
if contactsTimestamp == nil, case .requestable = contactsAndNotifications.0.status {
|
||||
if contactsTimestamp == nil, case .requestable = required.0.status {
|
||||
ApplicationSpecificNotice.setContactsPermissionWarning(postbox: account.postbox, value: 1)
|
||||
}
|
||||
if notificationsTimestamp == nil, case .requestable = contactsAndNotifications.1.status {
|
||||
if notificationsTimestamp == nil, case .requestable = required.1.status {
|
||||
ApplicationSpecificNotice.setNotificationsPermissionWarning(postbox: account.postbox, value: 1)
|
||||
}
|
||||
|
||||
let config = splitTest.configuration
|
||||
var order = config.order
|
||||
if !order.contains(.siri) {
|
||||
order.append(.siri)
|
||||
}
|
||||
var requestedPermissions: [(PermissionState, Bool)] = []
|
||||
var i: Int = 0
|
||||
for subject in config.order {
|
||||
for subject in order {
|
||||
if i < position {
|
||||
i += 1
|
||||
continue
|
||||
@ -833,15 +835,19 @@ final class AuthorizedApplicationContext {
|
||||
if case .modal = config.contacts {
|
||||
modal = true
|
||||
}
|
||||
if case .requestable = contactsAndNotifications.0.status, contactsTimestamp != 0 {
|
||||
requestedPermissions.append((contactsAndNotifications.0, modal || alwaysModal))
|
||||
if case .requestable = required.0.status, contactsTimestamp != 0 {
|
||||
requestedPermissions.append((required.0, modal || alwaysModal))
|
||||
}
|
||||
case .notifications:
|
||||
if case .modal = config.notifications {
|
||||
modal = true
|
||||
}
|
||||
if case .requestable = contactsAndNotifications.1.status, notificationsTimestamp != 0 {
|
||||
requestedPermissions.append((contactsAndNotifications.1, modal || alwaysModal))
|
||||
if case .requestable = required.1.status, notificationsTimestamp != 0 {
|
||||
requestedPermissions.append((required.1, modal || alwaysModal))
|
||||
}
|
||||
case .siri:
|
||||
if case .requestable = required.2.status {
|
||||
requestedPermissions.append((required.2, false))
|
||||
}
|
||||
default:
|
||||
break
|
||||
@ -902,7 +908,11 @@ final class AuthorizedApplicationContext {
|
||||
}
|
||||
permissionsPosition.set(position + 1)
|
||||
ApplicationSpecificNotice.setNotificationsPermissionWarning(postbox: account.postbox, value: 0)
|
||||
}
|
||||
}
|
||||
case .siri:
|
||||
DeviceAccess.authorizeAccess(to: .siri, account: account) { result in
|
||||
permissionsPosition.set(position + 1)
|
||||
}
|
||||
default:
|
||||
break
|
||||
}
|
||||
@ -910,8 +920,7 @@ final class AuthorizedApplicationContext {
|
||||
} else {
|
||||
if let controller = strongSelf.currentPermissionsController {
|
||||
strongSelf.currentPermissionsController = nil
|
||||
controller.dismiss(completion: {
|
||||
})
|
||||
controller.dismiss(completion: {})
|
||||
}
|
||||
}
|
||||
}))
|
||||
|
@ -80,7 +80,7 @@ func snapshotEnvironment(application: UIApplication, mainWindow: UIWindow, statu
|
||||
}, openSettings: {
|
||||
}, openAppStorePage: {
|
||||
}, registerForNotifications: { _ in
|
||||
}, getWindowHost: {
|
||||
}, requestSiriAuthorization: { _ in }, siriAuthorization: { return .notDetermined }, getWindowHost: {
|
||||
return nil
|
||||
}, presentNativeController: { _ in
|
||||
}, dismissNativeController: {
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit ccfa2e2f8381bcca126abba8de3fb326dfb168fc
|
||||
Subproject commit f161e2a23a48fd7526a9a94116edc8237d803a20
|
@ -1 +1 @@
|
||||
Subproject commit e4941e6e21ff63b18fa461e1aed3c6d8324731ab
|
||||
Subproject commit 85effd85fa42116c6d227f92bf29f3f84416b5bc
|
Loading…
x
Reference in New Issue
Block a user