Skip to content

Commit 4df5fec

Browse files
committed
Added new mechanism to present a UIAlertController
1 parent 8fc676b commit 4df5fec

32 files changed

+33
-35
lines changed

Diff for: CONTRIBUTORS.md

100644100755
+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
- [ipedro](https://github.com/ipedro) for [Pull Request #76 (Harpy)](https://github.com/ArtSabintsev/Harpy/pull/76)
88
- [Michael Graff](http://github.com/skandragon) for [Pull Request #15](https://github.com/ArtSabintsev/Siren/pull/15)
99
- [Jaroslav_](https://github.com/jaroslavas) for [Pull Request #83 (Harpy)](https://github.com/ArtSabintsev/Harpy/pull/83)
10+
- [Dylan Bettermann](https://github.com/dbettermann) for [Pull Request #18](https://github.com/ArtSabintsev/Siren/pull/18)
1011

1112
### Harpy Project Contributors
1213
This repo is a Swift language port of [Harpy](http://github.com/ArtSabintsev/Harpy). We couldn't have built this port without acknowledging the following developers who were instrumental in getting Harpy to v3.2.1, the version of Harpy that Siren was based on.

Diff for: LICENSE

100644100755
File mode changed.

Diff for: README.md

100644100755
+5-5
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,11 @@ If a new version is available, an alert can be presented to the user informing t
1212
- Siren is a Swift language port of [**Harpy**](http://github.com/ArtSabintsev/Harpy), an Objective-C library that achieves the same functionality.
1313
- Siren is actively maintained by [**Arthur Sabintsev**](http://github.com/ArtSabintsev) and [**Aaron Brager**](http://twitter.com/getaaron).
1414

15-
### Changelog (v0.3.5)
16-
- Added Lithuanian localization (thanks to [Jaroslav_](https://github.com/jaroslavas))
15+
### Changelog (v0.4.0)
16+
- Added new mechanism to present a `UIAlertController` that now:
17+
- Respects device orientation
18+
- Is independent of visibility of `rootViewController` when app starts
19+
- Massive thanks to [Dylan Bettermann](https://github.com/dbettermann) for [Pull Request #18](https://github.com/ArtSabintsev/Siren/pull/18)
1720

1821
### Features
1922
- [x] CocoaPods Support
@@ -57,9 +60,6 @@ func application(application: UIApplication, didFinishLaunchingWithOptions launc
5760
// Required: Your app's iTunes App Store ID
5861
siren.appID = <#Your_App_ID#>
5962

60-
// Required on iOS 8: The controller to present the alert from (usually the UIWindow's rootViewController)
61-
siren.presentingViewController = window?.rootViewController
62-
6363
// Optional: Defaults to .Option
6464
siren.alertType = <#SirenAlertType_Enum_Value#>
6565

Diff for: Sample App/Sample App.xcodeproj/project.pbxproj

100644100755
+2-2
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@
260260
buildSettings = {
261261
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
262262
INFOPLIST_FILE = "$(SRCROOT)/Sample App/Info.plist";
263-
IPHONEOS_DEPLOYMENT_TARGET = 7.1;
263+
IPHONEOS_DEPLOYMENT_TARGET = 8.3;
264264
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
265265
PRODUCT_NAME = "Sample App";
266266
};
@@ -271,7 +271,7 @@
271271
buildSettings = {
272272
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
273273
INFOPLIST_FILE = "$(SRCROOT)/Sample App/Info.plist";
274-
IPHONEOS_DEPLOYMENT_TARGET = 7.1;
274+
IPHONEOS_DEPLOYMENT_TARGET = 8.3;
275275
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
276276
PRODUCT_NAME = "Sample App";
277277
};

Diff for: Sample App/Sample App.xcodeproj/project.xcworkspace/contents.xcworkspacedata

100644100755
File mode changed.

Diff for: Sample App/Sample App/AppDelegate.swift

100644100755
-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
2424

2525
func setupSiren() {
2626

27-
2827
let siren = Siren.sharedInstance
2928

3029
// Required

Diff for: Sample App/Sample App/Base.lproj/LaunchScreen.xib

100644100755
File mode changed.

Diff for: Sample App/Sample App/Base.lproj/Main.storyboard

100644100755
File mode changed.

Diff for: Sample App/Sample App/Images.xcassets/AppIcon.appiconset/Contents.json

100644100755
File mode changed.

Diff for: Sample App/Sample App/Info.plist

100644100755
+2
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333
<key>UISupportedInterfaceOrientations</key>
3434
<array>
3535
<string>UIInterfaceOrientationPortrait</string>
36+
<string>UIInterfaceOrientationLandscapeLeft</string>
37+
<string>UIInterfaceOrientationLandscapeRight</string>
3638
</array>
3739
</dict>
3840
</plist>

Diff for: Sample App/Sample App/ViewController.swift

100644100755
+1-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ class ViewController: UIViewController {
1919
super.didReceiveMemoryWarning()
2020
// Dispose of any resources that can be recreated.
2121
}
22-
23-
22+
2423
}
2524

Diff for: Siren.podspec

100644100755
+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = "Siren"
3-
s.version = "0.3.5"
3+
s.version = "0.4.0"
44
s.summary = "Notify users when a new version of your iOS app is available, and prompt them with the App Store link.."
55

66
s.description = <<-DESC
@@ -15,7 +15,7 @@ Siren is actively maintained by Arthur Sabintsev and Aaron Brager.
1515
s.license = "MIT"
1616
s.authors = { "Arthur Sabintsev" => "[email protected]", "Aaron Brager" => "[email protected]" }
1717
s.platform = :ios, "8.0"
18-
s.source = { :git => "https://github.com/ArtSabintsev/Siren.git", :tag => "0.3.5" }
18+
s.source = { :git => "https://github.com/ArtSabintsev/Siren.git", :tag => "0.4.0" }
1919
s.source_files = 'Siren/Siren.swift'
2020
s.resources = 'Siren/Siren.bundle'
2121
s.requires_arc = true

Diff for: Siren/Siren.bundle/da.lproj/SirenLocalizable.strings

100644100755
File mode changed.

Diff for: Siren/Siren.bundle/de.lproj/SirenLocalizable.strings

100644100755
File mode changed.

Diff for: Siren/Siren.bundle/en.lproj/SirenLocalizable.strings

100644100755
File mode changed.

Diff for: Siren/Siren.bundle/es.lproj/SirenLocalizable.strings

100644100755
File mode changed.

Diff for: Siren/Siren.bundle/eu.lproj/SirenLocalizable.strings

100644100755
File mode changed.

Diff for: Siren/Siren.bundle/fr.lproj/SirenLocalizable.strings

100644100755
File mode changed.

Diff for: Siren/Siren.bundle/he.lproj/SirenLocalizable.strings

100644100755
File mode changed.

Diff for: Siren/Siren.bundle/it.lproj/SirenLocalizable.strings

100644100755
File mode changed.

Diff for: Siren/Siren.bundle/ja.lproj/SirenLocalizable.strings

100644100755
File mode changed.

Diff for: Siren/Siren.bundle/ko.lproj/SirenLocalizable.strings

100644100755
File mode changed.

Diff for: Siren/Siren.bundle/nl.lproj/SirenLocalizable.strings

100644100755
File mode changed.

Diff for: Siren/Siren.bundle/pl.lproj/SirenLocalizable.strings

100644100755
File mode changed.

Diff for: Siren/Siren.bundle/pt-PT.lproj/HarpyLocalizable.strings

100644100755
File mode changed.

Diff for: Siren/Siren.bundle/pt.lproj/HarpyLocalizable.strings

100644100755
File mode changed.

Diff for: Siren/Siren.bundle/ru.lproj/SirenLocalizable.strings

100644100755
File mode changed.

Diff for: Siren/Siren.bundle/sv.lproj/SirenLocalizable.strings

100644100755
File mode changed.

Diff for: Siren/Siren.bundle/tr.lproj/SirenLocalizable.strings

100644100755
File mode changed.

Diff for: Siren/Siren.bundle/zh-Hans.lproj/SirenLocalizable.strings

100644100755
File mode changed.

Diff for: Siren/Siren.bundle/zh-Hant.lproj/SirenLocalizable.strings

100644100755
File mode changed.

Diff for: Siren/Siren.swift

100644100755
+20-23
Original file line numberDiff line numberDiff line change
@@ -429,34 +429,11 @@ private extension Siren
429429

430430
return action
431431
}
432-
433-
func hideWindow() {
434-
updaterWindow.hidden = true
435-
updaterWindow = nil
436-
}
437-
}
438-
439-
// MARK: UIAlertController + UIWindow
440-
private extension UIAlertController
441-
{
442-
443-
func show() {
444-
let window = UIWindow(frame: UIScreen.mainScreen().bounds)
445-
window.rootViewController = UIViewController()
446-
window.windowLevel = UIWindowLevelAlert + 1 // make the window appear above all other view controllers and windows
447-
448-
Siren.sharedInstance.updaterWindow = window
449-
450-
window.makeKeyAndVisible()
451-
window.rootViewController?.presentViewController(self, animated: true, completion: nil)
452-
}
453-
454432
}
455433

456434
// MARK: Helpers
457435
private extension Siren
458436
{
459-
460437
func iTunesURLFromString() -> NSURL {
461438

462439
var storeURLString = "https://itunes.apple.com/lookup?id=\(appID!)"
@@ -517,6 +494,11 @@ private extension Siren
517494
return alertType
518495
}
519496

497+
func hideWindow() {
498+
updaterWindow.hidden = true
499+
updaterWindow = nil
500+
}
501+
520502
// iOS 8 Compatibility Check
521503
var useAlertController: Bool { // iOS 8 check
522504
return objc_getClass("UIAlertController") != nil
@@ -530,6 +512,21 @@ private extension Siren
530512
}
531513
}
532514

515+
// MARK: UIAlertController
516+
private extension UIAlertController
517+
{
518+
func show() {
519+
let window = UIWindow(frame: UIScreen.mainScreen().bounds)
520+
window.rootViewController = UIViewController()
521+
window.windowLevel = UIWindowLevelAlert + 1
522+
523+
Siren.sharedInstance.updaterWindow = window
524+
525+
window.makeKeyAndVisible()
526+
window.rootViewController!.presentViewController(self, animated: true, completion: nil)
527+
}
528+
}
529+
533530
// MARK: String Localization
534531
private extension Siren
535532
{

0 commit comments

Comments
 (0)