diff --git a/README.md b/README.md index b548324a..0a87f89e 100644 --- a/README.md +++ b/README.md @@ -56,12 +56,10 @@ A fully-featured iOS client for [appdb.to](https://appdb.to) written in Swift 5 You can download the latest .ipa from the [releases page](https://github.com/n3d1117/appdb/releases). ## Build manually -Alernatively, you can build the project manually. -Make sure you have [Carthage](https://github.com/Carthage/Carthage) installed. Run the following commands: +Alernatively, you can build the project manually. Run the following commands: ``` $ git clone https://github.com/n3d1117/appdb.git $ cd appdb/ -$ carthage update --platform iOS --use-xcframeworks $ open appdb.xcodeproj ``` diff --git a/Widgets/Models/Content.swift b/Widgets/Models/Content.swift index 01c3f96e..f0118c76 100644 --- a/Widgets/Models/Content.swift +++ b/Widgets/Models/Content.swift @@ -10,11 +10,11 @@ import Foundation struct Content: Identifiable, Decodable { - let id: String + let id: Int let name: String let image: String static var dummy: Content { - Content(id: "", name: "Example Name", image: "") + Content(id: 0, name: "Example Name", image: "") } } diff --git a/Widgets/Models/News.swift b/Widgets/Models/News.swift index c0efd503..6d85250a 100644 --- a/Widgets/Models/News.swift +++ b/Widgets/Models/News.swift @@ -10,11 +10,11 @@ import Foundation struct News: Identifiable, Decodable { - let id: String + let id: Int let title: String let added: String static var dummy: News { - News(id: "", title: "Example News Title Goes Here", added: "Tue, 16 Feb 2021 14:30:48 +0000") + News(id: 0, title: "Example News Title Goes Here", added: "Tue, 16 Feb 2021 14:30:48 +0000") } } diff --git a/Widgets/Network/AppdbRepository.swift b/Widgets/Network/AppdbRepository.swift index 561f679a..546b5cdb 100644 --- a/Widgets/Network/AppdbRepository.swift +++ b/Widgets/Network/AppdbRepository.swift @@ -53,9 +53,8 @@ struct AppdbSearchResource: APIResource { var queryItems: [URLQueryItem]? init(_ contentType: ContentType, _ sortOrder: SortOrder, _ contentPrice: ContentPrice) { - methodPath = "/v1.5/" + methodPath = "/v1.6/search/" queryItems = [ - URLQueryItem(name: "action", value: "search"), URLQueryItem(name: "type", value: type(from: contentType)), URLQueryItem(name: "price", value: price(from: contentPrice)), URLQueryItem(name: "order", value: order(from: sortOrder)) @@ -77,9 +76,8 @@ struct AppdbNewsResource: APIResource { var queryItems: [URLQueryItem]? init() { - methodPath = "/v1.5/" + methodPath = "/v1.6/get_pages/" queryItems = [ - URLQueryItem(name: "action", value: "get_pages"), URLQueryItem(name: "category", value: "news"), URLQueryItem(name: "length", value: "8") ] diff --git a/appdb.xcodeproj/project.pbxproj b/appdb.xcodeproj/project.pbxproj index 084b3e76..4ff1161f 100644 --- a/appdb.xcodeproj/project.pbxproj +++ b/appdb.xcodeproj/project.pbxproj @@ -670,22 +670,6 @@ 81BE06711E6CB6DE00AD9827 /* Details+SegmentControl.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Details+SegmentControl.swift"; sourceTree = ""; }; 81C274D7229FFA57000D8BEB /* Credits+Views.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Credits+Views.swift"; sourceTree = ""; }; 81C82B7A22C3DBC1008BB076 /* AskBundleBeforeUploadViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AskBundleBeforeUploadViewController.swift; sourceTree = ""; }; - 81CD0A9425F27FBF001C9EEA /* SwiftMessages.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = SwiftMessages.xcframework; path = Carthage/Build/SwiftMessages.xcframework; sourceTree = ""; }; - 81CD0A9525F27FBF001C9EEA /* SwiftyJSON.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = SwiftyJSON.xcframework; path = Carthage/Build/SwiftyJSON.xcframework; sourceTree = ""; }; - 81CD0A9625F27FBF001C9EEA /* AlamofireImage.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = AlamofireImage.xcframework; path = Carthage/Build/AlamofireImage.xcframework; sourceTree = ""; }; - 81CD0A9725F27FBF001C9EEA /* Alamofire.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = Alamofire.xcframework; path = Carthage/Build/Alamofire.xcframework; sourceTree = ""; }; - 81CD0A9825F27FBF001C9EEA /* Localize_Swift.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = Localize_Swift.xcframework; path = Carthage/Build/Localize_Swift.xcframework; sourceTree = ""; }; - 81CD0A9925F27FBF001C9EEA /* AlamofireNetworkActivityIndicator.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = AlamofireNetworkActivityIndicator.xcframework; path = Carthage/Build/AlamofireNetworkActivityIndicator.xcframework; sourceTree = ""; }; - 81CD0A9A25F27FBF001C9EEA /* Cartography.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = Cartography.xcframework; path = Carthage/Build/Cartography.xcframework; sourceTree = ""; }; - 81CD0A9B25F27FBF001C9EEA /* BLTNBoard.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = BLTNBoard.xcframework; path = Carthage/Build/BLTNBoard.xcframework; sourceTree = ""; }; - 81CD0A9C25F27FBF001C9EEA /* Static.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = Static.xcframework; path = Carthage/Build/Static.xcframework; sourceTree = ""; }; - 81CD0A9D25F27FBF001C9EEA /* SwiftTheme.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = SwiftTheme.xcframework; path = Carthage/Build/SwiftTheme.xcframework; sourceTree = ""; }; - 81CD0A9E25F27FBF001C9EEA /* DeepDiff.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = DeepDiff.xcframework; path = Carthage/Build/DeepDiff.xcframework; sourceTree = ""; }; - 81CD0A9F25F27FBF001C9EEA /* Swifter.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = Swifter.xcframework; path = Carthage/Build/Swifter.xcframework; sourceTree = ""; }; - 81CD0AA025F27FBF001C9EEA /* Kanna.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = Kanna.xcframework; path = Carthage/Build/Kanna.xcframework; sourceTree = ""; }; - 81CD0AA125F27FBF001C9EEA /* ObjectMapper.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = ObjectMapper.xcframework; path = Carthage/Build/ObjectMapper.xcframework; sourceTree = ""; }; - 81CD0AA225F27FBF001C9EEA /* ZIPFoundation.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = ZIPFoundation.xcframework; path = Carthage/Build/ZIPFoundation.xcframework; sourceTree = ""; }; - 81CD0AA325F27FBF001C9EEA /* Cosmos.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = Cosmos.xcframework; path = Carthage/Build/Cosmos.xcframework; sourceTree = ""; }; 81D3F72A2163E1DA001EC9F2 /* Item+Properties.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Item+Properties.swift"; sourceTree = ""; }; 81D661751E5A0B6C00BB6461 /* Details+Extension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = "Details+Extension.swift"; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; 81D873332365BAD800F7240E /* fr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fr; path = fr.lproj/Localizable.strings; sourceTree = ""; }; @@ -1023,8 +1007,8 @@ children = ( 813F01772A7C02C2008DCA2E /* AltStoreRepoCell.swift */, 813F01782A7C02C2008DCA2E /* AltStoreRepos+Extension.swift */, - 813F01792A7C02C2008DCA2E /* Apps */, 813F017E2A7C02C2008DCA2E /* AltStoreRepos.swift */, + 813F01792A7C02C2008DCA2E /* Apps */, ); name = AltStoreRepos; path = appdb/Tabs/Settings/AltStoreRepos; @@ -1615,22 +1599,6 @@ 81AB37A31DAC2ED7003A586F /* Frameworks */ = { isa = PBXGroup; children = ( - 81CD0A9725F27FBF001C9EEA /* Alamofire.xcframework */, - 81CD0A9625F27FBF001C9EEA /* AlamofireImage.xcframework */, - 81CD0A9925F27FBF001C9EEA /* AlamofireNetworkActivityIndicator.xcframework */, - 81CD0A9B25F27FBF001C9EEA /* BLTNBoard.xcframework */, - 81CD0A9A25F27FBF001C9EEA /* Cartography.xcframework */, - 81CD0AA325F27FBF001C9EEA /* Cosmos.xcframework */, - 81CD0A9E25F27FBF001C9EEA /* DeepDiff.xcframework */, - 81CD0AA025F27FBF001C9EEA /* Kanna.xcframework */, - 81CD0A9825F27FBF001C9EEA /* Localize_Swift.xcframework */, - 81CD0AA125F27FBF001C9EEA /* ObjectMapper.xcframework */, - 81CD0A9C25F27FBF001C9EEA /* Static.xcframework */, - 81CD0A9F25F27FBF001C9EEA /* Swifter.xcframework */, - 81CD0A9425F27FBF001C9EEA /* SwiftMessages.xcframework */, - 81CD0A9D25F27FBF001C9EEA /* SwiftTheme.xcframework */, - 81CD0A9525F27FBF001C9EEA /* SwiftyJSON.xcframework */, - 81CD0AA225F27FBF001C9EEA /* ZIPFoundation.xcframework */, 81521EAB25F672600064CA84 /* WidgetKit.framework */, 81521EAD25F672600064CA84 /* SwiftUI.framework */, ); @@ -2629,7 +2597,7 @@ "@executable_path/Frameworks", "@executable_path/../../Frameworks", ); - MARKETING_VERSION = 1.1.3; + MARKETING_VERSION = 1.1.6; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = "it.ned.appdb-ios.Widgets"; @@ -2662,7 +2630,7 @@ "@executable_path/Frameworks", "@executable_path/../../Frameworks", ); - MARKETING_VERSION = 1.1.3; + MARKETING_VERSION = 1.1.6; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = "it.ned.appdb-ios.Widgets"; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -2840,7 +2808,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.1.3; + MARKETING_VERSION = 1.1.6; OTHER_SWIFT_FLAGS = ""; PRODUCT_BUNDLE_IDENTIFIER = "it.ned.appdb-ios"; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -2879,7 +2847,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.1.3; + MARKETING_VERSION = 1.1.6; OTHER_SWIFT_FLAGS = ""; PRODUCT_BUNDLE_IDENTIFIER = "it.ned.appdb-ios"; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -2953,7 +2921,7 @@ repositoryURL = "https://github.com/Alamofire/AlamofireImage"; requirement = { kind = upToNextMajorVersion; - minimumVersion = 4.0.0; + minimumVersion = 4.2.0; }; }; 813F013C2A7BFF50008DCA2E /* XCRemoteSwiftPackageReference "AlamofireNetworkActivityIndicator" */ = { diff --git a/appdb/API/API+AltStoreRepos.swift b/appdb/API/API+AltStoreRepos.swift index db9dff50..c9e41cb0 100644 --- a/appdb/API/API+AltStoreRepos.swift +++ b/appdb/API/API+AltStoreRepos.swift @@ -12,7 +12,7 @@ import SwiftyJSON extension API { static func getAltStoreRepos(isPublic: Bool = false, success: @escaping (_ items: [AltStoreRepo]) -> Void, fail: @escaping (_ error: String) -> Void) { - AF.request(endpoint, parameters: ["action": Actions.getAltStoreRepos.rawValue, "is_public": isPublic ? 1 : 0, "lang": languageCode], headers: headersWithCookie) + AF.request(endpoint + Actions.getAltStoreRepos.rawValue, parameters: ["is_public": isPublic ? 1 : 0, "lang": languageCode], headers: headersWithCookie) .responseArray(keyPath: "data") { (response: AFDataResponse<[AltStoreRepo]>) in switch response.result { case .success(let results): @@ -24,7 +24,7 @@ extension API { } static func getAltStoreRepo(id: String, success: @escaping (_ item: AltStoreRepo) -> Void, fail: @escaping (_ error: String) -> Void) { - AF.request(endpoint, parameters: ["action": Actions.getAltStoreRepos.rawValue, "id": id, "lang": languageCode], headers: headersWithCookie) + AF.request(endpoint + Actions.getAltStoreRepos.rawValue, parameters: ["id": id, "lang": languageCode], headers: headersWithCookie) .responseArray(keyPath: "data") { (response: AFDataResponse<[AltStoreRepo]>) in switch response.result { case .success(let result): @@ -40,7 +40,7 @@ extension API { } static func addAltStoreRepo(url: String, isPublic: Bool = false, success: @escaping (_ item: AltStoreRepo) -> Void, fail: @escaping (_ error: String) -> Void) { - AF.request(endpoint, parameters: ["action": Actions.editAltStoreRepo.rawValue, "url": url, "is_public": isPublic ? 1 : 0, "lang": languageCode], headers: headersWithCookie) + AF.request(endpoint + Actions.editAltStoreRepo.rawValue, parameters: ["url": url, "is_public": isPublic ? 1 : 0, "lang": languageCode], headers: headersWithCookie) .responseObject(keyPath: "data") { (response: AFDataResponse) in switch response.result { case .success(let result): @@ -52,7 +52,7 @@ extension API { } static func editAltStoreRepo(id: String, url: String, isPublic: Bool = false, success: @escaping (_ item: AltStoreRepo) -> Void, fail: @escaping (_ error: String) -> Void) { - AF.request(endpoint, parameters: ["action": Actions.editAltStoreRepo.rawValue, "id": id, "url": url, "is_public": isPublic ? 1 : 0, "lang": languageCode], headers: headersWithCookie) + AF.request(endpoint + Actions.editAltStoreRepo.rawValue, parameters: ["id": id, "url": url, "is_public": isPublic ? 1 : 0, "lang": languageCode], headers: headersWithCookie) .responseObject(keyPath: "data") { (response: AFDataResponse) in switch response.result { case .success(let result): @@ -64,7 +64,7 @@ extension API { } static func deleteAltStoreRepo(id: String, success: @escaping () -> Void, fail: @escaping (_ error: String) -> Void) { - AF.request(endpoint, parameters: ["action": Actions.deleteAltStoreRepo.rawValue, "id": id, "lang": languageCode], headers: headersWithCookie) + AF.request(endpoint + Actions.deleteAltStoreRepo.rawValue, parameters: ["id": id, "lang": languageCode], headers: headersWithCookie) .responseJSON { response in switch response.result { case .success(let value): diff --git a/appdb/API/API+Configuration.swift b/appdb/API/API+Configuration.swift index c80c7065..1e578170 100644 --- a/appdb/API/API+Configuration.swift +++ b/appdb/API/API+Configuration.swift @@ -13,7 +13,7 @@ import SwiftyJSON extension API { static func getEnterpriseCerts(success: @escaping (_ items: [EnterpriseCertificate]) -> Void, fail: @escaping (_ error: NSError) -> Void) { - AF.request(endpoint, parameters: ["action": Actions.getEnterpriseCerts.rawValue, "lang": languageCode], headers: headersWithCookie) + AF.request(endpoint + Actions.getEnterpriseCerts.rawValue, parameters: ["lang": languageCode], headers: headersWithCookie) .responseArray(keyPath: "data") { (response: AFDataResponse<[EnterpriseCertificate]>) in switch response.result { case .success(let certs): @@ -25,8 +25,7 @@ extension API { } static func getConfiguration(success: @escaping () -> Void, fail: @escaping (_ error: String) -> Void) { - AF.request(endpoint, parameters: ["action": Actions.getConfiguration.rawValue, - "lang": languageCode], headers: headersWithCookie) + AF.request(endpoint + Actions.getConfiguration.rawValue, parameters: ["lang": languageCode], headers: headersWithCookie) .responseJSON { response in switch response.result { case .success(let value): @@ -36,13 +35,13 @@ extension API { } else { let data = json["data"] - checkRevocation(completion: { isRevoked, revokedOn in + // checkRevocation(completion: { isRevoked, revokedOn in Preferences.set(.appsync, to: data["appsync"].stringValue == "yes") Preferences.set(.ignoreCompatibility, to: data["ignore_compatibility"].stringValue == "yes") Preferences.set(.askForInstallationOptions, to: data["ask_for_installation_options"].stringValue == "yes") - Preferences.set(.revoked, to: isRevoked) - Preferences.set(.revokedOn, to: revokedOn) + // Preferences.set(.revoked, to: isRevoked) + // Preferences.set(.revokedOn, to: revokedOn) if !data["p12_password"].stringValue.isEmpty, !data["p12"].stringValue.isEmpty, !data["provision"].stringValue.isEmpty { Preferences.set(.usesCustomDeveloperIdentity, to: true) @@ -77,9 +76,9 @@ extension API { Preferences.set(.optedOutFromEmails, to: data["is_opted_out_from_emails"].stringValue == "yes") success() - }, fail: { error in - fail(error) - }) + // }, fail: { error in + // fail(error) + // }) } case .failure(let error): fail(error.localizedDescription) @@ -88,10 +87,10 @@ extension API { } static func setConfiguration(params: [ConfigurationParameters: String], success: @escaping () -> Void, fail: @escaping (_ error: String) -> Void) { - var parameters: [String: Any] = ["action": Actions.configure.rawValue, "lang": languageCode] + var parameters: [String: Any] = ["lang": languageCode] for (key, value) in params { parameters[key.rawValue] = value } - AF.request(endpoint, parameters: parameters, headers: headersWithCookie) + AF.request(endpoint + Actions.configure.rawValue, parameters: parameters, headers: headersWithCookie) .responseJSON { response in switch response.result { case .success(let value): @@ -121,8 +120,8 @@ extension API { } } - static func checkRevocation(completion: @escaping (_ revoked: Bool, _ revokedOn: String) -> Void, fail: @escaping (_ error: String) -> Void) { - AF.request(endpoint, parameters: ["action": Actions.checkRevoke.rawValue], headers: headersWithCookie) + /*static func checkRevocation(completion: @escaping (_ revoked: Bool, _ revokedOn: String) -> Void, fail: @escaping (_ error: String) -> Void) { + AF.request(endpoint + Actions.checkRevoke.rawValue, headers: headersWithCookie) .responseJSON { response in switch response.result { case .success(let value): @@ -132,5 +131,5 @@ extension API { fail(error.localizedDescription) } } - } + }*/ } diff --git a/appdb/API/API+DeviceLink.swift b/appdb/API/API+DeviceLink.swift index 0638b7b3..09e935f4 100644 --- a/appdb/API/API+DeviceLink.swift +++ b/appdb/API/API+DeviceLink.swift @@ -20,7 +20,7 @@ extension API { return } - AF.request(endpoint, parameters: ["action": Actions.getLinkToken.rawValue, "udid": deviceUdid, "client": "appdb unofficial client"], headers: headers) + AF.request(endpoint + Actions.getLinkToken.rawValue, parameters: ["udid": deviceUdid, "client": "appdb unofficial client"], headers: headers) .responseJSON { response in switch response.result { case .success(let value): @@ -39,14 +39,14 @@ extension API { fail() }) } - case .failure: + case .failure(let error): fail() } } } static func linkDevice(code: String, success: @escaping () -> Void, fail: @escaping (_ error: String) -> Void) { - AF.request(endpoint, parameters: ["action": Actions.link.rawValue, "type": "control", "link_code": code, + AF.request(endpoint + Actions.link.rawValue, parameters: ["type": "control", "link_code": code, "lang": languageCode], headers: headers) .responseJSON { response in switch response.result { @@ -72,7 +72,7 @@ extension API { } static func getLinkCode(success: @escaping () -> Void, fail: @escaping (_ error: String) -> Void) { - AF.request(endpoint, parameters: ["action": Actions.getLinkCode.rawValue, "lang": languageCode], headers: headersWithCookie) + AF.request(endpoint + Actions.getLinkCode.rawValue, parameters: ["lang": languageCode], headers: headersWithCookie) .responseJSON { response in switch response.result { case .success(let value): @@ -90,7 +90,7 @@ extension API { } static func emailLinkCode(email: String, success: @escaping () -> Void, fail: @escaping (_ error: String) -> Void) { - AF.request(endpoint, parameters: ["email": email, "action": Actions.emailLinkCode.rawValue, + AF.request(endpoint + Actions.emailLinkCode.rawValue, parameters: ["email": email, "lang": languageCode], headers: headersWithCookie) .responseJSON { response in switch response.result { @@ -108,8 +108,7 @@ extension API { } static func getAppdbAppsBundleIdsTicket(success: @escaping (_ ticket: String) -> Void, fail: @escaping (_ error: String) -> Void) { - AF.request(endpoint, parameters: ["action": Actions.getAppdbAppsBundleIdsTicket.rawValue, - "lang": languageCode], headers: headersWithCookie) + AF.request(endpoint + Actions.getAppdbAppsBundleIdsTicket.rawValue, parameters: ["lang": languageCode], headers: headersWithCookie) .responseJSON { response in switch response.result { case .success(let value): @@ -126,7 +125,7 @@ extension API { } static func getAppdbAppsBundleIds(ticket: String, success: @escaping (_ bundleIds: [String]) -> Void, fail: @escaping (_ error: String, _ code: String) -> Void) { - AF.request(endpoint, parameters: ["t": ticket, "action": Actions.getAppdbAppsBundleIds.rawValue, + AF.request(endpoint + Actions.getAppdbAppsBundleIds.rawValue, parameters: ["t": ticket, "lang": languageCode], headers: headersWithCookie) .responseJSON { response in switch response.result { @@ -144,8 +143,7 @@ extension API { } static func getAllLinkedDevices(success: @escaping (_ devices: [LinkedDevice]) -> Void, fail: @escaping (_ error: String) -> Void) { - AF.request(endpoint, parameters: ["action": Actions.getAllDevices.rawValue, - "lang": languageCode], headers: headersWithCookie) + AF.request(endpoint + Actions.getAllDevices.rawValue, parameters: ["lang": languageCode], headers: headersWithCookie) .responseArray(keyPath: "data") { (response: AFDataResponse<[LinkedDevice]>) in switch response.result { case .success(let devices): diff --git a/appdb/API/API+DeviceStatus.swift b/appdb/API/API+DeviceStatus.swift index e0063526..0c573344 100644 --- a/appdb/API/API+DeviceStatus.swift +++ b/appdb/API/API+DeviceStatus.swift @@ -13,7 +13,7 @@ import SwiftyJSON extension API { static func getDeviceStatus(success: @escaping (_ items: [DeviceStatusItem]) -> Void, fail: @escaping (_ error: NSError) -> Void) { - AF.request(endpoint, parameters: ["action": Actions.getStatus.rawValue, "lang": languageCode], headers: headersWithCookie) + AF.request(endpoint + Actions.getStatus.rawValue, parameters: ["lang": languageCode], headers: headersWithCookie) .responseArray(keyPath: "data") { (response: AFDataResponse<[DeviceStatusItem]>) in switch response.result { case .success(let results): @@ -25,7 +25,7 @@ extension API { } static func emptyCommandQueue(success: @escaping () -> Void) { - AF.request(endpoint, parameters: ["action": Actions.clear.rawValue, "lang": languageCode], headers: headersWithCookie) + AF.request(endpoint + Actions.clear.rawValue, parameters: ["lang": languageCode], headers: headersWithCookie) .responseJSON { response in switch response.result { case .success: @@ -37,10 +37,10 @@ extension API { } static func fixCommand(uuid: String) { - AF.request(endpoint, parameters: ["action": Actions.fix.rawValue, "uuid": uuid, "lang": languageCode], headers: headersWithCookie).responseJSON { _ in } + AF.request(endpoint + Actions.fix.rawValue, parameters: ["uuid": uuid, "lang": languageCode], headers: headersWithCookie).responseJSON { _ in } } static func retryCommand(uuid: String) { - AF.request(endpoint, parameters: ["action": Actions.retry.rawValue, "uuid": uuid, "lang": languageCode], headers: headersWithCookie).responseJSON { _ in } + AF.request(endpoint + Actions.retry.rawValue, parameters: ["uuid": uuid, "lang": languageCode], headers: headersWithCookie).responseJSON { _ in } } } diff --git a/appdb/API/API+Dylibs.swift b/appdb/API/API+Dylibs.swift index 7eeb7bb2..52076618 100644 --- a/appdb/API/API+Dylibs.swift +++ b/appdb/API/API+Dylibs.swift @@ -13,7 +13,7 @@ import SwiftyJSON extension API { static func getDylibs(success: @escaping (_ items: [String]) -> Void, fail: @escaping (_ error: String) -> Void) { - AF.request(endpoint, parameters: ["action": Actions.getDylibs.rawValue, "lang": languageCode], headers: headersWithCookie) + AF.request(endpoint + Actions.getDylibs.rawValue, parameters: ["lang": languageCode], headers: headersWithCookie) .responseJSON { response in switch response.result { case .success(let value): @@ -30,7 +30,7 @@ extension API { } static func addDylib(url: String, success: @escaping () -> Void, fail: @escaping (_ error: String) -> Void) { - AF.request(endpoint, parameters: ["action": Actions.addDylib.rawValue, "url": url, "lang": languageCode], headers: headersWithCookie) + AF.request(endpoint + Actions.addDylib.rawValue, parameters: ["url": url, "lang": languageCode], headers: headersWithCookie) .responseJSON { response in switch response.result { case .success(let value): @@ -48,16 +48,10 @@ extension API { } static func uploadDylib(fileURL: URL, request: @escaping (_ r: Alamofire.UploadRequest) -> Void, completion: @escaping (_ error: String?) -> Void) { - let parameters = [ - "action": Actions.addDylib.rawValue, - ] request(AF.upload(multipartFormData: { multipartFormData in multipartFormData.append(fileURL, withName: "dylib") - for (key, value) in parameters { - multipartFormData.append(value.data(using: String.Encoding.utf8)!, withName: key) - } - }, to: endpoint, method: .post, headers: headersWithCookie).responseJSON { response in + }, to: endpoint + Actions.addDylib.rawValue, method: .post, headers: headersWithCookie).responseJSON { response in switch response.result { case .success(let value): @@ -74,7 +68,7 @@ extension API { } static func deleteDylib(name: String, success: @escaping () -> Void, fail: @escaping (_ error: String) -> Void) { - AF.request(endpoint, parameters: ["action": Actions.deleteDylib.rawValue, "name": name, "lang": languageCode], headers: headersWithCookie) + AF.request(endpoint + Actions.deleteDylib.rawValue, parameters: ["name": name, "lang": languageCode], headers: headersWithCookie) .responseJSON { response in switch response.result { case .success(let value): diff --git a/appdb/API/API+Genres.swift b/appdb/API/API+Genres.swift index 9244adeb..380bcecb 100644 --- a/appdb/API/API+Genres.swift +++ b/appdb/API/API+Genres.swift @@ -14,7 +14,7 @@ extension API { // MARK: - Genres static func listGenres(completion: @escaping () -> Void) { - AF.request(endpoint, parameters: ["action": Actions.listGenres.rawValue, "lang": languageCode], headers: headers) + AF.request(endpoint + Actions.listGenres.rawValue, parameters: ["lang": languageCode], headers: headers) .responseJSON { response in switch response.result { case .success(let value): @@ -29,23 +29,23 @@ extension API { genres.append(Genre(category: "books", id: "0", name: "All Categories".localized())) // Cydia genres - for (key, value): (String, JSON) in data["cydia"] { + for value in data["cydia"].arrayValue { genres.append( - Genre(category: "cydia", id: key, name: value["name"].stringValue, amount: value["content_amount"].stringValue) + Genre(category: "cydia", id: value["id"].intValue.description, name: value["name"].stringValue, amount: value["content_amount"].stringValue) ) } // iOS Genres - for (key, value): (String, JSON) in data["ios"] { + for value in data["ios"].arrayValue { genres.append( - Genre(category: "ios", id: key, name: value["name"].stringValue, amount: value["content_amount"].stringValue) + Genre(category: "ios", id: value["id"].stringValue, name: value["name"].stringValue, amount: value["content_amount"].stringValue) ) } // Books Genres - for (key, value): (String, JSON) in data["books"] { + for value in data["books"].arrayValue { genres.append( - Genre(category: "books", id: key, name: value["name"].stringValue, amount: value["content_amount"].stringValue) + Genre(category: "books", id: value["id"].stringValue, name: value["name"].stringValue, amount: value["content_amount"].stringValue) ) } @@ -89,7 +89,7 @@ extension API { } static func getIcon(id: String, type: ItemType, completion: @escaping (String) -> Void) { - AF.request(endpoint, parameters: ["action": Actions.search.rawValue, "type": type.rawValue, "genre": id, "order": Order.all.rawValue, "lang": languageCode], headers: headers) + AF.request(endpoint + Actions.search.rawValue, parameters: ["type": type.rawValue, "genre": id, "order": Order.all.rawValue, "lang": languageCode], headers: headers) .responseJSON { response in switch response.result { case .success(let value): diff --git a/appdb/API/API+IPACache.swift b/appdb/API/API+IPACache.swift index 7727bc2d..f12c383d 100644 --- a/appdb/API/API+IPACache.swift +++ b/appdb/API/API+IPACache.swift @@ -13,8 +13,7 @@ import SwiftyJSON extension API { static func getIPACacheStatus(success: @escaping (_ status: IPACacheStatus) -> Void, fail: @escaping (_ error: NSError) -> Void) { - - AF.request(endpoint, parameters: ["action": Actions.getIpaCacheStatus.rawValue, "lang": languageCode], headers: headersWithCookie) + AF.request(endpoint + Actions.getIpaCacheStatus.rawValue, parameters: ["lang": languageCode], headers: headersWithCookie) .responseObject(keyPath: "data") { (response: AFDataResponse) in switch response.result { case .success(let result): @@ -26,7 +25,7 @@ extension API { } static func reinstallEverything(success: @escaping () -> Void, fail: @escaping (_ error: String) -> Void) { - AF.request(endpoint, parameters: ["action": Actions.installFromCache.rawValue, "lang": languageCode], headers: headersWithCookie) + AF.request(endpoint + Actions.installFromCache.rawValue, parameters: ["lang": languageCode], headers: headersWithCookie) .responseJSON { response in switch response.result { case .success(let value): @@ -43,21 +42,21 @@ extension API { } static func clearIpaCache(success: @escaping () -> Void) { - AF.request(endpoint, parameters: ["action": Actions.clearIpaCache.rawValue, "lang": languageCode], headers: headersWithCookie) + AF.request(endpoint + Actions.clearIpaCache.rawValue, parameters: ["lang": languageCode], headers: headersWithCookie) .response { _ in success() } } static func deleteIpaFromCache(bundleId: String, success: @escaping () -> Void) { - AF.request(endpoint, parameters: ["action": Actions.deleteIpaFromCache.rawValue, "bundle_id": bundleId, "lang": languageCode], headers: headersWithCookie) + AF.request(endpoint + Actions.deleteIpaFromCache.rawValue, parameters: ["bundle_id": bundleId, "lang": languageCode], headers: headersWithCookie) .response { _ in success() } } static func revalidateIpaCache(success: @escaping () -> Void) { - AF.request(endpoint, parameters: ["action": Actions.revalidateIpaCache.rawValue, "lang": languageCode], headers: headersWithCookie) + AF.request(endpoint + Actions.revalidateIpaCache.rawValue, parameters: ["lang": languageCode], headers: headersWithCookie) .response { _ in success() } diff --git a/appdb/API/API+Install.swift b/appdb/API/API+Install.swift index 5fc1dc24..5ed2ff82 100644 --- a/appdb/API/API+Install.swift +++ b/appdb/API/API+Install.swift @@ -13,7 +13,7 @@ import SwiftyJSON extension API { static func getInstallationOptions(success: @escaping (_ items: [InstallationOption]) -> Void, fail: @escaping (_ error: NSError) -> Void) { - AF.request(endpoint, parameters: ["action": Actions.getFeatures.rawValue, "lang": languageCode], headers: headersWithCookie) + AF.request(endpoint + Actions.getFeatures.rawValue, parameters: ["lang": languageCode], headers: headersWithCookie) .responseArray(keyPath: "data") { (response: AFDataResponse<[InstallationOption]>) in switch response.result { case .success(let installationOptions): @@ -25,10 +25,10 @@ extension API { } static func install(id: String, type: ItemType, additionalOptions: [AdditionalInstallationParameters: Any] = [:], completion: @escaping (_ error: String?) -> Void) { - var parameters: [String: Any] = ["action": Actions.install.rawValue, "type": type.rawValue, "id": id, "lang": languageCode] + var parameters: [String: Any] = ["type": type.rawValue, "id": id, "lang": languageCode] for (key, value) in additionalOptions { parameters[key.rawValue] = value } - AF.request(endpoint, parameters: parameters, headers: headersWithCookie) + AF.request(endpoint + Actions.install.rawValue, parameters: parameters, headers: headersWithCookie) .responseJSON { response in switch response.result { case .success(let value): @@ -45,10 +45,10 @@ extension API { } static func customInstall(ipaUrl: String, type: ItemType, iconUrl: String, bundleId: String, name: String, additionalOptions: [AdditionalInstallationParameters: Any] = [:], completion: @escaping (_ error: String?) -> Void) { - var parameters: [String: Any] = ["action": Actions.install.rawValue, "type": type.rawValue, "link": ipaUrl, "image": iconUrl, "bundle_id": bundleId, "name": name, "lang": languageCode] + var parameters: [String: Any] = ["type": type.rawValue, "link": ipaUrl, "image": iconUrl, "bundle_id": bundleId, "name": name, "lang": languageCode] for (key, value) in additionalOptions { parameters[key.rawValue] = value } - AF.request(endpoint, parameters: parameters, headers: headersWithCookie) + AF.request(endpoint + Actions.install.rawValue, parameters: parameters, headers: headersWithCookie) .responseJSON { response in switch response.result { case .success(let value): @@ -65,7 +65,7 @@ extension API { } static func requestInstallJB(plist: String, icon: String, link: String, completion: @escaping (_ error: String?) -> Void) { - AF.request(endpoint, method: .post, parameters: ["action": Actions.customInstall.rawValue, "plist": plist, "icon": icon, "link": link, "lang": languageCode], headers: headersWithCookie) + AF.request(endpoint + Actions.customInstall.rawValue, method: .post, parameters: ["plist": plist, "icon": icon, "link": link, "lang": languageCode], headers: headersWithCookie) .responseJSON { response in switch response.result { case .success(let value): diff --git a/appdb/API/API+Links.swift b/appdb/API/API+Links.swift index ec0fc3ac..9ade4878 100644 --- a/appdb/API/API+Links.swift +++ b/appdb/API/API+Links.swift @@ -13,7 +13,7 @@ import SwiftyJSON extension API { static func getLinks(type: ItemType, trackid: String, success: @escaping (_ items: [Version]) -> Void, fail: @escaping (_ error: String) -> Void) { - AF.request(endpoint, parameters: ["action": Actions.getLinks.rawValue, "type": type.rawValue, "trackids": trackid, "lang": languageCode], headers: headersWithCookie) + AF.request(endpoint + Actions.getLinks.rawValue, parameters: ["type": type.rawValue, "trackids": trackid, "lang": languageCode], headers: headersWithCookie) .responseJSON { response in switch response.result { case .success(let value): @@ -47,9 +47,8 @@ extension API { host: link["host"].stringValue, id: link["id"].stringValue, verified: link["verified"].boolValue, - di_compatible: link["di_compatible"].boolValue, + di_compatible: link["di_compatible"].intValue == 1, hidden: link["is_hidden"] != "0", - universal: link["is_universal"] != "0", is_compatible: link["is_compatible"]["result"] == "yes", incompatibility_reason: incompatibility_reason, report_reason: report_reason @@ -83,9 +82,8 @@ extension API { host: link["host"].stringValue, id: link["id"].stringValue, verified: link["verified"].boolValue, - di_compatible: link["di_compatible"].boolValue, + di_compatible: link["di_compatible"].intValue == 1, hidden: link["is_hidden"] != "0", - universal: link["is_universal"] != "0", is_compatible: link["is_compatible"]["result"] == "yes", isTicket: link["link"].stringValue.starts(with: "ticket://"), incompatibility_reason: incompatibility_reason, @@ -108,7 +106,7 @@ extension API { } static func reportLink(id: String, type: ItemType, reason: String, completion: @escaping (_ error: String?) -> Void) { - AF.request(endpoint, parameters: ["action": Actions.report.rawValue, "type": type.rawValue, "id": id, "reason": reason, "lang": languageCode], headers: headersWithCookie) + AF.request(endpoint + Actions.report.rawValue, parameters: ["type": type.rawValue, "id": id, "reason": reason, "lang": languageCode], headers: headersWithCookie) .responseJSON { response in switch response.result { case .success(let value): @@ -131,7 +129,7 @@ extension API { // If I don't do this, '%3D' gets encoded to '%253D' which makes the ticket invalid ticket = ticket.replacingOccurrences(of: "%3D", with: "=") - AF.request(endpoint, parameters: ["action": Actions.processRedirect.rawValue, "t": ticket, "lang": languageCode], headers: headersWithCookie) + AF.request(endpoint + Actions.processRedirect.rawValue, parameters: ["t": ticket, "lang": languageCode], headers: headersWithCookie) .responseJSON { response in switch response.result { case .success(let value): @@ -150,7 +148,7 @@ extension API { } static func getPlainTextLink(rt: String, completion: @escaping (_ error: String?, _ link: String?) -> Void) { - AF.request(endpoint, parameters: ["action": Actions.processRedirect.rawValue, "rt": rt, "lang": languageCode], headers: headersWithCookie) + AF.request(endpoint + Actions.processRedirect.rawValue, parameters: ["rt": rt, "lang": languageCode], headers: headersWithCookie) .responseJSON { response in switch response.result { case .success(let value): diff --git a/appdb/API/API+MyAppstore.swift b/appdb/API/API+MyAppstore.swift index 5d52a37b..ef41aca7 100644 --- a/appdb/API/API+MyAppstore.swift +++ b/appdb/API/API+MyAppstore.swift @@ -13,7 +13,7 @@ import SwiftyJSON extension API { static func getIpas(success: @escaping (_ items: [MyAppStoreApp]) -> Void, fail: @escaping (_ error: NSError) -> Void) { - AF.request(endpoint, parameters: ["action": Actions.getIpas.rawValue, "lang": languageCode], headers: headersWithCookie) + AF.request(endpoint + Actions.getIpas.rawValue, parameters: ["lang": languageCode], headers: headersWithCookie) .responseArray(keyPath: "data") { (response: AFDataResponse<[MyAppStoreApp]>) in switch response.result { case .success(let ipas): @@ -25,7 +25,7 @@ extension API { } static func deleteIpa(id: String, completion: @escaping (_ error: String?) -> Void) { - AF.request(endpoint, parameters: ["action": Actions.deleteIpa.rawValue, "id": id, "lang": languageCode], headers: headersWithCookie) + AF.request(endpoint + Actions.deleteIpa.rawValue, parameters: ["id": id, "lang": languageCode], headers: headersWithCookie) .responseJSON { response in switch response.result { case .success(let value): @@ -43,7 +43,6 @@ extension API { static func addToMyAppStore(jobId: String, fileURL: URL, request: @escaping (_ r: Alamofire.UploadRequest) -> Void, completion: @escaping (_ error: String?) -> Void) { let parameters = [ - "action": Actions.addIpa.rawValue, "job_id": jobId ] @@ -52,7 +51,7 @@ extension API { for (key, value) in parameters { multipartFormData.append(value.data(using: String.Encoding.utf8)!, withName: key) } - }, to: endpoint, method: .post, headers: headersWithCookie).responseJSON { response in + }, to: endpoint + Actions.addIpa.rawValue, method: .post, headers: headersWithCookie).responseJSON { response in switch response.result { case .success(let value): @@ -69,7 +68,7 @@ extension API { } static func analyzeJob(jobId: String, completion: @escaping (_ error: String?) -> Void) { - AF.request(endpoint, parameters: ["action": Actions.analyzeIpa.rawValue, "lang": languageCode], headers: headersWithCookie) + AF.request(endpoint + Actions.analyzeIpa.rawValue, parameters: ["lang": languageCode], headers: headersWithCookie) .responseJSON { response in switch response.result { case .success(let value): diff --git a/appdb/API/API+News.swift b/appdb/API/API+News.swift index 64f63467..11c732e5 100644 --- a/appdb/API/API+News.swift +++ b/appdb/API/API+News.swift @@ -12,7 +12,7 @@ import Alamofire extension API { static func getNews(limit: Int = 10, success: @escaping (_ items: [SingleNews]) -> Void, fail: @escaping (_ error: NSError) -> Void) { - AF.request(endpoint, parameters: ["action": Actions.getPages.rawValue, "category": Actions.newsCategory.rawValue, "lang": languageCode, "length": String(limit)], headers: headers) + AF.request(endpoint + Actions.getPages.rawValue, parameters: ["category": Actions.newsCategory.rawValue, "lang": languageCode, "length": String(limit)], headers: headers) .responseArray(keyPath: "data") { (response: AFDataResponse<[SingleNews]>) in switch response.result { case .success(let news): @@ -24,7 +24,7 @@ extension API { } static func getNewsDetail(id: String, success: @escaping (_ item: SingleNews) -> Void, fail: @escaping (_ error: NSError) -> Void) { - AF.request(endpoint, parameters: ["action": Actions.getPages.rawValue, "category": Actions.newsCategory.rawValue, "lang": languageCode, "id": id], headers: headers) + AF.request(endpoint + Actions.getPages.rawValue, parameters: ["category": Actions.newsCategory.rawValue, "lang": languageCode, "id": id], headers: headers) .responseObject(keyPath: "data") { (response: AFDataResponse) in switch response.result { case .success(let singleNews): diff --git a/appdb/API/API+Plus.swift b/appdb/API/API+Plus.swift index fb77873b..0846ddf4 100644 --- a/appdb/API/API+Plus.swift +++ b/appdb/API/API+Plus.swift @@ -12,8 +12,7 @@ import SwiftyJSON extension API { static func getPlusPurchaseOptions(success: @escaping (_ items: [PlusPurchaseOption]) -> Void, fail: @escaping (_ error: String) -> Void) { - AF.request(endpoint, parameters: ["action": Actions.getPlusPurchaseOptions.rawValue, - "lang": languageCode], headers: headersWithCookie) + AF.request(endpoint + Actions.getPlusPurchaseOptions.rawValue, parameters: ["lang": languageCode], headers: headersWithCookie) .responseArray(keyPath: "data") { (response: AFDataResponse<[PlusPurchaseOption]>) in switch response.result { case .success(let plusPurchaseOptions): diff --git a/appdb/API/API+Promotions.swift b/appdb/API/API+Promotions.swift index ad7750b7..b3299f2e 100644 --- a/appdb/API/API+Promotions.swift +++ b/appdb/API/API+Promotions.swift @@ -12,7 +12,7 @@ import Alamofire extension API { static func getPromotions(success: @escaping (_ items: [Promotion]) -> Void, fail: @escaping (_ error: NSError) -> Void) { - AF.request(endpoint, parameters: ["action": Actions.promotions.rawValue, "lang": languageCode], headers: headers) + AF.request(endpoint + Actions.promotions.rawValue, parameters: ["lang": languageCode], headers: headers) .responseArray(keyPath: "data") { (response: AFDataResponse<[Promotion]>) in switch response.result { case .success(let promotions): diff --git a/appdb/API/API+Search.swift b/appdb/API/API+Search.swift index 951ca161..6d433765 100644 --- a/appdb/API/API+Search.swift +++ b/appdb/API/API+Search.swift @@ -13,7 +13,7 @@ import ObjectMapper extension API { static func search (type: T.Type, order: Order = .all, price: Price = .all, genre: String = "0", dev: String = "0", trackid: String = "0", q: String = "", page: Int = 1, success: @escaping (_ items: [T]) -> Void, fail: @escaping (_ error: String) -> Void) where T: Item { - let request = AF.request(endpoint, parameters: ["action": Actions.search.rawValue, "type": T.type().rawValue, "order": order.rawValue, "price": price.rawValue, "genre": genre, "dev": dev, "trackid": trackid, "q": q, "page": page, "lang": languageCode], headers: headers) + let request = AF.request(endpoint + Actions.search.rawValue, parameters: ["type": T.type().rawValue, "order": order.rawValue, "price": price.rawValue, "genre": genre, "dev": dev, "trackid": trackid, "q": q, "start": 25 * (page - 1), "length": 25, "lang": languageCode], headers: headers) quickCheckForErrors(request, completion: { ok, hasError, _ in if ok { @@ -32,12 +32,11 @@ extension API { } static func fastSearch(type: ItemType, query: String, maxResults: Int = 10, success: @escaping (_ results: [String]) -> Void) { - AF.request(endpoint, parameters: ["action": Actions.search.rawValue, - "type": type.rawValue, - "order": Order.all.rawValue, - "q": query, - "lang": languageCode, - "perpage": maxResults], headers: headers) + AF.request(endpoint + Actions.search.rawValue, parameters: ["type": type.rawValue, + "order": Order.all.rawValue, + "q": query, + "lang": languageCode, + "perpage": maxResults], headers: headers) .responseJSON { response in if let value = try? response.result.get() { @@ -72,11 +71,10 @@ extension API { } static func getTrending(type: ItemType, order: Order = .all, maxResults: Int = 8, success: @escaping (_ results: [String]) -> Void) { - AF.request(endpoint, parameters: ["action": Actions.search.rawValue, - "type": type.rawValue, - "order": order.rawValue, - "lang": languageCode, - "perpage": maxResults], headers: headers) + AF.request(endpoint + Actions.search.rawValue, parameters: ["type": type.rawValue, + "order": order.rawValue, + "lang": languageCode, + "perpage": maxResults], headers: headers) .responseJSON { response in switch response.result { case .success(let value): diff --git a/appdb/API/API+SystemStatus.swift b/appdb/API/API+SystemStatus.swift index 0004a6a2..576b5382 100644 --- a/appdb/API/API+SystemStatus.swift +++ b/appdb/API/API+SystemStatus.swift @@ -18,7 +18,7 @@ extension API { .responseJSON { response in switch response.result { case .success(let value): - checkedAt = JSON(value)["checked_at"].stringValue.rfc2822decoded + checkedAt = JSON(value)["checked_at"].stringValue.unixToString case .failure(let error): fail(error as NSError) return diff --git a/appdb/API/API+Updates.swift b/appdb/API/API+Updates.swift index fea4d79e..fa4d322a 100644 --- a/appdb/API/API+Updates.swift +++ b/appdb/API/API+Updates.swift @@ -12,7 +12,7 @@ import SwiftyJSON extension API { static func getUpdatesTicket(success: @escaping (_ ticket: String) -> Void, fail: @escaping (_ error: String) -> Void) { - AF.request(endpoint, parameters: ["action": Actions.getUpdatesTicket.rawValue, "lang": languageCode], headers: headersWithCookie) + AF.request(endpoint + Actions.getUpdatesTicket.rawValue, parameters: ["lang": languageCode], headers: headersWithCookie) .responseJSON { response in switch response.result { case .success(let value): @@ -29,7 +29,7 @@ extension API { } static func getUpdates(ticket: String, success: @escaping (_ items: [UpdateableApp]) -> Void, fail: @escaping (_ error: String, _ code: String) -> Void) { - let request = AF.request(endpoint, parameters: ["action": Actions.getUpdates.rawValue, "t": ticket, "lang": languageCode], headers: headersWithCookie) + let request = AF.request(endpoint + Actions.getUpdates.rawValue, parameters: ["t": ticket, "lang": languageCode], headers: headersWithCookie) quickCheckForErrors(request, completion: { ok, hasError, errorCode in if ok { diff --git a/appdb/API/API+Voucher.swift b/appdb/API/API+Voucher.swift index d6c8a722..f0782849 100644 --- a/appdb/API/API+Voucher.swift +++ b/appdb/API/API+Voucher.swift @@ -12,7 +12,7 @@ import SwiftyJSON extension API { static func activateVoucher(voucher: String, success: @escaping () -> Void, fail: @escaping (_ error: String) -> Void) { - AF.request(endpoint, parameters: ["voucher": voucher, "action": Actions.activatePro.rawValue, "lang": languageCode], headers: headersWithCookie) + AF.request(endpoint + Actions.activatePro.rawValue, parameters: ["voucher": voucher, "lang": languageCode], headers: headersWithCookie) .responseJSON { response in switch response.result { case .success(let value): @@ -29,7 +29,7 @@ extension API { } static func validateVoucher(voucher: String, success: @escaping () -> Void, fail: @escaping (_ error: String) -> Void) { - AF.request(endpoint, parameters: ["voucher": voucher, "action": Actions.validatePro.rawValue, "lang": languageCode], headers: headersWithCookie) + AF.request(endpoint + Actions.validatePro.rawValue, parameters: ["voucher": voucher, "lang": languageCode], headers: headersWithCookie) .responseJSON { response in switch response.result { case .success(let value): diff --git a/appdb/API/API+Wishes.swift b/appdb/API/API+Wishes.swift index 1fa32a0b..2a200d74 100644 --- a/appdb/API/API+Wishes.swift +++ b/appdb/API/API+Wishes.swift @@ -12,7 +12,7 @@ import SwiftyJSON extension API { static func createPublishRequest(appStoreUrl: String, type: String = "ios", completion: @escaping (_ error: String?) -> Void) { - AF.request(endpoint, parameters: ["action": Actions.createPublishRequest.rawValue, "url": appStoreUrl, "type": type, "lang": languageCode], headers: headersWithCookie) + AF.request(endpoint + Actions.createPublishRequest.rawValue, parameters: ["url": appStoreUrl, "type": type, "lang": languageCode], headers: headersWithCookie) .responseJSON { response in switch response.result { case .success(let value): @@ -29,7 +29,7 @@ extension API { } static func getPublishRequests(includeAll: Bool, page: Int = 1, success: @escaping (_ items: [WishApp]) -> Void, fail: @escaping (_ error: String) -> Void) { - AF.request(endpoint, parameters: ["action": Actions.getPublishRequests.rawValue, "type": "ios", "include_all": includeAll ? 1 : 0, "page": page, "lang": languageCode], headers: headers) + AF.request(endpoint + Actions.getPublishRequests.rawValue, parameters: ["type": "ios", "include_all": includeAll ? 1 : 0, "start": 25 * (page - 1), "length": 25, "lang": languageCode], headers: headers) .responseArray(keyPath: "data") { (response: AFDataResponse<[WishApp]>) in switch response.result { case .success(let results): diff --git a/appdb/API/API.swift b/appdb/API/API.swift index 4ad445cc..fb0eb1f1 100644 --- a/appdb/API/API.swift +++ b/appdb/API/API.swift @@ -11,7 +11,7 @@ import SwiftyJSON import Localize_Swift enum API { - static let endpoint = "https://api.dbservices.to/v1.5/" + static let endpoint = "https://api.dbservices.to/v1.6/" static let statusEndpoint = "https://status.dbservices.to/API/v1.0/" static let itmsHelperEndpoint = "https://dbservices.to/manifest.php" diff --git a/appdb/Models/AltStoreApp.swift b/appdb/Models/AltStoreApp.swift index 0010dce8..9e142f10 100644 --- a/appdb/Models/AltStoreApp.swift +++ b/appdb/Models/AltStoreApp.swift @@ -16,7 +16,7 @@ class AltStoreApp: Item { super.init(map: map) } - override var id: String { + override var id: Int { get { super.id } set { super.id = newValue } } diff --git a/appdb/Models/AltStoreRepo.swift b/appdb/Models/AltStoreRepo.swift index ef87ef91..93e9257b 100644 --- a/appdb/Models/AltStoreRepo.swift +++ b/appdb/Models/AltStoreRepo.swift @@ -14,7 +14,7 @@ struct AltStoreRepo: Mappable { init?(map: Map) { } - var id: String = "" + var id: Int = 0 var name: String = "" var identifier: String = "" var url: String = "" @@ -22,7 +22,7 @@ struct AltStoreRepo: Mappable { var statusTranslated: String = "" var statusString: String = "" var status: Status = .ok - var totalApps: String = "0" + var totalApps: Int = 0 var addedAt: String = "" var lastCheckedAt: String = "" var contents: AltStoreRepoContents? diff --git a/appdb/Models/App.swift b/appdb/Models/App.swift index 0f43ff34..fb297937 100644 --- a/appdb/Models/App.swift +++ b/appdb/Models/App.swift @@ -16,7 +16,7 @@ class App: Item { super.init(map: map) } - override var id: String { + override var id: Int { get { super.id } set { super.id = newValue } } @@ -45,8 +45,8 @@ class App: Item { var whatsnew: String = "" // Dev apps - var artistId: String = "" - var genreId: String = "" + var artistId: Int = 0 + var genreId: Int = 0 // Copyright notice var publisher: String = "" @@ -76,11 +76,11 @@ class App: Item { var screenshotsIpad = [Screenshot]() // Download stats - var clicksDay: String = "0" - var clicksWeek: String = "0" - var clicksMonth: String = "0" - var clicksYear: String = "0" - var clicksAll: String = "0" + var clicksDay: Int = 0 + var clicksWeek: Int = 0 + var clicksMonth: Int = 0 + var clicksYear: Int = 0 + var clicksAll: Int = 0 override func mapping(map: Map) { name <- map["name"] @@ -125,7 +125,7 @@ class App: Item { // Pulled app? // Fix categories not showing for pulled apps - if let genre = Preferences.genres.first(where: { $0.category == "ios" && $0.id == genreId }) { + if let genre = Preferences.genres.first(where: { $0.category == "ios" && $0.id == genreId.description }) { category = Category(name: genre.name, id: genre.id) } seller = pname diff --git a/appdb/Models/Book.swift b/appdb/Models/Book.swift index 1f0e201d..a0b7a375 100644 --- a/appdb/Models/Book.swift +++ b/appdb/Models/Book.swift @@ -16,7 +16,7 @@ class Book: Item { super.init(map: map) } - override var id: String { + override var id: Int { get { super.id } set { super.id = newValue } } @@ -32,7 +32,7 @@ class Book: Item { var image: String = "" // General - var categoryId: String = "" + var categoryId: Int = 0 var printLenght: String = "" var published: String = "" var author: String = "" @@ -51,7 +51,7 @@ class Book: Item { var language: String = "" // Artist ID - var artistId: String = "" + var artistId: Int = 0 // Copyright var publisher: String = "" @@ -63,11 +63,11 @@ class Book: Item { var reviews = [Review]() // Download stats - var clicksDay: String = "0" - var clicksWeek: String = "0" - var clicksMonth: String = "0" - var clicksYear: String = "0" - var clicksAll: String = "0" + var clicksDay: Int = 0 + var clicksWeek: Int = 0 + var clicksMonth: Int = 0 + var clicksYear: Int = 0 + var clicksAll: Int = 0 override func mapping(map: Map) { name <- map["name"] diff --git a/appdb/Models/CydiaApp.swift b/appdb/Models/CydiaApp.swift index 4db32527..704d6a59 100644 --- a/appdb/Models/CydiaApp.swift +++ b/appdb/Models/CydiaApp.swift @@ -15,7 +15,7 @@ class CydiaApp: Item { super.init(map: map) } - override var id: String { + override var id: Int { get { super.id } set { super.id = newValue } } @@ -34,9 +34,9 @@ class CydiaApp: Item { var image: String = "" // General - var categoryId: String = "" + var categoryId: Int = 0 var developer: String = "" - var developerId: String = "" + var developerId: Int = 0 // Text var description_: String = "" @@ -49,7 +49,7 @@ class CydiaApp: Item { var updated: String = "" // Tweaked - var originalTrackid: String = "" + var originalTrackid: Int = 0 var originalSection: String = "" var isTweaked = false @@ -58,11 +58,11 @@ class CydiaApp: Item { var screenshotsIpad = [Screenshot]() // Download stats - var clicksDay: String = "0" - var clicksWeek: String = "0" - var clicksMonth: String = "0" - var clicksYear: String = "0" - var clicksAll: String = "0" + var clicksDay: Int = 0 + var clicksWeek: Int = 0 + var clicksMonth: Int = 0 + var clicksYear: Int = 0 + var clicksAll: Int = 0 override func mapping(map: Map) { name <- map["name"] @@ -81,7 +81,7 @@ class CydiaApp: Item { originalSection <- map["original_section"] screenshotsData <- map["screenshots"] - isTweaked = originalTrackid != "0" + isTweaked = originalTrackid != 0 if developer.hasSuffix(" ") { developer = String(developer.dropLast()) } if let data = screenshotsData.data(using: .utf8), let screenshotsParse = try? JSON(data: data) { diff --git a/appdb/Models/EnterpriseCertificate.swift b/appdb/Models/EnterpriseCertificate.swift index de927fde..4d7c202e 100644 --- a/appdb/Models/EnterpriseCertificate.swift +++ b/appdb/Models/EnterpriseCertificate.swift @@ -6,8 +6,6 @@ // Copyright © 2023 stev3fvcks. All rights reserved. // -import Foundation - import Foundation import ObjectMapper diff --git a/appdb/Models/IPACacheStatus.swift b/appdb/Models/IPACacheStatus.swift index 9ac7dd6f..b9957d51 100644 --- a/appdb/Models/IPACacheStatus.swift +++ b/appdb/Models/IPACacheStatus.swift @@ -16,7 +16,7 @@ struct IPACacheStatus: Mappable { var sizeHr: String = "" var sizeLimitHr: String = "" - var inUpdate = false + var inUpdate: Int = 0 var updatedAt: String = "" var ipas: [CachedIPA] = [] diff --git a/appdb/Models/Item+Properties.swift b/appdb/Models/Item+Properties.swift index 905c7623..4e9d6627 100644 --- a/appdb/Models/Item+Properties.swift +++ b/appdb/Models/Item+Properties.swift @@ -14,9 +14,9 @@ import UIKit extension Item { var itemId: String { - if let app = self as? App { return app.id } - if let cydiaApp = self as? CydiaApp { return cydiaApp.id } - if let book = self as? Book { return book.id } + if let app = self as? App { return app.id.description } + if let cydiaApp = self as? CydiaApp { return cydiaApp.id.description } + if let book = self as? Book { return book.id.description } return "" } @@ -66,7 +66,7 @@ extension Item { } var itemCydiaCategoryId: String { - if let cydiaApp = self as? CydiaApp { return cydiaApp.categoryId } + if let cydiaApp = self as? CydiaApp { return cydiaApp.categoryId.description } return "" } @@ -95,7 +95,7 @@ extension Item { } var itemOriginalTrackid: String { - if let cydiaApp = self as? CydiaApp { return cydiaApp.originalTrackid } + if let cydiaApp = self as? CydiaApp { return cydiaApp.originalTrackid.description } return "" } @@ -171,33 +171,33 @@ extension Item { } var downloadsDay: String { - if let app = self as? App { return app.clicksDay } - if let cydiaApp = self as? CydiaApp { return cydiaApp.clicksDay } - if let book = self as? Book { return book.clicksDay } + if let app = self as? App { return app.clicksDay.description } + if let cydiaApp = self as? CydiaApp { return cydiaApp.clicksDay.description } + if let book = self as? Book { return book.clicksDay.description } return "-" } var downloadsWeek: String { - if let app = self as? App { return app.clicksWeek } - if let cydiaApp = self as? CydiaApp { return cydiaApp.clicksWeek } - if let book = self as? Book { return book.clicksWeek } + if let app = self as? App { return app.clicksWeek.description } + if let cydiaApp = self as? CydiaApp { return cydiaApp.clicksWeek.description } + if let book = self as? Book { return book.clicksWeek.description } return "-" } var downloadsMonth: String { - if let app = self as? App { return app.clicksMonth } - if let cydiaApp = self as? CydiaApp { return cydiaApp.clicksMonth } - if let book = self as? Book { return book.clicksMonth } + if let app = self as? App { return app.clicksMonth.description } + if let cydiaApp = self as? CydiaApp { return cydiaApp.clicksMonth.description } + if let book = self as? Book { return book.clicksMonth.description } return "-" } var downloadsYear: String { - if let app = self as? App { return app.clicksYear } - if let cydiaApp = self as? CydiaApp { return cydiaApp.clicksYear } - if let book = self as? Book { return book.clicksYear } + if let app = self as? App { return app.clicksYear.description } + if let cydiaApp = self as? CydiaApp { return cydiaApp.clicksYear.description } + if let book = self as? Book { return book.clicksYear.description } return "-" } var downloadsAll: String { - if let app = self as? App { return app.clicksAll } - if let cydiaApp = self as? CydiaApp { return cydiaApp.clicksAll } - if let book = self as? Book { return book.clicksAll } + if let app = self as? App { return app.clicksAll.description } + if let cydiaApp = self as? CydiaApp { return cydiaApp.clicksAll.description } + if let book = self as? Book { return book.clicksAll.description } return "-" } } diff --git a/appdb/Models/Items.swift b/appdb/Models/Items.swift index 954a1e24..1a2d27a5 100644 --- a/appdb/Models/Items.swift +++ b/appdb/Models/Items.swift @@ -14,7 +14,7 @@ class Item: Hashable, Mappable { required init?(map: Map) { } func mapping(map: Map) { } - var id: String = "" + var id: Int = 0 class func type() -> ItemType { .ios // Default implementation diff --git a/appdb/Models/Link.swift b/appdb/Models/Link.swift index 87b6d386..5851a497 100644 --- a/appdb/Models/Link.swift +++ b/appdb/Models/Link.swift @@ -33,10 +33,9 @@ struct Link { var verified = false var diCompatible = false var hidden = false - var universal = false var isTicket = false - init(link: String, cracker: String, uploader: String, host: String, id: String, verified: Bool, di_compatible: Bool, hidden: Bool, universal: Bool, is_compatible: Bool, isTicket: Bool = false, incompatibility_reason: String = "", report_reason: String = "") { + init(link: String, cracker: String, uploader: String, host: String, id: String, verified: Bool, di_compatible: Bool, hidden: Bool, is_compatible: Bool, isTicket: Bool = false, incompatibility_reason: String = "", report_reason: String = "") { self.link = link self.cracker = cracker self.uploader = uploader @@ -45,7 +44,6 @@ struct Link { self.verified = verified self.diCompatible = di_compatible self.hidden = hidden - self.universal = universal self.isTicket = isTicket while self.cracker.hasPrefix(" ") { self.cracker = String(self.cracker.dropFirst()) } diff --git a/appdb/Models/MyAppstoreApp.swift b/appdb/Models/MyAppstoreApp.swift index 657507fb..9f483a52 100644 --- a/appdb/Models/MyAppstoreApp.swift +++ b/appdb/Models/MyAppstoreApp.swift @@ -19,7 +19,7 @@ class MyAppStoreApp: Item { .myAppstore } - override var id: String { + override var id: Int { get { super.id } set { super.id = newValue } } diff --git a/appdb/Models/Promotion.swift b/appdb/Models/Promotion.swift index fc90e714..25a033ae 100644 --- a/appdb/Models/Promotion.swift +++ b/appdb/Models/Promotion.swift @@ -12,10 +12,10 @@ struct Promotion: Mappable { init?(map: Map) { } - var id: String = "" + var id: Int = 0 var lead: String = "" var type: String = "" - var trackid: String = "" + var trackid: Int = 0 var name: String = "" var image: String = "" diff --git a/appdb/Models/SingleNews.swift b/appdb/Models/SingleNews.swift index 1d7431ec..aa46e8d9 100644 --- a/appdb/Models/SingleNews.swift +++ b/appdb/Models/SingleNews.swift @@ -12,7 +12,7 @@ struct SingleNews: Mappable { init?(map: Map) { } - var id: String = "" + var id: Int = 0 var title: String = "" var text: String = "" var added: String = "" @@ -23,7 +23,7 @@ struct SingleNews: Mappable { text <- map["text"] added <- map["added"] - added = added.rfc2822decoded + added = added.unixToString title = title.decoded } } diff --git a/appdb/Models/UpdateableApp.swift b/appdb/Models/UpdateableApp.swift index b3860fe5..91f373e0 100644 --- a/appdb/Models/UpdateableApp.swift +++ b/appdb/Models/UpdateableApp.swift @@ -19,16 +19,16 @@ struct UpdateableApp: Equatable { var versionOld: String = "" var versionNew: String = "" var alongsideId: String = "" - var trackid: String = "" + var trackid: Int = 0 var image: String = "" - var updateable = false + var updateable = 0 var type: String = "" var name: String = "" var whatsnew: String = "" var date: String = "" var isIgnored: Bool { - !Preferences.ignoredUpdateableApps.filter({ $0.trackid == trackid }).isEmpty + !Preferences.ignoredUpdateableApps.filter({ $0.trackid == String(trackid) }).isEmpty } static func == (lhs: UpdateableApp, rhs: UpdateableApp) -> Bool { diff --git a/appdb/Models/WishApp.swift b/appdb/Models/WishApp.swift index 2e0e5278..e58aa7b7 100644 --- a/appdb/Models/WishApp.swift +++ b/appdb/Models/WishApp.swift @@ -14,8 +14,8 @@ struct WishApp: Mappable { init?(map: Map) { } - var id: String = "" - var trackid: String = "" + var id: Int = 0 + var trackid: Int = 0 var version: String = "" var image: String = "" var name: String = "" diff --git a/appdb/Startup/Extensions.swift b/appdb/Startup/Extensions.swift index d99ededa..c6c5eaaf 100644 --- a/appdb/Startup/Extensions.swift +++ b/appdb/Startup/Extensions.swift @@ -126,40 +126,6 @@ extension String { return "" } - // - // Returns formatted string from rfc2822 date - // E.G. "Sat, 05 May 2018 13:42:01 -0400" -> "May 5, 2018 at 10.07 PM" - // - var rfc2822decoded: String { - let formatter = DateFormatter() - formatter.dateFormat = "EEE, dd MMM yyyy HH:mm:ss Z" // RFC 2822 - formatter.locale = Locale(identifier: "en_US") - if let date = formatter.date(from: self) { - formatter.locale = Locale(identifier: Localize.currentLanguage()) - formatter.dateStyle = .medium - formatter.timeStyle = .short - return formatter.string(from: date) - } - return "" - } - - // - // Returns short formatted string from rfc2822 date - // E.G. "Sat, 05 May 2018 13:42:01 -0400" -> "May 5, 2018" - // - var rfc2822decodedShort: String { - let formatter = DateFormatter() - formatter.dateFormat = "EEE, dd MMM yyyy HH:mm:ss Z" // RFC 2822 - formatter.locale = Locale(identifier: "en_US") - if let date = formatter.date(from: self) { - formatter.locale = Locale(identifier: Localize.currentLanguage()) - formatter.dateStyle = .medium - formatter.timeStyle = .none - return formatter.string(from: date) - } - return "" - } - // // Returns short formatted string from revocation date // E.G. "Revocation Time: May 30 22:03:50 2019 GMT" -> "May 31, 2019 at 12:03 AM" diff --git a/appdb/Startup/Global.swift b/appdb/Startup/Global.swift index e9726e05..637b18dc 100644 --- a/appdb/Startup/Global.swift +++ b/appdb/Startup/Global.swift @@ -20,7 +20,7 @@ func debugLog(_ arg: Any) { enum Global { - static let showAds = false + // static let showAds = false static let adsId: String = "5209496" #if DEBUG diff --git a/appdb/Tabs/Downloads/Library/Cells/MyAppstoreCell.swift b/appdb/Tabs/Downloads/Library/Cells/MyAppstoreCell.swift index 4358732c..689ea654 100644 --- a/appdb/Tabs/Downloads/Library/Cells/MyAppstoreCell.swift +++ b/appdb/Tabs/Downloads/Library/Cells/MyAppstoreCell.swift @@ -18,7 +18,7 @@ class MyAppStoreCell: UICollectionViewCell { func configure(with app: MyAppStoreApp) { name.text = app.name + " (\(app.version))" bundleId.text = app.bundleId - installButton.linkId = app.id + installButton.linkId = app.id.description } required init?(coder aDecoder: NSCoder) { diff --git a/appdb/Tabs/Downloads/Library/Library.swift b/appdb/Tabs/Downloads/Library/Library.swift index d1353e5a..1208a323 100644 --- a/appdb/Tabs/Downloads/Library/Library.swift +++ b/appdb/Tabs/Downloads/Library/Library.swift @@ -165,7 +165,7 @@ class Library: LoadingCollectionView { } }) alertController.addAction(UIAlertAction(title: "Delete".localized(), style: .destructive) { _ in - self.deleteMyAppStoreApp(id: app.id, indexPath: indexPath) + self.deleteMyAppStoreApp(id: app.id.description, indexPath: indexPath) }) alertController.addAction(UIAlertAction(title: "Cancel".localized(), style: .cancel)) @@ -316,7 +316,7 @@ extension Library { let deleteCancel = UIAction(title: "Cancel".localized(), image: UIImage(systemName: "xmark")) { _ in } let deleteConfirmation = UIAction(title: "Delete".localized(), image: UIImage(systemName: "checkmark"), attributes: .destructive) { _ in - self.deleteMyAppStoreApp(id: app.id, indexPath: indexPath) + self.deleteMyAppStoreApp(id: app.id.description, indexPath: indexPath) } let delete = UIMenu(title: "Delete".localized(), image: UIImage(systemName: "trash"), options: .destructive, children: [deleteCancel, deleteConfirmation]) diff --git a/appdb/Tabs/Featured/Details/Cells/Details/Information/Details+Information.swift b/appdb/Tabs/Featured/Details/Cells/Details/Information/Details+Information.swift index 5911cc3e..e21bb0c3 100644 --- a/appdb/Tabs/Featured/Details/Cells/Details/Information/Details+Information.swift +++ b/appdb/Tabs/Featured/Details/Cells/Details/Information/Details+Information.swift @@ -120,7 +120,7 @@ class DetailsInformation: DetailsCell { bundleIdText = buildLabel(text: app.bundleId, isContent: true) category = buildLabel(text: "Category") - categoryText = buildLabel(text: API.categoryFromId(id: app.categoryId, type: .cydia), isContent: true) + categoryText = buildLabel(text: API.categoryFromId(id: app.categoryId.description, type: .cydia), isContent: true) updated = buildLabel(text: "Updated") updatedText = buildLabel(text: app.updated.unixToString, isContent: true) @@ -145,7 +145,7 @@ class DetailsInformation: DetailsCell { sellerText = buildLabel(text: book.author, isContent: true) category = buildLabel(text: "Category") - categoryText = buildLabel(text: API.categoryFromId(id: book.categoryId, type: .books), isContent: true) + categoryText = buildLabel(text: API.categoryFromId(id: book.categoryId.description, type: .books), isContent: true) if categoryText.text!.isEmpty { categoryText.text = "Unknown".localized() } updated = buildLabel(text: "Updated") diff --git a/appdb/Tabs/Featured/Details/Cells/Download/Details+DownloadCell.swift b/appdb/Tabs/Featured/Details/Cells/Download/Details+DownloadCell.swift index 2d3c7198..f1a37e0d 100644 --- a/appdb/Tabs/Featured/Details/Cells/Download/Details+DownloadCell.swift +++ b/appdb/Tabs/Featured/Details/Cells/Download/Details+DownloadCell.swift @@ -33,7 +33,7 @@ class DetailsDownload: DetailsCell { button.linkId = link.id button.isHidden = !link.diCompatible button.isEnabled = installEnabled - host.theme_textColor = link.universal ? Color.mainTint : Color.title + host.theme_textColor = Color.title selectionStyle = accessoryType == .none ? .none : .default @@ -149,7 +149,7 @@ class DetailsDownloadUnified: DetailsCell { button.isHidden = !link.diCompatible button.isEnabled = installEnabled button.setTitle(button.isHidden ? "" : "Install".localized().uppercased(), for: .normal) - host.theme_textColor = link.universal ? Color.mainTint : Color.title + host.theme_textColor = Color.title selectionStyle = accessoryType == .none ? .none : .default diff --git a/appdb/Tabs/Featured/Details/Cells/Header/Details+Header.swift b/appdb/Tabs/Featured/Details/Cells/Header/Details+Header.swift index 0cc997be..8e562cdf 100644 --- a/appdb/Tabs/Featured/Details/Cells/Header/Details+Header.swift +++ b/appdb/Tabs/Featured/Details/Cells/Header/Details+Header.swift @@ -103,7 +103,7 @@ class DetailsHeader: DetailsCell { icon.af.setImage(withURL: url, placeholderImage: #imageLiteral(resourceName: "placeholderIcon"), filter: Global.roundedFilter(from: (130 ~~ 100)), imageTransition: .crossDissolve(0.2)) } - self.devId = app.artistId + self.devId = app.artistId.description } case .cydia: if let cydiaApp = content as? CydiaApp { name.text = cydiaApp.name.decoded @@ -113,14 +113,14 @@ class DetailsHeader: DetailsCell { } tweaked = buildPaddingLabel() - tweaked!.text = API.categoryFromId(id: cydiaApp.categoryId, type: .cydia).uppercased() + tweaked!.text = API.categoryFromId(id: cydiaApp.categoryId.description, type: .cydia).uppercased() icon.layer.cornerRadius = Global.cornerRadius(from: (130 ~~ 100)) if let url = URL(string: cydiaApp.image) { icon.af.setImage(withURL: url, placeholderImage: #imageLiteral(resourceName: "placeholderIcon"), filter: Global.roundedFilter(from: (130 ~~ 100)), imageTransition: .crossDissolve(0.2)) } - self.devId = cydiaApp.developerId + self.devId = cydiaApp.developerId.description } case .books: if let book = content as? Book { name.text = book.name.decoded @@ -153,7 +153,7 @@ class DetailsHeader: DetailsCell { icon.af.setImage(withURL: url, placeholderImage: #imageLiteral(resourceName: "placeholderCover"), imageTransition: .crossDissolve(0.2)) } - self.devId = book.artistId + self.devId = book.artistId.description } case .altstore: if let altstoreApp = content as? AltStoreApp { name.text = altstoreApp.name @@ -183,7 +183,7 @@ class DetailsHeader: DetailsCell { installButton!.setTitle("Install".localized().uppercased(), for: .normal) installButton!.theme_tintColor = Color.softGreen installButton!.addTarget(self, action: #selector(installTapped), for: .touchUpInside) - installButton!.isEnabled = !Global.showAds || Global.DEBUG || Preferences.isPlus + installButton!.isEnabled = true } default: break diff --git a/appdb/Tabs/Featured/Details/Details+Extension.swift b/appdb/Tabs/Featured/Details/Details+Extension.swift index 1b0d4ce7..5b6f07b0 100644 --- a/appdb/Tabs/Featured/Details/Details+Extension.swift +++ b/appdb/Tabs/Featured/Details/Details+Extension.swift @@ -120,12 +120,12 @@ extension Details { DetailsChangelog(), // dynamic DetailsRelated(type: contentType, related: content.itemRelatedContent, delegate: self), DetailsInformation(type: contentType, content: content), - DetailsDownloadStats(content: content), + DetailsDownloadStats(content: content) ] switch contentType { case .ios: if let app = content as? App { - details.append(DetailsExternalLink(text: "Developer Apps".localized(), devId: app.artistId, devName: app.seller)) + details.append(DetailsExternalLink(text: "Developer Apps".localized(), devId: app.artistId.description, devName: app.seller)) if !app.website.isEmpty { details.append(DetailsExternalLink(text: "Developer Website".localized(), url: content.itemWebsite)) } if !app.support.isEmpty { details.append(DetailsExternalLink(text: "Developer Support".localized(), url: content.itemSupport)) } if !app.publisher.isEmpty { details.append(DetailsPublisher(app.publisher)) } @@ -134,7 +134,7 @@ extension Details { details.append(DetailsPublisher("© " + app.developer)) } case .books: if let book = content as? Book { - details.append(DetailsExternalLink(text: "More by this author".localized(), devId: book.artistId, devName: book.author)) + details.append(DetailsExternalLink(text: "More by this author".localized(), devId: book.artistId.description, devName: book.author)) if !book.publisher.isEmpty { details.append(DetailsPublisher(book.publisher)) } else if !book.author.isEmpty { details.append(DetailsPublisher("© " + book.author)) } } default: diff --git a/appdb/Tabs/Featured/Details/Details.swift b/appdb/Tabs/Featured/Details/Details.swift index 3664b070..ea21128f 100644 --- a/appdb/Tabs/Featured/Details/Details.swift +++ b/appdb/Tabs/Featured/Details/Details.swift @@ -77,10 +77,6 @@ class Details: LoadingTableView { showsErrorButton = false fetchInfo(type: dynamicType, trackid: dynamicTrackid) } - - /*if Global.showAds && !Global.DEBUG && !Preferences.isPlus { - UnityAds.initialize(Global.adsId, testMode: Global.adsTestMode, initializationDelegate: self) - }*/ } // MARK: - Share @@ -186,13 +182,13 @@ class Details: LoadingTableView { if link.cracker == link.uploader { guard let cell = tableView.dequeueReusableCell(withIdentifier: "downloadUnified", for: indexPath) as? DetailsDownloadUnified else { return UITableViewCell() } cell.accessoryType = shouldHideDisclosureIndicator ? .none : .disclosureIndicator - cell.configure(with: link, installEnabled: !Global.showAds || adsLoaded) + cell.configure(with: link, installEnabled: true) cell.button.addTarget(self, action: #selector(self.install), for: .touchUpInside) return cell } else { guard let cell = tableView.dequeueReusableCell(withIdentifier: "download", for: indexPath) as? DetailsDownload else { return UITableViewCell() } cell.accessoryType = shouldHideDisclosureIndicator ? .none : .disclosureIndicator - cell.configure(with: link, installEnabled: !Global.showAds || adsLoaded) + cell.configure(with: link, installEnabled: true) cell.button.addTarget(self, action: #selector(self.install), for: .touchUpInside) return cell } @@ -287,11 +283,7 @@ class Details: LoadingTableView { @objc private func install(sender: RoundedButton) { currentInstallButton = sender - if !Global.showAds || Global.DEBUG || Preferences.isPlus { - actualInstall(sender: currentInstallButton!) - }/* else { - UnityAds.show(self, placementId: "Interstitial_iOS", showDelegate: self) - }*/ + actualInstall(sender: currentInstallButton!) } private func actualInstall(sender: RoundedButton) { @@ -531,66 +523,3 @@ extension Details: IPAWebViewControllerDelegate { } } } - -// MARK: - Ads - -/*extension Details: UnityAdsInitializationDelegate { - func initializationComplete() { - adsInitialized = true - - if Global.showAds && !Global.DEBUG && !Preferences.isPlus { - UnityAds.load("Interstitial_iOS", loadDelegate: self) - } - } - - func initializationFailed(_ error: UnityAdsInitializationError, withMessage message: String) { - adsInitialized = false - } -} - -extension Details: UnityAdsLoadDelegate { - func unityAdsAdLoaded(_ placementId: String) { - adsLoaded = true - if indexForSegment == .download { - tableView.reloadData() - } - } - - func unityAdsAdFailed(toLoad placementId: String, withError error: UnityAdsLoadError, withMessage message: String) { - adsLoaded = true - if indexForSegment == .download { - tableView.reloadData() - } - } -} - -extension Details: UnityAdsShowDelegate { - - func performActualInstall() { - if currentInstallButton != nil { - actualInstall(sender: currentInstallButton!) - adsLoaded = false - if indexForSegment == .download { - tableView.reloadData() - } - if Global.showAds && !Global.DEBUG && !Preferences.isPlus { - UnityAds.load("Interstitial_iOS", loadDelegate: self) - } - } - } - - func unityAdsShowComplete(_ placementId: String, withFinish state: UnityAdsShowCompletionState) { - performActualInstall() - } - func unityAdsShowFailed(_ placementId: String, withError error: UnityAdsShowError, withMessage message: String) { - performActualInstall() - } - - func unityAdsShowStart(_ placementId: String) { - - } - - func unityAdsShowClick(_ placementId: String) { - - } -}*/ diff --git a/appdb/Tabs/Featured/Featured/Cells/ItemCollection.swift b/appdb/Tabs/Featured/Featured/Cells/ItemCollection.swift index ba535beb..fbb01757 100644 --- a/appdb/Tabs/Featured/Featured/Cells/ItemCollection.swift +++ b/appdb/Tabs/Featured/Featured/Cells/ItemCollection.swift @@ -37,7 +37,7 @@ extension ItemCollection: UICollectionViewDelegate, UICollectionViewDataSource { guard let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "cydia", for: indexPath) as? FeaturedApp else { return UICollectionViewCell() } cell.title.text = cydiaApp.name.decoded cell.tweaked = cydiaApp.isTweaked - cell.category.text = API.categoryFromId(id: cydiaApp.categoryId, type: .cydia) + cell.category.text = API.categoryFromId(id: cydiaApp.categoryId.description, type: .cydia) if let url = URL(string: cydiaApp.image) { cell.icon.af.setImage(withURL: url, placeholderImage: #imageLiteral(resourceName: "placeholderIcon"), filter: Global.roundedFilter(from: Global.Size.itemWidth.value), imageTransition: .crossDissolve(0.2)) } diff --git a/appdb/Tabs/Featured/See All/SeeAll.swift b/appdb/Tabs/Featured/See All/SeeAll.swift index e53a8401..5690b844 100644 --- a/appdb/Tabs/Featured/See All/SeeAll.swift +++ b/appdb/Tabs/Featured/See All/SeeAll.swift @@ -261,19 +261,18 @@ class SeeAll: LoadingTableView { if book.itemHasStars { guard let cell = tableView.dequeueReusableCell(withIdentifier: "seeallcellwithstars_book", for: indexPath) as? SeeAllCellWithStars else { return UITableViewCell() } - cell.configure(name: book.name, author: book.author, language: book.language, categoryId: book.categoryId, - coverUrl: book.image, rating: book.numberOfStars, num: book.numberOfRating) + cell.configure(name: book.name, author: book.author, language: book.language, categoryId: book.categoryId.description, coverUrl: book.image, rating: book.numberOfStars, num: book.numberOfRating) return cell } else { guard let cell = tableView.dequeueReusableCell(withIdentifier: "seeallcell_book", for: indexPath) as? SeeAllCell else { return UITableViewCell() } - cell.configure(name: book.name, author: book.author, language: book.language, categoryId: book.categoryId, coverUrl: book.image) + cell.configure(name: book.name, author: book.author, language: book.language, categoryId: book.categoryId.description, coverUrl: book.image) return cell } } else if let cydiaApp = item as? CydiaApp { guard let cell = tableView.dequeueReusableCell(withIdentifier: "seeallcell", for: indexPath) as? SeeAllCell else { return UITableViewCell() } - cell.configure(name: cydiaApp.name, categoryId: cydiaApp.categoryId, version: cydiaApp.version, + cell.configure(name: cydiaApp.name, categoryId: cydiaApp.categoryId.description, version: cydiaApp.version, iconUrl: cydiaApp.image, tweaked: cydiaApp.isTweaked) return cell } diff --git a/appdb/Tabs/Featured/Wishes/Fulfilled/FulfilledWishes.swift b/appdb/Tabs/Featured/Wishes/Fulfilled/FulfilledWishes.swift index 0d6e6893..933af990 100644 --- a/appdb/Tabs/Featured/Wishes/Fulfilled/FulfilledWishes.swift +++ b/appdb/Tabs/Featured/Wishes/Fulfilled/FulfilledWishes.swift @@ -124,7 +124,7 @@ class FulfilledWishes: LoadingTableView { override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { tableView.deselectRow(at: indexPath, animated: true) - let vc = Details(type: .ios, trackid: items[indexPath.row].trackid) + let vc = Details(type: .ios, trackid: items[indexPath.row].trackid.description) navigationController?.pushViewController(vc, animated: true) } } diff --git a/appdb/Tabs/Featured/Wishes/New/NewWishes.swift b/appdb/Tabs/Featured/Wishes/New/NewWishes.swift index 3b10f4dc..afd20f64 100644 --- a/appdb/Tabs/Featured/Wishes/New/NewWishes.swift +++ b/appdb/Tabs/Featured/Wishes/New/NewWishes.swift @@ -125,7 +125,7 @@ class NewWishes: LoadingTableView { override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { tableView.deselectRow(at: indexPath, animated: true) - let vc = Details(type: .ios, trackid: items[indexPath.row].trackid) + let vc = Details(type: .ios, trackid: items[indexPath.row].trackid.description) navigationController?.pushViewController(vc, animated: true) } diff --git a/appdb/Tabs/Search/Search Cells/LandscapeScreenshotSearchCell.swift b/appdb/Tabs/Search/Search Cells/LandscapeScreenshotSearchCell.swift index 7431762f..e8d8c6db 100644 --- a/appdb/Tabs/Search/Search Cells/LandscapeScreenshotSearchCell.swift +++ b/appdb/Tabs/Search/Search Cells/LandscapeScreenshotSearchCell.swift @@ -42,8 +42,7 @@ class LandscapeScreenshotSearchCell: SearchCell { super.configure(with: item) if let url = URL(string: item.itemFirstScreenshotUrl) { - let filter = Global.screenshotRoundedFilter(size: screenshot.frame.size, radius: 5) - screenshot.af.setImage(withURL: url, placeholderImage: #imageLiteral(resourceName: "placeholderCover"), filter: filter, imageTransition: .crossDissolve(0.2)) + screenshot.af.setImage(withURL: url, placeholderImage: #imageLiteral(resourceName: "placeholderCover"), imageTransition: .crossDissolve(0.2)) } } diff --git a/appdb/Tabs/Search/Search Cells/MixedScreenshotsSearchCell_L->P.swift b/appdb/Tabs/Search/Search Cells/MixedScreenshotsSearchCell_L->P.swift index 73164061..ce169b1f 100644 --- a/appdb/Tabs/Search/Search Cells/MixedScreenshotsSearchCell_L->P.swift +++ b/appdb/Tabs/Search/Search Cells/MixedScreenshotsSearchCell_L->P.swift @@ -52,10 +52,8 @@ class MixedScreenshotsSearchCellOne: SearchCell { super.configure(with: item) guard item.itemFirstTwoScreenshotsUrls.count > 1 else { return } if let url1 = URL(string: item.itemFirstTwoScreenshotsUrls[0]), let url2 = URL(string: item.itemFirstTwoScreenshotsUrls[1]) { - let filter1 = Global.screenshotRoundedFilter(size: screenshotOne.frame.size, radius: 5) - let filter2 = Global.screenshotRoundedFilter(size: screenshotTwo.frame.size, radius: 5) - screenshotOne.af.setImage(withURL: url1, placeholderImage: #imageLiteral(resourceName: "placeholderCover"), filter: filter1, imageTransition: .crossDissolve(0.2)) - screenshotTwo.af.setImage(withURL: url2, placeholderImage: #imageLiteral(resourceName: "placeholderCover"), filter: filter2, imageTransition: .crossDissolve(0.2)) + screenshotOne.af.setImage(withURL: url1, placeholderImage: #imageLiteral(resourceName: "placeholderCover"), imageTransition: .crossDissolve(0.2)) + screenshotTwo.af.setImage(withURL: url2, placeholderImage: #imageLiteral(resourceName: "placeholderCover"), imageTransition: .crossDissolve(0.2)) } } diff --git a/appdb/Tabs/Search/Search Cells/MixedScreenshotsSearchCell_P->L.swift b/appdb/Tabs/Search/Search Cells/MixedScreenshotsSearchCell_P->L.swift index 3e0dbc19..8620ee8e 100644 --- a/appdb/Tabs/Search/Search Cells/MixedScreenshotsSearchCell_P->L.swift +++ b/appdb/Tabs/Search/Search Cells/MixedScreenshotsSearchCell_P->L.swift @@ -52,10 +52,8 @@ class MixedScreenshotsSearchCellTwo: SearchCell { super.configure(with: item) guard item.itemFirstTwoScreenshotsUrls.count > 1 else { return } if let url1 = URL(string: item.itemFirstTwoScreenshotsUrls[0]), let url2 = URL(string: item.itemFirstTwoScreenshotsUrls[1]) { - let filter1 = Global.screenshotRoundedFilter(size: screenshotOne.frame.size, radius: 5) - let filter2 = Global.screenshotRoundedFilter(size: screenshotTwo.frame.size, radius: 5) - screenshotOne.af.setImage(withURL: url1, placeholderImage: #imageLiteral(resourceName: "placeholderCover"), filter: filter1, imageTransition: .crossDissolve(0.2)) - screenshotTwo.af.setImage(withURL: url2, placeholderImage: #imageLiteral(resourceName: "placeholderCover"), filter: filter2, imageTransition: .crossDissolve(0.2)) + screenshotOne.af.setImage(withURL: url1, placeholderImage: #imageLiteral(resourceName: "placeholderCover"), imageTransition: .crossDissolve(0.2)) + screenshotTwo.af.setImage(withURL: url2, placeholderImage: #imageLiteral(resourceName: "placeholderCover"), imageTransition: .crossDissolve(0.2)) } } diff --git a/appdb/Tabs/Search/Search Cells/PortraitScreenshotSearchCell.swift b/appdb/Tabs/Search/Search Cells/PortraitScreenshotSearchCell.swift index e65e95bf..2047ee55 100644 --- a/appdb/Tabs/Search/Search Cells/PortraitScreenshotSearchCell.swift +++ b/appdb/Tabs/Search/Search Cells/PortraitScreenshotSearchCell.swift @@ -44,8 +44,7 @@ class PortraitScreenshotSearchCell: SearchCell { super.configure(with: item) if let url = URL(string: item.itemFirstScreenshotUrl) { - let filter = Global.screenshotRoundedFilter(size: screenshot.frame.size, radius: 5) - screenshot.af.setImage(withURL: url, placeholderImage: #imageLiteral(resourceName: "placeholderCover"), filter: filter, imageTransition: .crossDissolve(0.2)) + screenshot.af.setImage(withURL: url, placeholderImage: #imageLiteral(resourceName: "placeholderCover"), imageTransition: .crossDissolve(0.2)) } } diff --git a/appdb/Tabs/Search/Search Cells/ThreePortraitScreenshotsSearchCell.swift b/appdb/Tabs/Search/Search Cells/ThreePortraitScreenshotsSearchCell.swift index 54490b8d..2ae9d9a6 100644 --- a/appdb/Tabs/Search/Search Cells/ThreePortraitScreenshotsSearchCell.swift +++ b/appdb/Tabs/Search/Search Cells/ThreePortraitScreenshotsSearchCell.swift @@ -62,10 +62,9 @@ class ThreePortraitScreenshotsSearchCell: SearchCell { guard item.itemFirstThreeScreenshotsUrls.count > 2 else { return } let ssUrls = item.itemFirstThreeScreenshotsUrls if let url1 = URL(string: ssUrls[0]), let url2 = URL(string: ssUrls[1]), let url3 = URL(string: ssUrls[2]) { - let filter = Global.screenshotRoundedFilter(size: screenshotOne.frame.size, radius: 5) - screenshotOne.af.setImage(withURL: url1, placeholderImage: #imageLiteral(resourceName: "placeholderCover"), filter: filter, imageTransition: .crossDissolve(0.2)) - screenshotTwo.af.setImage(withURL: url2, placeholderImage: #imageLiteral(resourceName: "placeholderCover"), filter: filter, imageTransition: .crossDissolve(0.2)) - screenshotThree.af.setImage(withURL: url3, placeholderImage: #imageLiteral(resourceName: "placeholderCover"), filter: filter, imageTransition: .crossDissolve(0.2)) + screenshotOne.af.setImage(withURL: url1, placeholderImage: #imageLiteral(resourceName: "placeholderCover"), imageTransition: .crossDissolve(0.2)) + screenshotTwo.af.setImage(withURL: url2, placeholderImage: #imageLiteral(resourceName: "placeholderCover"), imageTransition: .crossDissolve(0.2)) + screenshotThree.af.setImage(withURL: url3, placeholderImage: #imageLiteral(resourceName: "placeholderCover"), imageTransition: .crossDissolve(0.2)) } } diff --git a/appdb/Tabs/Search/Search Cells/TwoPortraitScreenshotsSearchCell.swift b/appdb/Tabs/Search/Search Cells/TwoPortraitScreenshotsSearchCell.swift index eec1e508..8992c57e 100644 --- a/appdb/Tabs/Search/Search Cells/TwoPortraitScreenshotsSearchCell.swift +++ b/appdb/Tabs/Search/Search Cells/TwoPortraitScreenshotsSearchCell.swift @@ -55,9 +55,8 @@ class TwoPortraitScreenshotsSearchCell: SearchCell { super.configure(with: item) guard item.itemFirstTwoScreenshotsUrls.count > 1 else { return } if let url1 = URL(string: item.itemFirstTwoScreenshotsUrls[0]), let url2 = URL(string: item.itemFirstTwoScreenshotsUrls[1]) { - let filter = Global.screenshotRoundedFilter(size: screenshotOne.frame.size, radius: 5) - screenshotOne.af.setImage(withURL: url1, placeholderImage: #imageLiteral(resourceName: "placeholderCover"), filter: filter, imageTransition: .crossDissolve(0.2)) - screenshotTwo.af.setImage(withURL: url2, placeholderImage: #imageLiteral(resourceName: "placeholderCover"), filter: filter, imageTransition: .crossDissolve(0.2)) + screenshotOne.af.setImage(withURL: url1, placeholderImage: #imageLiteral(resourceName: "placeholderCover"), imageTransition: .crossDissolve(0.2)) + screenshotTwo.af.setImage(withURL: url2, placeholderImage: #imageLiteral(resourceName: "placeholderCover"), imageTransition: .crossDissolve(0.2)) } } diff --git a/appdb/Tabs/Settings/Advanced Options/AdvancedOptions.swift b/appdb/Tabs/Settings/Advanced Options/AdvancedOptions.swift index 72b462f2..e562ee05 100644 --- a/appdb/Tabs/Settings/Advanced Options/AdvancedOptions.swift +++ b/appdb/Tabs/Settings/Advanced Options/AdvancedOptions.swift @@ -29,9 +29,9 @@ class AdvancedOptions: TableViewController { }, cellClass: SimpleStaticCell.self) ]), StaticSection(rows: [ - StaticRow(text: "Check Revocation".localized(), selection: { [unowned self] _ in + /*StaticRow(text: "Check Revocation".localized(), selection: { [unowned self] _ in self.checkRevocationStatus() - }, accessory: .disclosureIndicator, cellClass: SimpleStaticCell.self), + }, accessory: .disclosureIndicator, cellClass: SimpleStaticCell.self),*/ StaticRow(text: "Email Link Code".localized(), selection: { [unowned self] _ in self.emailLinkCode() }, accessory: .disclosureIndicator, cellClass: SimpleStaticCell.self), @@ -131,7 +131,7 @@ extension AdvancedOptions: UITableViewDelegate { extension AdvancedOptions { - fileprivate func checkRevocationStatus() { + /*fileprivate func checkRevocationStatus() { API.checkRevocation(completion: { isRevoked, revokedOn in if isRevoked { var message: String = "Revoked on %@".localizedFormat(revokedOn.revokedDateDecoded) @@ -149,7 +149,7 @@ extension AdvancedOptions { }, fail: { error in Messages.shared.showError(message: error.prettified, context: .viewController(self)) }) - } + }*/ fileprivate func emailLinkCode() { let title = "Enter Email".localized() diff --git a/appdb/Tabs/Settings/AltStoreRepos/AltStoreRepoCell.swift b/appdb/Tabs/Settings/AltStoreRepos/AltStoreRepoCell.swift index 242492f9..3194f15c 100644 --- a/appdb/Tabs/Settings/AltStoreRepos/AltStoreRepoCell.swift +++ b/appdb/Tabs/Settings/AltStoreRepos/AltStoreRepoCell.swift @@ -23,7 +23,7 @@ class AltStoreRepoCell: UITableViewCell { name.text = repo.name identifier.text = repo.identifier lastChecked.text = "Last update " + repo.lastCheckedAt - totalApps.text = repo.totalApps + " Apps" + totalApps.text = repo.totalApps.description + " Apps" } override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { diff --git a/appdb/Tabs/Settings/AltStoreRepos/AltStoreRepos.swift b/appdb/Tabs/Settings/AltStoreRepos/AltStoreRepos.swift index c99275b6..24c166d0 100644 --- a/appdb/Tabs/Settings/AltStoreRepos/AltStoreRepos.swift +++ b/appdb/Tabs/Settings/AltStoreRepos/AltStoreRepos.swift @@ -193,7 +193,7 @@ class AltStoreRepos: LoadingTableView { let item = repos[indexPath.row] if !item.isPublic { - API.deleteAltStoreRepo(id: item.id) { + API.deleteAltStoreRepo(id: String(item.id)) { Messages.shared.showSuccess(message: "The repository was deleted successfully".localized(), context: .viewController(self)) self.loadRepos() } fail: { error in diff --git a/appdb/Tabs/Settings/AltStoreRepos/Apps/AltStoreAppDetails.swift b/appdb/Tabs/Settings/AltStoreRepos/Apps/AltStoreAppDetails.swift index fbe7437d..c97ace25 100644 --- a/appdb/Tabs/Settings/AltStoreRepos/Apps/AltStoreAppDetails.swift +++ b/appdb/Tabs/Settings/AltStoreRepos/Apps/AltStoreAppDetails.swift @@ -12,8 +12,6 @@ import TelemetryClient class AltStoreAppDetails: LoadingTableView { - var adsInitialized = false - var adsLoaded: Bool = !Global.showAds || Global.DEBUG || Preferences.isPlus var currentInstallButton: RoundedButton? var app: AltStoreApp! @@ -40,10 +38,6 @@ class AltStoreAppDetails: LoadingTableView { setUp() initializeCells() - - /*if Global.showAds && !Global.DEBUG && !Preferences.isPlus { - UnityAds.initialize(Global.adsId, testMode: Global.adsTestMode, initializationDelegate: self) - }*/ } // MARK: - Table view data source @@ -102,11 +96,7 @@ class AltStoreAppDetails: LoadingTableView { @objc func install(sender: RoundedButton) { currentInstallButton = sender - if !Global.showAds || Global.DEBUG || Preferences.isPlus { - actualInstall(sender: currentInstallButton!) - }/* else { - UnityAds.show(self, placementId: "Interstitial_iOS", showDelegate: self) - }*/ + actualInstall(sender: currentInstallButton!) } private func actualInstall(sender: RoundedButton) { @@ -213,59 +203,3 @@ extension AltStoreAppDetails: ScreenshotRedirectionDelegate { present(nav, animated: true) } } - -// MARK: - Ads - -/*extension AltStoreAppDetails: UnityAdsInitializationDelegate { - func initializationComplete() { - adsInitialized = true - - if Global.showAds && !Global.DEBUG && !Preferences.isPlus { - UnityAds.load("Interstitial_iOS", loadDelegate: self) - } - } - - func initializationFailed(_ error: UnityAdsInitializationError, withMessage message: String) { - adsInitialized = false - } -} - -extension AltStoreAppDetails: UnityAdsLoadDelegate { - func enableInstallButton() { - if let detailsHeader = header.first as? DetailsHeader, let installButton = detailsHeader.installButton { - installButton.isEnabled = true - } - } - - func unityAdsAdLoaded(_ placementId: String) { - adsLoaded = true - enableInstallButton() - } - - func unityAdsAdFailed(toLoad placementId: String, withError error: UnityAdsLoadError, withMessage message: String) { - adsLoaded = false - enableInstallButton() - } -} - -extension AltStoreAppDetails: UnityAdsShowDelegate { - func unityAdsShowComplete(_ placementId: String, withFinish state: UnityAdsShowCompletionState) { - if currentInstallButton != nil { - actualInstall(sender: currentInstallButton!) - } - } - func unityAdsShowFailed(_ placementId: String, withError error: UnityAdsShowError, withMessage message: String) { - if currentInstallButton != nil { - actualInstall(sender: currentInstallButton!) - } - } - - func unityAdsShowStart(_ placementId: String) { - - } - - func unityAdsShowClick(_ placementId: String) { - - } -} -*/ diff --git a/appdb/Tabs/Settings/AltStoreRepos/Apps/AltStoreRepoApps.swift b/appdb/Tabs/Settings/AltStoreRepos/Apps/AltStoreRepoApps.swift index e8246fbf..3c7a96ee 100644 --- a/appdb/Tabs/Settings/AltStoreRepos/Apps/AltStoreRepoApps.swift +++ b/appdb/Tabs/Settings/AltStoreRepos/Apps/AltStoreRepoApps.swift @@ -106,7 +106,7 @@ class AltStoreRepoApps: LoadingTableView { } private func loadContent() { - API.getAltStoreRepo(id: repo.id, success: { [weak self] _repo in + API.getAltStoreRepo(id: String(repo.id), success: { [weak self] _repo in guard let self = self else { return } self.repo = _repo diff --git a/appdb/Tabs/Settings/IPA Cache/IPACache.swift b/appdb/Tabs/Settings/IPA Cache/IPACache.swift index 90617cbc..98d94ece 100644 --- a/appdb/Tabs/Settings/IPA Cache/IPACache.swift +++ b/appdb/Tabs/Settings/IPA Cache/IPACache.swift @@ -101,7 +101,7 @@ class IPACache: LoadingTableView { cell.selectionStyle = .none case 1: cell.textLabel?.text = "In Update".localized() - cell.detailTextLabel?.text = status.inUpdate ? "Yes".localized() : "No".localized() + cell.detailTextLabel?.text = status.inUpdate == 1 ? "Yes".localized() : "No".localized() cell.textLabel?.theme_textColor = Color.title cell.selectionStyle = .none case 2: diff --git a/appdb/Tabs/Settings/News/News.swift b/appdb/Tabs/Settings/News/News.swift index 477d8b45..9fcece77 100644 --- a/appdb/Tabs/Settings/News/News.swift +++ b/appdb/Tabs/Settings/News/News.swift @@ -168,8 +168,8 @@ class News: LoadingTableView { override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { let item = isFiltering() ? filteredNews[indexPath.row] : displayedNews[indexPath.row] - guard !item.id.isEmpty else { return } - let newsDetailViewController = NewsDetail(with: item.id) + guard item.id != 0 else { return } + let newsDetailViewController = NewsDetail(with: item.id.description) navigationController?.pushViewController(newsDetailViewController, animated: true) } @@ -220,8 +220,8 @@ extension News { override func tableView(_ tableView: UITableView, contextMenuConfigurationForRowAt indexPath: IndexPath, point: CGPoint) -> UIContextMenuConfiguration? { let item = isFiltering() ? filteredNews[indexPath.row] : displayedNews[indexPath.row] - guard !item.id.isEmpty else { return nil } - return UIContextMenuConfiguration(identifier: nil, previewProvider: { NewsDetail(with: item.id) }) + guard item.id != 0 else { return nil } + return UIContextMenuConfiguration(identifier: nil, previewProvider: { NewsDetail(with: item.id.description) }) } override func tableView(_ tableView: UITableView, willPerformPreviewActionForMenuWith configuration: UIContextMenuConfiguration, animator: UIContextMenuInteractionCommitAnimating) { @@ -241,8 +241,8 @@ extension News: UIViewControllerPreviewingDelegate { guard let indexPath = tableView.indexPathForRow(at: location) else { return nil } previewingContext.sourceRect = tableView.rectForRow(at: indexPath) let item = isFiltering() ? filteredNews[indexPath.row] : displayedNews[indexPath.row] - guard !item.id.isEmpty else { return nil } - let newsDetailViewController = NewsDetail(with: item.id) + guard item.id != 0 else { return nil } + let newsDetailViewController = NewsDetail(with: item.id.description) return newsDetailViewController } diff --git a/appdb/Tabs/Settings/Settings+StaticCells.swift b/appdb/Tabs/Settings/Settings+StaticCells.swift index f388c00b..5de5f135 100644 --- a/appdb/Tabs/Settings/Settings+StaticCells.swift +++ b/appdb/Tabs/Settings/Settings+StaticCells.swift @@ -168,7 +168,7 @@ final class SimpleStaticSigningCertificateCell: UITableViewCell, Cell { guard let freeSignsLeftNumber = Int(freeSignsLeft) else { return } guard let freeSignsResetAt = row.context?["freeSignsResetAt"] as? String else { return } guard let plus = row.context?["isPlus"] as? Bool else { return } - guard let plusUntil = (row.context?["plusUntil"] as? String)?.rfc2822decodedShort else { return } + guard let plusUntil = (row.context?["plusUntil"] as? String)?.unixToString else { return } guard let plusAccountStatus = row.context?["plusAccountStatus"] as? String else { return } guard let revoked = row.context?["revoked"] as? Bool else { return } guard let revokedOn = (row.context?["revokedOn"] as? String)?.revokedDateDecoded else { return } @@ -194,7 +194,7 @@ final class SimpleStaticSigningCertificateCell: UITableViewCell, Cell { } else { activeLabel.theme_textColor = freeSignsLeftNumber > 0 ? Color.softGreen : Color.softRed expirationLabel.text = signingWith - activeLabel.text = "%@ signs left until %@".localizedFormat(freeSignsLeft, freeSignsResetAt.rfc2822decoded) + activeLabel.text = "%@ signs left until %@".localizedFormat(freeSignsLeft, freeSignsResetAt.unixToString) } selectionStyle = .default @@ -271,7 +271,7 @@ final class SimpleStaticPLUSStatusCell: UITableViewCell, Cell { textLabel?.text = row.text guard let isPlus = row.context?["active"] as? Bool else { return } - guard let plusExpirationDate = (row.context?["expire"] as? String)?.rfc2822decodedShort else { return } + guard let plusExpirationDate = (row.context?["expire"] as? String)?.unixToString else { return } if isPlus { activeLabel.theme_textColor = Color.softGreen diff --git a/appdb/Tabs/Settings/Signing Type Chooser/SigningTypeChooser.swift b/appdb/Tabs/Settings/Signing Type Chooser/SigningTypeChooser.swift index d39ca0bb..c1f724cd 100644 --- a/appdb/Tabs/Settings/Signing Type Chooser/SigningTypeChooser.swift +++ b/appdb/Tabs/Settings/Signing Type Chooser/SigningTypeChooser.swift @@ -23,7 +23,7 @@ class SigningTypeChooser: UITableViewController { return bgColorView }() - let availableOptions = ["auto", "development", "production"] + let availableOptions = ["auto", "development", "distribution"] static var currentType: String { Preferences.signingIdentityType diff --git a/appdb/Tabs/Updates/Updates+Extension.swift b/appdb/Tabs/Updates/Updates+Extension.swift index e30ee02d..122217d9 100644 --- a/appdb/Tabs/Updates/Updates+Extension.swift +++ b/appdb/Tabs/Updates/Updates+Extension.swift @@ -119,8 +119,8 @@ extension Updates: ElasticLabelDelegate { extension Updates: IgnoredAppsListChanged { func ignoredChanged() { let updatedList = allApps.filter({ !$0.isIgnored }).sorted { $0.name.lowercased() < $1.name.lowercased() } - let updatedList1 = updatedList.filter({ $0.updateable }) - let updatedList2 = updatedList.filter({ !$0.updateable }) + let updatedList1 = updatedList.filter({ $0.updateable == 1 }) + let updatedList2 = updatedList.filter({ $0.updateable == 0 }) if self.updateableApps != updatedList1 { self.updateableApps = updatedList1 @@ -146,7 +146,7 @@ extension Updates { let apps = indexPath.section == 0 ? updateableApps : nonUpdateableApps guard apps.indices.contains(indexPath.row) else { return nil } let item = apps[indexPath.row] - return UIContextMenuConfiguration(identifier: nil, previewProvider: { Details(type: item.itemType, trackid: item.trackid) }) + return UIContextMenuConfiguration(identifier: nil, previewProvider: { Details(type: item.itemType, trackid: item.trackid.description) }) } override func tableView(_ tableView: UITableView, willPerformPreviewActionForMenuWith configuration: UIContextMenuConfiguration, animator: UIContextMenuInteractionCommitAnimating) { @@ -173,7 +173,7 @@ extension Updates: UIViewControllerPreviewingDelegate { let apps = indexPath.section == 0 ? updateableApps : nonUpdateableApps guard apps.indices.contains(indexPath.row) else { return nil } let item = apps[indexPath.row] - let vc = Details(type: item.itemType, trackid: item.trackid) + let vc = Details(type: item.itemType, trackid: item.trackid.description) return vc } diff --git a/appdb/Tabs/Updates/Updates.swift b/appdb/Tabs/Updates/Updates.swift index cd8e4c5a..086b118c 100644 --- a/appdb/Tabs/Updates/Updates.swift +++ b/appdb/Tabs/Updates/Updates.swift @@ -124,8 +124,8 @@ class Updates: LoadingTableView { self.retryCount = 0 self.allApps = apps let mixed = apps.filter({ !$0.isIgnored }).sorted { $0.name.lowercased() < $1.name.lowercased() } - self.updateableApps = mixed.filter { $0.updateable } - self.nonUpdateableApps = mixed.filter { !$0.updateable } + self.updateableApps = mixed.filter { $0.updateable == 1 } + self.nonUpdateableApps = mixed.filter { $0.updateable == 0 } done(nil) }, fail: { [weak self] error, errorCode in guard let self = self else { return } @@ -175,7 +175,7 @@ class Updates: LoadingTableView { override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { let apps = indexPath.section == 0 ? updateableApps : nonUpdateableApps let item = apps[indexPath.row] - let vc = Details(type: item.itemType, trackid: item.trackid) + let vc = Details(type: item.itemType, trackid: item.trackid.description) if Global.isIpad { let nav = DismissableModalNavController(rootViewController: vc) nav.modalPresentationStyle = .formSheet @@ -222,7 +222,7 @@ class Updates: LoadingTableView { override func tableView(_ tableView: UITableView, editActionsForRowAt indexPath: IndexPath) -> [UITableViewRowAction]? { let ignore = UITableViewRowAction(style: .normal, title: "Ignore".localized()) { _, _ in let app = (indexPath.section == 0 ? self.updateableApps : self.nonUpdateableApps)[indexPath.row] - let ignoredApp = IgnoredApp(trackid: app.trackid, name: app.name, iconUrl: app.image, type: app.type) + let ignoredApp = IgnoredApp(trackid: app.trackid.description, name: app.name, iconUrl: app.image, type: app.type) Preferences.append(.ignoredUpdateableApps, element: ignoredApp) if indexPath.section == 0 {