Skip to content

Commit

Permalink
add setup guide
Browse files Browse the repository at this point in the history
  • Loading branch information
lukesthl committed Dec 27, 2023
1 parent 5d2e187 commit 9adb9a0
Show file tree
Hide file tree
Showing 7 changed files with 277 additions and 16 deletions.
3 changes: 3 additions & 0 deletions apps/expo/app/(tabs)/apps/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ const Apps = observer(() => {
pressStyle={{
backgroundColor: "$grey1",
}}
onPress={() => {
router.push("/setup");
}}
>
<View borderWidth={1} borderColor={"$grey3"} borderRadius={"$2"} padding="$4" borderStyle="dashed">
<XStack justifyContent="center" alignItems="center" space="$2">
Expand Down
3 changes: 3 additions & 0 deletions apps/expo/app/(tabs)/overview/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,9 @@ const Overview = observer(() => {
pressStyle={{
backgroundColor: "$grey1",
}}
onPress={() => {
router.push("/setup");
}}
>
<View borderWidth={1} borderColor={"$grey3"} borderRadius={"$2"} padding="$4" borderStyle="dashed">
<XStack justifyContent="center" alignItems="center" space="$2">
Expand Down
1 change: 1 addition & 0 deletions apps/expo/app/_layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ const NavigationStack = () => {
<Stack.Screen name="(tabs)" options={{ headerShown: false }} />
<Stack.Screen name="break" options={{ headerShown: false }} />
<Stack.Screen name="settings" options={{ headerShown: false, presentation: "modal" }} />
<Stack.Screen name="setup" options={{ headerShown: false, presentation: "modal" }} />
</Stack>
</NavigationThemeProvider>
);
Expand Down
43 changes: 43 additions & 0 deletions apps/expo/app/setup/_layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import { router, Stack } from "expo-router";
import { observer } from "mobx-react-lite";
import { Button, SizableText } from "tamagui";

export const unstable_settings = {
initialRouteName: "index",
};

const BreakLayout = observer(() => {
return (
<Stack>
<Stack.Screen
name="index"
options={{
title: "Instructions",
presentation: "modal",
headerRight: () => {
return (
<Button
pressStyle={{
backgroundColor: "transparent",
borderWidth: 0,
}}
onPress={() => {
router.back();
}}
borderWidth={0}
size="$4"
backgroundColor={"transparent"}
>
<SizableText color="$text11" size="$4">
Skip
</SizableText>
</Button>
);
},
}}
/>
</Stack>
);
});

export default BreakLayout;
225 changes: 225 additions & 0 deletions apps/expo/app/setup/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,225 @@
import * as Linking from "expo-linking";
import { router } from "expo-router";
import * as WebBrowser from "expo-web-browser";
import { observer } from "mobx-react-lite";
import { Button, H4, Paragraph, Text, View, XStack, YStack } from "tamagui";

import { Container } from "../../components/container";
import { ShadowCard } from "../../components/shadow.card";

const Setup = observer(() => {
return (
<Container paddingVertical={"$4"}>
<YStack space="$4">
<>
<H4 color="$text11">Tutorial</H4>
<Paragraph color="$text11">Step by step instructions to get you started.</Paragraph>
</>
<ShadowCard>
<XStack space="$3" alignItems={"flex-start"}>
<View
backgroundColor={"$grey1"}
borderRadius={999}
height={"$2.5"}
width={"$2.5"}
flexDirection="row"
alignItems="center"
justifyContent="center"
>
<Text color="$text11" fontWeight={"800"} fontSize={"$6"}>
1
</Text>
</View>
<View marginTop={"$1.5"}>
<H4 color="$text11" lineHeight={20}>
Download the shortcut
</H4>
<Paragraph color="$text11">Import the shortcut into your Shortcuts app.</Paragraph>
<Button
onPress={() => {
void WebBrowser.openBrowserAsync("https://www.icloud.com/shortcuts/67875c273b96497f9639a8f374ef7d92");
}}
marginTop="$2"
backgroundColor={"$primary5"}
paddingHorizontal={"$3"}
paddingVertical={"$2"}
>
<Text fontWeight={"600"}>Download and import shortcut</Text>
</Button>
</View>
</XStack>
</ShadowCard>
<ShadowCard>
<XStack space="$3" alignItems={"flex-start"}>
<View
backgroundColor={"$grey1"}
borderRadius={999}
height={"$2.5"}
width={"$2.5"}
flexDirection="row"
alignItems="center"
justifyContent="center"
>
<Text color="$text11" fontWeight={"800"} fontSize={"$6"}>
2
</Text>
</View>
<View marginTop={"$1.5"}>
<H4 color="$text11" lineHeight={20}>
Open the Shortcut app
</H4>
<Paragraph color="$text11">Go to Automations and create a new automation via the + button.</Paragraph>
<Button
onPress={() => {
void Linking.openURL("shortcuts://automation");
}}
marginTop="$2"
backgroundColor={"$primary5"}
paddingHorizontal={"$3"}
paddingVertical={"$2"}
>
<Text fontWeight={"600"}>Open Shortcuts App</Text>
</Button>
</View>
</XStack>
</ShadowCard>
<ShadowCard>
<XStack space="$3" alignItems={"flex-start"}>
<View
backgroundColor={"$grey1"}
borderRadius={999}
height={"$2.5"}
width={"$2.5"}
flexDirection="row"
alignItems="center"
justifyContent="center"
>
<Text color="$text11" fontWeight={"800"} fontSize={"$6"}>
3
</Text>
</View>
<View marginTop={"$1.5"}>
<H4 color="$text11" lineHeight={20}>
Select "App"-Trigger
</H4>
<Paragraph color="$text11">Scroll down and select "App" as the trigger.</Paragraph>
</View>
</XStack>
</ShadowCard>
<ShadowCard>
<XStack space="$3" alignItems={"flex-start"}>
<View
backgroundColor={"$grey1"}
borderRadius={999}
height={"$2.5"}
width={"$2.5"}
flexDirection="row"
alignItems="center"
justifyContent="center"
>
<Text color="$text11" fontWeight={"800"} fontSize={"$6"}>
4
</Text>
</View>
<View marginTop={"$1.5"}>
<H4 color="$text11" lineHeight={20}>
Configure the trigger
</H4>
<Paragraph color="$text11">Select "Choose" and search for the app you want to use.</Paragraph>
<Paragraph color="$text11">Info: You need to create a trigger for every app you want to use.</Paragraph>
<Paragraph color="$text11">Select "open directly"</Paragraph>
<Paragraph color="$text11">Select "Next" when you are done.</Paragraph>
</View>
</XStack>
</ShadowCard>
<ShadowCard>
<XStack space="$3" alignItems={"flex-start"}>
<View
backgroundColor={"$grey1"}
borderRadius={999}
height={"$2.5"}
width={"$2.5"}
flexDirection="row"
alignItems="center"
justifyContent="center"
>
<Text color="$text11" fontWeight={"800"} fontSize={"$6"}>
5
</Text>
</View>
<View marginTop={"$1.5"}>
<H4 color="$text11" lineHeight={22}>
Select "digital break" as the action
</H4>
<Paragraph color="$text11">Search for "digital break" and select it.</Paragraph>
</View>
</XStack>
</ShadowCard>
<ShadowCard>
<XStack space="$3" alignItems={"flex-start"}>
<View
backgroundColor={"$grey1"}
borderRadius={999}
height={"$2.5"}
width={"$2.5"}
flexDirection="row"
alignItems="center"
justifyContent="center"
>
<Text color="$text11" fontWeight={"800"} fontSize={"$6"}>
6
</Text>
</View>
<View marginTop={"$1.5"}>
<H4 color="$text11" lineHeight={20}>
Replace the default app
</H4>
<Paragraph color="$text11">
Replace the default app with the app you want to use. (e.g. Instagram)
</Paragraph>
</View>
</XStack>
</ShadowCard>
<ShadowCard>
<XStack space="$3" alignItems={"flex-start"}>
<View
backgroundColor={"$grey1"}
borderRadius={999}
height={"$2.5"}
width={"$2.5"}
flexDirection="row"
alignItems="center"
justifyContent="center"
>
<Text color="$text11" fontWeight={"800"} fontSize={"$6"}>
7
</Text>
</View>
<View marginTop={"$1.5"}>
<H4 color="$text11" lineHeight={24}>
Congrats 🎉
</H4>
<Paragraph color="$text11">You are all set. Now you can try to open the app you selected.</Paragraph>
<Paragraph color="$text11">
The App will be displayed in Digital Break after the first time you open it.
</Paragraph>
</View>
</XStack>
</ShadowCard>
<Button
onPress={() => {
void router.back();
}}
marginBottom="$4"
backgroundColor={"$primary5"}
paddingHorizontal={"$3"}
paddingVertical={"$2"}
>
<Text fontWeight={"600"}>Done</Text>
</Button>
</YStack>
</Container>
);
});

export default Setup;
4 changes: 2 additions & 2 deletions apps/expo/targets/intents/DigitalBreak.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ enum MyError: Error {
case runtimeError(String)
}
struct DigitalBreak: AppIntent {
static var title: LocalizedStringResource = "Activate Digital Break when an app opens"
static var title: LocalizedStringResource = "Check Digital Break"

static var description =
IntentDescription(
"This shortcut starts a breathing exercise and asks if you really want to continue in the selected app"
"This shortcut checks if you need a digital break and returns true."
)

static var openAppWhenRun: Bool = false
Expand Down
14 changes: 0 additions & 14 deletions apps/expo/targets/intents/EmptyAppIntent.swift

This file was deleted.

0 comments on commit 9adb9a0

Please sign in to comment.