-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
155 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
This folder should contain credential files (e.g. provided by Google): | ||
|
||
1. Firebase files (if this app uses Firebase Cloud Messaging and Firebase Crashlytics atm): | ||
|
||
- `google-services.json` for android | ||
- `GoogleService-Info.plist` for iOS | ||
|
||
2. Google service account key file for Expo EAS to be able to submit apps to the Play Store: | ||
- `google-play-service-key.json` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
export const formatDate = (date: Date, locale?: string) => { | ||
return date.toLocaleDateString(locale ?? 'en-US', { | ||
year: 'numeric', | ||
month: 'long', | ||
day: 'numeric', | ||
}); | ||
}; | ||
|
||
export const formatTime = (date: Date, locale?: string) => { | ||
return date.toLocaleTimeString(locale ?? 'en-US', { | ||
hour: '2-digit', | ||
minute: '2-digit', | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import * as Network from 'expo-network'; | ||
import { useEffect, useState } from 'react'; | ||
|
||
export default function useIsOnline() { | ||
// Custom hook to check if the user is online or offline | ||
// Returns a boolean | ||
const [isConnected, setIsConnected] = useState<boolean | undefined>( | ||
undefined, | ||
); | ||
|
||
useEffect(() => { | ||
// Check if the user is online or offline | ||
Network.getNetworkStateAsync().then((state) => { | ||
setIsConnected(state.isConnected); | ||
}); | ||
}, []); | ||
|
||
return isConnected === true; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#!/bin/bash | ||
set -e # The script fails if any of the steps fail | ||
|
||
# This script fetches secrets from Infisical and creates a .env file | ||
|
||
# Function to use jq command | ||
use_jq() { | ||
if command -v jq >/dev/null 2>&1; then | ||
# Use system jq | ||
jq "$@" | ||
else | ||
# Use downloaded jq | ||
./jq "$@" | ||
fi | ||
} | ||
|
||
# Download jq binary only if EAS_BUILD is true and jq is not available in the system | ||
if [ "$EAS_BUILD" = "true" ] && ! command -v jq >/dev/null 2>&1; then | ||
echo "EAS_BUILD is true and jq is not installed. Downloading jq binary..." | ||
|
||
# Check the platform and download the appropriate jq binary | ||
if [ "$EAS_BUILD_PLATFORM" = "ios" ]; then | ||
curl -L -o jq https://github.com/jqlang/jq/releases/download/jq-1.7.1/jq-macos-arm64 && chmod +x ./jq | ||
else | ||
curl -L -o jq https://github.com/jqlang/jq/releases/download/jq-1.7.1/jq-linux-amd64 && chmod +x ./jq | ||
fi | ||
else | ||
echo "Skipping jq binary download." | ||
fi | ||
|
||
# Determine the environment to use | ||
ENVIRONMENT="staging" | ||
if [ "$EAS_BUILD_PROFILE" = "production" ]; then | ||
ENVIRONMENT="prod" | ||
fi | ||
echo "Using environment: $ENVIRONMENT" | ||
|
||
# Fetch secrets and create .env file | ||
echo "Fetching secrets and creating .env file..." | ||
curl "https://app.infisical.com/api/v3/secrets/raw?environment=$ENVIRONMENT&secretPath=/native&workspaceId=650c0ca916f6d380e9193251" \ | ||
--header "Authorization: Bearer $INFISICAL_TOKEN" | \ | ||
use_jq -r '.secrets[] | "\(.secretKey)=\(.secretValue)"' > .env | ||
|
||
# Cleanup if ./jq binary was downloaded | ||
if [ -f "./jq" ]; then | ||
echo "Cleaning up ./jq binary..." | ||
rm ./jq | ||
fi | ||
|
||
echo "Script execution completed." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import AsyncStorage from '@react-native-async-storage/async-storage'; | ||
import { create } from 'zustand'; | ||
import { createJSONStorage, persist } from 'zustand/middleware'; | ||
|
||
interface ExampleStore { | ||
value: number; | ||
increment: () => void; | ||
decrement: () => void; | ||
} | ||
|
||
export const useExampleStore = create<ExampleStore>()( | ||
persist( | ||
(set) => ({ | ||
value: 0, | ||
increment: () => set((state) => ({ value: state.value + 1 })), | ||
decrement: () => set((state) => ({ value: state.value - 1 })), | ||
}), | ||
{ | ||
name: 'example-store', | ||
storage: createJSONStorage(() => AsyncStorage), | ||
}, | ||
), | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1817,6 +1817,13 @@ | |
"@babel/runtime" "^7.13.10" | ||
"@radix-ui/react-compose-refs" "1.0.0" | ||
|
||
"@react-native-async-storage/async-storage@^1.23.1": | ||
version "1.23.1" | ||
resolved "https://registry.yarnpkg.com/@react-native-async-storage/async-storage/-/async-storage-1.23.1.tgz#cad3cd4fab7dacfe9838dce6ecb352f79150c883" | ||
integrity sha512-Qd2kQ3yi6Y3+AcUlrHxSLlnBvpdCEMVGFlVBneVOjaFaPU61g1huc38g339ysXspwY1QZA2aNhrk/KlHGO+ewA== | ||
dependencies: | ||
merge-options "^3.0.4" | ||
|
||
"@react-native-community/[email protected]": | ||
version "12.3.6" | ||
resolved "https://registry.yarnpkg.com/@react-native-community/cli-clean/-/cli-clean-12.3.6.tgz#e8a7910bebc97266fd5068649013a03958021fc4" | ||
|
@@ -4274,6 +4281,11 @@ [email protected]: | |
dependencies: | ||
invariant "^2.2.4" | ||
|
||
expo-network@~5.8.0: | ||
version "5.8.0" | ||
resolved "https://registry.yarnpkg.com/expo-network/-/expo-network-5.8.0.tgz#1481471467fc5cc55df750eaf74927ea8c664fbc" | ||
integrity sha512-mTtyqRgLKvXWB+xCoY5WMtRrpVqYmcXWz3YbyN+X0HRGqXg7a+UYOXeKlxrkwBiadsElhmfMeaj1UpmW79Zw/w== | ||
|
||
expo-router@~3.4.8: | ||
version "3.4.8" | ||
resolved "https://registry.yarnpkg.com/expo-router/-/expo-router-3.4.8.tgz#c7e55f500467985950760d325f75d06f8dfc17e7" | ||
|
@@ -5196,6 +5208,11 @@ is-path-inside@^3.0.2, is-path-inside@^3.0.3: | |
resolved "https://registry.yarnpkg.com/is-path-inside/-/is-path-inside-3.0.3.tgz#d231362e53a07ff2b0e0ea7fed049161ffd16283" | ||
integrity sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ== | ||
|
||
is-plain-obj@^2.1.0: | ||
version "2.1.0" | ||
resolved "https://registry.yarnpkg.com/is-plain-obj/-/is-plain-obj-2.1.0.tgz#45e42e37fccf1f40da8e5f76ee21515840c09287" | ||
integrity sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA== | ||
|
||
is-plain-object@^2.0.4: | ||
version "2.0.4" | ||
resolved "https://registry.yarnpkg.com/is-plain-object/-/is-plain-object-2.0.4.tgz#2c163b3fafb1b606d9d17928f05c2a1c38e07677" | ||
|
@@ -5909,6 +5926,13 @@ memory-cache@~0.2.0: | |
resolved "https://registry.yarnpkg.com/memory-cache/-/memory-cache-0.2.0.tgz#7890b01d52c00c8ebc9d533e1f8eb17e3034871a" | ||
integrity sha512-OcjA+jzjOYzKmKS6IQVALHLVz+rNTMPoJvCztFaZxwG14wtAW7VRZjwTQu06vKCYOxh4jVnik7ya0SXTB0W+xA== | ||
|
||
merge-options@^3.0.4: | ||
version "3.0.4" | ||
resolved "https://registry.yarnpkg.com/merge-options/-/merge-options-3.0.4.tgz#84709c2aa2a4b24c1981f66c179fe5565cc6dbb7" | ||
integrity sha512-2Sug1+knBjkaMsMgf1ctR1Ujx+Ayku4EdJN4Z+C2+JzoeF7A3OZ9KM2GY0CpQS51NR61LTurMJrRKPhSs3ZRTQ== | ||
dependencies: | ||
is-plain-obj "^2.1.0" | ||
|
||
merge-stream@^2.0.0: | ||
version "2.0.0" | ||
resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60" | ||
|
@@ -8396,6 +8420,11 @@ use-latest-callback@^0.1.9: | |
resolved "https://registry.yarnpkg.com/use-latest-callback/-/use-latest-callback-0.1.9.tgz#10191dc54257e65a8e52322127643a8940271e2a" | ||
integrity sha512-CL/29uS74AwreI/f2oz2hLTW7ZqVeV5+gxFeGudzQrgkCytrHw33G4KbnQOrRlAEzzAFXi7dDLMC9zhWcVpzmw== | ||
|
||
[email protected]: | ||
version "1.2.0" | ||
resolved "https://registry.yarnpkg.com/use-sync-external-store/-/use-sync-external-store-1.2.0.tgz#7dbefd6ef3fe4e767a0cf5d7287aacfb5846928a" | ||
integrity sha512-eEgnFxGQ1Ife9bzYs6VLi8/4X6CObHMw9Qr9tPY43iKwsPw8xE8+EFsf/2cFZ5S3esXgpWgtSCtLNS41F+sKPA== | ||
|
||
util-deprecate@^1.0.1, util-deprecate@^1.0.2, util-deprecate@~1.0.1: | ||
version "1.0.2" | ||
resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" | ||
|
@@ -8764,3 +8793,10 @@ yocto-queue@^0.1.0: | |
version "0.1.0" | ||
resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b" | ||
integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q== | ||
|
||
zustand@^4.5.2: | ||
version "4.5.2" | ||
resolved "https://registry.yarnpkg.com/zustand/-/zustand-4.5.2.tgz#fddbe7cac1e71d45413b3682cdb47b48034c3848" | ||
integrity sha512-2cN1tPkDVkwCy5ickKrI7vijSjPksFRfqS6237NzT0vqSsztTNnQdHw9mmN7uBdk3gceVXU0a+21jFzFzAc9+g== | ||
dependencies: | ||
use-sync-external-store "1.2.0" |