diff --git a/eas.json b/eas.json index dd7509c..ac64287 100644 --- a/eas.json +++ b/eas.json @@ -8,7 +8,8 @@ "distribution": "internal", "env": { "APP_VARIANT": "development", - "EXPO_PUBLIC_API_URL": "apprentice-scryer.jinni.health" + "EXPO_PUBLIC_API_URL": "apprentice-scryer.jinni.health", + "EXPO_PUBLIC_REDIRECT_URL": "apprentice-scryer.jinni.health" }, "android": { "buildType": "apk", @@ -18,7 +19,8 @@ "staging": { "env": { "APP_VARIANT": "staging", - "EXPO_PUBLIC_API_URL": "apprentice-scryer.jinni.health" + "EXPO_PUBLIC_API_URL": "apprentice-scryer.jinni.health", + "EXPO_PUBLIC_REDIRECT_URL": "apprentice-scryer.jinni.health" }, "android": { "buildType": "apk", @@ -28,7 +30,8 @@ "production": { "env": { "APP_VARIANT": "production", - "EXPO_PUBLIC_API_URL": "master-scryer.jinni.health" + "EXPO_PUBLIC_API_URL": "master-scryer.jinni.health", + "EXPO_PUBLIC_REDIRECT_URL": "master-scryer.jinni.health" }, "android": { "buildType": "app-bundle", diff --git a/sample.env b/sample.env index 9f5dcdf..041663a 100644 --- a/sample.env +++ b/sample.env @@ -1,5 +1,4 @@ EXPO_PUBLIC_API_URL="{someapi.domain.com}" -EXPO_PUBLIC_API_KEY="!believeme!" EXPO_ETH_RPC_PROVIDER="{alchemy/infura/etc}" EXPO_PUBLIC_SEGMENT_API_KEY="{some_key}" diff --git a/src/app/index.tsx b/src/app/index.tsx index d15fe31..e5f3640 100644 --- a/src/app/index.tsx +++ b/src/app/index.tsx @@ -4,8 +4,7 @@ import Animated, { useAnimatedStyle, useSharedValue, withSpring } from 'react-na import { isEmpty } from 'lodash/fp'; import { useHomeConfig } from 'hooks'; -import { useTheme } from 'contexts'; -import { WidgetConfig } from 'types/UserConfig'; +import { WidgetConfig, obj } from 'types/UserConfig'; import { getIconForWidget } from 'utils/rendering'; import { saveHomeConfig } from 'utils/api'; import { getActivityData } from 'inventory/android-health-connect'; @@ -13,6 +12,15 @@ import { getActivityData } from 'inventory/android-health-connect'; import { AvatarViewer, WidgetIcon } from 'components/index'; import DefaultAvatar from 'assets/avatars/red-yellow-egg'; import WidgetContainer from 'components/home/WidgetContainer'; +import OnboardingWizard from 'components/wizards/OnboardingWizard'; +import { + STAGE_AVATAR_CONFIG, + TRACK_ONBOARDING_STAGE, + filterOutDefaultWidgets, + getStorage, + saveStorage, +} from 'utils/config'; +import { debug } from 'utils/logging'; const HomeScreen = () => { const homeConfig = useHomeConfig(); @@ -21,6 +29,7 @@ const HomeScreen = () => { transform: [{ rotate: `${eggRollAngle.value}deg` }], })); const [widgetConfig, setWidgetConfig] = useState([]); + const [onboardingStage, setOnboardingStage] = useState(); useMemo(() => { if (isEmpty(widgetConfig) && homeConfig?.widgets) { @@ -28,6 +37,14 @@ const HomeScreen = () => { } }, [homeConfig, widgetConfig]); + useMemo(async () => { + const currentStage = await getStorage(TRACK_ONBOARDING_STAGE); + console.log('onboarding stage', onboardingStage, currentStage); + if (!onboardingStage && !currentStage?.[STAGE_AVATAR_CONFIG]) { + setOnboardingStage(STAGE_AVATAR_CONFIG); + } + }, [onboardingStage]); + useEffect(() => { const intervalId = setInterval(() => { const otherSide = eggRollAngle.value < 0 ? 30 : -30; @@ -52,11 +69,23 @@ const HomeScreen = () => { [setWidgetConfig], ); - const finalizeRenovation = () => - // TODO widgetConfig is not updated when adding/removing widgets - saveHomeConfig({ - widgets: widgetConfig, - }); + const finalizeRenovation = useCallback( + (widgets?: WidgetConfig[]) => + // TODO widgetConfig is not updated when adding/removing widgets + saveHomeConfig({ + widgets: widgets ?? widgetConfig, + }), + [widgetConfig], + ); + + const completeWizardStage = useCallback( + (stage: string) => { + saveStorage(TRACK_ONBOARDING_STAGE, { [stage]: String(true) }, true, {}).then(() => + setOnboardingStage(undefined), + ); + }, + [setOnboardingStage], + ); const HomeWidget = ({ id, title, path }: WidgetConfig) => { return ( @@ -82,8 +111,35 @@ const HomeScreen = () => { console.log('eggroll ', eggRollAngle.value); + if (onboardingStage === STAGE_AVATAR_CONFIG) + return ( + { + try { + await finalizeRenovation([ + ...widgetConfig, + { + id: 'maliksmajik-avatar-viewer', + provider: 'MaliksMajik', + routeName: 'index', // home page + title: 'Avatar Viewer', + path: '/', + config, + // They can't have registered yet so no jinni id to specify for config + // eventually need to link with jiini. Could do in activate_jinni but :Widget wont be there if they start from desktop flow (github/facrcaster) + // target_uuid: await getStorage(ID_JINNI_SLOT) + }, + ]); + completeWizardStage(STAGE_AVATAR_CONFIG); + } catch (e) { + debug(e, { extra: { onboardingStage } }); + } + }} + /> + ); return ( - + @@ -92,7 +148,7 @@ const HomeScreen = () => { + + ); + + return useModal ? ( + + {' '} + Save {' '} + + ), + }} + > + {renderMultiSelect()} + ) : ( + + {renderMultiSelect()} + + ); }; const styles = StyleSheet.create({ @@ -87,6 +123,20 @@ const styles = StyleSheet.create({ fontSize: 24, fontWeight: '500', }, + buttonContainer: { + bottom: 0, + }, + container: { + top: '8%', + left: '10%', + right: '10%', + bottom: '10%', + + position: 'absolute', + flexDirection: 'column', + justifyContent: 'space-between', + padding: 5, + }, }); export default SelectModal; diff --git a/src/components/wizards/BaseScreen.tsx b/src/components/wizards/BaseScreen.tsx new file mode 100644 index 0000000..0f53e8e --- /dev/null +++ b/src/components/wizards/BaseScreen.tsx @@ -0,0 +1,73 @@ +import { Button } from '@rneui/themed'; +import { entries } from 'lodash'; +import React from 'react'; +import { StyleSheet, View, Text } from 'react-native'; +// basic fullsized screen +// back and next buttons +// + +export interface BaseWizardScreenProps { + dialogueData?: { [key: string]: string }; // key = title | text + step: number; + onNext: () => void; + onBack: () => void; + backButtonStyle?: object; + nextButtonStyle?: object; +} + +const BaseWizardScreen = ({ dialogueData, step, onNext, onBack }: BaseWizardScreenProps) => { + return ( + + {!dialogueData ? null : ( + + {entries(dialogueData).map(([type, content]) => ( + + {content} + + ))} + + )} + +