Skip to content

Commit 4dc37dc

Browse files
Manuel RuckManAnRuck
authored andcommitted
Add store review URL configuration and update rateApp function to use it as fallback
Signed-off-by: Manuel Ruck <[email protected]>
1 parent 76754a4 commit 4dc37dc

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed

app.config.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,5 +143,10 @@ export default ({ config }: ConfigContext): ExpoConfig => ({
143143
graphqlUrl: getGraphqlUrl(),
144144
appVariant: APP_VARIANT || "internal",
145145
associatedDomains: getAssociatedDomains(),
146+
storeReviewUrl: {
147+
ios: "https://apps.apple.com/de/app/democracy/id1341311162",
148+
android:
149+
"https://play.google.com/store/apps/details?id=de.democracydeutschland.app&hl=de&pli=1",
150+
},
146151
},
147152
});

src/api/config.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import Constants from "expo-constants";
2+
import { Platform } from "react-native";
23

34
const extra = Constants.expoConfig?.extra || {};
45
const APP_VARIANT = extra.appVariant || "internal";
@@ -13,10 +14,20 @@ const ANDROID_SERVER = "192.168.0.166";
1314
const ASSOCIATED_DOMAINS = extra.associatedDomains || [
1415
"internal.democracy-app.de",
1516
];
17+
const STORE_REVIEW_URL_IOS = extra.storeReviewUrl?.ios || "";
18+
const STORE_REVIEW_URL_ANDROID = extra.storeReviewUrl?.android || "";
19+
const STORE_REVIEW_URL =
20+
Platform.select({
21+
ios: STORE_REVIEW_URL_IOS,
22+
android: STORE_REVIEW_URL_ANDROID,
23+
}) || "";
1624

1725
export {
1826
GRAPHQL_URL,
1927
GRAPHQL_SERVER_LOCAL,
2028
ANDROID_SERVER,
2129
ASSOCIATED_DOMAINS,
30+
STORE_REVIEW_URL_IOS,
31+
STORE_REVIEW_URL_ANDROID,
32+
STORE_REVIEW_URL,
2233
};

src/lib/rateApp.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Linking } from "react-native";
22
import * as StoreReview from "expo-store-review";
3+
import { STORE_REVIEW_URL } from "../api/config";
34

45
export const rateApp = async () => {
56
try {
@@ -12,6 +13,8 @@ export const rateApp = async () => {
1213

1314
if (storeUrl) {
1415
await Linking.openURL(storeUrl);
16+
} else if (STORE_REVIEW_URL) {
17+
await Linking.openURL(STORE_REVIEW_URL);
1518
} else {
1619
console.warn("Store review URL is unavailable.");
1720
}

0 commit comments

Comments
 (0)