Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic link for Rate the App #564

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions DWDS-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>APP_STORE_ID</key>
<string>$(APP_STORE_ID)</string>
<key>BGTaskSchedulerPermittedIdentifiers</key>
<array>
<string>org.kiwix.library_refresh</string>
Expand Down
4 changes: 2 additions & 2 deletions Kiwix.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1537,7 +1537,7 @@
CODE_SIGN_ENTITLEMENTS = Support/Kiwix.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 123;
CURRENT_PROJECT_VERSION = 124;
DEVELOPMENT_ASSET_PATHS = "";
DEVELOPMENT_TEAM = L7HWM3SP3L;
"ENABLE_HARDENED_RUNTIME[sdk=macosx*]" = YES;
Expand Down Expand Up @@ -1587,7 +1587,7 @@
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_ENTITLEMENTS = Support/Kiwix.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 123;
CURRENT_PROJECT_VERSION = 124;
DEVELOPMENT_ASSET_PATHS = "";
DEVELOPMENT_TEAM = L7HWM3SP3L;
"ENABLE_HARDENED_RUNTIME[sdk=macosx*]" = YES;
Expand Down
2 changes: 2 additions & 0 deletions Model/Brand.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import os

enum Brand {
static let appName: String = Config.value(for: .displayName) ?? "Kiwix"
static let appStoreId: String = Config.value(for: .appStoreID) ?? "id997079563"
static let welcomeLogoImageName: String = "welcomeLogo"
static var mainZimFileURL: URL? {
guard let zimFileName: String = Config.value(for: .zimFileMain),
Expand All @@ -28,6 +29,7 @@ enum Config: String {
case zimFileMain = "ZIM_FILE_MAIN"
case showExternalLinkSettings = "SETTINGS_SHOW_EXTERNAL_LINK_OPTION"
case externalLinkDefaultPolicy = "SETTINGS_DEFAULT_EXTERNAL_LINK_TO"
case appStoreID = "APP_STORE_ID"

static func value<T>(for key: Config) -> T? where T: LosslessStringConvertible {
guard let object = Bundle.main.object(forInfoDictionaryKey:key.rawValue) else {
Expand Down
4 changes: 4 additions & 0 deletions Model/Utilities/URL.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,8 @@ extension URL {
}

static let documentDirectory = try! FileManager.default.url(for: .documentDirectory, in: .userDomainMask, appropriateFor: nil, create: false)

init(appStoreReviewForName appName: String, appStoreID: String) {
self.init(string: "itms-apps://itunes.apple.com/us/app/\(appName)/\(appStoreID)?action=write-review")!
}
}
2 changes: 2 additions & 0 deletions Support/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>APP_STORE_ID</key>
<string>$(APP_STORE_ID)</string>
<key>BGTaskSchedulerPermittedIdentifiers</key>
<array>
<string>org.kiwix.library_refresh</string>
Expand Down
1 change: 1 addition & 0 deletions Support/dwds.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ HAS_LIBRARY = false
ZIM_FILE_MAIN = dwds_de_dictionary_nopic_2023-11-20
SETTINGS_DEFAULT_EXTERNAL_LINK_TO = alwaysLoad
SETTINGS_SHOW_EXTERNAL_LINK_OPTION = false
APP_STORE_ID = id6473090365
3 changes: 2 additions & 1 deletion Support/kiwix.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@
HAS_LIBRARY = true
ZIM_FILE_MAIN =
SETTINGS_DEFAULT_EXTERNAL_LINK_TO = alwaysAsk
SETTINGS_SHOW_EXTERNAL_LINK_OPTION = true
SETTINGS_SHOW_EXTERNAL_LINK_OPTION = true
APP_STORE_ID = id997079563
3 changes: 2 additions & 1 deletion Views/Settings/Settings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,8 @@ struct Settings: View {
Section("Misc".localized) {
Button("Feedback".localized) { UIApplication.shared.open(URL(string: "mailto:[email protected]")!) }
Button("Rate the App".localized) {
let url = URL(string: "itms-apps://itunes.apple.com/us/app/kiwix/id997079563?action=write-review")!
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@BPerlakiH Please replace the App store ID using Brand.appstoreId

Copy link
Collaborator Author

@BPerlakiH BPerlakiH Nov 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tvision251 I am not sure if I understand your point here.
With these changes the value from Brand.appStoreId is used.

let url = URL(appStoreReviewForName: Brand.appName.lowercased(),
appStoreID: Brand.appStoreId)
UIApplication.shared.open(url)
}
NavigationLink("About".localized) { About() }
Expand Down