Skip to content

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

enable multi-language and scope bundled fonts to CJK only

Denis Lupookov307b9f110b54
diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml
new file mode 100644
index 0000000..346cee6
--- /dev/null
+++ b/.github/workflows/codeql.yml
@@ -0,0 +1,36 @@
+name: CodeQL
+
+on:
+ push:
+ branches: [main]
+ pull_request:
+ branches: [main]
+ schedule:
+ - cron: "0 6 * * 1"
+
+jobs:
+ analyze:
+ name: Analyze (${{ matrix.language }})
+ runs-on: ubuntu-latest
+ permissions:
+ actions: read
+ contents: read
+ security-events: write
+ strategy:
+ fail-fast: false
+ matrix:
+ language: [actions, javascript-typescript]
+
+ steps:
+ - uses: actions/checkout@v4
+
+ - name: Initialize CodeQL
+ uses: github/codeql-action/init@v4
+ with:
+ languages: ${{ matrix.language }}
+ build-mode: none
+
+ - name: Perform CodeQL Analysis
+ uses: github/codeql-action/analyze@v4
+ with:
+ category: "/language:${{ matrix.language }}"
diff --git a/apps/desktop/scripts/afterPack.cjs b/apps/desktop/scripts/afterPack.cjs
index c3053e2..18d7f13 100644
--- a/apps/desktop/scripts/afterPack.cjs
+++ b/apps/desktop/scripts/afterPack.cjs
@@ -18,7 +18,6 @@
const fs = require('fs')
const fsp = require('fs/promises')
const path = require('path')
-const releaseConfig = require('../../../packages/locales/src/release.json')
const ARCH_NAMES = {
0: 'ia32',
@@ -45,14 +44,11 @@ async function copyMacLocalizations(context) {
const appName = context.packager.appInfo.productFilename
const resourcesDir = path.join(context.appOutDir, `${appName}.app`, 'Contents', 'Resources')
- const entries = await safeReadDir(sourceDir)
-
- const localeEntries = releaseConfig.isMultiLangEnabled
- ? entries
- : entries.filter((entry) => entry.name === 'en.lproj')
+ const localeEntries = (await safeReadDir(sourceDir)).filter(
+ (entry) => entry.isDirectory() && entry.name.endsWith('.lproj')
+ )
for (const entry of localeEntries) {
- if (!entry.isDirectory() || !entry.name.endsWith('.lproj')) continue
const targetDir = path.join(resourcesDir, entry.name)
await fsp.mkdir(targetDir, { recursive: true })
await fsp.copyFile(
diff --git a/apps/desktop/src/renderer/main.tsx b/apps/desktop/src/renderer/main.tsx
index ceb726b..51fbbe6 100644
--- a/apps/desktop/src/renderer/main.tsx
+++ b/apps/desktop/src/renderer/main.tsx
@@ -5,7 +5,7 @@ import {
getLocaleFontFamily,
initI18n,
isSupportedLocaleCode,
- resolveActiveLocalePreference,
+ resolveLocalePreference,
useTranslation
} from '@altersend/locales'
import {
@@ -73,7 +73,7 @@ if (hasBridge()) {
async function bootstrap() {
try {
await initI18n(
- resolveActiveLocalePreference(getSavedLocalePreference(), getDesktopSystemLocales())
+ resolveLocalePreference(getSavedLocalePreference(), getDesktopSystemLocales())
)
} catch (error) {
captureException(error)
diff --git a/apps/desktop/src/renderer/pages/TransferPage/FooterBar.tsx b/apps/desktop/src/renderer/pages/TransferPage/FooterBar.tsx
index b440b32..5944c16 100644
--- a/apps/desktop/src/renderer/pages/TransferPage/FooterBar.tsx
+++ b/apps/desktop/src/renderer/pages/TransferPage/FooterBar.tsx
@@ -11,9 +11,8 @@ import {
LOCALE_OPTIONS,
changeI18nLanguage,
getLocaleFontFamily,
- isMultiLangEnabled,
normalizeLocalePreference,
- resolveActiveLocalePreference,
+ resolveLocalePreference,
Trans,
useTranslation,
type LocaleOption,
@@ -85,7 +84,7 @@ export function FooterBar({ version }: { version: string }) {
const preference = normalizeLocalePreference(value)
setLocalePreference(preference)
setSavedLocalePreference(preference)
- void changeI18nLanguage(resolveActiveLocalePreference(preference, getDesktopSystemLocales()))
+ void changeI18nLanguage(resolveLocalePreference(preference, getDesktopSystemLocales()))
}
const closePanel = () => {
@@ -180,25 +179,23 @@ export function FooterBar({ version }: { version: string }) {
label={t('settings:crashReports.label')}
description={t('settings:crashReports.description')}
/>
- {isMultiLangEnabled && (
- <div className='mt-3'>
- <label className='mb-2 block text-[13px] font-medium text-text-secondary'>
- {t('common:labels.language')}
- </label>
- <Select
- aria-label={t('common:labels.language')}
- value={localePreference}
- onChange={handleLocaleChange}
- options={LOCALE_OPTIONS.map((option) => ({
- value: option.preference,
- label: option.nativeName
- ? `${option.nativeName} · ${option.label}`
- : t('common:labels.systemDefault'),
- fontFamily: getLocaleOptionFontFamily(option)
- }))}
- />
- </div>
- )}
+ <div className='mt-3'>
+ <label className='mb-2 block text-[13px] font-medium text-text-secondary'>
+ {t('common:labels.language')}
+ </label>
+ <Select
+ aria-label={t('common:labels.language')}
+ value={localePreference}
+ onChange={handleLocaleChange}
+ options={LOCALE_OPTIONS.map((option) => ({
+ value: option.preference,
+ label: option.nativeName
+ ? `${option.nativeName} · ${option.label}`
+ : t('common:labels.systemDefault'),
+ fontFamily: getLocaleOptionFontFamily(option)
+ }))}
+ />
+ </div>
</div>
<div className='border-t border-border-primary py-1'>
{MENU_ITEMS.map(({ icon: Icon, key, ...rest }) => (
diff --git a/apps/mobile/app.config.cjs b/apps/mobile/app.config.cjs
index aa763c5..d3b7c1e 100644
--- a/apps/mobile/app.config.cjs
+++ b/apps/mobile/app.config.cjs
@@ -1,43 +1,8 @@
const appJson = require('./app.json')
-const releaseConfig = require('../../packages/locales/src/release.json')
-const DEFAULT_LOCALE = 'en-US'
+const clone = (value) => JSON.parse(JSON.stringify(value))
-function clone(value) {
- return JSON.parse(JSON.stringify(value))
-}
-
-function getEnabledLocaleCodes(locales) {
- return releaseConfig.isMultiLangEnabled ? Object.keys(locales) : [DEFAULT_LOCALE]
-}
-
-function filterLocales(locales, enabledCodes) {
- return Object.fromEntries(enabledCodes.map((code) => [code, locales[code]]).filter(([, path]) => path))
-}
-
-function gateLocalizationPlugin(plugin, enabledCodes) {
- if (!Array.isArray(plugin) || plugin[0] !== 'expo-localization') return plugin
-
- const options = clone(plugin[1] ?? {})
- options.supportedLocales = {
- ios: enabledCodes,
- android: enabledCodes
- }
-
- return [plugin[0], options]
-}
-
-module.exports = ({ config }) => {
- const expo = clone(appJson.expo)
- const enabledLocaleCodes = getEnabledLocaleCodes(expo.locales ?? {})
-
- expo.locales = filterLocales(expo.locales ?? {}, enabledLocaleCodes)
- expo.plugins = (expo.plugins ?? []).map((plugin) =>
- gateLocalizationPlugin(plugin, enabledLocaleCodes)
- )
-
- return {
- ...config,
- ...expo
- }
-}
+module.exports = ({ config }) => ({
+ ...config,
+ ...clone(appJson.expo)
+})
diff --git a/apps/mobile/app/_layout.tsx b/apps/mobile/app/_layout.tsx
index b94b5f0..e1b2d41 100644
--- a/apps/mobile/app/_layout.tsx
+++ b/apps/mobile/app/_layout.tsx
@@ -16,7 +16,7 @@ import {
getLocaleFontFamily,
initI18n,
isSupportedLocaleCode,
- resolveActiveLocalePreference,
+ resolveLocalePreference,
useTranslation
} from '@altersend/locales'
import { Stack } from 'expo-router'
@@ -149,7 +149,7 @@ export default function RootLayout() {
async function initializeLocale() {
try {
const preference = await getSavedLocalePreference()
- await initI18n(resolveActiveLocalePreference(preference, getMobileSystemLocales()))
+ await initI18n(resolveLocalePreference(preference, getMobileSystemLocales()))
} catch (error) {
captureException(error)
console.warn('Failed to initialize locale:', error)
diff --git a/apps/mobile/app/language.tsx b/apps/mobile/app/language.tsx
index b62ecb1..f244b41 100644
--- a/apps/mobile/app/language.tsx
+++ b/apps/mobile/app/language.tsx
@@ -2,9 +2,8 @@ import {
LOCALE_OPTIONS,
changeI18nLanguage,
getLocaleFontFamily,
- isMultiLangEnabled,
normalizeLocalePreference,
- resolveActiveLocalePreference,
+ resolveLocalePreference,
useTranslation,
type LocaleOption,
type LocalePreference,
@@ -31,11 +30,6 @@ export default function LanguageScreen() {
const [preference, setPreference] = useState<LocalePreference>(getLocalePreferenceSnapshot)
useEffect(() => {
- if (!isMultiLangEnabled) {
- router.back()
- return
- }
-
let mounted = true
void getSavedLocalePreference().then((saved) => {
if (mounted) setPreference(saved)
@@ -43,13 +37,11 @@ export default function LanguageScreen() {
return () => {
mounted = false
}
- }, [router])
-
- if (!isMultiLangEnabled) return null
+ }, [])
const handleSelect = async (value: string) => {
const next = normalizeLocalePreference(value)
- const resolvedLocale = resolveActiveLocalePreference(next, getMobileSystemLocales())
+ const resolvedLocale = resolveLocalePreference(next, getMobileSystemLocales())
setPreference(next)
await setSavedLocalePreference(next)
router.back()
diff --git a/apps/mobile/app/settings.tsx b/apps/mobile/app/settings.tsx
index 49a19ff..2e0a84a 100644
--- a/apps/mobile/app/settings.tsx
+++ b/apps/mobile/app/settings.tsx
@@ -4,7 +4,6 @@ import { useCallback, useEffect, useState } from 'react'
import { useFocusEffect, useRouter } from 'expo-router'
import {
LOCALE_OPTIONS,
- isMultiLangEnabled,
useTranslation,
type LocalePreference
} from '@altersend/locales'
@@ -127,22 +126,20 @@ export default function SettingsScreen() {
return (
<Layout title={t('settings:title')} description='' hasNativeHeader>
<View style={styles.content}>
- {isMultiLangEnabled && (
- <View style={styles.section}>
- <View style={[styles.card, cardStyle]}>
- <LinkRow
- label={t('common:labels.language')}
- hint={
- LOCALE_OPTIONS.find((option) => option.preference === localePreference)
- ?.nativeName ?? t('common:labels.systemDefault')
- }
- icon={<GlobeIcon size={16} color={theme.colors.colorTextSecondary} />}
- onPress={() => router.push('/language')}
- isLast
- />
- </View>
+ <View style={styles.section}>
+ <View style={[styles.card, cardStyle]}>
+ <LinkRow
+ label={t('common:labels.language')}
+ hint={
+ LOCALE_OPTIONS.find((option) => option.preference === localePreference)
+ ?.nativeName ?? t('common:labels.systemDefault')
+ }
+ icon={<GlobeIcon size={16} color={theme.colors.colorTextSecondary} />}
+ onPress={() => router.push('/language')}
+ isLast
+ />
</View>
- )}
+ </View>
<View style={styles.section}>
<Text style={[styles.sectionTitle, { color: theme.colors.colorTextMuted }]}>
diff --git a/packages/components/src/components/FeedbackTypeSelector/FeedbackTypeSelector.test.ts b/packages/components/src/components/FeedbackTypeSelector/FeedbackTypeSelector.test.ts
index 52cf7f8..6585330 100644
--- a/packages/components/src/components/FeedbackTypeSelector/FeedbackTypeSelector.test.ts
+++ b/packages/components/src/components/FeedbackTypeSelector/FeedbackTypeSelector.test.ts
@@ -13,12 +13,11 @@ function getStyleBlock(name: string, followingName: string): string {
}
describe('FeedbackTypeSelector layout', () => {
- it('keeps long translated labels inside fixed-height segments', () => {
+ it('keeps long translated labels inside single-line segments', () => {
const chipStyle = getStyleBlock('chip', 'chipDefault')
const labelStyle = getStyleBlock('label', 'labelDefault')
expect(chipStyle).toContain('minWidth: 0')
- expect(chipStyle).toContain('minHeight:')
expect(labelStyle).toContain("overflow: 'hidden'")
expect(labelStyle).toContain("textOverflow: 'ellipsis'")
expect(labelStyle).toContain("whiteSpace: 'nowrap'")
diff --git a/packages/components/src/components/FeedbackTypeSelector/FeedbackTypeSelector.tsx b/packages/components/src/components/FeedbackTypeSelector/FeedbackTypeSelector.tsx
index c22769b..1b2c460 100644
--- a/packages/components/src/components/FeedbackTypeSelector/FeedbackTypeSelector.tsx
+++ b/packages/components/src/components/FeedbackTypeSelector/FeedbackTypeSelector.tsx
@@ -25,11 +25,10 @@ const styles = css.create({
display: 'flex',
flex: 1,
minWidth: 0,
- minHeight: 40,
borderRadius: tokens.radiusSm,
borderWidth: 0,
- paddingTop: 8,
- paddingBottom: 8,
+ paddingTop: 10,
+ paddingBottom: 10,
paddingLeft: 8,
paddingRight: 8,
alignItems: 'center',
diff --git a/packages/components/src/components/Input/Input.android.tsx b/packages/components/src/components/Input/Input.android.tsx
deleted file mode 100644
index 95cd4be..0000000
--- a/packages/components/src/components/Input/Input.android.tsx
+++ /dev/null
@@ -1,215 +0,0 @@
-import { useId, useState, type ReactNode } from 'react'
-import { StyleSheet, Text, TextInput, View, type TextInputProps } from 'react-native'
-import { LockIcon } from '../../icons'
-import { rawTokens, useTheme } from '../../theme'
-
-type InputChangeEvent = {
- target: { value: string }
- type: 'change'
-}
-
-export interface InputProps extends Omit<
- TextInputProps,
- 'editable' | 'onChange' | 'onChangeText' | 'secureTextEntry' | 'style'
-> {
- description?: string
- disabled?: boolean
- error?: string
- icon?: ReactNode
- label?: string
- mono?: boolean
- onChange?: (event: InputChangeEvent) => void
- onChangeText?: (text: string) => void
- readOnly?: boolean
- secure?: boolean
- trailing?: ReactNode
- type?: string
-}
-
-export function Input({
- description,
- disabled = false,
- error,
- icon,
- id,
- label,
- mono = false,
- onBlur,
- onChange,
- onChangeText,
- onFocus,
- readOnly = false,
- secure = false,
- trailing,
- type,
- ...props
-}: InputProps) {
- const generatedId = useId()
- const inputId = id ?? generatedId
- const { fontFamilyName, theme } = useTheme()
- const [isFocused, setIsFocused] = useState(false)
- const hasError = Boolean(error)
- const resolvedIcon = secure ? <LockIcon size={13} /> : icon
- const useWrapper = Boolean(resolvedIcon || trailing)
- const textColor = disabled ? theme.colors.colorTextMuted : theme.colors.colorTextPrimary
- const borderColor = hasError
- ? theme.colors.colorDanger
- : isFocused
- ? theme.colors.colorFocusRing
- : theme.colors.colorBorderPrimary
- const fontFamilyStyle = fontFamilyName ? { fontFamily: fontFamilyName } : null
-
- const handleChangeText = (text: string) => {
- onChangeText?.(text)
- onChange?.({ target: { value: text }, type: 'change' })
- }
-
- const handleFocus: NonNullable<TextInputProps['onFocus']> = (event) => {
- setIsFocused(true)
- onFocus?.(event)
- }
-
- const handleBlur: NonNullable<TextInputProps['onBlur']> = (event) => {
- setIsFocused(false)
- onBlur?.(event)
- }
-
- const input = (
- <TextInput
- {...props}
- accessibilityLabel={label}
- accessibilityState={{ disabled }}
- editable={!disabled && !readOnly}
- id={inputId}
- key={fontFamilyName ?? 'system'}
- onBlur={handleBlur}
- onChangeText={handleChangeText}
- onFocus={handleFocus}
- placeholderTextColor={theme.colors.colorTextMuted}
- secureTextEntry={type === 'password'}
- style={[
- styles.input,
- {
- color: textColor
- },
- fontFamilyStyle,
- mono && styles.inputMono,
- !useWrapper && styles.fieldInput
- ]}
- underlineColorAndroid='transparent'
- />
- )
-
- return (
- <View style={styles.root}>
- {label ? (
- <Text style={[styles.label, { color: theme.colors.colorTextMuted }, fontFamilyStyle]}>
- {label}
- </Text>
- ) : null}
-
- {useWrapper ? (
- <View
- style={[
- styles.iconWrapper,
- {
- backgroundColor: theme.colors.colorBackgroundSubtle,
- borderColor
- }
- ]}
- >
- {resolvedIcon ? <View style={styles.iconSlot}>{resolvedIcon}</View> : null}
- {input}
- {trailing ? (
- <View style={[styles.trailingSlot, { borderColor: theme.colors.colorBorderPrimary }]}>
- {trailing}
- </View>
- ) : null}
- </View>
- ) : (
- <View
- style={[
- styles.field,
- {
- backgroundColor: theme.colors.colorBackgroundSubtle,
- borderColor
- }
- ]}
- >
- {input}
- </View>
- )}
-
- {error || description ? (
- <Text
- style={[
- styles.hint,
- {
- color: error ? theme.colors.colorDanger : theme.colors.colorTextMuted
- },
- fontFamilyStyle
- ]}
- >
- {error ?? description}
- </Text>
- ) : null}
- </View>
- )
-}
-
-const styles = StyleSheet.create({
- root: {
- gap: rawTokens.space.space2,
- width: '100%'
- },
- label: {
- fontSize: rawTokens.fontSize.fontSizeXs,
- fontWeight: '600',
- letterSpacing: 1.3,
- lineHeight: 16,
- textTransform: 'uppercase'
- },
- field: {
- borderRadius: rawTokens.radius.radiusSm,
- borderWidth: 1,
- minHeight: 48
- },
- fieldInput: {
- paddingHorizontal: rawTokens.space.space4
- },
- iconWrapper: {
- alignItems: 'center',
- borderRadius: rawTokens.radius.radiusSm,
- borderWidth: 1,
- flexDirection: 'row',
- gap: rawTokens.space.space25,
- minHeight: 48,
- paddingLeft: rawTokens.space.space35
- },
- iconSlot: {
- alignItems: 'center',
- justifyContent: 'center'
- },
- input: {
- flex: 1,
- fontSize: rawTokens.fontSize.fontSizeLg,
- minWidth: 0,
- paddingHorizontal: 0,
- paddingVertical: 0,
- textAlignVertical: 'center'
- },
- inputMono: {
- fontSize: rawTokens.fontSize.fontSizeBase
- },
- trailingSlot: {
- alignItems: 'center',
- alignSelf: 'stretch',
- borderLeftWidth: 1,
- justifyContent: 'center',
- width: 48
- },
- hint: {
- fontSize: rawTokens.fontSize.fontSizeMd,
- lineHeight: 18
- }
-})
diff --git a/packages/components/src/components/Input/index.ts b/packages/components/src/components/Input/index.ts
index 3d46975..266c21c 100644
--- a/packages/components/src/components/Input/index.ts
+++ b/packages/components/src/components/Input/index.ts
@@ -1,2 +1 @@
-// Platform-specific export - Metro/Expo will automatically use Input.android.tsx on Android.
export { Input, type InputProps } from './Input'
diff --git a/packages/components/src/components/Tabs/Tabs.tsx b/packages/components/src/components/Tabs/Tabs.tsx
index f85c4f3..305e6c6 100644
--- a/packages/components/src/components/Tabs/Tabs.tsx
+++ b/packages/components/src/components/Tabs/Tabs.tsx
@@ -257,7 +257,7 @@ export function TabsTrigger({ children, onClick, value, ...props }: TabsTriggerP
tabIndex={isActive ? 0 : -1}
type='button'
>
- {children}
+ <html.span style={styles.triggerLabel}>{children}</html.span>
</html.button>
)
}
diff --git a/packages/components/src/components/Tabs/styles.ts b/packages/components/src/components/Tabs/styles.ts
index 3a657eb..e5e179d 100644
--- a/packages/components/src/components/Tabs/styles.ts
+++ b/packages/components/src/components/Tabs/styles.ts
@@ -40,7 +40,6 @@ export const styles = css.create({
color: tokens.colorTextSecondary,
fontFamily: tokens.fontFamilySans,
fontSize: tokens.fontSizeBase,
- fontWeight: tokens.fontWeightSemibold,
cursor: 'pointer',
transitionDuration: '160ms',
transitionProperty: 'color, border-color, background-color, box-shadow',
@@ -59,6 +58,10 @@ export const styles = css.create({
boxShadow: `0 1px 2px ${tokens.colorShadow}`,
color: tokens.colorTextPrimary
},
+ triggerLabel: {
+ fontWeight: tokens.fontWeightBold,
+ fontSize: tokens.fontSizeMd
+ },
content: {
display: 'flex',
flex: 1,
diff --git a/packages/components/src/theme/fontThemes.css.native.ts b/packages/components/src/theme/fontThemes.css.native.ts
index d4d3f63..dc527fe 100644
--- a/packages/components/src/theme/fontThemes.css.native.ts
+++ b/packages/components/src/theme/fontThemes.css.native.ts
@@ -1,16 +1,10 @@
import { css } from 'react-strict-dom'
-import { Platform } from 'react-native'
import { tokens } from './tokens.css'
import type { FontFamilyKey } from './fonts'
type FontThemeStyle = ReturnType<typeof css.createTheme>
-const nativeSystemFontFamily =
- Platform.select({
- ios: 'System',
- android: 'sans-serif',
- default: 'sans-serif'
- }) ?? 'sans-serif'
+const nativeSystemFontFamily = 'System'
const latinFontThemeStyle = css.createTheme(tokens, {
fontFamilySans: nativeSystemFontFamily,
diff --git a/packages/components/src/theme/tokens.css.native.ts b/packages/components/src/theme/tokens.css.native.ts
index d45193d..41fdba1 100644
--- a/packages/components/src/theme/tokens.css.native.ts
+++ b/packages/components/src/theme/tokens.css.native.ts
@@ -18,13 +18,13 @@ export const nativeFontFamilies = {
"fontFamilyMono": "Menlo"
},
"android": {
- "fontFamilySans": "sans-serif",
- "fontFamilyDisplay": "sans-serif",
+ "fontFamilySans": "System",
+ "fontFamilyDisplay": "System",
"fontFamilyMono": "monospace"
},
"default": {
- "fontFamilySans": "sans-serif",
- "fontFamilyDisplay": "sans-serif",
+ "fontFamilySans": "System",
+ "fontFamilyDisplay": "System",
"fontFamilyMono": "monospace"
}
} as Record<
diff --git a/packages/components/src/theme/tokens.json b/packages/components/src/theme/tokens.json
index ea5f840..d1095fc 100644
--- a/packages/components/src/theme/tokens.json
+++ b/packages/components/src/theme/tokens.json
@@ -126,13 +126,13 @@
"fontFamilyMono": "Menlo"
},
"android": {
- "fontFamilySans": "sans-serif",
- "fontFamilyDisplay": "sans-serif",
+ "fontFamilySans": "System",
+ "fontFamilyDisplay": "System",
"fontFamilyMono": "monospace"
},
"default": {
- "fontFamilySans": "sans-serif",
- "fontFamilyDisplay": "sans-serif",
+ "fontFamilySans": "System",
+ "fontFamilyDisplay": "System",
"fontFamilyMono": "monospace"
}
}
diff --git a/packages/core/src/worklet/transfer/receiver.ts b/packages/core/src/worklet/transfer/receiver.ts
index f5af6fe..dcc9214 100644
--- a/packages/core/src/worklet/transfer/receiver.ts
+++ b/packages/core/src/worklet/transfer/receiver.ts
@@ -39,8 +39,6 @@ function getChunkSize(chunk: unknown): number {
*
* It has no knowledge of Hyperswarm, peer sessions, or file staging.
*/
-const MAX_FILE_SIZE_BYTES = 50 * 1024 * 1024 * 1024 // 50 GB
-
export class TransferReceiver {
private readonly driveStore: Corestore
private readonly remoteDrives: Map<string, Hyperdrive>
@@ -158,13 +156,6 @@ export class TransferReceiver {
return fail(`Sender claimed ${file.size} bytes but file is ${actualBytes} bytes`, file.size)
}
- if (actualBytes > MAX_FILE_SIZE_BYTES) {
- return fail(
- `File "${resolvedName}" is ${actualBytes} bytes, exceeds maximum of ${MAX_FILE_SIZE_BYTES} bytes`,
- actualBytes
- )
- }
-
const totalBytes = actualBytes
callbacks.onFileStart({
transferId: file.transferId,
diff --git a/packages/locales/src/locale.test.ts b/packages/locales/src/locale.test.ts
index 7668c1b..c089e03 100644
--- a/packages/locales/src/locale.test.ts
+++ b/packages/locales/src/locale.test.ts
@@ -5,9 +5,7 @@ import {
SUPPORTED_LOCALES,
getLocaleByCode,
getLocaleFontFamily,
- isMultiLangEnabled,
isLocalePreference,
- resolveActiveLocalePreference,
resolveLocalePreference
} from './locale'
@@ -89,13 +87,9 @@ describe('resolveLocalePreference', () => {
})
})
-describe('release-gated locale activation', () => {
- it('keeps multi-language UI disabled until release', () => {
- expect(isMultiLangEnabled).toBe(false)
- })
-
- it('forces en-US while multi-language support is release-gated', () => {
- expect(resolveActiveLocalePreference('ja-JP', ['ja-JP'])).toBe(DEFAULT_LOCALE)
- expect(resolveActiveLocalePreference('system', ['ko-KR'])).toBe(DEFAULT_LOCALE)
+describe('active locale activation', () => {
+ it('resolves the requested locale preference', () => {
+ expect(resolveLocalePreference('ja-JP', ['ja-JP'])).toBe('ja-JP')
+ expect(resolveLocalePreference('system', ['ko-KR'])).toBe('ko-KR')
})
})
diff --git a/packages/locales/src/locale.ts b/packages/locales/src/locale.ts
index e4f9774..27e34cc 100644
--- a/packages/locales/src/locale.ts
+++ b/packages/locales/src/locale.ts
@@ -1,8 +1,5 @@
-import releaseConfig from './release.json'
-
export const DEFAULT_LOCALE = 'en-US'
export const SYSTEM_LOCALE_PREFERENCE = 'system'
-export const isMultiLangEnabled: boolean = releaseConfig.isMultiLangEnabled
export type TextDirection = 'ltr' | 'rtl'
export type LocaleFontFamily =
@@ -212,11 +209,3 @@ export function resolveLocalePreference(
return DEFAULT_LOCALE
}
-
-export function resolveActiveLocalePreference(
- preference: string | null | undefined,
- systemLocales: readonly string[]
-): SupportedLocaleCode {
- if (!isMultiLangEnabled) return DEFAULT_LOCALE
- return resolveLocalePreference(preference, systemLocales)
-}
diff --git a/packages/locales/src/native-metadata.test.ts b/packages/locales/src/native-metadata.test.ts
index 6379d3e..ea9d0a7 100644
--- a/packages/locales/src/native-metadata.test.ts
+++ b/packages/locales/src/native-metadata.test.ts
@@ -3,7 +3,7 @@ import { existsSync, mkdtempSync, readFileSync, rmSync } from 'node:fs'
import { tmpdir } from 'node:os'
import { join } from 'node:path'
import { describe, expect, it } from 'vitest'
-import { DEFAULT_LOCALE, isMultiLangEnabled, RESOURCES, SUPPORTED_LOCALES } from './index'
+import { RESOURCES, SUPPORTED_LOCALES } from './index'
const repoRoot = new URL('../../..', import.meta.url)
const require = createRequire(import.meta.url)
@@ -74,7 +74,7 @@ describe('native metadata localization', () => {
}
})
- it('keeps generated Expo native locale metadata English-only while release-gated', () => {
+ it('generates Expo native locale metadata for every supported locale', () => {
const createExpoConfig = require('../../../apps/mobile/app.config.cjs') as (args: {
config: Record<string, unknown>
}) => Record<string, unknown> | { expo: Record<string, unknown> }
@@ -85,28 +85,12 @@ describe('native metadata localization', () => {
? (generatedConfig.expo as Record<string, unknown>)
: (generatedConfig as Record<string, unknown>)
- if (isMultiLangEnabled) {
- expect(Object.keys((generated.locales as Record<string, string>) ?? {}).sort()).toEqual(
- SUPPORTED_LOCALES.map((locale) => locale.code).sort()
- )
- return
- }
-
- expect(Object.keys((generated.locales as Record<string, string>) ?? {})).toEqual([
- DEFAULT_LOCALE
- ])
-
- const plugins = generated.plugins as unknown[]
- const localizationPlugin = plugins.find(
- (plugin): plugin is [string, { supportedLocales: { ios: string[]; android: string[] } }] =>
- Array.isArray(plugin) && plugin[0] === 'expo-localization'
+ expect(Object.keys((generated.locales as Record<string, string>) ?? {}).sort()).toEqual(
+ SUPPORTED_LOCALES.map((locale) => locale.code).sort()
)
-
- expect(localizationPlugin?.[1].supportedLocales.ios).toEqual([DEFAULT_LOCALE])
- expect(localizationPlugin?.[1].supportedLocales.android).toEqual([DEFAULT_LOCALE])
})
- it('does not copy non-English macOS native localizations while release-gated', async () => {
+ it('copies macOS native localizations for every supported locale', async () => {
const afterPack = require('../../../apps/desktop/scripts/afterPack.cjs') as {
default: (context: unknown) => Promise<void>
}
@@ -126,11 +110,8 @@ describe('native metadata localization', () => {
const resourcesDir = join(tmp, 'AlterSend.app', 'Contents', 'Resources')
expect(existsSync(join(resourcesDir, 'en.lproj', 'InfoPlist.strings'))).toBe(true)
-
- if (!isMultiLangEnabled) {
- expect(existsSync(join(resourcesDir, 'ja.lproj', 'InfoPlist.strings'))).toBe(false)
- expect(existsSync(join(resourcesDir, 'ko.lproj', 'InfoPlist.strings'))).toBe(false)
- }
+ expect(existsSync(join(resourcesDir, 'ja.lproj', 'InfoPlist.strings'))).toBe(true)
+ expect(existsSync(join(resourcesDir, 'ko.lproj', 'InfoPlist.strings'))).toBe(true)
} finally {
rmSync(tmp, { recursive: true, force: true })
}
diff --git a/packages/locales/src/release-gate-source.test.ts b/packages/locales/src/release-gate-source.test.ts
deleted file mode 100644
index 708e142..0000000
--- a/packages/locales/src/release-gate-source.test.ts
+++ /dev/null
@@ -1,75 +0,0 @@
-import { readFileSync } from 'node:fs'
-import { join } from 'node:path'
-import { describe, expect, it } from 'vitest'
-
-const repoRoot = new URL('../../..', import.meta.url)
-const desktopRoot = new URL('apps/desktop', repoRoot)
-const mobileRoot = new URL('apps/mobile', repoRoot)
-
-function readDesktop(path: string): string {
- return readFileSync(join(desktopRoot.pathname, path), 'utf8')
-}
-
-function readMobile(path: string): string {
- return readFileSync(join(mobileRoot.pathname, path), 'utf8')
-}
-
-function readMobilePackageJson() {
- return JSON.parse(readMobile('package.json')) as {
- scripts: Record<string, string>
- }
-}
-
-describe('release-gated language UI wiring', () => {
- it('forces desktop locale initialization through the active locale resolver', () => {
- const source = readDesktop('src/renderer/main.tsx')
-
- expect(source).toContain('resolveActiveLocalePreference')
- expect(source).not.toContain('initI18n(resolveLocalePreference(')
- })
-
- it('hides the desktop language selector behind the multi-language flag', () => {
- const source = readDesktop('src/renderer/pages/TransferPage/FooterBar.tsx')
-
- expect(source).toContain('isMultiLangEnabled')
- expect(source).toMatch(/\{isMultiLangEnabled && \(/)
- })
-
- it('forces mobile locale initialization through the active locale resolver', () => {
- const source = readMobile('app/_layout.tsx')
-
- expect(source).toContain('resolveActiveLocalePreference')
- expect(source).not.toContain('initI18n(resolveLocalePreference(')
- })
-
- it('hides and guards the mobile language picker behind the multi-language flag', () => {
- const settingsSource = readMobile('app/settings.tsx')
- const languageSource = readMobile('app/language.tsx')
-
- expect(settingsSource).toContain('isMultiLangEnabled')
- expect(settingsSource).toMatch(/\{isMultiLangEnabled && \(/)
- expect(languageSource).toContain('isMultiLangEnabled')
- expect(languageSource).toMatch(/if \(!isMultiLangEnabled\)/)
- })
-
- it('builds shared packages before direct mobile dev commands can start Metro', () => {
- const { scripts } = readMobilePackageJson()
-
- expect(scripts['build:packages']).toBeDefined()
- expect(scripts['build:packages']).toContain('npm run build -w packages/locales')
- expect(scripts.prestart).toMatch(/build:packages.*bundle-bare/)
- expect(scripts.preandroid).toMatch(/build:packages.*bundle:android/)
- expect(scripts.preios).toMatch(/build:packages.*bundle:ios/)
- })
-
- it('routes mobile Metro workspace packages to source files', () => {
- const metroSource = readMobile('metro.config.js')
-
- expect(metroSource).toContain('workspaceSourceAliases')
- expect(metroSource).toContain("'@altersend/locales'")
- expect(metroSource).toContain('packages/locales/src/index.ts')
- expect(metroSource).toContain("'@altersend/components'")
- expect(metroSource).toContain('packages/components/src/index.ts')
- expect(metroSource).toContain('resolveRequest')
- })
-})
diff --git a/packages/locales/src/release.json b/packages/locales/src/release.json
deleted file mode 100644
index 2ec27b5..0000000
--- a/packages/locales/src/release.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "isMultiLangEnabled": false
-}