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

feat: add util to request store review #379

Merged
merged 1 commit into from
Apr 17, 2024
Merged
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
1 change: 1 addition & 0 deletions .env.development
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ APP_NAME="Dev"
EXPO_APPLE_TEAM_ID=""

API_URL=""
ITUNES_ITEM_ID=""

SENTRY_DSN=""
SENTRY_ORG=""
Expand Down
1 change: 1 addition & 0 deletions .env.production
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ APP_NAME="RN Starter"
EXPO_APPLE_TEAM_ID=""

API_URL=""
ITUNES_ITEM_ID=""

SENTRY_DSN=""
SENTRY_ORG=""
Expand Down
1 change: 1 addition & 0 deletions .env.staging
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ APP_NAME="Staging"
EXPO_APPLE_TEAM_ID=""

API_URL=""
ITUNES_ITEM_ID=""

SENTRY_DSN=""
SENTRY_ORG=""
Expand Down
3 changes: 3 additions & 0 deletions app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ export default ({ config }: ConfigContext): ExpoConfig => ({
ios: {
supportsTablet: false,
bundleIdentifier: Env.BUNDLE_ID,
// TODO(prod): Add correct app store URL
appStoreUrl: `https://apps.apple.com/app/XXX/${Env.ITUNES_ITEM_ID}`,
config: {
usesNonExemptEncryption: false,
},
Expand All @@ -104,6 +106,7 @@ export default ({ config }: ConfigContext): ExpoConfig => ({
backgroundColor: '#000',
},
package: Env.PACKAGE,
playStoreUrl: `https://play.google.com/store/apps/details?id=${Env.PACKAGE}`,
},
plugins,
extra: {
Expand Down
2 changes: 2 additions & 0 deletions env.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ const client = z.object({

// ADD CLIENT ENV VARS HERE
API_URL: z.string(),
ITUNES_ITEM_ID: z.string(),
FLAGSMITH_KEY: z.string(),
AMPLITUDE_API_KEY: z.string(),
SENTRY_DSN: z.string(),
Expand Down Expand Up @@ -66,6 +67,7 @@ const _clientEnv = {
// ADD ENV VARS HERE TOO
APP_NAME: process.env.APP_NAME,
API_URL: process.env.API_URL,
ITUNES_ITEM_ID: process.env.ITUNES_ITEM_ID,
FLAGSMITH_KEY: process.env.FLAGSMITH_KEY,
AMPLITUDE_API_KEY: process.env.AMPLITUDE_API_KEY,
SENTRY_DSN: process.env.SENTRY_DSN,
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@
"expo-secure-store": "~12.8.1",
"expo-splash-screen": "~0.26.4",
"expo-status-bar": "~1.11.1",
"expo-store-review": "~6.8.3",
"expo-updates": "~0.24.12",
"graphql": "16.8.1",
"graphql-request": "6.1.0",
Expand Down
21 changes: 21 additions & 0 deletions src/features/storeRating/hooks/useAppStoreReview.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import * as StoreReview from 'expo-store-review';

export const useAppStoreReview = () => {
const isStoreReviewAvailable = async () => {
const [isActionAvailable, isRequestAvailable] = await Promise.all([
StoreReview.hasAction(),
StoreReview.isAvailableAsync(),
]);

return isActionAvailable && isRequestAvailable;
};

const requestStoreReview = async () => {
await StoreReview.requestReview();
};

return {
isStoreReviewAvailable,
requestStoreReview,
};
};
10 changes: 10 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -11523,6 +11523,15 @@ __metadata:
languageName: node
linkType: hard

"expo-store-review@npm:~6.8.3":
version: 6.8.3
resolution: "expo-store-review@npm:6.8.3"
peerDependencies:
expo: "*"
checksum: 8a8967173aed19ac6640df51d74f909016715e83988ea030c93a276ea37fa80b13673e1fc028965511469fb657e9a9820b96a5deebce2213fd57fb5fb92aa179
languageName: node
linkType: hard

"expo-structured-headers@npm:~3.7.0":
version: 3.7.2
resolution: "expo-structured-headers@npm:3.7.2"
Expand Down Expand Up @@ -19355,6 +19364,7 @@ __metadata:
expo-secure-store: ~12.8.1
expo-splash-screen: ~0.26.4
expo-status-bar: ~1.11.1
expo-store-review: ~6.8.3
expo-updates: ~0.24.12
fs-extra: 11.2.0
graphql: 16.8.1
Expand Down
Loading