Update submodules

This commit is contained in:
Ilya Laktyushin 2018-12-04 22:30:19 +04:00
parent 2343e898a2
commit 3a2e04ef67
8 changed files with 123 additions and 33 deletions

View File

@ -130,7 +130,7 @@ class ShareRootController: UIViewController {
}, applicationInForeground: .single(false), applicationIsActive: .single(false), clearMessageNotifications: { _ in
}, pushIdleTimerExtension: {
return EmptyDisposable
}, openSettings: {}, openAppStorePage: {}, registerForNotifications: {}, getWindowHost: {
}, openSettings: {}, openAppStorePage: {}, registerForNotifications: { _ in }, getWindowHost: {
return nil
}, presentNativeController: { _ in
}, dismissNativeController: {

View File

@ -594,7 +594,7 @@ private enum QueuedWakeup: Int32 {
if let url = URL(string: "itms-apps://itunes.apple.com/app/id\(appStoreId)") {
UIApplication.shared.openURL(url)
}
}, registerForNotifications: {
}, registerForNotifications: { completion in
let _ = (self.currentAuthorizedContext()
|> take(1)
|> deliverOnMainQueue).start(next: { context in

View File

@ -183,8 +183,9 @@ final class AuthorizedApplicationContext {
private let inAppNotificationSettingsDisposable = MetaDisposable()
private let notificationMessagesDisposable = MetaDisposable()
private let termsOfServiceUpdatesDisposable = MetaDisposable()
private let proccedTOSBotDisposable = MetaDisposable()
private var watchNavigateToMessageDisposable = MetaDisposable()
private let termsOfServiceProceedToBotDisposable = MetaDisposable()
private let watchNavigateToMessageDisposable = MetaDisposable()
private let permissionsDisposable = MetaDisposable()
private var inAppNotificationSettings: InAppNotificationSettings?
@ -195,7 +196,7 @@ final class AuthorizedApplicationContext {
private let callState = Promise<PresentationCallState?>(nil)
private var currentTermsOfServiceUpdate: TermsOfServiceUpdate?
private var currentTermsOfServiceUpdateController: TermsOfServiceController?
private var currentPermissionsController: PermissionController?
private let unlockedStatePromise = Promise<Bool>()
var unlockedState: Signal<Bool, NoError> {
@ -743,17 +744,11 @@ final class AuthorizedApplicationContext {
self.termsOfServiceUpdatesDisposable.set((account.stateManager.termsOfServiceUpdate
|> deliverOnMainQueue).start(next: { [weak self] termsOfServiceUpdate in
guard let strongSelf = self else {
return
}
if strongSelf.currentTermsOfServiceUpdate == termsOfServiceUpdate {
guard let strongSelf = self, strongSelf.currentTermsOfServiceUpdate != termsOfServiceUpdate else {
return
}
strongSelf.currentTermsOfServiceUpdate = termsOfServiceUpdate
strongSelf.currentTermsOfServiceUpdateController?.dismiss()
strongSelf.currentTermsOfServiceUpdateController = nil
if let termsOfServiceUpdate = termsOfServiceUpdate {
let presentationData = strongSelf.applicationContext.currentPresentationData.with { $0 }
var acceptImpl: ((String?) -> Void)?
@ -777,7 +772,7 @@ final class AuthorizedApplicationContext {
|> deliverOnMainQueue).start(completed: {
controller?.dismiss()
if let botName = botName {
self?.proccedTOSBotDisposable.set((resolvePeerByName(account: account, name: botName, ageLimit: 10) |> take(1) |> deliverOnMainQueue).start(next: { peerId in
self?.termsOfServiceProceedToBotDisposable.set((resolvePeerByName(account: account, name: botName, ageLimit: 10) |> take(1) |> deliverOnMainQueue).start(next: { peerId in
if let peerId = peerId {
self?.rootController.pushViewController(ChatController(account: account, chatLocation: .peer(peerId), messageId: nil))
}
@ -802,6 +797,98 @@ final class AuthorizedApplicationContext {
}
}))
let permissionsPosition = ValuePromise(0, ignoreRepeated: true)
self.permissionsDisposable.set((combineLatest(requiredPermissions(account: account), permissionUISplitTest(postbox: account.postbox), permissionsPosition.get())
|> deliverOnMainQueue).start(next: { [weak self] contactsAndNotifications, splitTest, position in
guard let strongSelf = self else {
return
}
let config = splitTest.configuration
var states: [(PermissionState, Bool)] = []
var i: Int = 0
for subject in config.order {
if i < position {
i += 1
continue
}
var modal = false
switch subject {
case .contacts:
if case .modal = config.contacts {
modal = true
}
if case .requestable = contactsAndNotifications.0.status {
states.append((contactsAndNotifications.0, modal))
}
case .notifications:
if case .modal = config.notifications {
modal = true
}
if case .requestable = contactsAndNotifications.1.status {
states.append((contactsAndNotifications.1, modal))
}
default:
break
}
i += 1
}
if let (state, modal) = states.first {
if modal {
if let controller = strongSelf.currentPermissionsController {
controller.setState(state, animated: true)
controller.proceed = {
permissionsPosition.set(position + 1)
}
} else {
let controller = PermissionController(account: account, splitTest: splitTest)
strongSelf.currentPermissionsController = controller
controller.setState(state, animated: false)
controller.proceed = {
permissionsPosition.set(position + 1)
}
dispatch_after_delay(0.15, DispatchQueue.main, {
(strongSelf.rootController.viewControllers.last as? ViewController)?.present(controller, in: .window(.root), with: ViewControllerPresentationArguments.init(presentationAnimation: .modalSheet))
})
}
} else {
switch state {
case .contacts:
splitTest.addEvent(.ContactsRequest)
DeviceAccess.authorizeAccess(to: .contacts) { result in
if result {
splitTest.addEvent(.ContactsAllowed)
} else {
splitTest.addEvent(.ContactsDenied)
}
permissionsPosition.set(position + 1)
}
case .notifications:
splitTest.addEvent(.NotificationsRequest)
DeviceAccess.authorizeAccess(to: .notifications) { result in
if result {
splitTest.addEvent(.NotificationsAllowed)
} else {
splitTest.addEvent(.NotificationsDenied)
}
permissionsPosition.set(position + 1)
}
default:
break
}
}
} else {
if let controller = strongSelf.currentPermissionsController {
controller.dismiss(completion: { [weak self] in
if let strongSelf = self {
strongSelf.currentPermissionsController = nil
}
})
}
}
}))
self.displayAlertsDisposable = (account.stateManager.displayAlerts |> deliverOnMainQueue).start(next: { [weak self] alerts in
if let strongSelf = self{
for text in alerts {
@ -1017,8 +1104,9 @@ final class AuthorizedApplicationContext {
self.currentCallStatusTextTimer?.invalidate()
self.presentationDataDisposable?.dispose()
self.enablePostboxTransactionsDiposable?.dispose()
self.proccedTOSBotDisposable.dispose()
self.termsOfServiceProceedToBotDisposable.dispose()
self.watchNavigateToMessageDisposable.dispose()
self.permissionsDisposable.dispose()
}
func openChatWithPeerId(peerId: PeerId, messageId: MessageId? = nil) {

View File

@ -79,7 +79,7 @@ func snapshotEnvironment(application: UIApplication, mainWindow: UIWindow, statu
return EmptyDisposable
}, openSettings: {
}, openAppStorePage: {
}, registerForNotifications: {
}, registerForNotifications: { _ in
}, getWindowHost: {
return nil
}, presentNativeController: { _ in

View File

@ -3546,24 +3546,25 @@ Unused sets are archived when you add more.";
"Permissions.Skip" = "Skip";
"Permissions.ContactsTitle" = "Sync Your Contacts";
"Permissions.ContactsText" = "See who's on Telegram and switch seamlessly, without having to \"add\" your friends.";
"Permissions.ContactsAllow" = "Allow Access";
"Permissions.ContactsAllowInSettings" = "Allow in Settings";
"Permissions.ContactsTitle.v0" = "Sync Your Contacts";
"Permissions.ContactsText.v0" = "See who's on Telegram and switch seamlessly, without having to \"add\" your friends.";
"Permissions.ContactsAllow.v0" = "Allow Access";
"Permissions.ContactsAllowInSettings.v0" = "Allow in Settings";
"Permissions.NotificationsTitle" = "Turn ON Notifications";
"Permissions.NotificationsText" = "Don't miss important messages from your friends and coworkers.";
"Permissions.NotificationsAllow" = "Turn Notifications ON";
"Permissions.NotificationsAllowInSettings" = "Turn ON in Settings";
"Permissions.NotificationsTitle.v0" = "Turn ON Notifications";
"Permissions.NotificationsText.v0" = "Don't miss important messages from your friends and coworkers.";
"Permissions.NotificationsUnreachableText.v0" = "Check that both Alert and Sound are enabled in Settings.";
"Permissions.NotificationsAllow.v0" = "Turn Notifications ON";
"Permissions.NotificationsAllowInSettings.v0" = "Turn ON in Settings";
"Permissions.CellularDataTitle" = "Turn ON Notifications";
"Permissions.CellularDataText" = "Don't worry, Telegram keeps network usage to a minimum. You can further control this in Settings > Data and Storage.";
"Permissions.CellularDataAllowInSettings" = "Turn ON in Settings";
"Permissions.CellularDataTitle.v0" = "Turn ON Notifications";
"Permissions.CellularDataText.v0" = "Don't worry, Telegram keeps network usage to a minimum. You can further control this in Settings > Data and Storage.";
"Permissions.CellularDataAllowInSettings.v0" = "Turn ON in Settings";
"Permissions.SiriTitle" = "Turn ON Siri";
"Permissions.SiriText" = "Use Siri to send messages and make calls.";
"Permissions.SiriAllow" = "Turn Siri ON";
"Permissions.SiriAllowInSettings" = "Turn ON in Settings";
"Permissions.SiriTitle.v0" = "Turn ON Siri";
"Permissions.SiriText.v0" = "Use Siri to send messages and make calls.";
"Permissions.SiriAllow.v0" = "Turn Siri ON";
"Permissions.SiriAllowInSettings.v0" = "Turn ON in Settings";
"Permissions.PrivacyPolicy" = "Privacy Policy";
@ -3574,5 +3575,6 @@ Unused sets are archived when you add more.";
"Notifications.PermissionsTitle" = "Turn ON Notifications";
"Notifications.PermissionsText" = "Don't miss important messages from your friends and coworkers.";
"Notifications.PermissionsUnreachableText" = "Check that both Alert and Sound are enabled in Settings.";
"Notifications.PermissionsAllow" = "Turn Notifications ON";
"Notifications.PermissionsAllowInSettings" = "Turn ON in Settings";

@ -1 +1 @@
Subproject commit 7dbc5b2e78119a24f26c2888030d861e6ff07d45
Subproject commit c8a85704654a263d5d389339adb612a16c589309

@ -1 +1 @@
Subproject commit e8b5a8e807c186a3994dc6211e746bed61009090
Subproject commit 37c72419743b7be8a6f82ddcbbc58516ed07e3b0

@ -1 +1 @@
Subproject commit 2579de5d1d22d37fd92e6d1a038da36f09bf2be2
Subproject commit 7c850a413fcfb5e5b6237a6cf4b9d22691d51e1d