Skip to content

Commit

Permalink
Merge pull request #13 from SimformSolutionsPvtLtd/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
bhargavbajani-simformsolutions authored Jun 23, 2023
2 parents a354b5a + f4a6d31 commit 685692a
Show file tree
Hide file tree
Showing 4 changed files with 103 additions and 16 deletions.
2 changes: 1 addition & 1 deletion SSAppUpdater.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

Pod::Spec.new do |s|
s.name = "SSAppUpdater"
s.version = "1.1.1"
s.version = "1.2.0"
s.summary = "SSAppUpdater is an open-source framework which notify the users about newly updated version on app store of the apps user already installed "


Expand Down
99 changes: 97 additions & 2 deletions Sources/SSAppUpdater/Models/LookUpResponseModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ internal struct Result: Codable {
let artworkUrl100: String?
let artworkUrl512: String?
let artworkUrl60: String?
let averageUserRating: Int?
let averageUserRatingForCurrentVersion: Int?
let averageUserRating: Float?
let averageUserRatingForCurrentVersion: Float?
let bundleId: String?
let contentAdvisoryRating: String?
let currency: String?
Expand Down Expand Up @@ -63,4 +63,99 @@ internal struct Result: Codable {
let version: String?
let wrapperType: String?

enum CodingKeys: String, CodingKey {
case advisories = "advisories"
case appletvScreenshotUrls = "appletvScreenshotUrls"
case artistId = "artistId"
case artistName = "artistName"
case artistViewUrl = "artistViewUrl"
case artworkUrl100 = "artworkUrl100"
case artworkUrl512 = "artworkUrl512"
case artworkUrl60 = "artworkUrl60"
case averageUserRating = "averageUserRating"
case averageUserRatingForCurrentVersion = "averageUserRatingForCurrentVersion"
case bundleId = "bundleId"
case contentAdvisoryRating = "contentAdvisoryRating"
case currency = "currency"
case currentVersionReleaseDate = "currentVersionReleaseDate"
case descriptionField = "descriptionField"
case features = "features"
case fileSizeBytes = "fileSizeBytes"
case formattedPrice = "formattedPrice"
case genreIds = "genreIds"
case genres = "genres"
case ipadScreenshotUrls = "ipadScreenshotUrls"
case isGameCenterEnabled = "isGameCenterEnabled"
case isVppDeviceBasedLicensingEnabled = "isVppDeviceBasedLicensingEnabled"
case kind = "kind"
case languageCodesISO2A = "languageCodesISO2A"
case minimumOsVersion = "minimumOsVersion"
case price = "price"
case primaryGenreId = "primaryGenreId"
case primaryGenreName = "primaryGenreName"
case releaseDate = "releaseDate"
case releaseNotes = "releaseNotes"
case screenshotUrls = "screenshotUrls"
case sellerName = "sellerName"
case sellerUrl = "sellerUrl"
case supportedDevices = "supportedDevices"
case trackCensoredName = "trackCensoredName"
case trackContentRating = "trackContentRating"
case trackId = "trackId"
case trackName = "trackName"
case trackViewUrl = "trackViewUrl"
case userRatingCount = "userRatingCount"
case userRatingCountForCurrentVersion = "userRatingCountForCurrentVersion"
case version = "version"
case wrapperType = "wrapperType"
}

init(from decoder: Decoder) throws {
let values = try decoder.container(keyedBy: CodingKeys.self)
advisories = try values.decodeIfPresent([String].self, forKey: .advisories)
appletvScreenshotUrls = try values.decodeIfPresent([String].self, forKey: .appletvScreenshotUrls)
artistId = try values.decodeIfPresent(Int.self, forKey: .artistId)
artistName = try values.decodeIfPresent(String.self, forKey: .artistName)
artistViewUrl = try values.decodeIfPresent(String.self, forKey: .artistViewUrl)
artworkUrl100 = try values.decodeIfPresent(String.self, forKey: .artworkUrl100)
artworkUrl512 = try values.decodeIfPresent(String.self, forKey: .artworkUrl512)
artworkUrl60 = try values.decodeIfPresent(String.self, forKey: .artworkUrl60)
averageUserRating = try values.decodeIfPresent(Float.self, forKey: .averageUserRating)
averageUserRatingForCurrentVersion = try values.decodeIfPresent(Float.self, forKey: .averageUserRatingForCurrentVersion)
bundleId = try values.decodeIfPresent(String.self, forKey: .bundleId)
contentAdvisoryRating = try values.decodeIfPresent(String.self, forKey: .contentAdvisoryRating)
currency = try values.decodeIfPresent(String.self, forKey: .currency)
currentVersionReleaseDate = try values.decodeIfPresent(String.self, forKey: .currentVersionReleaseDate)
descriptionField = try values.decodeIfPresent(String.self, forKey: .descriptionField)
features = try values.decodeIfPresent([String].self, forKey: .features)
fileSizeBytes = try values.decodeIfPresent(String.self, forKey: .fileSizeBytes)
formattedPrice = try values.decodeIfPresent(String.self, forKey: .formattedPrice)
genreIds = try values.decodeIfPresent([String].self, forKey: .genreIds)
genres = try values.decodeIfPresent([String].self, forKey: .genres)
ipadScreenshotUrls = try values.decodeIfPresent([String].self, forKey: .ipadScreenshotUrls)
isGameCenterEnabled = try values.decodeIfPresent(Bool.self, forKey: .isGameCenterEnabled)
isVppDeviceBasedLicensingEnabled = try values.decodeIfPresent(Bool.self, forKey: .isVppDeviceBasedLicensingEnabled)
kind = try values.decodeIfPresent(String.self, forKey: .kind)
languageCodesISO2A = try values.decodeIfPresent([String].self, forKey: .languageCodesISO2A)
minimumOsVersion = try values.decodeIfPresent(String.self, forKey: .minimumOsVersion)
price = try values.decodeIfPresent(Float.self, forKey: .price)
primaryGenreId = try values.decodeIfPresent(Int.self, forKey: .primaryGenreId)
primaryGenreName = try values.decodeIfPresent(String.self, forKey: .primaryGenreName)
releaseDate = try values.decodeIfPresent(String.self, forKey: .releaseDate)
releaseNotes = try values.decodeIfPresent(String.self, forKey: .releaseNotes)
screenshotUrls = try values.decodeIfPresent([String].self, forKey: .screenshotUrls)
sellerName = try values.decodeIfPresent(String.self, forKey: .sellerName)
sellerUrl = try values.decodeIfPresent(String.self, forKey: .sellerUrl)
supportedDevices = try values.decodeIfPresent([String].self, forKey: .supportedDevices)
trackCensoredName = try values.decodeIfPresent(String.self, forKey: .trackCensoredName)
trackContentRating = try values.decodeIfPresent(String.self, forKey: .trackContentRating)
trackId = try values.decodeIfPresent(Int.self, forKey: .trackId)
trackName = try values.decodeIfPresent(String.self, forKey: .trackName)
trackViewUrl = try values.decodeIfPresent(String.self, forKey: .trackViewUrl)
userRatingCount = try values.decodeIfPresent(Int.self, forKey: .userRatingCount)
userRatingCountForCurrentVersion = try values.decodeIfPresent(Int.self, forKey: .userRatingCountForCurrentVersion)
version = try values.decodeIfPresent(String.self, forKey: .version)
wrapperType = try values.decodeIfPresent(String.self, forKey: .wrapperType)
}

}
14 changes: 3 additions & 11 deletions Sources/SSAppUpdater/PerformVersionCheck/PerformVersionCheck.swift
Original file line number Diff line number Diff line change
Expand Up @@ -108,23 +108,15 @@ internal class PerformVersionCheck {
guard let releaseNote = versionInfo.appReleaseNote, let trackID = versionInfo.appID, let appStoreVersion = versionInfo.appVersion else {
return
}
var window = UIWindow()
if #available(iOS 13.0, *) {
guard let windowScene = getFirstWindowScene() else { return }
window = UIWindow(windowScene: windowScene)
} else {
window = UIWindow(frame: UIScreen.main.bounds)
}
let window = UIApplication.shared.windows.first

let ssViewController = SSViewController()
ssViewController.currentWindow = window
ssViewController.releaseNote = releaseNote
ssViewController.trackID = trackID
ssViewController.appStoreVersion = appStoreVersion
let navController = UINavigationController(rootViewController: ssViewController)
navController.navigationBar.isHidden = true
window.rootViewController = navController
window.makeKeyAndVisible()
ssViewController.modalPresentationStyle = .overFullScreen
window?.rootViewController?.present(ssViewController, animated: false)
}

@available(iOS 13.0, *)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ class SSViewController: UIViewController {
}
let cancelAction = UIAlertAction(title: "Cancel", style: .default) { (action) in
DispatchQueue.main.async {
self.currentWindow = nil
self.dismiss(animated: false)
}
}
let skipAction = UIAlertAction(title: "Skip this version", style: .default) { (action) in
DispatchQueue.main.async {
UserDefaults.skipVersion = self.appStoreVersion
self.currentWindow = nil
self.dismiss(animated: false)
}
}
var actions: [UIAlertAction] = []
Expand Down

0 comments on commit 685692a

Please sign in to comment.