You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: Sources/UpgradeAlert/UpgradeAlert.swift
+9-9
Original file line number
Diff line number
Diff line change
@@ -68,11 +68,14 @@ extension UpgradeAlert {
68
68
}
69
69
}
70
70
}
71
-
72
71
/**
73
72
* Network
74
73
*/
75
74
extensionUpgradeAlert{
75
+
/**
76
+
* fixme: add doc
77
+
*/
78
+
typealiasCompletion=(AppInfo?,UAError?)->Void
76
79
/**
77
80
* - Description: Retrieves the app information from the App Store using a network request. This function fetches the JSON data from the App Store API and decodes it to `AppInfo` format, handling errors appropriately.
78
81
* let url = URL(string: "http://www.")
@@ -82,11 +85,11 @@ extension UpgradeAlert {
82
85
* - Note: Discussing this solution: https://stackoverflow.com/questions/6256748/check-if-my-app-has-a-new-version-on-appstore
83
86
* - Fixme: ⚠️️ Add timeout interval and local cache pollacy: https://github.com/amebalabs/AppVersion/blob/master/AppVersion/Source/AppStoreVersion.swift
84
87
* - Parameter completion: A closure that is called when the app information retrieval is complete. It returns an optional AppInfo object and an optional UAError object. If an error occurs during the retrieval, the UAError object describes the error. If the retrieval is successful, the AppInfo object contains information about the app.
guardlet info:AppInfo= result.results.first else{ // Get the first app info from the result
100
-
101
103
throwNSError(domain:"no app info", code:0) // If there is no app info, throw an NSError with the description "no app info"
102
104
}
103
-
104
105
// ⚠️️ new
105
106
// The App Store metadata may be updated before the app binary is available, causing users to see an update prompt before they can download the update.
106
107
// Check the currentVersionReleaseDate from the App Store response and delay prompting users if the update is very recent.
0 commit comments