Skip to content

Commit

Permalink
Merge pull request #294 from Orderella/development
Browse files Browse the repository at this point in the history
Fixes crash when dialog is presented while app is in background
  • Loading branch information
mwfire authored Dec 2, 2018
2 parents 7543328 + 234f3ac commit c39ad2b
Show file tree
Hide file tree
Showing 9 changed files with 40 additions and 29 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Changelog

* **0.9.2** Fixes crash when presenting dialog while app is inactive
* **0.9.1** Fixes Carthage support
* **0.9.0** Swift 4.2 support
* **0.8.1** Added shadow appearance properties
Expand Down
8 changes: 4 additions & 4 deletions Example/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ PODS:
- FBSnapshotTestCase/SwiftSupport (2.1.4):
- FBSnapshotTestCase/Core
- Nimble (7.3.1)
- PopupDialog (0.9.1):
- PopupDialog (0.9.2):
- DynamicBlurView (~> 3.0.1)
- SwiftLint (0.27.0)
- SwiftLint (0.29.1)

DEPENDENCIES:
- FBSnapshotTestCase (~> 2.1.4)
Expand All @@ -31,8 +31,8 @@ SPEC CHECKSUMS:
DynamicBlurView: b1df5415f9bd31897549e5d7077e5ec120a4d636
FBSnapshotTestCase: 094f9f314decbabe373b87cc339bea235a63e07a
Nimble: 04f732da099ea4d153122aec8c2a88fd0c7219ae
PopupDialog: 2e2b7dcde4bd6d6ef62a8b6f4ea02c7fea2710cd
SwiftLint: 3207c1faa2240bf8973b191820a116113cd11073
PopupDialog: 262df853f60f779ec354244e83dbb47ce52ac32a
SwiftLint: 6772320e40b52049053a518c17db9b0634a0b45a

PODFILE CHECKSUM: 2d0166d1e20a1e39377fb316142d39a3785d58f2

Expand Down
4 changes: 2 additions & 2 deletions Example/Pods/Local Podspecs/PopupDialog.podspec.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions Example/Pods/Manifest.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified Example/Pods/SwiftLint/swiftlint
Binary file not shown.
2 changes: 1 addition & 1 deletion Example/Pods/Target Support Files/PopupDialog/Info.plist

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion PopupDialog.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'PopupDialog'
s.version = '0.9.1'
s.version = '0.9.2'
s.summary = 'A simple custom popup dialog view controller'
s.homepage = 'https://github.com/orderella/PopupDialog'
s.license = { :type => 'MIT', :file => 'LICENSE' }
Expand Down
43 changes: 26 additions & 17 deletions PopupDialog/Classes/TransitionAnimations.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,15 @@ final internal class BounceUpTransition: TransitionAnimator {
switch direction {
case .in:
to.view.bounds.origin = CGPoint(x: 0, y: -from.view.bounds.size.height)
UIView.animate(withDuration: 0.6, delay: 0.0, usingSpringWithDamping: 0.6, initialSpringVelocity: 0, options: [.curveEaseOut], animations: {
UIView.animate(withDuration: 0.6, delay: 0.0, usingSpringWithDamping: 0.6, initialSpringVelocity: 0, options: [.curveEaseOut], animations: { [weak self] in
guard let self = self else { return }
self.to.view.bounds = self.from.view.bounds
}, completion: { completed in
transitionContext.completeTransition(completed)
}, completion: { _ in
transitionContext.completeTransition(true)
})
case .out:
UIView.animate(withDuration: outDuration, delay: 0.0, options: [.curveEaseIn], animations: {
UIView.animate(withDuration: outDuration, delay: 0.0, options: [.curveEaseIn], animations: { [weak self] in
guard let self = self else { return }
self.from.view.bounds.origin = CGPoint(x: 0, y: -self.from.view.bounds.size.height)
self.from.view.alpha = 0.0
}, completion: { _ in
Expand All @@ -84,13 +86,15 @@ final internal class BounceDownTransition: TransitionAnimator {
switch direction {
case .in:
to.view.bounds.origin = CGPoint(x: 0, y: from.view.bounds.size.height)
UIView.animate(withDuration: 0.6, delay: 0.0, usingSpringWithDamping: 0.6, initialSpringVelocity: 0, options: [.curveEaseOut], animations: {
UIView.animate(withDuration: 0.6, delay: 0.0, usingSpringWithDamping: 0.6, initialSpringVelocity: 0, options: [.curveEaseOut], animations: { [weak self] in
guard let self = self else { return }
self.to.view.bounds = self.from.view.bounds
}, completion: { completed in
transitionContext.completeTransition(completed)
}, completion: { _ in
transitionContext.completeTransition(true)
})
case .out:
UIView.animate(withDuration: outDuration, delay: 0.0, options: [.curveEaseIn], animations: {
UIView.animate(withDuration: outDuration, delay: 0.0, options: [.curveEaseIn], animations: { [weak self] in
guard let self = self else { return }
self.from.view.bounds.origin = CGPoint(x: 0, y: self.from.view.bounds.size.height)
self.from.view.alpha = 0.0
}, completion: { _ in
Expand All @@ -113,13 +117,15 @@ final internal class ZoomTransition: TransitionAnimator {
switch direction {
case .in:
to.view.transform = CGAffineTransform(scaleX: 0.1, y: 0.1)
UIView.animate(withDuration: 0.6, delay: 0.0, usingSpringWithDamping: 0.6, initialSpringVelocity: 0, options: [.curveEaseOut], animations: {
UIView.animate(withDuration: 0.6, delay: 0.0, usingSpringWithDamping: 0.6, initialSpringVelocity: 0, options: [.curveEaseOut], animations: { [weak self] in
guard let self = self else { return }
self.to.view.transform = CGAffineTransform(scaleX: 1, y: 1)
}, completion: { completed in
transitionContext.completeTransition(completed)
}, completion: { _ in
transitionContext.completeTransition(true)
})
case .out:
UIView.animate(withDuration: outDuration, delay: 0.0, options: [.curveEaseIn], animations: {
UIView.animate(withDuration: outDuration, delay: 0.0, options: [.curveEaseIn], animations: { [weak self] in
guard let self = self else { return }
self.from.view.transform = CGAffineTransform(scaleX: 0.1, y: 0.1)
self.from.view.alpha = 0.0
}, completion: { _ in
Expand All @@ -143,13 +149,15 @@ final internal class FadeTransition: TransitionAnimator {
case .in:
to.view.alpha = 0
UIView.animate(withDuration: 0.6, delay: 0.0, options: [.curveEaseOut],
animations: {
animations: { [weak self] in
guard let self = self else { return }
self.to.view.alpha = 1
}, completion: { completed in
transitionContext.completeTransition(completed)
}, completion: { _ in
transitionContext.completeTransition(true)
})
case .out:
UIView.animate(withDuration: outDuration, delay: 0.0, options: [.curveEaseIn], animations: {
UIView.animate(withDuration: outDuration, delay: 0.0, options: [.curveEaseIn], animations: { [weak self] in
guard let self = self else { return }
self.from.view.alpha = 0.0
}, completion: { _ in
transitionContext.completeTransition(!transitionContext.transitionWasCancelled)
Expand All @@ -167,7 +175,8 @@ final internal class DismissInteractiveTransition: TransitionAnimator {

override func animateTransition(using transitionContext: UIViewControllerContextTransitioning) {
super.animateTransition(using: transitionContext)
UIView.animate(withDuration: outDuration, delay: 0.0, options: [.beginFromCurrentState], animations: {
UIView.animate(withDuration: outDuration, delay: 0.0, options: [.beginFromCurrentState], animations: { [weak self] in
guard let self = self else { return }
self.from.view.bounds.origin = CGPoint(x: 0, y: -self.from.view.bounds.size.height)
self.from.view.alpha = 0.0
}, completion: { _ in
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,7 @@ Minimum requirement is iOS 9.0. This dialog was written with Swift 4, for suppor
<p>&nbsp;</p>
# Changelog
* **0.9.2** Fixes crash when presenting dialog while app is inactive
* **0.9.1** Fixes Carthage support
* **0.9.0** Swift 4.2 support
* **0.8.1** Added shadow appearance properties
Expand Down

0 comments on commit c39ad2b

Please sign in to comment.