From c03d81d2aa8b12f12c9ad218cd89a0b61d67b828 Mon Sep 17 00:00:00 2001 From: Alexander Ivlev Date: Mon, 17 Jun 2019 23:07:50 +0700 Subject: [PATCH] Add name for result required permissions --- TelegramUI/Permission.swift | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/TelegramUI/Permission.swift b/TelegramUI/Permission.swift index bf651b46..c1dfc27d 100644 --- a/TelegramUI/Permission.swift +++ b/TelegramUI/Permission.swift @@ -63,9 +63,14 @@ public enum PermissionState: Equatable { } } -public func requiredPermissions(context: AccountContext) -> Signal<(PermissionState, PermissionState, PermissionState), NoError> { - return combineLatest(DeviceAccess.authorizationStatus(context: context, subject: .contacts), DeviceAccess.authorizationStatus(context: context, subject: .notifications), DeviceAccess.authorizationStatus(context: context, subject: .siri)) +public typealias RequiredPermissionsResult = (contactsState: PermissionState, notificationsState: PermissionState, siriState: PermissionState) +public func requiredPermissions(context: AccountContext) -> Signal { + return combineLatest(DeviceAccess.authorizationStatus(context: context, subject: .contacts), + DeviceAccess.authorizationStatus(context: context, subject: .notifications), + DeviceAccess.authorizationStatus(context: context, subject: .siri)) |> map { contactsStatus, notificationsStatus, siriStatus in - return (.contacts(status: PermissionRequestStatus(accessType: contactsStatus)), .notifications(status: PermissionRequestStatus(accessType: notificationsStatus)), .siri(status: PermissionRequestStatus(accessType: siriStatus))) + return (.contacts(status: PermissionRequestStatus(accessType: contactsStatus)), + .notifications(status: PermissionRequestStatus(accessType: notificationsStatus)), + .siri(status: PermissionRequestStatus(accessType: siriStatus))) } }