Skip to content

Commit

Permalink
Merge branch 'lock-screen'
Browse files Browse the repository at this point in the history
  • Loading branch information
Flaque committed Jul 12, 2019
2 parents 5852a6b + 21f461b commit d9d18d6
Show file tree
Hide file tree
Showing 17 changed files with 402 additions and 7 deletions.
3 changes: 3 additions & 0 deletions App.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
CBT_ON_BOARDING_SCREEN,
PAYMENT_SCREEN,
CBT_VIEW_SCREEN,
LOCK_SCREEN,
} from "./src/screens";
import CBTListScreen from "./src/CBTListScreen";
import CBTFormScreen from "./src/form/FormScreen";
Expand All @@ -16,6 +17,7 @@ import SettingScreen from "./src/SettingsScreen";
import OnboardingScreen from "./src/onboarding/OnboardingScreen";
import withErrorBoundary from "./src/sentry/withErrorBoundary";
import PaymentScreen from "./src/PaymentScreen";
import LockScreen from "./src/lock/LockScreen";

const App = createStackNavigator(
{
Expand All @@ -26,6 +28,7 @@ const App = createStackNavigator(
[EXPLANATION_SCREEN]: ExplanationScreen,
[SETTING_SCREEN]: SettingScreen,
[CBT_VIEW_SCREEN]: FinishedThoughtScreen,
[LOCK_SCREEN]: LockScreen,
},
{
initialRouteName: PAYMENT_SCREEN,
Expand Down
Binary file modified assets/awebottom/awebottom.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/awebottom/awebottom@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/awebottom/awebottom@3x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion ios/quirk/Supporting/EXBuildConstants.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"TEMPORARY_SDK_VERSION":"31.0.0","EXPO_RUNTIME_VERSION":"2.9.0","STANDALONE_CONTEXT_TYPE":"user","DEFAULT_API_KEYS":{"GOOGLE_MAPS_IOS_API_KEY":"","AMPLITUDE_KEY":"1e246ef3dacaabe8648768d7c35fceb1"},"developmentUrl":"exp4d07d66c4b23470393769aad813cee0c://192.168.86.33:19000"}
{"TEMPORARY_SDK_VERSION":"31.0.0","EXPO_RUNTIME_VERSION":"2.9.0","STANDALONE_CONTEXT_TYPE":"user","DEFAULT_API_KEYS":{"GOOGLE_MAPS_IOS_API_KEY":"","AMPLITUDE_KEY":"1e246ef3dacaabe8648768d7c35fceb1"},"developmentUrl":"exp4d07d66c4b23470393769aad813cee0c://172.20.3.65:19000"}
2 changes: 1 addition & 1 deletion ios/quirk/Supporting/EXBuildConstants.plist
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
<key>TEMPORARY_SDK_VERSION</key>
<string>31.0.0</string>
<key>developmentUrl</key>
<string>exp4d07d66c4b23470393769aad813cee0c://192.168.86.33:19000</string>
<string>exp4d07d66c4b23470393769aad813cee0c://172.20.3.65:19000</string>
</dict>
</plist>
2 changes: 1 addition & 1 deletion ios/quirk/Supporting/EXBuildConstants.plist.bak
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
<key>TEMPORARY_SDK_VERSION</key>
<string>31.0.0</string>
<key>developmentUrl</key>
<string>exp4d07d66c4b23470393769aad813cee0c://192.168.86.33:19000</string>
<string>exp4d07d66c4b23470393769aad813cee0c://172.20.3.65:19000</string>
</dict>
</plist>
15 changes: 13 additions & 2 deletions src/PaymentScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ import {
} from "react-navigation";
import { Paragraph, SubHeader, ActionButton } from "./ui";
import * as InAppPurchases from "react-native-iap";
import { CBT_FORM_SCREEN } from "./screens";
import { CBT_FORM_SCREEN, LOCK_SCREEN } from "./screens";
import {
getSubscriptionDefinition,
requiresPayment,
Expand All @@ -60,6 +60,7 @@ import { getAppleExpirationDateFromReceipt } from "./subscriptions/iosReceipts";
import { isGrandfatheredIntoFreeSubscription } from "./history/grandfatherstore";
import Sentry from "./sentry";
import { FadesIn } from "./animations";
import { hasPincode } from "./lock/lockstore";

const IOS_SKU = "fyi.quirk.subscription";
const ANDROID_ID = "basic_subscription";
Expand Down Expand Up @@ -95,20 +96,30 @@ class PaymentScreen extends React.Component<
canMakePayments: boolean;
isReady: boolean;
loading: boolean;
shouldShowLock: boolean;
}
> {
static navigationOptions = {
header: null,
};

state = {
shouldShowLock: false,
subscription: null,
canMakePayments: false,
isReady: false,
loading: false,
};

redirectToFormScreen = () => {
redirectToFormScreen = async () => {
// If we're locked, go to the lock instead
// Check if we should show a pincode
const isLocked = await hasPincode();
if (isLocked) {
this.props.navigation.replace(LOCK_SCREEN);
return;
}

// We replace here because you shouldn't be able to go "back" to this screen
this.props.navigation.replace(CBT_FORM_SCREEN, {
thought: false,
Expand Down
33 changes: 32 additions & 1 deletion src/SettingsScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
NavigationState,
NavigationAction,
} from "react-navigation";
import { CBT_ON_BOARDING_SCREEN } from "./screens";
import { CBT_ON_BOARDING_SCREEN, LOCK_SCREEN } from "./screens";
import { setSetting, getSettingOrSetDefault } from "./setting/settingstore";
import {
HISTORY_BUTTON_LABEL_KEY,
Expand Down Expand Up @@ -298,6 +298,37 @@ class SettingScreen extends React.Component<Props, State> {
/>
</Row>

<Row
style={{
marginBottom: 18,
display: "flex",
flexDirection: "column",
}}
>
<SubHeader>*pincode lock 🔒</SubHeader>
<Paragraph
style={{
marginBottom: 9,
}}
>
You can lock the app with a pincode if you'd like. Be warned
that the only way to reset the code is to contact support (which
can take awhile), so be careful not to forget.
</Paragraph>
<ActionButton
flex={1}
title={"Set Pincode"}
width={"100%"}
fillColor="#EDF0FC"
textColor={theme.darkBlue}
onPress={() => {
this.props.navigation.push(LOCK_SCREEN, {
isSettingCode: true,
});
}}
/>
</Row>

<Row
style={{
marginBottom: 18,
Expand Down
11 changes: 11 additions & 0 deletions src/alerts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,17 @@ They'll nudge you in the evenings every once and awhile to help you remember to
Love/hate them? Let me know by pressing the feedback button or sending an email to "ejc@quirk.fyi".
`,
},
{
slug: "lock-screen",
priority: 0,
title: "👋 Lock Screens!",
body: `Quirk has a pincode lock screen now.
You can turn it on in the settings. If you lock yourself out, send us an email.
Love/hate it? Let me know by pressing the feedback button or sending an email to "ejc@quirk.fyi".
`,
},
];

export default alerts;
6 changes: 6 additions & 0 deletions src/animations/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,9 @@ export const FadesIn = posed.View({
visible: { opacity: 1 },
hidden: { opacity: 0 },
});

export const BouncyBigOnActive = posed.View({
active: { scale: 1, transition: { type: "spring", stiffness: 200 } },
inactive: { scale: 0.5 },
upcoming: { y: -24 },
});
1 change: 1 addition & 0 deletions src/form/FormScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import haptic from "../haptic";
import { recordScreenCallOnFocus } from "../navigation";
import * as stats from "../stats";
import { FadesIn } from "../animations";
import { hasPincode } from "../lock/lockstore";

interface ScreenProps {
navigation: NavigationScreenProp<any, NavigationAction>;
Expand Down
Loading

0 comments on commit d9d18d6

Please sign in to comment.