new: watchOS phone end
This commit is contained in:
@@ -228,6 +228,7 @@
|
||||
"virtKeyHelpClipboard": "In die Zwischenablage kopieren, wenn das ausgewählte Terminal nicht leer ist, andernfalls den Inhalt der Zwischenablage in das Terminal einfügen.",
|
||||
"virtKeyHelpSFTP": "Aktuelles Verzeichnis in SFTP öffnen.",
|
||||
"waitConnection": "Bitte warte, bis die Verbindung hergestellt wurde.",
|
||||
"watchNotPaired": "Keine gekoppelte Apple Watch",
|
||||
"whenOpenApp": "Beim Öffnen der App",
|
||||
"willTakEeffectImmediately": "Wird sofort angewendet"
|
||||
}
|
||||
@@ -228,6 +228,7 @@
|
||||
"virtKeyHelpClipboard": "Copy to the clipboard if terminal selected is not empty, otherwise paste the contents of the clipboard to the terminal.",
|
||||
"virtKeyHelpSFTP": "Open current directory in SFTP.",
|
||||
"waitConnection": "Please wait for the connection to be established.",
|
||||
"watchNotPaired": "No paired Apple Watch",
|
||||
"whenOpenApp": "When opening the app",
|
||||
"willTakEeffectImmediately": "Will take effect immediately"
|
||||
}
|
||||
@@ -228,6 +228,7 @@
|
||||
"virtKeyHelpClipboard": "Salin ke clipboard jika terminal yang dipilih tidak kosong, jika tidak, tempel isi clipboard ke terminal.",
|
||||
"virtKeyHelpSFTP": "Buka direktori saat ini di SFTP.",
|
||||
"waitConnection": "Harap tunggu koneksi akan dibuat.",
|
||||
"watchNotPaired": "Tidak ada Apple Watch yang dipasangkan",
|
||||
"whenOpenApp": "Saat membuka aplikasi",
|
||||
"willTakEeffectImmediately": "Akan segera berlaku"
|
||||
}
|
||||
@@ -228,6 +228,7 @@
|
||||
"virtKeyHelpClipboard": "如果终端有选中字符,则复制选中字符至剪切板,否则粘贴剪切板内容至终端。",
|
||||
"virtKeyHelpSFTP": "在 SFTP 中打开当前路径。",
|
||||
"waitConnection": "请等待连接建立",
|
||||
"watchNotPaired": "没有已配对的 Apple Watch",
|
||||
"whenOpenApp": "当打开 App 时",
|
||||
"willTakEeffectImmediately": "更改将会立即生效"
|
||||
}
|
||||
@@ -228,6 +228,7 @@
|
||||
"virtKeyHelpClipboard": "如果終端有選中字符,則復製選中字符至剪切板,否則粘貼剪切板內容至終端。",
|
||||
"virtKeyHelpSFTP": "在 SFTP 中打開當前路徑。",
|
||||
"waitConnection": "請等待連接建立",
|
||||
"watchNotPaired": "沒有已配對的 Apple Watch",
|
||||
"whenOpenApp": "當打開 App 時",
|
||||
"willTakEeffectImmediately": "更改將會立即生效"
|
||||
}
|
||||
@@ -362,9 +362,10 @@ class _HomePageState extends State<HomePage>
|
||||
}
|
||||
|
||||
Future<void> _onLongPressSetting() async {
|
||||
/// Encode [map] to String with indent `\t`
|
||||
final map = Stores.setting.toJson();
|
||||
final keys = map.keys;
|
||||
|
||||
/// Encode [map] to String with indent `\t`
|
||||
final text = Miscs.jsonEncoder.convert(map);
|
||||
final result = await AppRoute.editor(
|
||||
text: text,
|
||||
|
||||
@@ -6,6 +6,7 @@ import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||
import 'package:flutter_highlight/theme_map.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:toolbox/core/build_mode.dart';
|
||||
import 'package:toolbox/core/extension/colorx.dart';
|
||||
import 'package:toolbox/core/extension/context/common.dart';
|
||||
import 'package:toolbox/core/extension/context/snackbar.dart';
|
||||
@@ -14,8 +15,11 @@ import 'package:toolbox/core/extension/context/dialog.dart';
|
||||
import 'package:toolbox/core/extension/stringx.dart';
|
||||
import 'package:toolbox/core/utils/platform/auth.dart';
|
||||
import 'package:toolbox/core/utils/platform/base.dart';
|
||||
import 'package:toolbox/data/res/logger.dart';
|
||||
import 'package:toolbox/data/res/misc.dart';
|
||||
import 'package:toolbox/data/res/provider.dart';
|
||||
import 'package:toolbox/data/res/store.dart';
|
||||
import 'package:watch_connectivity/watch_connectivity.dart';
|
||||
|
||||
import '../../../core/persistant_store.dart';
|
||||
import '../../../core/route.dart';
|
||||
@@ -57,6 +61,8 @@ class _SettingPageState extends State<SettingPage> {
|
||||
late S _s;
|
||||
late SharedPreferences _sp;
|
||||
|
||||
final wc = WatchConnectivity();
|
||||
|
||||
final _selectedColorValue = ValueNotifier(0);
|
||||
final _nightMode = ValueNotifier(0);
|
||||
final _maxRetryCount = ValueNotifier(0);
|
||||
@@ -69,7 +75,6 @@ class _SettingPageState extends State<SettingPage> {
|
||||
final _keyboardType = ValueNotifier(0);
|
||||
final _rotateQuarter = ValueNotifier(0);
|
||||
final _netViewType = ValueNotifier(NetViewType.speed);
|
||||
|
||||
final _pushToken = ValueNotifier<String?>(null);
|
||||
|
||||
@override
|
||||
@@ -188,13 +193,14 @@ class _SettingPageState extends State<SettingPage> {
|
||||
children.add(_buildBgRun());
|
||||
children.add(_buildAndroidWidgetSharedPreference());
|
||||
}
|
||||
if (isIOS) {
|
||||
children.add(_buildPushToken());
|
||||
children.add(_buildAutoUpdateHomeWidget());
|
||||
}
|
||||
if (BioAuth.isPlatformSupported) {
|
||||
children.add(_buildBioAuth());
|
||||
}
|
||||
if (isIOS) {
|
||||
if (BuildMode.isRelease) children.add(_buildPushToken());
|
||||
children.add(_buildAutoUpdateHomeWidget());
|
||||
children.add(_buildWatchApp());
|
||||
}
|
||||
return Column(
|
||||
children: children.map((e) => RoundRectCard(e)).toList(),
|
||||
);
|
||||
@@ -1115,6 +1121,10 @@ class _SettingPageState extends State<SettingPage> {
|
||||
success: (can) {
|
||||
return ListTile(
|
||||
title: Text(_s.bioAuth),
|
||||
subtitle: can
|
||||
? null
|
||||
: const Text('Error: Bio auth is not available',
|
||||
style: UIs.textGrey),
|
||||
trailing: can
|
||||
? StoreSwitch(
|
||||
prop: Stores.setting.useBioAuth,
|
||||
@@ -1131,10 +1141,66 @@ class _SettingPageState extends State<SettingPage> {
|
||||
}
|
||||
},
|
||||
)
|
||||
: Text(_s.error, style: UIs.textGrey),
|
||||
: null,
|
||||
);
|
||||
},
|
||||
noData: UIs.placeholder,
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildWatchApp() {
|
||||
return FutureWidget<Map<String, dynamic>?>(
|
||||
future: () async {
|
||||
if (!await wc.isPaired) {
|
||||
return null;
|
||||
}
|
||||
return await wc.applicationContext;
|
||||
}(),
|
||||
loading: UIs.centerLoading,
|
||||
error: (e, trace) {
|
||||
Loggers.app.warning('WatchOS error', e, trace);
|
||||
return ListTile(
|
||||
title: const Text('Watch app'),
|
||||
subtitle: Text('${_s.error}: $e', style: UIs.textGrey),
|
||||
);
|
||||
},
|
||||
success: (ctx) {
|
||||
if (ctx == null) {
|
||||
return ListTile(
|
||||
title: const Text('Watch app'),
|
||||
subtitle: Text(_s.watchNotPaired, style: UIs.textGrey),
|
||||
);
|
||||
}
|
||||
return ListTile(
|
||||
title: const Text('Watch app'),
|
||||
trailing: const Icon(Icons.keyboard_arrow_right),
|
||||
onTap: () async => _onTapWatchApp(ctx),
|
||||
);
|
||||
},
|
||||
noData: UIs.placeholder,
|
||||
);
|
||||
}
|
||||
|
||||
void _onTapWatchApp(Map<String, dynamic> map) async {
|
||||
/// Encode [map] to String with indent `\t`
|
||||
final text = Miscs.jsonEncoder.convert(map);
|
||||
final result = await AppRoute.editor(
|
||||
text: text,
|
||||
langCode: 'json',
|
||||
title: 'Watch app config',
|
||||
).go(context);
|
||||
if (result == null) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
final newCtx = json.decode(result) as Map<String, dynamic>;
|
||||
await wc.updateApplicationContext(newCtx);
|
||||
} catch (e, trace) {
|
||||
context.showRoundDialog(
|
||||
title: Text(_s.error),
|
||||
child: Text('${_s.save}:\n$e'),
|
||||
);
|
||||
Loggers.app.warning('Update watch config failed', e, trace);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user