Skip to content

Commit

Permalink
Make a preview build (#140)
Browse files Browse the repository at this point in the history
* preview build

* update eas json
  • Loading branch information
thedev132 authored Jan 20, 2025
1 parent 5dac326 commit d1dac55
Show file tree
Hide file tree
Showing 5 changed files with 196 additions and 26 deletions.
4 changes: 4 additions & 0 deletions app.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
10 changes: 9 additions & 1 deletion eas.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
133 changes: 132 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down
72 changes: 49 additions & 23 deletions src/Navigator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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 (
<Tab.Navigator
screenOptions={({ route }) => ({
Expand Down Expand Up @@ -99,28 +114,39 @@ export default function Navigator() {
title: "Home",
headerLargeTitle: true,
headerRight: () => (
<Ionicons.Button
name="add-circle-outline"
backgroundColor="transparent"
size={24}
underlayColor={themeColors.card}
color={palette.primary}
iconStyle={{ marginRight: 0 }}
onPress={() =>
WebBrowser.openBrowserAsync(
"https://hackclub.com/hcb/apply",
{
presentationStyle:
WebBrowser.WebBrowserPresentationStyle.POPOVER,
controlsColor: palette.primary,
dismissButtonStyle: "cancel",
},
).then(() => {
mutate("user/organizations");
mutate("user/invitations");
})
}
/>
<View style={{ flexDirection: "row", alignItems: "center" }}>
<Ionicons.Button
name="add-circle-outline"
backgroundColor="transparent"
size={24}
underlayColor={themeColors.card}
color={palette.primary}
iconStyle={{ marginRight: 0 }}
onPress={() =>
WebBrowser.openBrowserAsync(
"https://hackclub.com/hcb/apply",
{
presentationStyle:
WebBrowser.WebBrowserPresentationStyle.POPOVER,
controlsColor: palette.primary,
dismissButtonStyle: "cancel",
},
).then(() => {
mutate("user/organizations");
mutate("user/invitations");
})
}
/>
<Ionicons.Button
name="refresh-outline"
backgroundColor="transparent"
size={24}
underlayColor={themeColors.card}
color={palette.primary}
iconStyle={{ marginRight: 0 }}
onPress={() => onFetchUpdateAsync()}
/>
</View>
),
}}
/>
Expand Down

0 comments on commit d1dac55

Please sign in to comment.