Skip to content

Commit

Permalink
Fixed layout bug for dialog for iOS 12.
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanvorobei committed Nov 1, 2021
1 parent ff646f1 commit e28d19d
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 3 deletions.
Binary file not shown.
5 changes: 3 additions & 2 deletions Example Apps/iOS Example/Scenes/RootController.swift
Expand Up @@ -90,8 +90,9 @@ class RootController: SPTableViewController {
let controller = SPPermissions.dialog(selectedPermissions)
controller.dataSource = self
controller.delegate = self
// controller.allowSwipeDismiss = true
// controller.showCloseButton = true
//controller.bounceAnimationEnabled = false
//controller.allowSwipeDismiss = true
//controller.showCloseButton = true
controller.present(on: self)
case 2:
let controller = SPPermissions.native(selectedPermissions)
Expand Down
2 changes: 1 addition & 1 deletion SPPermissions.podspec
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|

s.name = "SPPermissions"
s.version = "6.8.0"
s.version = "6.8.1"
s.summary = "Ask permissions on Swift. Available List, Dialog & Native interface. Can check state permission."
s.homepage = "https://github.com/ivanvorobei/SPPermissions"
s.source = { :git => "https://github.com/ivanvorobei/SPPermissions.git", :tag => s.version }
Expand Down
Expand Up @@ -113,6 +113,25 @@ public class SPPermissionsDialogController: UIViewController, SPPermissionsContr
NotificationCenter.default.addObserver(self, selector: #selector(self.applicationDidBecomeActive), name: UIApplication.didBecomeActiveNotification, object: nil)
}

public override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)

/**
Special layout call becouse table hasn't valid content size before appear for early ios 12 and lower.
Happen only if `bounceAnimationEnabled` set to false.
Related issue on github: https://github.com/ivanvorobei/SPPermissions/issues/262
*/
if !bounceAnimationEnabled {
if #available(iOS 13, *) {
// All good for iOS 13+
} else {
DelayService.wait(0.2, closure: {
self.dialogView.layout(in: self.view)
})
}
}
}

@objc func applicationDidBecomeActive() {
dialogView.tableView.reloadData()
}
Expand Down

0 comments on commit e28d19d

Please sign in to comment.