Compare commits

...

15 Commits

Author SHA1 Message Date
Arthur Ariel Sabintsev 6a94c4f4e5 Updated podspec 2015-03-01 21:48:53 -05:00
Arthur Ariel Sabintsev 2afe920c86 Added Polish language support and updated docs 2015-03-01 21:47:34 -05:00
Arthur Ariel Sabintsev 7f8c2a6fb1 Merge pull request #10 from jedrekk/master
Added Polish language support
2015-03-01 21:35:00 -05:00
Jędrek Kostecki 1463428c8c Added Polish language support (pl_PL) 2015-02-28 13:11:06 +01:00
Arthur Ariel Sabintsev 8021367f54 Update README.md 2015-02-25 10:52:21 -05:00
Arthur Ariel Sabintsev af139d649c Updated docs for change from #8 2015-02-24 11:04:11 -05:00
Arthur Ariel Sabintsev 8ba1ac7fb3 Merge pull request #8 from bonkey/master
Simplify split function
2015-02-24 11:01:18 -05:00
Daniel Bauke 133bfd4088 Simplify split function
Main reason is compatibility with Xcode 6.3 beta 2, but why not have it
simple anyway?
2015-02-24 10:50:33 +01:00
Arthur Ariel Sabintsev 0f0c7bbbd2 Multiple changes to property initializations 2015-02-03 23:34:20 -05:00
Arthur Ariel Sabintsev b5a9cd6fd1 Update README.md 2015-01-29 12:16:18 -05:00
Arthur Ariel Sabintsev bb8916f598 Updated README and Contributors 2015-01-29 12:15:38 -05:00
Aaron Brager de7f6654e2 Update README 2015-01-29 09:06:57 -08:00
Aaron Brager 6c5b0e3318 Merge pull request #7 from diamondsky/master
Fixes crash with nil iTunesURL
2015-01-29 09:03:24 -08:00
Dmitry Bespalov 37cb67d979 Small refactoring 2015-01-29 17:58:33 +01:00
Dmitry Bespalov 0194a691c9 Fixes crash with nil iTunesURL 2015-01-29 17:23:20 +01:00
6 changed files with 28 additions and 42 deletions
+5 -2
View File
@@ -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.
+5 -7
View File
@@ -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).
+1 -1
View File
@@ -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
View File
@@ -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
View File
@@ -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!);
}