Skip to content

Commit

Permalink
Merge branch 'develop' into po/tlon-3223-move-fixtures-to-app-package
Browse files Browse the repository at this point in the history
  • Loading branch information
patosullivan committed Nov 15, 2024
2 parents 363f018 + b76ab9e commit a1337be
Show file tree
Hide file tree
Showing 42 changed files with 535 additions and 285 deletions.
1 change: 1 addition & 0 deletions .github/workflows/mobile-update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,4 @@ jobs:
RECAPTCHA_SITE_KEY_ANDROID: ${{ secrets.RECAPTCHA_SITE_KEY_ANDROID }}
RECAPTCHA_SITE_KEY_IOS: ${{ secrets.RECAPTCHA_SITE_KEY_IOS }}
TLON_EMPLOYEE_GROUP: ${{ secrets.TLON_EMPLOYEE_GROUP }}
INVITE_SERVICE_ENDPOINT: ${{ secrets.INVITE_SERVICE_ENDPOINT }}
2 changes: 1 addition & 1 deletion apps/tlon-mobile/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ android {
targetSdkVersion rootProject.ext.targetSdkVersion
compileSdk rootProject.ext.compileSdkVersion
versionCode 108
versionName "4.1.7"
versionName "4.2.0"

buildConfigField("boolean", "REACT_NATIVE_UNSTABLE_USE_RUNTIME_SCHEDULER_ALWAYS", (findProperty("reactNative.unstable_useRuntimeSchedulerAlways") ?: true).toString())
}
Expand Down
2 changes: 2 additions & 0 deletions apps/tlon-mobile/app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ export default ({ config }: ConfigContext): ExpoConfig => ({
branchDomain: isPreview
? process.env.BRANCH_DOMAIN_TEST
: process.env.BRANCH_DOMAIN_PROD,
inviteServiceEndpoint: process.env.INVITE_SERVICE_ENDPOINT,
inviteServiceIsDev: process.env.INVITE_SERVICE_IS_DEV,
},
ios: {
runtimeVersion: '4.0.2',
Expand Down
8 changes: 4 additions & 4 deletions apps/tlon-mobile/ios/Landscape.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1427,7 +1427,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 4.1.7;
MARKETING_VERSION = 4.2.0;
OTHER_LDFLAGS = (
"$(inherited)",
"-ObjC",
Expand Down Expand Up @@ -1465,7 +1465,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 4.1.7;
MARKETING_VERSION = 4.2.0;
OTHER_LDFLAGS = (
"$(inherited)",
"-ObjC",
Expand Down Expand Up @@ -1689,7 +1689,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 4.1.7;
MARKETING_VERSION = 4.2.0;
OTHER_LDFLAGS = (
"$(inherited)",
"-ObjC",
Expand Down Expand Up @@ -1732,7 +1732,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 4.1.7;
MARKETING_VERSION = 4.2.0;
OTHER_LDFLAGS = (
"$(inherited)",
"-ObjC",
Expand Down
15 changes: 4 additions & 11 deletions apps/tlon-mobile/src/fixtures/Onboarding.fixture.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
import { NavigationContainer } from '@react-navigation/native';
import {
Context as BranchContext,
LureData,
} from '@tloncorp/app/contexts/branch';
import { exampleContacts } from '@tloncorp/app/fixtures/contentHelpers';
import { group } from '@tloncorp/app/fixtures/fakeData';
import {
DeepLinkData,
QueryClientProvider,
queryClient,
} from '@tloncorp/shared';
import { Context as BranchContext } from '@tloncorp/app/contexts/branch';
import { AppInvite, QueryClientProvider, queryClient } from '@tloncorp/shared';
import { Theme } from '@tloncorp/ui';
import { PropsWithChildren, useState } from 'react';
import { useFixtureSelect } from 'react-cosmos/client';
Expand Down Expand Up @@ -47,7 +40,7 @@ function OnboardingFixture({
hasGroupInvite,
children,
}: PropsWithChildren<{ hasGroupInvite: boolean }>) {
const [lure, setLure] = useState<LureData | undefined>(
const [lure, setLure] = useState<AppInvite | undefined>(
hasGroupInvite
? {
id: group.id,
Expand Down Expand Up @@ -108,7 +101,7 @@ function OnboardingFixture({
<BranchContext.Provider
value={{
lure,
setLure: setLure as unknown as (data: DeepLinkData) => void,
setLure: setLure as unknown as (lure: AppInvite) => void,
clearLure: () => setLure(undefined),
clearDeepLink: () => {},
deepLinkPath: undefined,
Expand Down
14 changes: 14 additions & 0 deletions apps/tlon-mobile/src/lib/signupContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@ import { createDevLogger } from '@tloncorp/shared';
import * as api from '@tloncorp/shared/api';
import { SignupParams, didSignUp, signupData } from '@tloncorp/shared/db';
import * as store from '@tloncorp/shared/store';
import PostHog, { usePostHog } from 'posthog-react-native';
import {
createContext,
useCallback,
useContext,
useEffect,
useState,
} from 'react';
import branch from 'react-native-branch';

const logger = createDevLogger('signup', true);

Expand Down Expand Up @@ -56,6 +58,7 @@ export const SignupProvider = ({ children }: { children: React.ReactNode }) => {
const [reviveCheckComplete, setReviveCheckComplete] = useState(false);
const { bootPhase, bootReport, kickOffBootSequence } =
useBootSequence(values);
const postHog = usePostHog();

const setOnboardingValues = useCallback(
(newValues: Partial<SignupValues>) => {
Expand All @@ -80,6 +83,7 @@ export const SignupProvider = ({ children }: { children: React.ReactNode }) => {
nickname: values.nickname,
telemetry: values.telemetry,
notificationToken: values.notificationToken,
postHog,
};
runPostSignupActions(postSignupParams);
logger.trackEvent('hosted signup report', {
Expand Down Expand Up @@ -139,6 +143,7 @@ async function runPostSignupActions(params: {
nickname?: string;
telemetry?: boolean;
notificationToken?: string;
postHog?: PostHog;
}) {
if (params.nickname) {
try {
Expand All @@ -156,6 +161,15 @@ async function runPostSignupActions(params: {
if (typeof params.telemetry !== 'undefined') {
try {
await api.updateTelemetrySetting(params.telemetry);
if (!params.telemetry) {
// we give some wiggle room here before disabling telemetry to allow
// the initial signup flow to complete before severing analytics
const tenMinutes = 10 * 60 * 1000;
setTimeout(() => {
params.postHog?.optOut();
branch.disableTracking(true);
}, tenMinutes);
}
} catch (e) {
logger.trackError('post signup: failed to set telemetry', {
errorMessage: e.message,
Expand Down
1 change: 1 addition & 0 deletions apps/tlon-mobile/src/screens/Onboarding/CheckOTPScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ export const CheckOTPScreen = ({ navigation, route: { params } }: Props) => {
phoneNumber:
otpMethod === 'phone' ? signupContext.phoneNumber! : undefined,
email: otpMethod === 'email' ? signupContext.email! : undefined,
hostingUser: user,
});
navigation.navigate('ReserveShip', { user });
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
DeepLinkData,
createInviteLinkRegex,
extractNormalizedInviteLink,
getMetadaFromInviteLink,
getInviteLinkMeta,
} from '@tloncorp/shared';
import {
Field,
Expand Down Expand Up @@ -68,12 +68,13 @@ export const PasteInviteLinkScreen = ({ navigation }: Props) => {
setMetadataError(null);
if (extractedLink) {
try {
const inviteLinkMeta = await getMetadaFromInviteLink(
extractedLink,
BRANCH_KEY
);
if (inviteLinkMeta) {
setLure(inviteLinkMeta as DeepLinkData);
const appInvite = await getInviteLinkMeta({
inviteLink: extractedLink,
branchDomain: BRANCH_DOMAIN,
branchKey: BRANCH_KEY,
});
if (appInvite) {
setLure(appInvite);
return;
} else {
throw new Error('Failed to retrieve invite metadata');
Expand Down
17 changes: 7 additions & 10 deletions apps/tlon-mobile/src/screens/Onboarding/SetTelemetryScreen.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { NativeStackScreenProps } from '@react-navigation/native-stack';
import { useSignupContext } from '.././../lib/signupContext';
import { trackOnboardingAction } from '@tloncorp/app/utils/posthog';
import {
ScreenHeader,
SizableText,
Expand All @@ -8,12 +8,11 @@ import {
XStack,
YStack,
} from '@tloncorp/ui';
import { usePostHog } from 'posthog-react-native';
import { useCallback, useState } from 'react';
import { Switch } from 'react-native';
import branch from 'react-native-branch';

import type { OnboardingStackParamList } from '../../types';
import { useSignupContext } from '.././../lib/signupContext';

type Props = NativeStackScreenProps<OnboardingStackParamList, 'SetTelemetry'>;

Expand All @@ -24,21 +23,19 @@ export const SetTelemetryScreen = ({
},
}: Props) => {
const [isEnabled, setIsEnabled] = useState(true);
const postHog = usePostHog();
const signupContext = useSignupContext();

const handleNext = useCallback(() => {
signupContext.setOnboardingValues({ telemetry: isEnabled });

if (!isEnabled) {
postHog?.optOut();
branch.disableTracking(true);
}
trackOnboardingAction({
actionName: 'SetTelemetry',
telemetryEnabled: isEnabled,
});

navigation.push('ReserveShip', {
user,
});
}, [isEnabled, user, postHog, navigation, signupContext]);
}, [isEnabled, user, navigation, signupContext]);

return (
<View flex={1} backgroundColor="$secondaryBackground">
Expand Down
20 changes: 6 additions & 14 deletions apps/tlon-mobile/src/screens/Onboarding/SignupScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
} from '@tloncorp/app/contexts/branch';
import { HostingError } from '@tloncorp/app/lib/hostingApi';
import { trackOnboardingAction } from '@tloncorp/app/utils/posthog';
import { createDevLogger } from '@tloncorp/shared';
import { AnalyticsEvent, createDevLogger } from '@tloncorp/shared';
import {
Field,
KeyboardAvoidingView,
Expand Down Expand Up @@ -81,7 +81,7 @@ export const SignupScreen = ({ navigation }: Props) => {
actionName: 'Phone or Email Submitted',
phoneNumber: phoneForm.getValues().phoneNumber,
email: emailForm.getValues().email,
lure: signupParams.lureId,
lure: lureMeta?.id,
});

signupContext.setOnboardingValues({
Expand All @@ -93,14 +93,7 @@ export const SignupScreen = ({ navigation }: Props) => {
mode: 'signup',
otpMethod,
});
}, [
phoneForm,
emailForm,
signupParams.lureId,
signupContext,
navigation,
otpMethod,
]);
}, [phoneForm, emailForm, lureMeta, signupContext, navigation, otpMethod]);

const toggleSignupMode = useCallback(() => {
setRemoteError(undefined);
Expand All @@ -113,10 +106,10 @@ export const SignupScreen = ({ navigation }: Props) => {
setIsSubmitting(true);
try {
const { enabled } = await hostingApi.getHostingAvailability({
lure: signupParams.lureId,
priorityToken: signupParams.priorityToken,
});
if (!enabled) {
logger.trackError(AnalyticsEvent.InvitedUserFailedInventoryCheck);
navigation.navigate('JoinWaitList', {});
return;
}
Expand Down Expand Up @@ -167,7 +160,6 @@ export const SignupScreen = ({ navigation }: Props) => {
setIsSubmitting(false);
}, [
hostingApi,
signupParams.lureId,
signupParams.priorityToken,
recaptcha,
otpMethod,
Expand Down Expand Up @@ -276,8 +268,8 @@ export const SignupScreen = ({ navigation }: Props) => {
</YStack>
<View marginLeft="$l" marginTop="$m">
<TlonText.Text
size="$label/m"
color="$secondaryText"
size="$label/s"
color="$tertiaryText"
onPress={toggleSignupMode}
textAlign="center"
>
Expand Down
2 changes: 1 addition & 1 deletion apps/tlon-mobile/src/screens/Onboarding/TlonLogin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,6 @@ export const TlonLoginScreen = ({ navigation, route }: Props) => {
loading={isSubmitting}
disabled={
isSubmitting ||
remoteError !== undefined ||
(otpMethod === 'phone'
? !phoneForm.formState.isValid
: !emailForm.formState.isValid)
Expand Down Expand Up @@ -256,6 +255,7 @@ export const TlonLoginScreen = ({ navigation, route }: Props) => {
</>
) : (
<TlonText.Text
size="$label/s"
color="$secondaryText"
textAlign="center"
onPress={handlePressEmailSignup}
Expand Down
38 changes: 21 additions & 17 deletions apps/tlon-mobile/src/screens/Onboarding/TlonLoginLegacy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ export const TlonLoginLegacy = ({ navigation }: Props) => {
});

return (
<View flex={1}>
<View flex={1} backgroundColor="$secondaryBackground">
<ScreenHeader
title="Tlon Login"
showSessionStatus={false}
Expand Down Expand Up @@ -251,30 +251,34 @@ export const TlonLoginLegacy = ({ navigation }: Props) => {
)}
name="password"
/>
<View paddingBottom="$m">
<TlonText.Text
size="$label/s"
color="$tertiaryText"
textAlign="center"
>
By logging in you agree to Tlon&rsquo;s{' '}
<TlonText.RawText
pressStyle={{
opacity: 0.5,
}}
textDecorationLine="underline"
textDecorationDistance={10}
onPress={handlePressEula}
>
Terms of Service
</TlonText.RawText>
</TlonText.Text>
</View>
<TlonText.Text
size="$label/m"
color="$primaryText"
color="$secondaryText"
textAlign="center"
onPress={handleForgotPassword}
>
Forgot password?
</TlonText.Text>
</YStack>
<View padding="$xl">
<TlonText.Text size="$label/s" color="$tertiaryText">
By logging in you agree to Tlon&rsquo;s{' '}
<TlonText.RawText
pressStyle={{
opacity: 0.5,
}}
textDecorationLine="underline"
textDecorationDistance={10}
onPress={handlePressEula}
>
Terms of Service
</TlonText.RawText>
</TlonText.Text>
</View>
</YStack>
</KeyboardAvoidingView>
</View>
Expand Down
3 changes: 1 addition & 2 deletions desk/app/activity.hoon
Original file line number Diff line number Diff line change
Expand Up @@ -1180,8 +1180,7 @@
=. importing &
=. indices (~(put by indices) [%base ~] *index:a)
=. cor set-chat-reads
::REVIEW maybe need a scry api version bump here?
=+ .^(=channels:c %gx (scry-path %channels /v2/channels/full/noun))
=+ .^(=channels:c %gx (scry-path %channels /v3/channels/full/noun))
=. cor (set-volumes channels)
=. cor (set-channel-reads channels)
=. cor refresh-all-summaries
Expand Down
3 changes: 3 additions & 0 deletions desk/app/channels.hoon
Original file line number Diff line number Diff line change
Expand Up @@ -734,6 +734,9 @@
::
[%x %v2 %channels full=?(~ [%full ~])]
``channels-2+!>((uv-channels-2:utils v-channels ?=(^ full.pole)))
::
[%x %v3 %channels full=?(~ [%full ~])]
``channels-3+!>((uv-channels-3:utils v-channels ?=(^ full.pole)))
::
[%x ?(%v0 %v1) %init ~] ``noun+!>([unreads (uv-channels-1:utils v-channels)])
[%x %v2 %init ~] ``noun+!>([unreads (uv-channels-2:utils v-channels |)])
Expand Down
Loading

0 comments on commit a1337be

Please sign in to comment.