Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory leak and app crash fixes #10

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions Notchy/View Controllers/WelcomeViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,17 @@ final class WelcomeViewController: UIViewController {

@objc func selectScreenshotButtonDidTouchUpInside(_ sender: Any) {
PHPhotoLibrary.requestAuthorization { [unowned self] status in
switch status {
case .notDetermined, .restricted, .denied:
let alert = UIAlertController(title: "Photo Library Inaccessible", message: "Notchy couldn't read your photo library.", preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "OK", style: .default, handler: nil))
self.present(alert, animated: true, completion: nil)

case .authorized:
let navigation = NotchyNavigationController(rootViewController: GridViewController())
self.present(navigation, animated: true, completion: nil)
DispatchQueue.main.async {
switch status {
case .notDetermined, .restricted, .denied:
let alert = UIAlertController(title: "Photo Library Inaccessible", message: "Notchy couldn't read your photo library.", preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "OK", style: .default, handler: nil))
self.present(alert, animated: true, completion: nil)

case .authorized:
let navigation = NotchyNavigationController(rootViewController: GridViewController())
self.present(navigation, animated: true, completion: nil)
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion Notchy/Views/NotchyToolbar.swift
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ final class CheckmarkView: UIStackView {
}

final class NotchyToolbar: UIView {
@objc private var delegate: NotchyToolbarDelegate!
@objc private weak var delegate: NotchyToolbarDelegate?

private var shareButton: PlainButton!
private var saveButton: ShortPlainButton!
Expand Down