Skip to content

Commit 950830d

Browse files
authored
Merge pull request #136 from ArtSabintsev/improvement/delayed-launch
2.0.0
2 parents 1301d13 + 11bfdca commit 950830d

11 files changed

+371
-277
lines changed

.swiftlint.yml

+9-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
1+
reporter: "xcode"
2+
13
included:
24
- ../Sources/
35

46
disabled_rules:
57
- cyclomatic_complexity
6-
- file_length
7-
- line_length
8+
- unused_optional_binding
89
- variable_name
910

10-
reporter: "xcode"
11+
# Specialized Rules
12+
file_length:
13+
- 1000
14+
15+
line_length:
16+
- 200

README.md

+22-20
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
## Table of Contents
99
- [About](https://github.com/ArtSabintsev/Siren#about)
10-
- [README Translations](https://github.com/ArtSabintsev/Siren#readme-translations)
1110
- [Features](https://github.com/ArtSabintsev/Siren#features)
1211
- [Screenshots](https://github.com/ArtSabintsev/Siren#screenshots)
1312
- [Installation Instructions](https://github.com/ArtSabintsev/Siren#installation-instructions)
@@ -33,20 +32,19 @@ If a new version is available, an alert can be presented to the user informing t
3332
- Siren also supports two-number versioning (e.g., 1.0) and four-number versioning (e.g., 1.0.0.0)
3433
- Siren is actively maintained by [**Arthur Sabintsev**](http://github.com/ArtSabintsev) and [**Aaron Brager**](http://twitter.com/getaaron)
3534

36-
---
37-
## README Translations
35+
### README Translations
3836
- [**简体中文**](README.zh_CN.md) (by [**Daniel Hu**](http://www.jianshu.com/u/d8bbc4831623))
3937

4038
## Features
4139
- [x] CocoaPods Support
4240
- [x] Carthage Support
4341
- [x] Swift Package Manager Support
44-
- [x] Localized for 30+ languages (See **Localization**)
45-
- [x] Pre-Update Device Compatibility Check (See **Device Compatibility**)
46-
- [x] Three types of alerts (see **Screenshots**)
47-
- [x] Optional delegate methods (see **Optional Delegate**)
42+
- [x] Localized for 30+ languages (see [Localization](https://github.com/ArtSabintsev/Siren#localization))
43+
- [x] Pre-Update Device Compatibility Check (see [Device Compatibility](https://github.com/ArtSabintsev/Siren#device-compatibility)
44+
- [x] Three types of alerts (see [Screenshots](https://github.com/ArtSabintsev/Siren#screenshots))
45+
- [x] Optional delegate methods (see [Delegates (Optional)](https://github.com/ArtSabintsev/Siren#optional-delegate-and-delegate-methods)
4846
- [x] Unit Tests
49-
- [x] Documentation can be found at http://sabintsev.com/Siren
47+
- [x] Documentation can be found at http://sabintsev.com/Siren.
5048

5149
## Screenshots
5250
- The **left picture** forces the user to update the app.
@@ -87,30 +85,34 @@ For Swift 2.3 support:
8785
``` swift
8886
github "ArtSabintsev/Siren" "swift2.3"
8987
```
90-
\
88+
9189
### Swift Package Manager
9290
```swift
93-
.Package(url: "https://github.com/ArtSabintsev/Siren.git", majorVersion: 1)
91+
.Package(url: "https://github.com/ArtSabintsev/Siren.git", majorVersion: 2)
9492
```
9593

9694
## Example Code
9795

98-
Here's some commented sample code. Adapt this to meet your app's needs. For a full list of optional settings/preferences, please refer to https://github.com/ArtSabintsev/Siren/blob/master/Sample%20App/Sample%20App/AppDelegate.swift in the Sample Project.
96+
Below is some commented sample code. Adapt this to meet your app's needs.
97+
98+
For a full list of optional settings/preferences, please refer to https://github.com/ArtSabintsev/Siren/blob/master/SirenExample/SirenExample/AppDelegate.swift in the Sample Project.
9999

100100
```Swift
101101
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
102102
/* Siren code should go below window?.makeKeyAndVisible() */
103103

104-
// Siren is a singleton
105-
let siren = Siren.shared
104+
// Siren is a singleton
105+
let siren = Siren.shared
106106

107-
// Optional: Defaults to .Option
108-
siren.alertType = <#SirenAlertType_Enum_Value#>
107+
// Optional: Defaults to .Option
108+
siren.alertType = <#SirenAlertType_Enum_Value#>
109109

110-
/*
111-
Replace .Immediately with .Daily or .Weekly to specify a maximum daily or weekly frequency for version
112-
checks.
113-
*/
110+
// Optional: Set this variable if you would only like to show an alert if your app has been available on the store for a few days.
111+
// This default value is set to 1 to avoid this issue: https://github.com/ArtSabintsev/Siren#words-of-caution
112+
// To show the update immediately after Apple has updated their JSON, set this value to 0. Not recommended due to aforementioned reason in https://github.com/ArtSabintsev/Siren#words-of-caution.
113+
siren.showAlertAfterCurrentVersionHasBeenReleasedForDays = 3
114+
115+
// Replace .Immediately with .Daily or .Weekly to specify a maximum daily or weekly frequency for version checks.
114116
siren.checkVersion(checkType: .immediately)
115117

116118
return true
@@ -244,7 +246,7 @@ The App Store reviewer will **not** see the alert. The version in the App Store
244246
## Words of Caution
245247
Occassionally, the iTunes JSON will update faster than the App Store CDN, meaning the JSON may state that the new verison of the app has been release, while no new binary is made available for download via the App Store. It is for this reason, I caution developers to not use the `Force` option unless you are controlling the `Force` option with a remote configuration file (e.g., enabling Siren remotely only after you have guaranteed that the app has propogated to the App Store).
246248

247-
Also, on even rarer situations, the iTunes JSON may fluctuate between multiple versions of your app shortly after pushing out a new version. This is extremely rare, and has only been reported once in the five years of that Siren and Harpy have been around.
249+
Also, in even rarer situations, the iTunes JSON may fluctuate between multiple versions of your app shortly after pushing out a new version. This is extremely rare, and has only been reported once in the five years that Siren and Harpy have been around.
248250

249251
## Ports
250252
- **Objective-C (iOS)**

Siren.podspec

+1-1
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 = "1.2.5"
3+
s.version = "2.0.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

SirenExample/SirenExample.xcodeproj/project.pbxproj

+18-2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
55EC36611E6BB99B00726F13 /* Siren.swift in Sources */ = {isa = PBXBuildFile; fileRef = 55EC365F1E6BB99B00726F13 /* Siren.swift */; };
1515
8E1635A91E6A0B9C0060CE27 /* SirenTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8EE6C74C1E6A0AE100DBE454 /* SirenTests.swift */; };
1616
8E43D6231E8223EE00ECFFC8 /* SirenDateExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8E43D6221E8223EE00ECFFC8 /* SirenDateExtension.swift */; };
17+
8E528A301E989A7A00B643C4 /* SirenDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8E528A2F1E989A7A00B643C4 /* SirenDelegate.swift */; };
18+
8E528A321E989E0A00B643C4 /* SirenTestHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8E528A311E989E0A00B643C4 /* SirenTestHelper.swift */; };
1719
8E9C238B1E7CDB42000ED3DA /* SirenBundleExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8E9C238A1E7CDB42000ED3DA /* SirenBundleExtension.swift */; };
1820
8E9C238D1E7CDD31000ED3DA /* SirenUIAlertControllerExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8E9C238C1E7CDD31000ED3DA /* SirenUIAlertControllerExtension.swift */; };
1921
8E9C238F1E7CDDE7000ED3DA /* SirenViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8E9C238E1E7CDDE7000ED3DA /* SirenViewController.swift */; };
@@ -63,6 +65,8 @@
6365
55EC365F1E6BB99B00726F13 /* Siren.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Siren.swift; path = ../../Sources/Siren.swift; sourceTree = "<group>"; };
6466
8E3A6C041D07CB6F00A8B7CF /* SirenExampleTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SirenExampleTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
6567
8E43D6221E8223EE00ECFFC8 /* SirenDateExtension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SirenDateExtension.swift; path = ../../Sources/SirenDateExtension.swift; sourceTree = "<group>"; };
68+
8E528A2F1E989A7A00B643C4 /* SirenDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SirenDelegate.swift; path = ../../Sources/SirenDelegate.swift; sourceTree = "<group>"; };
69+
8E528A311E989E0A00B643C4 /* SirenTestHelper.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SirenTestHelper.swift; path = ../../Sources/SirenTestHelper.swift; sourceTree = "<group>"; };
6670
8E9C238A1E7CDB42000ED3DA /* SirenBundleExtension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SirenBundleExtension.swift; path = ../../Sources/SirenBundleExtension.swift; sourceTree = "<group>"; };
6771
8E9C238C1E7CDD31000ED3DA /* SirenUIAlertControllerExtension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SirenUIAlertControllerExtension.swift; path = ../../Sources/SirenUIAlertControllerExtension.swift; sourceTree = "<group>"; };
6872
8E9C238E1E7CDDE7000ED3DA /* SirenViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SirenViewController.swift; path = ../../Sources/SirenViewController.swift; sourceTree = "<group>"; };
@@ -108,8 +112,10 @@
108112
children = (
109113
55EC365E1E6BB99B00726F13 /* Siren.bundle */,
110114
55EC365F1E6BB99B00726F13 /* Siren.swift */,
115+
8E528A2F1E989A7A00B643C4 /* SirenDelegate.swift */,
111116
8E9C238A1E7CDB42000ED3DA /* SirenBundleExtension.swift */,
112117
8E43D6221E8223EE00ECFFC8 /* SirenDateExtension.swift */,
118+
8E528A311E989E0A00B643C4 /* SirenTestHelper.swift */,
113119
8E9C238C1E7CDD31000ED3DA /* SirenUIAlertControllerExtension.swift */,
114120
8E9C238E1E7CDDE7000ED3DA /* SirenViewController.swift */,
115121
55EC36491E6BB98A00726F13 /* Siren.h */,
@@ -122,14 +128,22 @@
122128
isa = PBXGroup;
123129
children = (
124130
8EE6C7411E6A0AA500DBE454 /* AppDelegate.swift */,
131+
8E528A331E98AED300B643C4 /* Supporting Files */,
132+
);
133+
name = SirenExample;
134+
path = "Sample App";
135+
sourceTree = "<group>";
136+
};
137+
8E528A331E98AED300B643C4 /* Supporting Files */ = {
138+
isa = PBXGroup;
139+
children = (
125140
8EE6C7421E6A0AA500DBE454 /* ViewController.swift */,
126141
8EBDF8211E6A0C41006C87B4 /* LaunchScreen.xib */,
127142
8EBDF8231E6A0C41006C87B4 /* Main.storyboard */,
128143
8EE6C7461E6A0AB800DBE454 /* Images.xcassets */,
129144
8EE6C7471E6A0AB800DBE454 /* Info.plist */,
130145
);
131-
name = SirenExample;
132-
path = "Sample App";
146+
name = "Supporting Files";
133147
sourceTree = "<group>";
134148
};
135149
8EC391781A58B465001C121E = {
@@ -330,10 +344,12 @@
330344
isa = PBXSourcesBuildPhase;
331345
buildActionMask = 2147483647;
332346
files = (
347+
8E528A321E989E0A00B643C4 /* SirenTestHelper.swift in Sources */,
333348
8E9C238F1E7CDDE7000ED3DA /* SirenViewController.swift in Sources */,
334349
55EC36611E6BB99B00726F13 /* Siren.swift in Sources */,
335350
8E43D6231E8223EE00ECFFC8 /* SirenDateExtension.swift in Sources */,
336351
8E9C238B1E7CDB42000ED3DA /* SirenBundleExtension.swift in Sources */,
352+
8E528A301E989A7A00B643C4 /* SirenDelegate.swift in Sources */,
337353
8E9C238D1E7CDD31000ED3DA /* SirenUIAlertControllerExtension.swift in Sources */,
338354
);
339355
runOnlyForDeploymentPostprocessing = 0;

SirenExample/SirenExample/AppDelegate.swift

+8-6
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
3131
// Optional
3232
siren.debugEnabled = true
3333

34-
// Optional
35-
siren.appName = "Test App Name"
36-
34+
// Optional - Change the name of your app. Useful if you have a long app name and want to display a shortened version in the update dialog (e.g., the UIAlertController).
35+
// siren.appName = "Test App Name"
36+
3737
// Optional - Defaults to .Option
3838
// siren.alertType = .Option // or .Force, .Skip, .None
3939

@@ -49,8 +49,10 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
4949
// Optional - Set this variable if your app is not available in the U.S. App Store. List of codes: https://developer.apple.com/library/content/documentation/LanguagesUtilities/Conceptual/iTunesConnect_Guide/Appendices/AppStoreTerritories.html
5050
// siren.countryCode = ""
5151

52-
// Optional - Set this variable if you would only like to show an alert if your app has been available on the store for a few days. The number 5 is used as an example.
53-
// siren.showAlertAfterCurrentVersionHasBeenReleasedForDays = 5
52+
// Optional - Set this variable if you would only like to show an alert if your app has been available on the store for a few days.
53+
// This default value is set to 1 to avoid this issue: https://github.com/ArtSabintsev/Siren#words-of-caution
54+
// To show the update immediately after Apple has updated their JSON, set this value to 0. Not recommended due to aforementioned reason in https://github.com/ArtSabintsev/Siren#words-of-caution.
55+
// siren.showAlertAfterCurrentVersionHasBeenReleasedForDays = 3
5456

5557
// Required
5658
siren.checkVersion(checkType: .immediately)
@@ -69,7 +71,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
6971

7072
extension AppDelegate: SirenDelegate
7173
{
72-
func sirenDidShowUpdateDialog(alertType: SirenAlertType) {
74+
func sirenDidShowUpdateDialog(alertType: Siren.AlertType) {
7375
print(#function, alertType)
7476
}
7577

0 commit comments

Comments
 (0)