diff --git a/package.json b/package.json
index 50b868d..af2ad94 100644
--- a/package.json
+++ b/package.json
@@ -43,6 +43,7 @@
"immer": "^10.0.3",
"lodash": "^4.17.21",
"memize": "^2.1.0",
+ "p-timeout": "^6.1.2",
"react": "18.2.0",
"react-i18next": "^14.0.0",
"react-native": "0.72.6",
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 0a11117..208778e 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -92,6 +92,9 @@ dependencies:
memize:
specifier: ^2.1.0
version: 2.1.0
+ p-timeout:
+ specifier: ^6.1.2
+ version: 6.1.2
react:
specifier: 18.2.0
version: 18.2.0
@@ -7474,6 +7477,11 @@ packages:
aggregate-error: 3.1.0
dev: false
+ /p-timeout@6.1.2:
+ resolution: {integrity: sha512-UbD77BuZ9Bc9aABo74gfXhNvzC9Tx7SxtHSh1fxvx3jTLLYvmVhiQZZrJzqqU0jKbN32kb5VOKiLEQI/3bIjgQ==}
+ engines: {node: '>=14.16'}
+ dev: false
+
/p-try@2.2.0:
resolution: {integrity: sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==}
engines: {node: '>=6'}
diff --git a/src/pages/Importer/ImportBinary.tsx b/src/pages/Importer/ImportBinary.tsx
index 4b31e59..27b6a85 100644
--- a/src/pages/Importer/ImportBinary.tsx
+++ b/src/pages/Importer/ImportBinary.tsx
@@ -15,7 +15,7 @@ const ImportStatusText = styled.Text`
export function ImportBinary(props: { wikiWorkspace: IWikiWorkspace }) {
const { t } = useTranslation();
- const { importBinary, importingBinary, importPercentage, importBinaryError, resetState: resetImportBinaryState, importSuccess: importBinarySuccess } = useImportBinary(
+ const { importBinary, importingBinary, importPercentage, importBinaryError, resetState, importSuccess, importWarning } = useImportBinary(
props.wikiWorkspace,
);
@@ -24,10 +24,10 @@ export function ImportBinary(props: { wikiWorkspace: IWikiWorkspace }) {
{t('AddWorkspace.ImportBinaryFilesDescription')}
{importingBinary && (
<>
@@ -38,16 +38,25 @@ export function ImportBinary(props: { wikiWorkspace: IWikiWorkspace }) {
)}
{importBinaryError !== undefined && (
<>
-
- {t('ErrorMessage')}{' '}
- {importBinaryError}
-
+
+ {t('ErrorMessage')}{' '}
+ {importBinaryError}
+
+ >
+ )}
+ {importWarning !== undefined && (
+ <>
+ {t('AddWorkspace.WarningMessageDescription')}
+
+ {t('WarningMessage')}{' '}
+ {importWarning}
+
>
)}
>
diff --git a/src/services/BackgroundSyncService/index.ts b/src/services/BackgroundSyncService/index.ts
index 8ef9f1d..e143852 100644
--- a/src/services/BackgroundSyncService/index.ts
+++ b/src/services/BackgroundSyncService/index.ts
@@ -5,6 +5,7 @@ import * as fs from 'expo-file-system';
import * as Haptics from 'expo-haptics';
import * as TaskManager from 'expo-task-manager';
import { sortedUniqBy, uniq } from 'lodash';
+import pTimeout from 'p-timeout';
import { Alert } from 'react-native';
import type { ITiddlerFieldsParam } from 'tiddlywiki';
import { getWikiTiddlerPathByTitle } from '../../constants/paths';
@@ -294,7 +295,8 @@ export class BackgroundSyncService {
return;
}
const getTiddlerUrl = new URL(`/tw-mobile-sync/get-tiddler-text/${encodeURIComponent(title)}`, onlineLastSyncServer.uri);
- await fs.downloadAsync(getTiddlerUrl.toString(), getWikiTiddlerPathByTitle(workspace, title));
+ const downloadPromise = fs.downloadAsync(getTiddlerUrl.toString(), getWikiTiddlerPathByTitle(workspace, title));
+ await pTimeout(downloadPromise, { milliseconds: 10_000, message: `${i18n.t('AddWorkspace.DownloadBinaryTimeout')}: ${title}` });
} catch (error) {
console.error(`Failed to load tiddler ${title} from server: ${(error as Error).message} ${(error as Error).stack ?? ''}`);
throw error;