mirror of
https://github.com/RoboSats/robosats.git
synced 2025-09-13 00:56:22 +00:00
Reset proxy button
This commit is contained in:
@ -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')")
|
||||
|
||||
@ -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 =
|
||||
</ToggleButtonGroup>
|
||||
</ListItem>
|
||||
)}
|
||||
|
||||
{client == 'mobile' && (
|
||||
<ListItem>
|
||||
<ListItemIcon>
|
||||
<Tor />
|
||||
</ListItemIcon>
|
||||
<ToggleButtonGroup
|
||||
exclusive={true}
|
||||
sx={{ width: '100%' }}
|
||||
value={settings.useProxy}
|
||||
onChange={(_e, useProxy) => {
|
||||
setSettings({ ...settings, useProxy });
|
||||
systemClient.setItem('settings_use_proxy', String(useProxy));
|
||||
systemClient.restart();
|
||||
}}
|
||||
>
|
||||
<ToggleButton value={true} color='primary' sx={{ flexGrow: 1 }}>
|
||||
{t('Orbot')}
|
||||
</ToggleButton>
|
||||
<ToggleButton value={false} color='secondary' sx={{ flexGrow: 1 }}>
|
||||
{t('Build-in')}
|
||||
</ToggleButton>
|
||||
</ToggleButtonGroup>
|
||||
</ListItem>
|
||||
)}
|
||||
</List>
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
@ -85,31 +85,29 @@ export const LockInvoicePrompt = ({
|
||||
)}
|
||||
|
||||
<Grid item xs={12}>
|
||||
<Tooltip disableHoverListener enterTouchDelay={0} title={t('Copied!')}>
|
||||
<Box
|
||||
sx={{
|
||||
display: 'flex',
|
||||
backgroundColor: settings.lightQRs ? '#fff' : theme.palette.background.paper,
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
padding: '0.5em',
|
||||
borderRadius: '0.3em',
|
||||
border: '1px solid',
|
||||
borderColor: theme.palette.mode === 'dark' ? '#434343' : '#c4c4c4',
|
||||
'&:hover': {
|
||||
borderColor: theme.palette.mode === 'dark' ? '#ffffff' : '#2f2f2f',
|
||||
},
|
||||
}}
|
||||
>
|
||||
<QRCode
|
||||
bgColor={'rgba(255, 255, 255, 0)'}
|
||||
fgColor={settings.lightQRs ? '#000000' : theme.palette.text.primary}
|
||||
value={invoice?.toUpperCase() ?? 'Undefined: BOLT11 invoice not received'}
|
||||
size={theme.typography.fontSize * 21.8}
|
||||
onClick={handleClickQR}
|
||||
/>
|
||||
</Box>
|
||||
</Tooltip>
|
||||
<Box
|
||||
sx={{
|
||||
display: 'flex',
|
||||
backgroundColor: settings.lightQRs ? '#fff' : theme.palette.background.paper,
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
padding: '0.5em',
|
||||
borderRadius: '0.3em',
|
||||
border: '1px solid',
|
||||
borderColor: theme.palette.mode === 'dark' ? '#434343' : '#c4c4c4',
|
||||
'&:hover': {
|
||||
borderColor: theme.palette.mode === 'dark' ? '#ffffff' : '#2f2f2f',
|
||||
},
|
||||
}}
|
||||
>
|
||||
<QRCode
|
||||
bgColor={'rgba(255, 255, 255, 0)'}
|
||||
fgColor={settings.lightQRs ? '#000000' : theme.palette.text.primary}
|
||||
value={invoice?.toUpperCase() ?? 'Undefined: BOLT11 invoice not received'}
|
||||
size={theme.typography.fontSize * 21.8}
|
||||
onClick={handleClickQR}
|
||||
/>
|
||||
</Box>
|
||||
</Grid>
|
||||
<Grid item xs={12}>
|
||||
<Tooltip disableHoverListener enterTouchDelay={0} title={t('Copied!')}>
|
||||
|
||||
@ -28,6 +28,7 @@ interface AndroidAppRobosats {
|
||||
headers: string,
|
||||
body: string,
|
||||
) => void;
|
||||
restart: () => void;
|
||||
}
|
||||
|
||||
class AndroidRobosats {
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -39,6 +39,8 @@ class SystemDesktopClient implements SystemClient {
|
||||
public deleteItem: (key: string) => void = (key) => {
|
||||
window.sessionStorage.removeItem(key);
|
||||
};
|
||||
|
||||
public restart: () => void = () => {};
|
||||
}
|
||||
|
||||
export default SystemDesktopClient;
|
||||
|
||||
@ -45,6 +45,8 @@ class SystemWebClient implements SystemClient {
|
||||
public deleteItem: (key: string) => void = (key) => {
|
||||
window.localStorage.removeItem(key);
|
||||
};
|
||||
|
||||
public restart: () => void = () => {};
|
||||
}
|
||||
|
||||
export default SystemWebClient;
|
||||
|
||||
@ -9,6 +9,7 @@ export interface SystemClient {
|
||||
getItem: (key: string) => Promise<string | undefined>;
|
||||
setItem: (key: string, value: string) => void;
|
||||
deleteItem: (key: string) => void;
|
||||
restart: () => void;
|
||||
}
|
||||
|
||||
function getSystemClient(): SystemClient {
|
||||
|
||||
@ -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",
|
||||
|
||||
@ -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",
|
||||
|
||||
@ -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",
|
||||
|
||||
@ -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",
|
||||
|
||||
@ -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",
|
||||
|
||||
@ -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",
|
||||
|
||||
@ -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",
|
||||
|
||||
@ -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",
|
||||
|
||||
@ -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": "注文をキャンセル",
|
||||
|
||||
@ -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",
|
||||
|
||||
@ -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",
|
||||
|
||||
@ -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": "Отменить ордер",
|
||||
|
||||
@ -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",
|
||||
|
||||
@ -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",
|
||||
|
||||
@ -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": "ยกเลิกคำสั่งซื้อ",
|
||||
|
||||
@ -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": "取消订单",
|
||||
|
||||
@ -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": "取消訂單",
|
||||
|
||||
Reference in New Issue
Block a user