Skip to content

Commit 9df0dd6

Browse files
committed
Fixed denied alert logic for dialog style.
1 parent 3c29297 commit 9df0dd6

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

Sources/SPPermissions/Interface/Dialog Style/SPPermissionsDialogController.swift

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ public class SPPermissionsDialogController: UIViewController, SPPermissionsContr
155155

156156
@objc func process(button: SPPermissionsActionButton) {
157157
guard let permission = button.permission else { return }
158+
let firstRequest = permission.status == .notDetermined
158159
permission.request { [weak self] in
159160

160161
guard let self = self else { return }
@@ -191,12 +192,15 @@ public class SPPermissionsDialogController: UIViewController, SPPermissionsContr
191192
} else {
192193
self.delegate?.didDeniedPermission(permission)
193194

194-
// Delay using for fix animation freeze.
195+
if !firstRequest {
196+
197+
// Delay using for fix animation freeze.
198+
Delay.wait(0.3, closure: { [weak self] in
199+
guard let self = self else { return }
200+
Presenter.presentAlertAboutDeniedPermission(permission, dataSource: self.dataSource, on: self)
201+
})
202+
}
195203

196-
Delay.wait(0.3, closure: { [weak self] in
197-
guard let self = self else { return }
198-
Presenter.presentAlertAboutDeniedPermission(permission, dataSource: self.dataSource, on: self)
199-
})
200204
}
201205
}
202206
}

0 commit comments

Comments
 (0)