diff --git a/android/app/src/main/java/com/robosats/WebAppInterface.kt b/android/app/src/main/java/com/robosats/WebAppInterface.kt index a30a820c..2e8d59a1 100644 --- a/android/app/src/main/java/com/robosats/WebAppInterface.kt +++ b/android/app/src/main/java/com/robosats/WebAppInterface.kt @@ -383,6 +383,29 @@ class WebAppInterface(private val context: MainActivity, private val webView: We resolvePromise(uuid, key) } + @JavascriptInterface + fun restart() { + try { + Log.d(TAG, "Restarting app...") + + val intent = context.packageManager.getLaunchIntentForPackage(context.packageName) + intent?.let { + it.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP) + it.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) + it.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK) + + context.startActivity(it) + context.finish() + } ?: run { + Log.e(TAG, "Could not get launch intent for app restart") + Toast.makeText(context, "Failed to restart app", Toast.LENGTH_SHORT).show() + } + } catch (e: Exception) { + Log.e(TAG, "Error restarting app", e) + Toast.makeText(context, "Failed to restart app", Toast.LENGTH_SHORT).show() + } + } + private fun onWsMessage(path: String?, message: String?) { val encodedMessage = encodeForJavaScript(message) safeEvaluateJavascript("javascript:window.AndroidRobosats.onWSMessage('$path', '$encodedMessage')") diff --git a/frontend/src/components/SettingsForm/index.tsx b/frontend/src/components/SettingsForm/index.tsx index afe36875..a49b33f6 100644 --- a/frontend/src/components/SettingsForm/index.tsx +++ b/frontend/src/components/SettingsForm/index.tsx @@ -28,6 +28,7 @@ import { NotificationsActive, } from '@mui/icons-material'; import { systemClient } from '../../services/System'; +import Tor from '../Icons/Tor'; interface SettingsFormProps { dense?: boolean; @@ -262,6 +263,31 @@ const SettingsForm = ({ dense = false }: SettingsFormProps): React.JSX.Element = )} + + {client == 'mobile' && ( + + + + + { + setSettings({ ...settings, useProxy }); + systemClient.setItem('settings_use_proxy', String(useProxy)); + systemClient.restart(); + }} + > + + {t('Orbot')} + + + {t('Build-in')} + + + + )} diff --git a/frontend/src/components/TradeBox/Prompts/LockInvoice.tsx b/frontend/src/components/TradeBox/Prompts/LockInvoice.tsx index 5ceba1bf..cac0fde4 100644 --- a/frontend/src/components/TradeBox/Prompts/LockInvoice.tsx +++ b/frontend/src/components/TradeBox/Prompts/LockInvoice.tsx @@ -85,31 +85,29 @@ export const LockInvoicePrompt = ({ )} - - - - - + + + diff --git a/frontend/src/services/Android/index.ts b/frontend/src/services/Android/index.ts index 9b3678cf..77eeef46 100644 --- a/frontend/src/services/Android/index.ts +++ b/frontend/src/services/Android/index.ts @@ -28,6 +28,7 @@ interface AndroidAppRobosats { headers: string, body: string, ) => void; + restart: () => void; } class AndroidRobosats { diff --git a/frontend/src/services/System/SystemAndroidClient/index.ts b/frontend/src/services/System/SystemAndroidClient/index.ts index 4a9204a9..3c47731e 100644 --- a/frontend/src/services/System/SystemAndroidClient/index.ts +++ b/frontend/src/services/System/SystemAndroidClient/index.ts @@ -39,6 +39,10 @@ class SystemAndroidClient implements SystemClient { const uuid: string = uuidv4(); window.AndroidAppRobosats?.deleteEncryptedStorage(uuid, key); }; + + public restart: () => void = () => { + window.AndroidAppRobosats?.restart(); + }; } export default SystemAndroidClient; diff --git a/frontend/src/services/System/SystemDesktopClient/index.ts b/frontend/src/services/System/SystemDesktopClient/index.ts index 562232ac..0e65a4a4 100644 --- a/frontend/src/services/System/SystemDesktopClient/index.ts +++ b/frontend/src/services/System/SystemDesktopClient/index.ts @@ -39,6 +39,8 @@ class SystemDesktopClient implements SystemClient { public deleteItem: (key: string) => void = (key) => { window.sessionStorage.removeItem(key); }; + + public restart: () => void = () => {}; } export default SystemDesktopClient; diff --git a/frontend/src/services/System/SystemWebClient/index.ts b/frontend/src/services/System/SystemWebClient/index.ts index d671e8d3..917fb253 100644 --- a/frontend/src/services/System/SystemWebClient/index.ts +++ b/frontend/src/services/System/SystemWebClient/index.ts @@ -45,6 +45,8 @@ class SystemWebClient implements SystemClient { public deleteItem: (key: string) => void = (key) => { window.localStorage.removeItem(key); }; + + public restart: () => void = () => {}; } export default SystemWebClient; diff --git a/frontend/src/services/System/index.ts b/frontend/src/services/System/index.ts index 63ed7dba..07336b53 100644 --- a/frontend/src/services/System/index.ts +++ b/frontend/src/services/System/index.ts @@ -9,6 +9,7 @@ export interface SystemClient { getItem: (key: string) => Promise; setItem: (key: string, value: string) => void; deleteItem: (key: string) => void; + restart: () => void; } function getSystemClient(): SystemClient { diff --git a/frontend/static/locales/ca.json b/frontend/static/locales/ca.json index 8de59090..7eb1ef3b 100644 --- a/frontend/static/locales/ca.json +++ b/frontend/static/locales/ca.json @@ -509,11 +509,13 @@ "Your last order #{{orderID}}": "La teva última ordre #{{orderID}}", "#50": "Phrases in components/SettingsForm/index.tsx", "API": "API", + "Build-in": "Build-in", "Dark": "Fosc", "Light": "Clar", "Mainnet": "Mainnet", "Off": "Off", "On": "On", + "Orbot": "Orbot", "Testnet": "Testnet", "#51": "Phrases in components/TradeBox/CancelButton.tsx", "Cancel order": "Cancel order", diff --git a/frontend/static/locales/cs.json b/frontend/static/locales/cs.json index 30d879b5..e81e10d8 100644 --- a/frontend/static/locales/cs.json +++ b/frontend/static/locales/cs.json @@ -509,11 +509,13 @@ "Your last order #{{orderID}}": "Vaše poslední objednávka #{{orderID}}", "#50": "Phrases in components/SettingsForm/index.tsx", "API": "API", + "Build-in": "Build-in", "Dark": "Tmavé", "Light": "Světlé", "Mainnet": "Mainnet", "Off": "Off", "On": "On", + "Orbot": "Orbot", "Testnet": "Testnet", "#51": "Phrases in components/TradeBox/CancelButton.tsx", "Cancel order": "Zrušit objednávku", diff --git a/frontend/static/locales/de.json b/frontend/static/locales/de.json index cb5a36f8..661e34b1 100644 --- a/frontend/static/locales/de.json +++ b/frontend/static/locales/de.json @@ -509,11 +509,13 @@ "Your last order #{{orderID}}": "Deine letzte Bestellung #{{orderID}}", "#50": "Phrases in components/SettingsForm/index.tsx", "API": "API", + "Build-in": "Build-in", "Dark": "Dunkel", "Light": "Hell", "Mainnet": "Mainnet", "Off": "Off", "On": "On", + "Orbot": "Orbot", "Testnet": "Testnet", "#51": "Phrases in components/TradeBox/CancelButton.tsx", "Cancel order": "Bestellung stornieren", diff --git a/frontend/static/locales/en.json b/frontend/static/locales/en.json index 6d893e5c..2e17b731 100644 --- a/frontend/static/locales/en.json +++ b/frontend/static/locales/en.json @@ -509,11 +509,13 @@ "Your last order #{{orderID}}": "Your last order #{{orderID}}", "#50": "Phrases in components/SettingsForm/index.tsx", "API": "API", + "Build-in": "Build-in", "Dark": "Dark", "Light": "Light", "Mainnet": "Mainnet", "Off": "Off", "On": "On", + "Orbot": "Orbot", "Testnet": "Testnet", "#51": "Phrases in components/TradeBox/CancelButton.tsx", "Cancel order": "Cancel order", diff --git a/frontend/static/locales/es.json b/frontend/static/locales/es.json index 3c355626..4f77818a 100644 --- a/frontend/static/locales/es.json +++ b/frontend/static/locales/es.json @@ -509,11 +509,13 @@ "Your last order #{{orderID}}": "Tu última orden #{{orderID}}", "#50": "Phrases in components/SettingsForm/index.tsx", "API": "API", + "Build-in": "Build-in", "Dark": "Oscuro", "Light": "Claro", "Mainnet": "Mainnet", "Off": "Off", "On": "On", + "Orbot": "Orbot", "Testnet": "Testnet", "#51": "Phrases in components/TradeBox/CancelButton.tsx", "Cancel order": "Cancelar orden", diff --git a/frontend/static/locales/eu.json b/frontend/static/locales/eu.json index 24248853..2ed557d9 100644 --- a/frontend/static/locales/eu.json +++ b/frontend/static/locales/eu.json @@ -509,11 +509,13 @@ "Your last order #{{orderID}}": "Zure azken eskaera #{{orderID}}", "#50": "Phrases in components/SettingsForm/index.tsx", "API": "API", + "Build-in": "Build-in", "Dark": "Iluna", "Light": "Argia", "Mainnet": "Mainnet", "Off": "Off", "On": "On", + "Orbot": "Orbot", "Testnet": "Testnet", "#51": "Phrases in components/TradeBox/CancelButton.tsx", "Cancel order": "Eskaera bertan bera utzi", diff --git a/frontend/static/locales/fr.json b/frontend/static/locales/fr.json index ccb62a62..f9e548b5 100644 --- a/frontend/static/locales/fr.json +++ b/frontend/static/locales/fr.json @@ -509,11 +509,13 @@ "Your last order #{{orderID}}": "Votre dernière commande #{{orderID}}", "#50": "Phrases in components/SettingsForm/index.tsx", "API": "API", + "Build-in": "Build-in", "Dark": "Sombre", "Light": "Clair", "Mainnet": "Mainnet", "Off": "Off", "On": "On", + "Orbot": "Orbot", "Testnet": "Testnet", "#51": "Phrases in components/TradeBox/CancelButton.tsx", "Cancel order": "Annuler l'ordre", diff --git a/frontend/static/locales/it.json b/frontend/static/locales/it.json index 7b5a35db..d9bc4079 100644 --- a/frontend/static/locales/it.json +++ b/frontend/static/locales/it.json @@ -509,11 +509,13 @@ "Your last order #{{orderID}}": "Il tuo ultimo ordine #{{orderID}}", "#50": "Phrases in components/SettingsForm/index.tsx", "API": "API", + "Build-in": "Build-in", "Dark": "Scuro", "Light": "Chiaro", "Mainnet": "Mainnet", "Off": "Off", "On": "On", + "Orbot": "Orbot", "Testnet": "Testnet", "#51": "Phrases in components/TradeBox/CancelButton.tsx", "Cancel order": "Annulla ordine", diff --git a/frontend/static/locales/ja.json b/frontend/static/locales/ja.json index 14577ea8..1f31d9f6 100644 --- a/frontend/static/locales/ja.json +++ b/frontend/static/locales/ja.json @@ -509,11 +509,13 @@ "Your last order #{{orderID}}": "前回のオーダー #{{orderID}}", "#50": "Phrases in components/SettingsForm/index.tsx", "API": "API", + "Build-in": "Build-in", "Dark": "ダーク", "Light": "ライト", "Mainnet": "メインネット", "Off": "Off", "On": "On", + "Orbot": "Orbot", "Testnet": "テストネット", "#51": "Phrases in components/TradeBox/CancelButton.tsx", "Cancel order": "注文をキャンセル", diff --git a/frontend/static/locales/pl.json b/frontend/static/locales/pl.json index bdf1e35e..8fdfcbfe 100644 --- a/frontend/static/locales/pl.json +++ b/frontend/static/locales/pl.json @@ -509,11 +509,13 @@ "Your last order #{{orderID}}": "Twoje ostatnie zamówienie #{{orderID}}", "#50": "Phrases in components/SettingsForm/index.tsx", "API": "API", + "Build-in": "Build-in", "Dark": "Ciemny", "Light": "Jasny", "Mainnet": "Mainnet", "Off": "Off", "On": "On", + "Orbot": "Orbot", "Testnet": "Testnet", "#51": "Phrases in components/TradeBox/CancelButton.tsx", "Cancel order": "Anuluj zamówienie", diff --git a/frontend/static/locales/pt.json b/frontend/static/locales/pt.json index 0c3915d2..0b237a6a 100644 --- a/frontend/static/locales/pt.json +++ b/frontend/static/locales/pt.json @@ -509,11 +509,13 @@ "Your last order #{{orderID}}": "Sua última ordem #{{orderID}}", "#50": "Phrases in components/SettingsForm/index.tsx", "API": "API", + "Build-in": "Build-in", "Dark": "Escuro", "Light": "Claro", "Mainnet": "Mainnet", "Off": "Off", "On": "On", + "Orbot": "Orbot", "Testnet": "Testnet", "#51": "Phrases in components/TradeBox/CancelButton.tsx", "Cancel order": "Cancelar ordem", diff --git a/frontend/static/locales/ru.json b/frontend/static/locales/ru.json index 085ea16c..b6efdbc4 100644 --- a/frontend/static/locales/ru.json +++ b/frontend/static/locales/ru.json @@ -509,11 +509,13 @@ "Your last order #{{orderID}}": "Ваш последний ордер #{{orderID}}", "#50": "Phrases in components/SettingsForm/index.tsx", "API": "API", + "Build-in": "Build-in", "Dark": "Темный", "Light": "Светлый", "Mainnet": "Основная сеть", "Off": "Off", "On": "On", + "Orbot": "Orbot", "Testnet": "Тестовая сеть", "#51": "Phrases in components/TradeBox/CancelButton.tsx", "Cancel order": "Отменить ордер", diff --git a/frontend/static/locales/sv.json b/frontend/static/locales/sv.json index 669a02ce..f6d57736 100644 --- a/frontend/static/locales/sv.json +++ b/frontend/static/locales/sv.json @@ -509,11 +509,13 @@ "Your last order #{{orderID}}": "Din senaste order #{{orderID}}", "#50": "Phrases in components/SettingsForm/index.tsx", "API": "API", + "Build-in": "Build-in", "Dark": "Mörk", "Light": "Ljusa", "Mainnet": "Mainnet", "Off": "Off", "On": "On", + "Orbot": "Orbot", "Testnet": "Testnet", "#51": "Phrases in components/TradeBox/CancelButton.tsx", "Cancel order": "Avbryt beställning", diff --git a/frontend/static/locales/sw.json b/frontend/static/locales/sw.json index 64d7a4b4..dcd5fc5f 100644 --- a/frontend/static/locales/sw.json +++ b/frontend/static/locales/sw.json @@ -509,11 +509,13 @@ "Your last order #{{orderID}}": "Agizo lako la mwisho #{{orderID}}", "#50": "Phrases in components/SettingsForm/index.tsx", "API": "API", + "Build-in": "Build-in", "Dark": "Giza", "Light": "Mwanga", "Mainnet": "Mainnet", "Off": "Off", "On": "On", + "Orbot": "Orbot", "Testnet": "Testnet", "#51": "Phrases in components/TradeBox/CancelButton.tsx", "Cancel order": "Ghairi agizo", diff --git a/frontend/static/locales/th.json b/frontend/static/locales/th.json index 10110bf4..ecceb055 100644 --- a/frontend/static/locales/th.json +++ b/frontend/static/locales/th.json @@ -509,11 +509,13 @@ "Your last order #{{orderID}}": "คำสั่งซื้อสุดท้ายของคุณ #{{orderID}}", "#50": "Phrases in components/SettingsForm/index.tsx", "API": "API", + "Build-in": "Build-in", "Dark": "มืด", "Light": "สว่าง", "Mainnet": "Mainnet", "Off": "Off", "On": "On", + "Orbot": "Orbot", "Testnet": "Testnet", "#51": "Phrases in components/TradeBox/CancelButton.tsx", "Cancel order": "ยกเลิกคำสั่งซื้อ", diff --git a/frontend/static/locales/zh-SI.json b/frontend/static/locales/zh-SI.json index aed3c46a..15bd1f3d 100644 --- a/frontend/static/locales/zh-SI.json +++ b/frontend/static/locales/zh-SI.json @@ -509,11 +509,13 @@ "Your last order #{{orderID}}": "你的上一笔订单#{{orderID}}", "#50": "Phrases in components/SettingsForm/index.tsx", "API": "API", + "Build-in": "Build-in", "Dark": "黑色", "Light": "浅色", "Mainnet": "主网", "Off": "Off", "On": "On", + "Orbot": "Orbot", "Testnet": "测试网", "#51": "Phrases in components/TradeBox/CancelButton.tsx", "Cancel order": "取消订单", diff --git a/frontend/static/locales/zh-TR.json b/frontend/static/locales/zh-TR.json index bd70e09d..e5273955 100644 --- a/frontend/static/locales/zh-TR.json +++ b/frontend/static/locales/zh-TR.json @@ -509,11 +509,13 @@ "Your last order #{{orderID}}": "您的上一筆交易 #{{orderID}}", "#50": "Phrases in components/SettingsForm/index.tsx", "API": "API", + "Build-in": "Build-in", "Dark": "深色", "Light": "淺色", "Mainnet": "主網", "Off": "Off", "On": "On", + "Orbot": "Orbot", "Testnet": "測試網", "#51": "Phrases in components/TradeBox/CancelButton.tsx", "Cancel order": "取消訂單",