Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions apps/mobile/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
"expo-sharing": "~55.0.21",
"expo-splash-screen": "55.0.22",
"expo-status-bar": "55.0.6",
"expo-store-review": "~55.0.15",
"expo-tracking-transparency": "55.0.15",
"expo-web-browser": "55.0.17",
"jotai": "2.18.1",
Expand Down
28 changes: 6 additions & 22 deletions apps/mobile/src/components/profile-screen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ import { type Href, useRouter } from 'expo-router';
import {
GitPullRequest,
KeyRound,
LifeBuoy,
Lock,
LogOut,
MessageSquare,
ShieldCheck,
Trash2,
} from 'lucide-react-native';
import { Alert, Linking, Platform, Pressable, ScrollView, View } from 'react-native';
import { Alert, Platform, Pressable, ScrollView, View } from 'react-native';
import { toast } from 'sonner-native';
import { useSafeAreaInsets } from 'react-native-safe-area-context';
import Animated, { FadeIn, FadeOut, LinearTransition } from 'react-native-reanimated';
Expand All @@ -23,6 +23,7 @@ import { ConfigureRow } from '@/components/ui/configure-row';
import { Skeleton } from '@/components/ui/skeleton';
import { Text } from '@/components/ui/text';
import { useAuth } from '@/lib/auth/auth-context';
import { showFeedbackPrompt } from '@/lib/feedback';
import { useCurrentUserId } from '@/lib/hooks/use-current-user-id';
import { useThemeColors } from '@/lib/hooks/use-theme-colors';
import { useOrganization } from '@/lib/organization-context';
Expand All @@ -31,8 +32,6 @@ import { getSecurityAgentPath } from '@/lib/security-agent';
import { getTabBarOverlayHeight } from '@/lib/tab-bar-layout';
import { useTRPC } from '@/lib/trpc';

const SUPPORT_EMAIL = 'hi@kilo.ai';

function providerIcon(_provider: string) {
return KeyRound;
}
Expand Down Expand Up @@ -97,21 +96,6 @@ export function ProfileScreen() {

const { bottom } = useSafeAreaInsets();

const openSupportEmail = async () => {
const envDetails = [
`User ID: ${userId ?? 'unknown'}`,
`App version: ${Application.nativeApplicationVersion} (${Application.nativeBuildVersion})`,
`OS: ${Platform.OS} ${Platform.Version}`,
].join('\n');
const body = `\n\n---\n${envDetails}`;
const url = `mailto:${SUPPORT_EMAIL}?subject=${encodeURIComponent('mobile app feedback')}&body=${encodeURIComponent(body)}`;
try {
await Linking.openURL(url);
} catch {
toast.error(`No email app available. You can reach us at ${SUPPORT_EMAIL}`);
}
};

const deleteAccount = useMutation(
trpc.user.requestAccountDeletion.mutationOptions({
onSuccess: () => {
Expand Down Expand Up @@ -262,11 +246,11 @@ export function ProfileScreen() {
<View className="mt-6 gap-3">
<View className="flex-row gap-3">
<ActionTile
icon={LifeBuoy}
label="Support"
icon={MessageSquare}
label="Feedback"
color={colors.mutedForeground}
onPress={() => {
void openSupportEmail();
showFeedbackPrompt(userId);
}}
/>
<ActionTile
Expand Down
91 changes: 91 additions & 0 deletions apps/mobile/src/lib/feedback.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
import * as Application from 'expo-application';
import * as SecureStore from 'expo-secure-store';
import * as StoreReview from 'expo-store-review';
import { Alert, Linking, Platform } from 'react-native';
import { toast } from 'sonner-native';

import { REVIEW_REQUESTED_AT_KEY } from '@/lib/storage-keys';

const SUPPORT_EMAIL = 'hi@kilo.ai';

const STORE_REVIEW_URL = Platform.select({
ios: 'https://apps.apple.com/app/id6761193135?action=write-review',
default: 'https://play.google.com/store/apps/details?id=com.kilocode.kiloapp',
});

async function openSupportEmail(userId: string | undefined) {
const envDetails = [
`User ID: ${userId ?? 'unknown'}`,
`App version: ${Application.nativeApplicationVersion} (${Application.nativeBuildVersion})`,
`OS: ${Platform.OS} ${Platform.Version}`,
].join('\n');
const body = `\n\n---\n${envDetails}`;
const url = `mailto:${SUPPORT_EMAIL}?subject=${encodeURIComponent('mobile app feedback')}&body=${encodeURIComponent(body)}`;
try {
await Linking.openURL(url);
} catch {
toast.error(`No email app available. You can reach us at ${SUPPORT_EMAIL}`);
}
}

async function rateApp() {
// The native review popup silently no-ops when the OS rate limit is hit, so
// only use it the first time; afterwards deep-link to the store review page.
try {
const alreadyRequested = await SecureStore.getItemAsync(REVIEW_REQUESTED_AT_KEY);
if (alreadyRequested == null && (await StoreReview.isAvailableAsync())) {
await SecureStore.setItemAsync(REVIEW_REQUESTED_AT_KEY, new Date().toISOString());
await StoreReview.requestReview();
return;
}
} catch {
// Native popup path failed — fall through to the store page.
}
try {
await Linking.openURL(STORE_REVIEW_URL);
} catch {
toast.error('Could not open the store.');
}
}

export function showFeedbackPrompt(userId: string | undefined) {
Alert.alert('How are you liking the Kilo app?', undefined, [
{ text: 'Cancel', style: 'cancel' },
{
text: 'I like it',
onPress: () => {
Alert.alert(
"We're glad to hear that!",
'A store review would help us out immensely. Thanks for using Kilo!',
[
{ text: 'Not now', style: 'cancel' },
{
text: 'Rate Kilo',
onPress: () => {
void rateApp();
},
},
]
);
},
},
{
text: 'Needs work',
onPress: () => {
Alert.alert(
"We're sorry to hear that!",
'Please let us know what needs to be better. The engineer in charge of the app reads every single report!',
[
{ text: 'Not now', style: 'cancel' },
{
text: 'Email us',
onPress: () => {
void openSupportEmail(userId);
},
},
]
);
},
},
]);
}
1 change: 1 addition & 0 deletions apps/mobile/src/lib/storage-keys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ export const LAST_ACTIVE_INSTANCE_KEY = 'last-active-chat-instance';
export const CONSENT_USER_KEY_PREFIX = 'consent-accepted-';
export const AGENT_MODEL_PREFERENCE_KEY = 'agent-model-preference';
export const REASONING_DEFAULT_EXPANDED_KEY = 'agent-reasoning-default-expanded';
export const REVIEW_REQUESTED_AT_KEY = 'store-review-requested-at';
14 changes: 14 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.