Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ef8498a8e6 | |||
| 10ddcab12c | |||
| 8344ed8cb3 | |||
| d3668c8943 | |||
| 4def0e9441 | |||
| fa692a3912 | |||
| 80a449975b | |||
| 3fd2f93d21 | |||
| 13ad9ba3da | |||
| 31a59a4b3c | |||
| 19f303535c | |||
| cdfae11e70 |
@@ -0,0 +1 @@
|
||||
docs/* linguist-vendored
|
||||
@@ -1,6 +1,8 @@
|
||||
language: objective-c
|
||||
osx_image: xcode9.3
|
||||
|
||||
notifications:
|
||||
email: false
|
||||
env:
|
||||
- LC_CTYPE=en_US.UTF-8 LANG=en_US.UTF-8
|
||||
before_install:
|
||||
|
||||
@@ -50,6 +50,7 @@
|
||||
- [wbison](https://github.com/wbison) for [Pull Request #185 (Harpy)](https://github.com/ArtSabintsev/Harpy/pull/185)
|
||||
- [Balázs Vincze](https://github.com/vinczebalazs) for [Pull Request #200](https://github.com/ArtSabintsev/siren/pull/200)
|
||||
- [Txai Wieser](https://github.com/txaiwieser) for [Pull Request #201](https://github.com/ArtSabintsev/siren/pull/200)
|
||||
- [Gabriel Martelo](https://github.com/gabmarfer) for [Pull Request #214](https://github.com/ArtSabintsev/Siren/pull/214)
|
||||
|
||||
|
||||
### Harpy Project Contributors
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
### Notify users when a new version of your app is available and prompt them to upgrade.
|
||||
|
||||

|
||||

|
||||
|
||||
 
|
||||
|
||||
@@ -70,7 +70,7 @@ If a new version is available, an alert can be presented to the user informing t
|
||||
| 2.3 | swift2.3 | No
|
||||
|
||||
### CocoaPods
|
||||
For Swift 4 support:
|
||||
For Swift 4.1 support:
|
||||
```ruby
|
||||
pod 'Siren'
|
||||
```
|
||||
@@ -91,7 +91,7 @@ pod 'Siren', :git => 'https://github.com/ArtSabintsev/Siren.git', :branch => 'sw
|
||||
```
|
||||
|
||||
### Carthage
|
||||
For Swift 4 support:
|
||||
For Swift 4.1 support:
|
||||
```swift
|
||||
github "ArtSabintsev/Siren"
|
||||
```
|
||||
@@ -214,24 +214,39 @@ If you would like to set a different type of alert for revision, patch, minor, a
|
||||
Six delegate methods allow you to handle or track the user's behavior. Each method has a default, empty implementation, effectively making each of these methods optional.
|
||||
|
||||
``` swift
|
||||
public protocol SirenDelegate: class {
|
||||
// User presented with update dialog
|
||||
func sirenDidShowUpdateDialog(alertType: Siren.AlertType)
|
||||
public protocol SirenDelegate: NSObjectProtocol {
|
||||
/// Siren performed version check and did not display alert.
|
||||
func sirenDidDetectNewVersionWithoutAlert(message: String, updateType: UpdateType)
|
||||
|
||||
// User did click on button that launched App Store.app
|
||||
func sirenUserDidLaunchAppStore()
|
||||
/// Siren failed to perform version check.
|
||||
///
|
||||
/// - Note:
|
||||
/// Depending on the reason for failure,
|
||||
/// a system-level error may be returned.
|
||||
func sirenDidFailVersionCheck(error: Error)
|
||||
|
||||
// User did click on button that skips version update
|
||||
func sirenUserDidSkipVersion()
|
||||
/// User presented with update dialog.
|
||||
func sirenDidShowUpdateDialog(alertType: Siren.AlertType)
|
||||
|
||||
// User did click on button that cancels update dialog
|
||||
func sirenUserDidCancel()
|
||||
|
||||
// Siren failed to perform version check (may return system-level error)
|
||||
func sirenDidFailVersionCheck(error: Error)
|
||||
/// Siren performed a version check and latest version is installed.
|
||||
func sirenLatestVersionInstalled()
|
||||
|
||||
// Siren performed version check and did not display alert
|
||||
func sirenDidDetectNewVersionWithoutAlert(message: String, updateType: UpdateType)
|
||||
/// Provides the decoded JSON information from a successful version check call.
|
||||
///
|
||||
/// - SeeAlso:
|
||||
/// SirenLookupModel.swift
|
||||
///
|
||||
/// - Parameter lookupModel: The `Decodable` model representing the JSON results from the iTunes Lookup API.
|
||||
func sirenNetworkCallDidReturnWithNewVersionInformation(lookupModel: SirenLookupModel)
|
||||
|
||||
/// User did click on button that cancels update dialog.
|
||||
func sirenUserDidCancel()
|
||||
|
||||
/// User did click on button that launched "App Store.app".
|
||||
func sirenUserDidLaunchAppStore()
|
||||
|
||||
/// User did click on button that skips version update.
|
||||
func sirenUserDidSkipVersion()
|
||||
}
|
||||
```
|
||||
|
||||
@@ -288,7 +303,7 @@ If an app update is available, Siren checks to make sure that the version of iOS
|
||||
## Testing Siren
|
||||
Temporarily change the version string in Xcode (within the `.xcodeproj`) to an older version than the one that's currently available in the App Store. Afterwards, build and run your app, and you should see the alert.
|
||||
|
||||
If you currently don't have an app in the store, change your bundleID to one that is already in the store. In the sample app packaged with this library, we use the [iTunes Connect Mobile](https://itunes.apple.com/us/app/itunes-connect/id376771144?mt=8) app's bundleID: `com.apple.itunesconnect.mobile`.
|
||||
If you currently don't have an app in the store, change your bundleID to one that is already in the store. In the sample app packaged with this library, we use the [App Store Connect](https://itunes.apple.com/app/id1234793120) app's bundleID: `com.apple.AppStoreConnect`.
|
||||
|
||||
For your convenience, you may turn on debugging statements by setting `self.debugEnabled = true` before calling the `checkVersion()` method.
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
Pod::Spec.new do |s|
|
||||
# Version
|
||||
s.version = "3.3.2"
|
||||
s.version = "3.4.1"
|
||||
s.swift_version = '4.1'
|
||||
|
||||
# Meta
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<string>0.0.9</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>$(CURRENT_PROJECT_VERSION)</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
|
||||
@@ -8,8 +8,6 @@
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
55EC364B1E6BB98A00726F13 /* Siren.h in Headers */ = {isa = PBXBuildFile; fileRef = 55EC36491E6BB98A00726F13 /* Siren.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
55EC364E1E6BB98A00726F13 /* Siren.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 55EC36471E6BB98A00726F13 /* Siren.framework */; };
|
||||
55EC364F1E6BB98A00726F13 /* Siren.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 55EC36471E6BB98A00726F13 /* Siren.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
||||
55EC36601E6BB99B00726F13 /* Siren.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 55EC365E1E6BB99B00726F13 /* Siren.bundle */; };
|
||||
55EC36611E6BB99B00726F13 /* Siren.swift in Sources */ = {isa = PBXBuildFile; fileRef = 55EC365F1E6BB99B00726F13 /* Siren.swift */; };
|
||||
8E1635A91E6A0B9C0060CE27 /* SirenTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8EE6C74C1E6A0AE100DBE454 /* SirenTests.swift */; };
|
||||
@@ -18,6 +16,7 @@
|
||||
8E528A301E989A7A00B643C4 /* SirenDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8E528A2F1E989A7A00B643C4 /* SirenDelegate.swift */; };
|
||||
8E528A321E989E0A00B643C4 /* SirenTestHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8E528A311E989E0A00B643C4 /* SirenTestHelper.swift */; };
|
||||
8E5D15B11F3632D7001C0960 /* SirenLog.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8E5D15B01F3632D7001C0960 /* SirenLog.swift */; };
|
||||
8E641D2520C8B44B00908555 /* Siren.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 55EC36471E6BB98A00726F13 /* Siren.framework */; };
|
||||
8E9C238B1E7CDB42000ED3DA /* SirenBundleExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8E9C238A1E7CDB42000ED3DA /* SirenBundleExtension.swift */; };
|
||||
8E9C238D1E7CDD31000ED3DA /* SirenUIAlertControllerExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8E9C238C1E7CDD31000ED3DA /* SirenUIAlertControllerExtension.swift */; };
|
||||
8E9C238F1E7CDDE7000ED3DA /* SirenViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8E9C238E1E7CDDE7000ED3DA /* SirenViewController.swift */; };
|
||||
@@ -31,13 +30,6 @@
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
55EC364C1E6BB98A00726F13 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 8EC391791A58B465001C121E /* Project object */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = 55EC36461E6BB98A00726F13;
|
||||
remoteInfo = Siren;
|
||||
};
|
||||
8E3A6C091D07CB6F00A8B7CF /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 8EC391791A58B465001C121E /* Project object */;
|
||||
@@ -47,20 +39,6 @@
|
||||
};
|
||||
/* End PBXContainerItemProxy section */
|
||||
|
||||
/* Begin PBXCopyFilesBuildPhase section */
|
||||
558455D81C6690B4004BE492 /* Embed Frameworks */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
dstPath = "";
|
||||
dstSubfolderSpec = 10;
|
||||
files = (
|
||||
55EC364F1E6BB98A00726F13 /* Siren.framework in Embed Frameworks */,
|
||||
);
|
||||
name = "Embed Frameworks";
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXCopyFilesBuildPhase section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
55EC36471E6BB98A00726F13 /* Siren.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Siren.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
55EC36491E6BB98A00726F13 /* Siren.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Siren.h; sourceTree = "<group>"; };
|
||||
@@ -108,7 +86,7 @@
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
55EC364E1E6BB98A00726F13 /* Siren.framework in Frameworks */,
|
||||
8E641D2520C8B44B00908555 /* Siren.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@@ -136,6 +114,13 @@
|
||||
path = Siren;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
8E641D2420C8B44B00908555 /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
);
|
||||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
8EACA9651F37F2D3003134CA /* SirenExample */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
@@ -164,6 +149,7 @@
|
||||
8EACA9651F37F2D3003134CA /* SirenExample */,
|
||||
8EE6C74A1E6A0AE100DBE454 /* SirenExampleTests */,
|
||||
8EC391821A58B465001C121E /* Products */,
|
||||
8E641D2420C8B44B00908555 /* Frameworks */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
@@ -244,12 +230,10 @@
|
||||
8EC3917E1A58B465001C121E /* Frameworks */,
|
||||
8EE3A3F81E6A0E470010BDCE /* SwiftLint */,
|
||||
8EC3917F1A58B465001C121E /* Resources */,
|
||||
558455D81C6690B4004BE492 /* Embed Frameworks */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
55EC364D1E6BB98A00726F13 /* PBXTargetDependency */,
|
||||
);
|
||||
name = SirenExample;
|
||||
productName = Siren;
|
||||
@@ -279,7 +263,6 @@
|
||||
};
|
||||
8EC391801A58B465001C121E = {
|
||||
CreatedOnToolsVersion = 6.1.1;
|
||||
DevelopmentTeam = HT94948NDD;
|
||||
DevelopmentTeamName = "Arthur Sabintsev";
|
||||
LastSwiftMigration = 0900;
|
||||
};
|
||||
@@ -389,11 +372,6 @@
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXTargetDependency section */
|
||||
55EC364D1E6BB98A00726F13 /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = 55EC36461E6BB98A00726F13 /* Siren */;
|
||||
targetProxy = 55EC364C1E6BB98A00726F13 /* PBXContainerItemProxy */;
|
||||
};
|
||||
8E3A6C0A1D07CB6F00A8B7CF /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = 8EC391801A58B465001C121E /* SirenExample */;
|
||||
@@ -438,7 +416,7 @@
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.apple.itunesconnect.mobile.tests;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.apple.AppStoreConnect;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SKIP_INSTALL = YES;
|
||||
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
|
||||
@@ -469,7 +447,7 @@
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.apple.itunesconnect.mobile.tests;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.apple.AppStoreConnect;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SKIP_INSTALL = YES;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
|
||||
@@ -624,12 +602,12 @@
|
||||
8EC391A11A58B466001C121E /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
DEVELOPMENT_TEAM = "";
|
||||
INFOPLIST_FILE = "$(SRCROOT)/SirenExample/Supporting Files/Info.plist";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.apple.itunesconnect.mobile;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.apple.AppStoreConnect;
|
||||
PRODUCT_NAME = SirenExample;
|
||||
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
|
||||
SWIFT_VERSION = 4.0;
|
||||
@@ -639,12 +617,12 @@
|
||||
8EC391A21A58B466001C121E /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
DEVELOPMENT_TEAM = "";
|
||||
INFOPLIST_FILE = "$(SRCROOT)/SirenExample/Supporting Files/Info.plist";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.apple.itunesconnect.mobile;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.apple.AppStoreConnect;
|
||||
PRODUCT_NAME = SirenExample;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
|
||||
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
|
||||
|
||||
@@ -49,7 +49,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
|
||||
siren.minorUpdateAlertType = .option
|
||||
siren.patchUpdateAlertType = .option
|
||||
siren.revisionUpdateAlertType = .option
|
||||
|
||||
|
||||
// Optional - Sets all messages to appear in Russian. Siren supports many other languages, not just English and Russian.
|
||||
// siren.forceLanguageLocalization = .russian
|
||||
|
||||
@@ -102,8 +102,12 @@ extension AppDelegate: SirenDelegate
|
||||
print(#function, "Latest version of app is installed")
|
||||
}
|
||||
|
||||
func sirenNetworkCallDidReturnWithNewVersionInformation(lookupModel: SirenLookupModel) {
|
||||
print(#function, "\(lookupModel)")
|
||||
}
|
||||
|
||||
// This delegate method is only hit when alertType is initialized to .none
|
||||
func sirenDidDetectNewVersionWithoutAlert(message: String, updateType: UpdateType) {
|
||||
print(#function, "\(message).\nRelease type: \(updateType.rawValue.capitalized)")
|
||||
func sirenDidDetectNewVersionWithoutAlert(title: String, message: String, updateType: UpdateType) {
|
||||
print(#function, "\n\(title)\n\(message).\nRelease type: \(updateType.rawValue.capitalized)")
|
||||
}
|
||||
}
|
||||
|
||||
+15
@@ -1,5 +1,15 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "20x20",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "20x20",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "29x29",
|
||||
@@ -29,6 +39,11 @@
|
||||
"idiom" : "iphone",
|
||||
"size" : "60x60",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ios-marketing",
|
||||
"size" : "1024x1024",
|
||||
"scale" : "1x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0.0</string>
|
||||
<string>0.0.9</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
|
||||
+10
-2
@@ -30,7 +30,7 @@ public final class Siren: NSObject {
|
||||
/// - sirenUserDidCancel()
|
||||
///
|
||||
/// When a new version has been detected, and you would like to present a localized message in a custom UI. use this delegate method:
|
||||
/// - sirenDidDetectNewVersionWithoutAlert(message: String)
|
||||
/// - sirenDidDetectNewVersionWithoutAlert(title: String, message: String)
|
||||
public weak var delegate: SirenDelegate?
|
||||
|
||||
/// The debug flag, which is disabled by default.
|
||||
@@ -194,6 +194,8 @@ private extension Siren {
|
||||
DispatchQueue.main.async { [weak self] in
|
||||
self?.printMessage("Decoded JSON results: \(decodedData)")
|
||||
|
||||
self?.delegate?.sirenNetworkCallDidReturnWithNewVersionInformation(lookupModel: decodedData)
|
||||
|
||||
// Process Results (e.g., extract current version that is available on the AppStore)
|
||||
self?.processVersionCheck(with: decodedData)
|
||||
}
|
||||
@@ -305,7 +307,8 @@ private extension Siren {
|
||||
alertController.addAction(updateAlertAction())
|
||||
alertController.addAction(skipAlertAction())
|
||||
case .none:
|
||||
delegate?.sirenDidDetectNewVersionWithoutAlert(message: newVersionMessage, updateType: updateType)
|
||||
let updateTitle = localizedUpdateTitle()
|
||||
delegate?.sirenDidDetectNewVersionWithoutAlert(title: updateTitle, message: newVersionMessage, updateType: updateType)
|
||||
}
|
||||
|
||||
if alertType != .none && !alertViewIsVisible {
|
||||
@@ -403,6 +406,11 @@ private extension Siren {
|
||||
// MARK: - Helpers (Localization)
|
||||
|
||||
private extension Siren {
|
||||
func localizedUpdateTitle() -> String {
|
||||
let updateTitleToLocalize = alertMessaging.updateTitle
|
||||
return Bundle.localizedString(forKey: updateTitleToLocalize, forceLanguageLocalization: forceLanguageLocalization)
|
||||
}
|
||||
|
||||
func localizedNewVersionMessage() -> String {
|
||||
let newVersionMessageToLocalize = alertMessaging.updateMessage
|
||||
let newVersionMessage = Bundle.localizedString(forKey: newVersionMessageToLocalize, forceLanguageLocalization: forceLanguageLocalization)
|
||||
|
||||
+37
-28
@@ -31,17 +31,8 @@ public enum UpdateType: String {
|
||||
|
||||
/// Delegate that handles all codepaths for Siren upon version check completion.
|
||||
public protocol SirenDelegate: NSObjectProtocol {
|
||||
/// User presented with update dialog.
|
||||
func sirenDidShowUpdateDialog(alertType: Siren.AlertType)
|
||||
|
||||
/// User did click on button that launched "App Store.app".
|
||||
func sirenUserDidLaunchAppStore()
|
||||
|
||||
/// User did click on button that skips version update.
|
||||
func sirenUserDidSkipVersion()
|
||||
|
||||
/// User did click on button that cancels update dialog.
|
||||
func sirenUserDidCancel()
|
||||
/// Siren performed a version check and did not display an alert.
|
||||
func sirenDidDetectNewVersionWithoutAlert(title: String, message: String, updateType: UpdateType)
|
||||
|
||||
/// Siren failed to perform version check.
|
||||
///
|
||||
@@ -50,30 +41,32 @@ public protocol SirenDelegate: NSObjectProtocol {
|
||||
/// a system-level error may be returned.
|
||||
func sirenDidFailVersionCheck(error: Error)
|
||||
|
||||
/// Siren performed version check and did not display alert.
|
||||
func sirenDidDetectNewVersionWithoutAlert(message: String, updateType: UpdateType)
|
||||
/// User presented with an update dialog.
|
||||
func sirenDidShowUpdateDialog(alertType: Siren.AlertType)
|
||||
|
||||
/// Siren performed version check and latest version is installed.
|
||||
/// Siren performed a version check and the latest version was already installed.
|
||||
func sirenLatestVersionInstalled()
|
||||
|
||||
/// Provides the decoded JSON information from a successful version check call.
|
||||
///
|
||||
/// - Parameter lookupModel: The `Decodable` model representing the JSON results from the iTunes Lookup API.
|
||||
func sirenNetworkCallDidReturnWithNewVersionInformation(lookupModel: SirenLookupModel)
|
||||
|
||||
/// User did click on button that cancels update dialog.
|
||||
func sirenUserDidCancel()
|
||||
|
||||
/// User did click on button that launched "App Store.app".
|
||||
func sirenUserDidLaunchAppStore()
|
||||
|
||||
/// User did click on button that skips version update.
|
||||
func sirenUserDidSkipVersion()
|
||||
}
|
||||
|
||||
// MARK: - SirenDelegate Protocol Extension
|
||||
|
||||
public extension SirenDelegate {
|
||||
|
||||
func sirenDidShowUpdateDialog(alertType: Siren.AlertType) {
|
||||
printMessage()
|
||||
}
|
||||
|
||||
func sirenUserDidLaunchAppStore() {
|
||||
printMessage()
|
||||
}
|
||||
|
||||
func sirenUserDidSkipVersion() {
|
||||
printMessage()
|
||||
}
|
||||
|
||||
func sirenUserDidCancel() {
|
||||
func sirenDidDetectNewVersionWithoutAlert(title: String, message: String, updateType: UpdateType) {
|
||||
printMessage()
|
||||
}
|
||||
|
||||
@@ -81,7 +74,7 @@ public extension SirenDelegate {
|
||||
printMessage()
|
||||
}
|
||||
|
||||
func sirenDidDetectNewVersionWithoutAlert(message: String, updateType: UpdateType) {
|
||||
func sirenDidShowUpdateDialog(alertType: Siren.AlertType) {
|
||||
printMessage()
|
||||
}
|
||||
|
||||
@@ -89,6 +82,22 @@ public extension SirenDelegate {
|
||||
printMessage()
|
||||
}
|
||||
|
||||
func sirenUserDidCancel() {
|
||||
printMessage()
|
||||
}
|
||||
|
||||
func sirenUserDidLaunchAppStore() {
|
||||
printMessage()
|
||||
}
|
||||
|
||||
func sirenNetworkCallDidReturnWithNewVersionInformation(lookupModel: SirenLookupModel) {
|
||||
printMessage()
|
||||
}
|
||||
|
||||
func sirenUserDidSkipVersion() {
|
||||
printMessage()
|
||||
}
|
||||
|
||||
private func printMessage(_ function: String = #function) {
|
||||
SirenLog("The default implementation of \(function) is being called. You can ignore this message if you do not care to implement this method in your `SirenDelegate` conforming structure.")
|
||||
}
|
||||
|
||||
@@ -10,14 +10,14 @@ import Foundation
|
||||
|
||||
// MARK: - Model representing a selection of results from the iTunes Lookup API
|
||||
|
||||
struct SirenLookupModel: Decodable {
|
||||
public struct SirenLookupModel: Decodable {
|
||||
private enum CodingKeys: String, CodingKey {
|
||||
case results
|
||||
}
|
||||
|
||||
let results: [Results]
|
||||
public let results: [Results]
|
||||
|
||||
struct Results: Decodable {
|
||||
public struct Results: Decodable {
|
||||
private enum CodingKeys: String, CodingKey {
|
||||
case appID = "trackId"
|
||||
case currentVersionReleaseDate
|
||||
@@ -26,10 +26,10 @@ struct SirenLookupModel: Decodable {
|
||||
case version
|
||||
}
|
||||
|
||||
let appID: Int
|
||||
let currentVersionReleaseDate: String
|
||||
let minimumOSVersion: String
|
||||
let releaseNotes: String?
|
||||
let version: String
|
||||
public let appID: Int
|
||||
public let currentVersionReleaseDate: String
|
||||
public let minimumOSVersion: String
|
||||
public let releaseNotes: String?
|
||||
public let version: String
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user