Skip to content

Send files directly between devices over the internet - no cloud storage, no size limits.

Show failure toasts in the error tone on mobile

Denis Lupookov966e3e0ad3fb
diff --git a/apps/desktop/src/renderer/pages/LoadingPage/index.tsx b/apps/desktop/src/renderer/pages/LoadingPage/index.tsx
index 8af7532..1edf7c3 100644
--- a/apps/desktop/src/renderer/pages/LoadingPage/index.tsx
+++ b/apps/desktop/src/renderer/pages/LoadingPage/index.tsx
@@ -42,7 +42,7 @@ export default function LoadingPage({ progress = 0 }: LoadingPageProps) {
<div className='flex shrink-0 flex-col items-center px-8 pb-[76px]'>
<div className='h-[10px] w-full max-w-[360px] overflow-hidden rounded-full bg-border-primary'>
<div
- className='h-full rounded-full bg-info transition-[width] duration-100 ease-out'
+ className='h-full rounded-full bg-accent transition-[width] duration-100 ease-out'
style={{ width: `${clamped}%` }}
/>
</div>
diff --git a/apps/mobile/app/receive/scan.tsx b/apps/mobile/app/receive/scan.tsx
index 0e5f91f..4242faf 100644
--- a/apps/mobile/app/receive/scan.tsx
+++ b/apps/mobile/app/receive/scan.tsx
@@ -67,6 +67,7 @@ export default function ReceiveScanScreen() {
toast.show({
title: t('receive:errors.unsupportedQrTitle'),
hint: invalidHint,
+ tone: 'error',
durationMs: 2500
})
}
@@ -85,6 +86,7 @@ export default function ReceiveScanScreen() {
toast.show({
title: t('receive:errors.mobileJoinFailedTitle'),
hint: t('receive:errors.mobileJoinFailedHint'),
+ tone: 'error',
durationMs: 3500
})
}
@@ -118,6 +120,7 @@ export default function ReceiveScanScreen() {
toast.show({
title: t('receive:errors.imageNoQrTitle'),
hint: t('receive:errors.imageNoQrHint'),
+ tone: 'error',
durationMs: 2500
})
return
@@ -125,7 +128,11 @@ export default function ReceiveScanScreen() {
await resolveCode(scan.data, t('receive:errors.imageUnsupportedQrHint'))
} catch (error) {
console.warn('ReceiveScanScreen: importFromImage failed', error)
- toast.show({ title: t('receive:errors.imageReadFailedTitle'), durationMs: 2500 })
+ toast.show({
+ title: t('receive:errors.imageReadFailedTitle'),
+ tone: 'error',
+ durationMs: 2500
+ })
}
}, [resolveCode, role, t, toast])
diff --git a/apps/mobile/src/components/PairingManualCodeSheet/index.tsx b/apps/mobile/src/components/PairingManualCodeSheet/index.tsx
index df51ef2..5646dc8 100644
--- a/apps/mobile/src/components/PairingManualCodeSheet/index.tsx
+++ b/apps/mobile/src/components/PairingManualCodeSheet/index.tsx
@@ -66,7 +66,8 @@ export function PairingManualCodeSheet({
console.warn('PairingManualCodeSheet: joinPairingSession failed', error)
toast.show({
title: t('settings:pairing.couldNotJoin'),
- hint: t('settings:pairing.couldNotJoinHint')
+ hint: t('settings:pairing.couldNotJoinHint'),
+ tone: 'error'
})
} finally {
setIsJoining(false)
diff --git a/apps/mobile/src/components/PairingScanSheet/index.tsx b/apps/mobile/src/components/PairingScanSheet/index.tsx
index 7fbc4e9..5e8b620 100644
--- a/apps/mobile/src/components/PairingScanSheet/index.tsx
+++ b/apps/mobile/src/components/PairingScanSheet/index.tsx
@@ -62,7 +62,8 @@ export function PairingScanSheet({
invalidScanAtRef.current = now
toast.show({
title: t('settings:pairing.unsupportedQr'),
- hint: t('settings:pairing.unsupportedQrHint')
+ hint: t('settings:pairing.unsupportedQrHint'),
+ tone: 'error'
})
}
return
@@ -79,7 +80,8 @@ export function PairingScanSheet({
setIsResolving(false)
toast.show({
title: t('settings:pairing.couldNotJoin'),
- hint: t('settings:pairing.couldNotJoinQrHint')
+ hint: t('settings:pairing.couldNotJoinQrHint'),
+ tone: 'error'
})
}
},
@@ -117,14 +119,15 @@ export function PairingScanSheet({
if (!scan) {
toast.show({
title: t('settings:pairing.noQrFound'),
- hint: t('settings:pairing.noQrFoundHint')
+ hint: t('settings:pairing.noQrFoundHint'),
+ tone: 'error'
})
return
}
await resolveCode(scan.data)
} catch (error) {
console.warn('PairingScanSheet: importFromImage failed', error)
- toast.show({ title: t('settings:pairing.couldNotReadImage') })
+ toast.show({ title: t('settings:pairing.couldNotReadImage'), tone: 'error' })
}
}, [resolveCode, role, toast, t])
diff --git a/apps/mobile/src/components/Toast/ToastProvider.tsx b/apps/mobile/src/components/Toast/ToastProvider.tsx
index b568f6c..05208d5 100644
--- a/apps/mobile/src/components/Toast/ToastProvider.tsx
+++ b/apps/mobile/src/components/Toast/ToastProvider.tsx
@@ -35,7 +35,11 @@ export function ToastProvider({ children }: { children: ReactNode }) {
const show = useCallback((input: ShowToastInput) => {
nextId.current += 1
setCurrent({ ...input, id: nextId.current })
- void Haptics.notificationAsync(Haptics.NotificationFeedbackType.Success).catch(() => {})
+ Haptics.notificationAsync(
+ input.tone === 'error'
+ ? Haptics.NotificationFeedbackType.Error
+ : Haptics.NotificationFeedbackType.Success
+ ).catch(() => {})
}, [])
const dismiss = useCallback((id: number) => {
diff --git a/apps/mobile/src/loading/LoadingScreen.tsx b/apps/mobile/src/loading/LoadingScreen.tsx
index d367bca..620555b 100644
--- a/apps/mobile/src/loading/LoadingScreen.tsx
+++ b/apps/mobile/src/loading/LoadingScreen.tsx
@@ -49,7 +49,7 @@ export function LoadingScreen({ progress = 0 }: LoadingScreenProps) {
<View
style={[
styles.progressFill,
- { backgroundColor: theme.colors.colorInfo, width: `${clamped}%` as `${number}%` }
+ { backgroundColor: theme.colors.colorAccent, width: `${clamped}%` as `${number}%` }
]}
/>
</View>
diff --git a/apps/mobile/src/pairing/useDeviceRemove.ts b/apps/mobile/src/pairing/useDeviceRemove.ts
index 7374f73..27f3468 100644
--- a/apps/mobile/src/pairing/useDeviceRemove.ts
+++ b/apps/mobile/src/pairing/useDeviceRemove.ts
@@ -35,12 +35,13 @@ export function useDeviceRemove(forget: ForgetFn) {
forget(peerKey)
.then((removed) =>
toast.show({
- title: t(removed ? 'settings:pairing.deviceRemoved' : 'settings:pairing.removeFailed')
+ title: t(removed ? 'settings:pairing.deviceRemoved' : 'settings:pairing.removeFailed'),
+ tone: removed ? 'success' : 'error'
})
)
.catch((error) => {
console.warn('useDeviceRemove: forgetPeer failed', error)
- toast.show({ title: t('settings:pairing.removeFailed') })
+ toast.show({ title: t('settings:pairing.removeFailed'), tone: 'error' })
})
}
diff --git a/apps/mobile/src/pairing/useDeviceRename.ts b/apps/mobile/src/pairing/useDeviceRename.ts
index bbf6595..3f34c45 100644
--- a/apps/mobile/src/pairing/useDeviceRename.ts
+++ b/apps/mobile/src/pairing/useDeviceRename.ts
@@ -29,7 +29,8 @@ export function useDeviceRename(rename: RenameFn) {
const renamed = await rename(target.peerKey, name)
toast.show({
- title: t(renamed ? 'settings:pairing.deviceRenamed' : 'settings:pairing.renameFailed')
+ title: t(renamed ? 'settings:pairing.deviceRenamed' : 'settings:pairing.renameFailed'),
+ tone: renamed ? 'success' : 'error'
})
return renamed
}
diff --git a/apps/mobile/src/pairing/usePairingFlow.ts b/apps/mobile/src/pairing/usePairingFlow.ts
index d864cb0..44cea7a 100644
--- a/apps/mobile/src/pairing/usePairingFlow.ts
+++ b/apps/mobile/src/pairing/usePairingFlow.ts
@@ -39,7 +39,7 @@ export function usePairingFlow() {
closePairingSheets()
toast.show({ title: t('settings:pairing.devicePaired') })
},
- onFailed: () => toast.show({ title: t('settings:pairing.pairFailed') })
+ onFailed: () => toast.show({ title: t('settings:pairing.pairFailed'), tone: 'error' })
})
useEffect(() => {
diff --git a/apps/mobile/src/transfer/send/views/ShareView.tsx b/apps/mobile/src/transfer/send/views/ShareView.tsx
index 7496d4c..8f4f419 100644
--- a/apps/mobile/src/transfer/send/views/ShareView.tsx
+++ b/apps/mobile/src/transfer/send/views/ShareView.tsx
@@ -53,9 +53,11 @@ export function ShareView() {
toast.show({
title: t('send:status.inviteFailedToast', { name: peer.name }),
hint: t('send:status.inviteFailedHint'),
+ tone: 'error',
durationMs: 3500
}),
- onPeerOutdated: () => toast.show({ title: t('send:status.peerOutdated'), durationMs: 4000 })
+ onPeerOutdated: () =>
+ toast.show({ title: t('send:status.peerOutdated'), tone: 'error', durationMs: 4000 })
})
const [isFilesSheetOpen, setIsFilesSheetOpen] = useState(false)
const [isQrOpen, setIsQrOpen] = useState(false)