Skip to content

Commit c39ad2b

Browse files
authored
Merge pull request #294 from Orderella/development
Fixes crash when dialog is presented while app is in background
2 parents 7543328 + 234f3ac commit c39ad2b

File tree

9 files changed

+40
-29
lines changed

9 files changed

+40
-29
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Changelog
22

3+
* **0.9.2** Fixes crash when presenting dialog while app is inactive
34
* **0.9.1** Fixes Carthage support
45
* **0.9.0** Swift 4.2 support
56
* **0.8.1** Added shadow appearance properties

Example/Podfile.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ PODS:
66
- FBSnapshotTestCase/SwiftSupport (2.1.4):
77
- FBSnapshotTestCase/Core
88
- Nimble (7.3.1)
9-
- PopupDialog (0.9.1):
9+
- PopupDialog (0.9.2):
1010
- DynamicBlurView (~> 3.0.1)
11-
- SwiftLint (0.27.0)
11+
- SwiftLint (0.29.1)
1212

1313
DEPENDENCIES:
1414
- FBSnapshotTestCase (~> 2.1.4)
@@ -31,8 +31,8 @@ SPEC CHECKSUMS:
3131
DynamicBlurView: b1df5415f9bd31897549e5d7077e5ec120a4d636
3232
FBSnapshotTestCase: 094f9f314decbabe373b87cc339bea235a63e07a
3333
Nimble: 04f732da099ea4d153122aec8c2a88fd0c7219ae
34-
PopupDialog: 2e2b7dcde4bd6d6ef62a8b6f4ea02c7fea2710cd
35-
SwiftLint: 3207c1faa2240bf8973b191820a116113cd11073
34+
PopupDialog: 262df853f60f779ec354244e83dbb47ce52ac32a
35+
SwiftLint: 6772320e40b52049053a518c17db9b0634a0b45a
3636

3737
PODFILE CHECKSUM: 2d0166d1e20a1e39377fb316142d39a3785d58f2
3838

Example/Pods/Local Podspecs/PopupDialog.podspec.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Example/Pods/Manifest.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Example/Pods/SwiftLint/swiftlint

1010 KB
Binary file not shown.

Example/Pods/Target Support Files/PopupDialog/Info.plist

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

PopupDialog.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = 'PopupDialog'
3-
s.version = '0.9.1'
3+
s.version = '0.9.2'
44
s.summary = 'A simple custom popup dialog view controller'
55
s.homepage = 'https://github.com/orderella/PopupDialog'
66
s.license = { :type => 'MIT', :file => 'LICENSE' }

PopupDialog/Classes/TransitionAnimations.swift

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,15 @@ final internal class BounceUpTransition: TransitionAnimator {
5454
switch direction {
5555
case .in:
5656
to.view.bounds.origin = CGPoint(x: 0, y: -from.view.bounds.size.height)
57-
UIView.animate(withDuration: 0.6, delay: 0.0, usingSpringWithDamping: 0.6, initialSpringVelocity: 0, options: [.curveEaseOut], animations: {
57+
UIView.animate(withDuration: 0.6, delay: 0.0, usingSpringWithDamping: 0.6, initialSpringVelocity: 0, options: [.curveEaseOut], animations: { [weak self] in
58+
guard let self = self else { return }
5859
self.to.view.bounds = self.from.view.bounds
59-
}, completion: { completed in
60-
transitionContext.completeTransition(completed)
60+
}, completion: { _ in
61+
transitionContext.completeTransition(true)
6162
})
6263
case .out:
63-
UIView.animate(withDuration: outDuration, delay: 0.0, options: [.curveEaseIn], animations: {
64+
UIView.animate(withDuration: outDuration, delay: 0.0, options: [.curveEaseIn], animations: { [weak self] in
65+
guard let self = self else { return }
6466
self.from.view.bounds.origin = CGPoint(x: 0, y: -self.from.view.bounds.size.height)
6567
self.from.view.alpha = 0.0
6668
}, completion: { _ in
@@ -84,13 +86,15 @@ final internal class BounceDownTransition: TransitionAnimator {
8486
switch direction {
8587
case .in:
8688
to.view.bounds.origin = CGPoint(x: 0, y: from.view.bounds.size.height)
87-
UIView.animate(withDuration: 0.6, delay: 0.0, usingSpringWithDamping: 0.6, initialSpringVelocity: 0, options: [.curveEaseOut], animations: {
89+
UIView.animate(withDuration: 0.6, delay: 0.0, usingSpringWithDamping: 0.6, initialSpringVelocity: 0, options: [.curveEaseOut], animations: { [weak self] in
90+
guard let self = self else { return }
8891
self.to.view.bounds = self.from.view.bounds
89-
}, completion: { completed in
90-
transitionContext.completeTransition(completed)
92+
}, completion: { _ in
93+
transitionContext.completeTransition(true)
9194
})
9295
case .out:
93-
UIView.animate(withDuration: outDuration, delay: 0.0, options: [.curveEaseIn], animations: {
96+
UIView.animate(withDuration: outDuration, delay: 0.0, options: [.curveEaseIn], animations: { [weak self] in
97+
guard let self = self else { return }
9498
self.from.view.bounds.origin = CGPoint(x: 0, y: self.from.view.bounds.size.height)
9599
self.from.view.alpha = 0.0
96100
}, completion: { _ in
@@ -113,13 +117,15 @@ final internal class ZoomTransition: TransitionAnimator {
113117
switch direction {
114118
case .in:
115119
to.view.transform = CGAffineTransform(scaleX: 0.1, y: 0.1)
116-
UIView.animate(withDuration: 0.6, delay: 0.0, usingSpringWithDamping: 0.6, initialSpringVelocity: 0, options: [.curveEaseOut], animations: {
120+
UIView.animate(withDuration: 0.6, delay: 0.0, usingSpringWithDamping: 0.6, initialSpringVelocity: 0, options: [.curveEaseOut], animations: { [weak self] in
121+
guard let self = self else { return }
117122
self.to.view.transform = CGAffineTransform(scaleX: 1, y: 1)
118-
}, completion: { completed in
119-
transitionContext.completeTransition(completed)
123+
}, completion: { _ in
124+
transitionContext.completeTransition(true)
120125
})
121126
case .out:
122-
UIView.animate(withDuration: outDuration, delay: 0.0, options: [.curveEaseIn], animations: {
127+
UIView.animate(withDuration: outDuration, delay: 0.0, options: [.curveEaseIn], animations: { [weak self] in
128+
guard let self = self else { return }
123129
self.from.view.transform = CGAffineTransform(scaleX: 0.1, y: 0.1)
124130
self.from.view.alpha = 0.0
125131
}, completion: { _ in
@@ -143,13 +149,15 @@ final internal class FadeTransition: TransitionAnimator {
143149
case .in:
144150
to.view.alpha = 0
145151
UIView.animate(withDuration: 0.6, delay: 0.0, options: [.curveEaseOut],
146-
animations: {
152+
animations: { [weak self] in
153+
guard let self = self else { return }
147154
self.to.view.alpha = 1
148-
}, completion: { completed in
149-
transitionContext.completeTransition(completed)
155+
}, completion: { _ in
156+
transitionContext.completeTransition(true)
150157
})
151158
case .out:
152-
UIView.animate(withDuration: outDuration, delay: 0.0, options: [.curveEaseIn], animations: {
159+
UIView.animate(withDuration: outDuration, delay: 0.0, options: [.curveEaseIn], animations: { [weak self] in
160+
guard let self = self else { return }
153161
self.from.view.alpha = 0.0
154162
}, completion: { _ in
155163
transitionContext.completeTransition(!transitionContext.transitionWasCancelled)
@@ -167,7 +175,8 @@ final internal class DismissInteractiveTransition: TransitionAnimator {
167175

168176
override func animateTransition(using transitionContext: UIViewControllerContextTransitioning) {
169177
super.animateTransition(using: transitionContext)
170-
UIView.animate(withDuration: outDuration, delay: 0.0, options: [.beginFromCurrentState], animations: {
178+
UIView.animate(withDuration: outDuration, delay: 0.0, options: [.beginFromCurrentState], animations: { [weak self] in
179+
guard let self = self else { return }
171180
self.from.view.bounds.origin = CGPoint(x: 0, y: -self.from.view.bounds.size.height)
172181
self.from.view.alpha = 0.0
173182
}, completion: { _ in

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,7 @@ Minimum requirement is iOS 9.0. This dialog was written with Swift 4, for suppor
446446
<p>&nbsp;</p>
447447
448448
# Changelog
449+
* **0.9.2** Fixes crash when presenting dialog while app is inactive
449450
* **0.9.1** Fixes Carthage support
450451
* **0.9.0** Swift 4.2 support
451452
* **0.8.1** Added shadow appearance properties

0 commit comments

Comments
 (0)