Compare commits
15 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6a94c4f4e5 | |||
| 2afe920c86 | |||
| 7f8c2a6fb1 | |||
| 1463428c8c | |||
| 8021367f54 | |||
| af139d649c | |||
| 8ba1ac7fb3 | |||
| 133bfd4088 | |||
| 0f0c7bbbd2 | |||
| b5a9cd6fd1 | |||
| bb8916f598 | |||
| de7f6654e2 | |||
| 6c5b0e3318 | |||
| 37cb67d979 | |||
| 0194a691c9 |
+5
-2
@@ -1,8 +1,11 @@
|
||||
### Created and maintained by
|
||||
[Arthur Ariel Sabintsev](http://www.sabintsev.com/) and [Aaron Brager](http://twitter.com/GetAaron)
|
||||
|
||||
### Swift Project Contributors
|
||||
Open up a Pull Request to get your name on here.
|
||||
### Siren Project Contributors
|
||||
- [Dmitry Bespalov](https://github.com/diamondsky) for [Pull Request #7](https://github.com/ArtSabintsev/Siren/pull/7)
|
||||
- [Daniel Bauke](https://github.com/bonkey) for [Pull Request #8](https://github.com/ArtSabintsev/Siren/pull/8)
|
||||
- [Jędrek Kostecki](https://github.com/jedrekk) for [Pull Request #10](https://github.com/ArtSabintsev/Siren/pull/10)
|
||||
|
||||
|
||||
### Harpy Project Contributors
|
||||
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 its current state, v3.2.1 at the time this document was written.
|
||||
|
||||
@@ -12,15 +12,13 @@ If a new version is available, an alert can be presented to the user informing t
|
||||
- Siren is a Swift language port of [**Harpy**](http://github.com/ArtSabintsev/Harpy), an Objective-C library that achieves the same functionality.
|
||||
- Siren is actively maintained by [**Arthur Sabintsev**](http://github.com/ArtSabintsev) and [**Aaron Brager**](http://twitter.com/getaaron).
|
||||
|
||||
### Changelog
|
||||
#### 0.2.2
|
||||
- Fixed [Issue #6](https://github.com/ArtSabintsev/Siren/issues/6): Setting `checkType` to `.Daily` or `.Weekly` now works properly.
|
||||
- Other minor internal changes.
|
||||
### Changelog (v0.3.2)
|
||||
- Added Polish localization (thanks to [Jędrek Kostecki](https://github.com/jedrekk))
|
||||
|
||||
### Features
|
||||
- [x] CocoaPods Support
|
||||
- [x] Support for `UIAlertController` (iOS 8+) and `UIAlertView` (iOS 7)
|
||||
- [x] Localized for 18 languages (See **Localization** Section)
|
||||
- [x] Localized for 19 languages (See **Localization** Section)
|
||||
- [x] Three types of alerts (see **Screenshots & Alert Types**)
|
||||
- [x] Optional delegate methods (see **Optional Delegate** section)
|
||||
|
||||
@@ -53,7 +51,7 @@ func application(application: UIApplication, didFinishLaunchingWithOptions launc
|
||||
/* Siren code should go below window?.makeKeyAndVisible() */
|
||||
|
||||
// Siren is a singleton
|
||||
let siren = Siren.SharedInstance()
|
||||
let siren = Siren.SharedInstance
|
||||
|
||||
// Required: Your app's iTunes App Store ID
|
||||
siren.appID = <#Your_App_ID#>
|
||||
@@ -170,7 +168,7 @@ Five delegate methods allow you to handle or track the user's behavior:
|
||||
```
|
||||
|
||||
### Force Localization
|
||||
Siren supports 18 languages: Basque, Chinese (Simplified), Chinese (Traditional), Danish, Dutch, English, French, German, Hebrew, Italian, Japanese, Korean, Portuguese, Russian, Slovenian, Swedish, Spanish, and Turkish.
|
||||
Siren supports 18 languages: Basque, Chinese (Simplified), Chinese (Traditional), Danish, Dutch, English, French, German, Hebrew, Italian, Japanese, Korean, Polish, Portuguese, Russian, Slovenian, Swedish, Spanish, and Turkish.
|
||||
|
||||
You may want the update dialog to *always* appear in a certain language, ignoring iOS's language setting (e.g. apps released in a specific country).
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
|
||||
siren.alertType = .Option
|
||||
|
||||
// Optional
|
||||
// siren.forceLanguageLocalization = .Spanish // Optional: Sets all messages to appear in spanish. Siren supports many other languages, not just English and Spanish.
|
||||
// siren.forceLanguageLocalization = .Spanish // Optional: Sets all messages to appear in Spanish. Siren supports many other languages, not just English and Spanish.
|
||||
|
||||
// Required
|
||||
siren.checkVersion(.Immediately)
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
Pod::Spec.new do |s|
|
||||
s.name = "Siren"
|
||||
s.version = "0.2.2"
|
||||
s.version = "0.3.2"
|
||||
s.summary = "Notify users when a new version of your iOS app is available, and prompt them with the App Store link.."
|
||||
|
||||
s.description = <<-DESC
|
||||
@@ -15,7 +15,7 @@ Siren is actively maintained by Arthur Sabintsev and Aaron Brager.
|
||||
s.license = "MIT"
|
||||
s.authors = { "Arthur Sabintsev" => "arthur@sabintsev.com", "Aaron Brager" => "getaaron@gmail.com" }
|
||||
s.platform = :ios, "8.0"
|
||||
s.source = { :git => "https://github.com/ArtSabintsev/Siren.git", :tag => "0.2.2" }
|
||||
s.source = { :git => "https://github.com/ArtSabintsev/Siren.git", :tag => "0.3.2" }
|
||||
s.source_files = 'Siren/Siren.swift'
|
||||
s.resources = 'Siren/Siren.bundle'
|
||||
s.requires_arc = true
|
||||
|
||||
Binary file not shown.
+15
-30
@@ -92,6 +92,7 @@ public enum SirenLanguageType: String
|
||||
case Italian = "it"
|
||||
case Japanese = "ja"
|
||||
case Korean = "ko"
|
||||
case Polish = "pl"
|
||||
case Portuguese = "pt"
|
||||
case Russian = "ru"
|
||||
case Slovenian = "sl"
|
||||
@@ -142,7 +143,7 @@ public class Siren: NSObject
|
||||
|
||||
When enabled, a stream of println() statements are logged to your console when a version check is performed.
|
||||
*/
|
||||
var debugEnabled = false
|
||||
lazy var debugEnabled = false
|
||||
|
||||
// Alert Vars
|
||||
/**
|
||||
@@ -155,29 +156,29 @@ public class Siren: NSObject
|
||||
/**
|
||||
Determines the type of alert that should be shown for major version updates: A.b.c
|
||||
|
||||
When this property is nil, the value set for the general alertType property is used.
|
||||
Defaults to SirenAlertType.Option.
|
||||
|
||||
See the SirenAlertType enum for full details.
|
||||
*/
|
||||
var majorUpdateAlertType: SirenAlertType?
|
||||
var majorUpdateAlertType = SirenAlertType.Option
|
||||
|
||||
/**
|
||||
Determines the type of alert that should be shown for minor version updates: a.B.c
|
||||
|
||||
When this property is nil, the value set for the general alertType property is used.
|
||||
Defaults to SirenAlertType.Option.
|
||||
|
||||
See the SirenAlertType enum for full details.
|
||||
*/
|
||||
var minorUpdateAlertType: SirenAlertType?
|
||||
var minorUpdateAlertType = SirenAlertType.Option
|
||||
|
||||
/**
|
||||
Determines the type of alert that should be shown for minor patch updates: a.b.C
|
||||
|
||||
When this property is nil, the value set for the general alertType property is used.
|
||||
Defaults to SirenAlertType.Option.
|
||||
|
||||
See the SirenAlertType enum for full details.
|
||||
*/
|
||||
var patchUpdateAlertType: SirenAlertType?
|
||||
var patchUpdateAlertType = SirenAlertType.Option
|
||||
|
||||
// Required Vars
|
||||
/**
|
||||
@@ -200,7 +201,7 @@ public class Siren: NSObject
|
||||
|
||||
By default, it's set to the name of the app that's stored in your plist.
|
||||
*/
|
||||
var appName: String = (NSBundle.mainBundle().infoDictionary?[kCFBundleNameKey] as? String) ?? ""
|
||||
lazy var appName: String = (NSBundle.mainBundle().infoDictionary?[kCFBundleNameKey] as? String) ?? ""
|
||||
|
||||
/**
|
||||
The region or country of an App Store in which your app is available.
|
||||
@@ -499,34 +500,18 @@ private extension Siren {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
TODO: Potentially turn this into a custom setter/getter with property observers
|
||||
https://developer.apple.com/library/prerelease/ios/documentation/Swift/Conceptual/Swift_Programming_Language/Properties.html#//apple_ref/doc/uid/TP40014097-CH14-ID262
|
||||
*/
|
||||
func setAlertType() -> SirenAlertType {
|
||||
|
||||
if majorUpdateAlertType == nil {
|
||||
majorUpdateAlertType = alertType
|
||||
}
|
||||
|
||||
if minorUpdateAlertType == nil {
|
||||
minorUpdateAlertType = alertType
|
||||
}
|
||||
|
||||
if patchUpdateAlertType == nil {
|
||||
patchUpdateAlertType = alertType
|
||||
}
|
||||
|
||||
let oldVersion = split(currentInstalledVersion!, {$0 == "."}, maxSplit: Int.max, allowEmptySlices: false).map {$0.toInt() ?? 0}
|
||||
let newVersion = split(currentAppStoreVersion!, {$0 == "."}, maxSplit: Int.max, allowEmptySlices: false).map {$0.toInt() ?? 0}
|
||||
let oldVersion = split(currentInstalledVersion!) {$0 == "."}.map {$0.toInt() ?? 0}
|
||||
let newVersion = split(currentAppStoreVersion!) {$0 == "."}.map {$0.toInt() ?? 0}
|
||||
|
||||
if oldVersion.count == 3 && newVersion.count == 3 {
|
||||
if newVersion[0] > oldVersion[0] { // A.b.c
|
||||
alertType = majorUpdateAlertType!
|
||||
alertType = majorUpdateAlertType
|
||||
} else if newVersion[1] > oldVersion[1] { // a.B.c
|
||||
alertType = minorUpdateAlertType!
|
||||
alertType = minorUpdateAlertType
|
||||
} else if newVersion[2] > oldVersion[2] { // a.b.C
|
||||
alertType = patchUpdateAlertType!
|
||||
alertType = patchUpdateAlertType
|
||||
}
|
||||
}
|
||||
|
||||
@@ -540,7 +525,7 @@ private extension Siren {
|
||||
|
||||
// Actions
|
||||
func launchAppStore() {
|
||||
let iTunesString = "https://itunes.apple.com/app/id\(appID)";
|
||||
let iTunesString = "https://itunes.apple.com/app/id\(appID!)";
|
||||
let iTunesURL = NSURL(string: iTunesString);
|
||||
UIApplication.sharedApplication().openURL(iTunesURL!);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user