From d1dac551cdf905914f6c8207860f927153be72c1 Mon Sep 17 00:00:00 2001 From: Mohamad Mortada Date: Sun, 19 Jan 2025 17:07:04 -0800 Subject: [PATCH] Make a preview build (#140) * preview build * update eas json --- app.config.js | 4 ++ eas.json | 10 +++- package-lock.json | 133 +++++++++++++++++++++++++++++++++++++++++++++- package.json | 3 +- src/Navigator.tsx | 72 +++++++++++++++++-------- 5 files changed, 196 insertions(+), 26 deletions(-) diff --git a/app.config.js b/app.config.js index 0acfdac..dcfa20e 100644 --- a/app.config.js +++ b/app.config.js @@ -49,6 +49,10 @@ export default { projectId: "dfc97c77-31b1-4267-896f-9472c87f166c", }, }, + updates: { + url: "https://u.expo.dev/dfc97c77-31b1-4267-896f-9472c87f166c", + checkAutomatically: "NEVER", + }, plugins: [ [ "expo-image-picker", diff --git a/eas.json b/eas.json index 8cbbb81..ef1ffe7 100644 --- a/eas.json +++ b/eas.json @@ -8,7 +8,15 @@ "distribution": "internal" }, "preview": { - "distribution": "internal" + "distribution": "internal", + "env": { + "EXPO_PUBLIC_API_BASE": "https://hcb.hackclub.com/api/v4", + "EXPO_PUBLIC_CLIENT_ID": "yt8JHmPDmmYYLUmoEiGtocYwg5fSOGCrcIY3G-vkMRs", + "EXPO_PUBLIC_STRIPE_API_KEY": "pk_live_UAjIP1Kss29XZ6tW0MFWkjUQ" + }, + "android": { + "buildType": "apk" + } }, "production": { "env": { diff --git a/package-lock.json b/package-lock.json index ab30141..43ea1d9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -49,6 +49,7 @@ "expo-splash-screen": "~0.29.18", "expo-status-bar": "~2.0.0", "expo-system-ui": "~4.0.6", + "expo-updates": "^0.26.13", "expo-web-browser": "~14.0.1", "geopattern": "github:thedev132/geopattern", "hackclub-icons-rn": "github:thedev132/hackclub-icons-rn", @@ -65,7 +66,7 @@ "react-native-reanimated": "~3.16.1", "react-native-safe-area-context": "4.12.0", "react-native-screens": "~4.4.0", - "react-native-svg": "^15.8.0", + "react-native-svg": "^15.11.1", "react-native-web": "~0.19.10", "swr": "^2.2.1", "to-words": "^4.2.0", @@ -9887,6 +9888,12 @@ "react-native": "*" } }, + "node_modules/expo-structured-headers": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/expo-structured-headers/-/expo-structured-headers-4.0.0.tgz", + "integrity": "sha512-uPiwZjWq3AdFGgY52+I2nGPrNa6izxAglymPXHUZLekZW290GqIUOk7MBNDD4sg4JwUbSi3gdxEurpEvuq+FSg==", + "license": "MIT" + }, "node_modules/expo-system-ui": { "version": "4.0.7", "resolved": "https://registry.npmjs.org/expo-system-ui/-/expo-system-ui-4.0.7.tgz", @@ -9911,6 +9918,35 @@ "resolved": "https://registry.npmjs.org/@react-native/normalize-colors/-/normalize-colors-0.76.6.tgz", "integrity": "sha512-1n4udXH2Cla31iA/8eLRdhFHpYUYK1NKWCn4m1Sr9L4SarWKAYuRFliK1fcLvPPALCFoFlWvn8I0ekdUOHMzDQ==" }, + "node_modules/expo-updates": { + "version": "0.26.13", + "resolved": "https://registry.npmjs.org/expo-updates/-/expo-updates-0.26.13.tgz", + "integrity": "sha512-rNJQ5eCGOGy6Ewxop1Fz3Kh5HXxSoIH480qrbJYqUDrql2J4Fp7cnv36B+Kwz+r+47gwGm1VgzwUbA2PctQc+w==", + "license": "MIT", + "dependencies": { + "@expo/code-signing-certificates": "0.0.5", + "@expo/config": "~10.0.8", + "@expo/config-plugins": "~9.0.14", + "@expo/spawn-async": "^1.7.2", + "arg": "4.1.0", + "chalk": "^4.1.2", + "expo-eas-client": "~0.13.2", + "expo-manifests": "~0.15.5", + "expo-structured-headers": "~4.0.0", + "expo-updates-interface": "~1.0.0", + "fast-glob": "^3.3.2", + "fbemitter": "^3.0.0", + "ignore": "^5.3.1", + "resolve-from": "^5.0.0" + }, + "bin": { + "expo-updates": "bin/cli.js" + }, + "peerDependencies": { + "expo": "*", + "react": "*" + } + }, "node_modules/expo-updates-interface": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/expo-updates-interface/-/expo-updates-interface-1.0.0.tgz", @@ -9919,6 +9955,100 @@ "expo": "*" } }, + "node_modules/expo-updates/node_modules/@babel/code-frame": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.10.4.tgz", + "integrity": "sha512-vG6SvB6oYEhvgisZNFRmRCUkLz11c7rp+tbNTynGqc6mS1d5ATd/sGyV6W0KZZnXRKMTzZDRgQT3Ou9jhpAfUg==", + "license": "MIT", + "dependencies": { + "@babel/highlight": "^7.10.4" + } + }, + "node_modules/expo-updates/node_modules/@expo/config": { + "version": "10.0.8", + "resolved": "https://registry.npmjs.org/@expo/config/-/config-10.0.8.tgz", + "integrity": "sha512-RaKwi8e6PbkMilRexdsxObLMdQwxhY6mlgel+l/eW+IfIw8HEydSU0ERlzYUjlGJxHLHUXe4rC2vw8FEvaowyQ==", + "license": "MIT", + "dependencies": { + "@babel/code-frame": "~7.10.4", + "@expo/config-plugins": "~9.0.14", + "@expo/config-types": "^52.0.3", + "@expo/json-file": "^9.0.1", + "deepmerge": "^4.3.1", + "getenv": "^1.0.0", + "glob": "^10.4.2", + "require-from-string": "^2.0.2", + "resolve-from": "^5.0.0", + "resolve-workspace-root": "^2.0.0", + "semver": "^7.6.0", + "slugify": "^1.3.4", + "sucrase": "3.35.0" + } + }, + "node_modules/expo-updates/node_modules/@expo/json-file": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/@expo/json-file/-/json-file-9.0.1.tgz", + "integrity": "sha512-ZVPhbbEBEwafPCJ0+kI25O2Iivt3XKHEKAADCml1q2cmOIbQnKgLyn8DpOJXqWEyRQr/VWS+hflBh8DU2YFSqg==", + "license": "MIT", + "dependencies": { + "@babel/code-frame": "~7.10.4", + "json5": "^2.2.3", + "write-file-atomic": "^2.3.0" + } + }, + "node_modules/expo-updates/node_modules/arg": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.0.tgz", + "integrity": "sha512-ZWc51jO3qegGkVh8Hwpv636EkbesNV5ZNQPCtRa+0qytRYPEs9IYT9qITY9buezqUH5uqyzlWLcufrzU2rffdg==", + "license": "MIT" + }, + "node_modules/expo-updates/node_modules/glob": { + "version": "10.4.5", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.4.5.tgz", + "integrity": "sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==", + "license": "ISC", + "dependencies": { + "foreground-child": "^3.1.0", + "jackspeak": "^3.1.2", + "minimatch": "^9.0.4", + "minipass": "^7.1.2", + "package-json-from-dist": "^1.0.0", + "path-scurry": "^1.11.1" + }, + "bin": { + "glob": "dist/esm/bin.mjs" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/expo-updates/node_modules/minimatch": { + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", + "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", + "license": "ISC", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/expo-updates/node_modules/semver": { + "version": "7.6.3", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", + "integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==", + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/expo-web-browser": { "version": "14.0.2", "resolved": "https://registry.npmjs.org/expo-web-browser/-/expo-web-browser-14.0.2.tgz", @@ -14526,6 +14656,7 @@ "version": "15.11.1", "resolved": "https://registry.npmjs.org/react-native-svg/-/react-native-svg-15.11.1.tgz", "integrity": "sha512-Qmwx/yJKt+AHUr4zjxx/Q69qwKtRfr1+uIfFMQoq3WFRhqU76aL9db1DyvPiY632DAsVGba1pHf92OZPkpjrdQ==", + "license": "MIT", "dependencies": { "css-select": "^5.1.0", "css-tree": "^1.1.3", diff --git a/package.json b/package.json index 4c6afc4..bc05920 100644 --- a/package.json +++ b/package.json @@ -54,6 +54,7 @@ "expo-splash-screen": "~0.29.18", "expo-status-bar": "~2.0.0", "expo-system-ui": "~4.0.6", + "expo-updates": "^0.26.13", "expo-web-browser": "~14.0.1", "geopattern": "github:thedev132/geopattern", "hackclub-icons-rn": "github:thedev132/hackclub-icons-rn", @@ -70,7 +71,7 @@ "react-native-reanimated": "~3.16.1", "react-native-safe-area-context": "4.12.0", "react-native-screens": "~4.4.0", - "react-native-svg": "^15.8.0", + "react-native-svg": "^15.11.1", "react-native-web": "~0.19.10", "swr": "^2.2.1", "to-words": "^4.2.0", diff --git a/src/Navigator.tsx b/src/Navigator.tsx index ed3b4c4..2ca7810 100644 --- a/src/Navigator.tsx +++ b/src/Navigator.tsx @@ -3,8 +3,9 @@ import { createBottomTabNavigator } from "@react-navigation/bottom-tabs"; import { useTheme } from "@react-navigation/native"; import { createNativeStackNavigator } from "@react-navigation/native-stack"; import { BlurView } from "expo-blur"; +import * as Updates from "expo-updates"; import * as WebBrowser from "expo-web-browser"; -import { StyleSheet, useColorScheme } from "react-native"; +import { StyleSheet, useColorScheme, View } from "react-native"; import useSWR, { useSWRConfig } from "swr"; // import OrganizationTitle from "./components/organizations/OrganizationTitle"; @@ -49,6 +50,20 @@ export default function Navigator() { const { mutate } = useSWRConfig(); + async function onFetchUpdateAsync() { + try { + const update = await Updates.checkForUpdateAsync(); + + if (update.isAvailable) { + await Updates.fetchUpdateAsync(); + await Updates.reloadAsync(); + } + } catch (error) { + // You can also add an alert() to see the error message in case of an error when fetching updates. + alert(`Error fetching latest Expo update: ${error}`); + } + } + return ( ({ @@ -99,28 +114,39 @@ export default function Navigator() { title: "Home", headerLargeTitle: true, headerRight: () => ( - - WebBrowser.openBrowserAsync( - "https://hackclub.com/hcb/apply", - { - presentationStyle: - WebBrowser.WebBrowserPresentationStyle.POPOVER, - controlsColor: palette.primary, - dismissButtonStyle: "cancel", - }, - ).then(() => { - mutate("user/organizations"); - mutate("user/invitations"); - }) - } - /> + + + WebBrowser.openBrowserAsync( + "https://hackclub.com/hcb/apply", + { + presentationStyle: + WebBrowser.WebBrowserPresentationStyle.POPOVER, + controlsColor: palette.primary, + dismissButtonStyle: "cancel", + }, + ).then(() => { + mutate("user/organizations"); + mutate("user/invitations"); + }) + } + /> + onFetchUpdateAsync()} + /> + ), }} />