Skip to content

Commit

Permalink
migrate to v1.6 apis
Browse files Browse the repository at this point in the history
  • Loading branch information
n3d1117 committed Aug 3, 2023
1 parent 1d2608f commit af04ded
Show file tree
Hide file tree
Showing 69 changed files with 224 additions and 460 deletions.
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```

Expand Down
4 changes: 2 additions & 2 deletions Widgets/Models/Content.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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: "")
}
}
4 changes: 2 additions & 2 deletions Widgets/Models/News.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
}
6 changes: 2 additions & 4 deletions Widgets/Network/AppdbRepository.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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")
]
Expand Down
44 changes: 6 additions & 38 deletions appdb.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -670,22 +670,6 @@
81BE06711E6CB6DE00AD9827 /* Details+SegmentControl.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Details+SegmentControl.swift"; sourceTree = "<group>"; };
81C274D7229FFA57000D8BEB /* Credits+Views.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Credits+Views.swift"; sourceTree = "<group>"; };
81C82B7A22C3DBC1008BB076 /* AskBundleBeforeUploadViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AskBundleBeforeUploadViewController.swift; sourceTree = "<group>"; };
81CD0A9425F27FBF001C9EEA /* SwiftMessages.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = SwiftMessages.xcframework; path = Carthage/Build/SwiftMessages.xcframework; sourceTree = "<group>"; };
81CD0A9525F27FBF001C9EEA /* SwiftyJSON.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = SwiftyJSON.xcframework; path = Carthage/Build/SwiftyJSON.xcframework; sourceTree = "<group>"; };
81CD0A9625F27FBF001C9EEA /* AlamofireImage.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = AlamofireImage.xcframework; path = Carthage/Build/AlamofireImage.xcframework; sourceTree = "<group>"; };
81CD0A9725F27FBF001C9EEA /* Alamofire.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = Alamofire.xcframework; path = Carthage/Build/Alamofire.xcframework; sourceTree = "<group>"; };
81CD0A9825F27FBF001C9EEA /* Localize_Swift.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = Localize_Swift.xcframework; path = Carthage/Build/Localize_Swift.xcframework; sourceTree = "<group>"; };
81CD0A9925F27FBF001C9EEA /* AlamofireNetworkActivityIndicator.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = AlamofireNetworkActivityIndicator.xcframework; path = Carthage/Build/AlamofireNetworkActivityIndicator.xcframework; sourceTree = "<group>"; };
81CD0A9A25F27FBF001C9EEA /* Cartography.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = Cartography.xcframework; path = Carthage/Build/Cartography.xcframework; sourceTree = "<group>"; };
81CD0A9B25F27FBF001C9EEA /* BLTNBoard.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = BLTNBoard.xcframework; path = Carthage/Build/BLTNBoard.xcframework; sourceTree = "<group>"; };
81CD0A9C25F27FBF001C9EEA /* Static.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = Static.xcframework; path = Carthage/Build/Static.xcframework; sourceTree = "<group>"; };
81CD0A9D25F27FBF001C9EEA /* SwiftTheme.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = SwiftTheme.xcframework; path = Carthage/Build/SwiftTheme.xcframework; sourceTree = "<group>"; };
81CD0A9E25F27FBF001C9EEA /* DeepDiff.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = DeepDiff.xcframework; path = Carthage/Build/DeepDiff.xcframework; sourceTree = "<group>"; };
81CD0A9F25F27FBF001C9EEA /* Swifter.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = Swifter.xcframework; path = Carthage/Build/Swifter.xcframework; sourceTree = "<group>"; };
81CD0AA025F27FBF001C9EEA /* Kanna.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = Kanna.xcframework; path = Carthage/Build/Kanna.xcframework; sourceTree = "<group>"; };
81CD0AA125F27FBF001C9EEA /* ObjectMapper.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = ObjectMapper.xcframework; path = Carthage/Build/ObjectMapper.xcframework; sourceTree = "<group>"; };
81CD0AA225F27FBF001C9EEA /* ZIPFoundation.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = ZIPFoundation.xcframework; path = Carthage/Build/ZIPFoundation.xcframework; sourceTree = "<group>"; };
81CD0AA325F27FBF001C9EEA /* Cosmos.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = Cosmos.xcframework; path = Carthage/Build/Cosmos.xcframework; sourceTree = "<group>"; };
81D3F72A2163E1DA001EC9F2 /* Item+Properties.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Item+Properties.swift"; sourceTree = "<group>"; };
81D661751E5A0B6C00BB6461 /* Details+Extension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = "Details+Extension.swift"; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
81D873332365BAD800F7240E /* fr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fr; path = fr.lproj/Localizable.strings; sourceTree = "<group>"; };
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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 */,
);
Expand Down Expand Up @@ -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";
Expand Down Expand Up @@ -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)";
Expand Down Expand Up @@ -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)";
Expand Down Expand Up @@ -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)";
Expand Down Expand Up @@ -2953,7 +2921,7 @@
repositoryURL = "https://github.com/Alamofire/AlamofireImage";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 4.0.0;
minimumVersion = 4.2.0;
};
};
813F013C2A7BFF50008DCA2E /* XCRemoteSwiftPackageReference "AlamofireNetworkActivityIndicator" */ = {
Expand Down
10 changes: 5 additions & 5 deletions appdb/API/API+AltStoreRepos.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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):
Expand All @@ -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<AltStoreRepo>) in
switch response.result {
case .success(let result):
Expand All @@ -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<AltStoreRepo>) in
switch response.result {
case .success(let result):
Expand All @@ -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):
Expand Down
27 changes: 13 additions & 14 deletions appdb/API/API+Configuration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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):
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand All @@ -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):
Expand Down Expand Up @@ -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):
Expand All @@ -132,5 +131,5 @@ extension API {
fail(error.localizedDescription)
}
}
}
}*/
}
Loading

0 comments on commit af04ded

Please sign in to comment.