opt: Shares
This commit is contained in:
@@ -10,9 +10,9 @@ import 'package:toolbox/core/extension/context/snackbar.dart';
|
||||
import 'package:toolbox/core/persistant_store.dart';
|
||||
import 'package:toolbox/core/utils/icloud.dart';
|
||||
import 'package:toolbox/core/utils/platform/base.dart';
|
||||
import 'package:toolbox/core/utils/share.dart';
|
||||
import 'package:toolbox/data/model/app/backup.dart';
|
||||
import 'package:toolbox/data/res/logger.dart';
|
||||
import 'package:toolbox/data/res/path.dart';
|
||||
import 'package:toolbox/data/res/provider.dart';
|
||||
import 'package:toolbox/data/res/rebuild.dart';
|
||||
import 'package:toolbox/data/res/store.dart';
|
||||
@@ -20,7 +20,6 @@ import 'package:toolbox/view/widget/expand_tile.dart';
|
||||
import 'package:toolbox/view/widget/cardx.dart';
|
||||
import 'package:toolbox/view/widget/store_switch.dart';
|
||||
import 'package:toolbox/view/widget/value_notifier.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
import '../../core/utils/misc.dart';
|
||||
import '../../data/res/ui.dart';
|
||||
@@ -149,17 +148,14 @@ class BackupPage extends StatelessWidget {
|
||||
}
|
||||
|
||||
Future<void> _onBackup() async {
|
||||
await Backup.backup();
|
||||
final path = await Paths.bak;
|
||||
final path = await Backup.backup();
|
||||
|
||||
/// Issue #188
|
||||
if (isWindows) {
|
||||
await launchUrl(
|
||||
File(path).uri,
|
||||
mode: LaunchMode.externalNonBrowserApplication,
|
||||
);
|
||||
await Shares.text(await File(path).readAsString());
|
||||
|
||||
} else {
|
||||
await shareFiles([path]);
|
||||
await Shares.files([path]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import 'package:toolbox/core/extension/context/dialog.dart';
|
||||
import 'package:toolbox/core/extension/context/locale.dart';
|
||||
import 'package:toolbox/core/extension/context/snackbar.dart';
|
||||
import 'package:toolbox/core/extension/uint8list.dart';
|
||||
import 'package:toolbox/core/utils/misc.dart';
|
||||
import 'package:toolbox/core/utils/share.dart';
|
||||
import 'package:toolbox/data/res/provider.dart';
|
||||
import 'package:toolbox/view/widget/value_notifier.dart';
|
||||
|
||||
@@ -89,7 +89,7 @@ class _PingPageState extends State<PingPage>
|
||||
child: Text(e.toString()),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => copy2Clipboard(e.toString()),
|
||||
onPressed: () => Shares.copy(e.toString()),
|
||||
child: Text(l10n.copy),
|
||||
),
|
||||
],
|
||||
|
||||
@@ -7,7 +7,7 @@ import 'package:toolbox/core/extension/context/dialog.dart';
|
||||
import 'package:toolbox/core/extension/context/locale.dart';
|
||||
import 'package:toolbox/core/extension/context/snackbar.dart';
|
||||
import 'package:toolbox/core/extension/uint8list.dart';
|
||||
import 'package:toolbox/core/utils/misc.dart';
|
||||
import 'package:toolbox/core/utils/share.dart';
|
||||
import 'package:toolbox/data/res/store.dart';
|
||||
|
||||
import '../../data/model/app/shell_func.dart';
|
||||
@@ -111,7 +111,7 @@ class _ProcessPageState extends State<ProcessPage> {
|
||||
child: SingleChildScrollView(child: Text(_result.error!)),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => copy2Clipboard(_result.error!),
|
||||
onPressed: () => Shares.copy(_result.error!),
|
||||
child: Text(l10n.copy),
|
||||
),
|
||||
],
|
||||
|
||||
@@ -9,12 +9,12 @@ import 'package:toolbox/core/extension/context/locale.dart';
|
||||
import 'package:toolbox/core/extension/media_queryx.dart';
|
||||
import 'package:toolbox/core/extension/ssh_client.dart';
|
||||
import 'package:toolbox/core/utils/platform/base.dart';
|
||||
import 'package:toolbox/core/utils/share.dart';
|
||||
import 'package:toolbox/data/model/app/shell_func.dart';
|
||||
import 'package:toolbox/data/res/provider.dart';
|
||||
import 'package:toolbox/data/res/store.dart';
|
||||
|
||||
import '../../../core/route.dart';
|
||||
import '../../../core/utils/misc.dart';
|
||||
import '../../../data/model/app/net_view.dart';
|
||||
import '../../../data/model/server/disk.dart';
|
||||
import '../../../data/model/server/server.dart';
|
||||
@@ -412,7 +412,7 @@ class _ServerPageState extends State<ServerPage>
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => copy2Clipboard(ss.failedInfo!),
|
||||
onPressed: () => Shares.copy(ss.failedInfo!),
|
||||
child: Text(l10n.copy),
|
||||
)
|
||||
],
|
||||
|
||||
@@ -7,6 +7,7 @@ import 'package:toolbox/core/extension/context/snackbar.dart';
|
||||
import 'package:toolbox/core/route.dart';
|
||||
import 'package:toolbox/core/utils/misc.dart';
|
||||
import 'package:toolbox/core/utils/platform/auth.dart';
|
||||
import 'package:toolbox/core/utils/share.dart';
|
||||
import 'package:toolbox/data/res/logger.dart';
|
||||
import 'package:toolbox/data/res/misc.dart';
|
||||
import 'package:toolbox/data/res/store.dart';
|
||||
@@ -58,7 +59,7 @@ class _IOSSettingsPageState extends State<IOSSettingsPage> {
|
||||
padding: EdgeInsets.zero,
|
||||
onPressed: () {
|
||||
if (_pushToken.value != null) {
|
||||
copy2Clipboard(_pushToken.value!);
|
||||
Shares.copy(_pushToken.value!);
|
||||
context.showSnackBar(l10n.success);
|
||||
} else {
|
||||
context.showSnackBar(l10n.getPushTokenFailed);
|
||||
|
||||
@@ -11,6 +11,7 @@ import 'package:toolbox/core/extension/context/dialog.dart';
|
||||
import 'package:toolbox/core/extension/context/locale.dart';
|
||||
import 'package:toolbox/core/extension/context/snackbar.dart';
|
||||
import 'package:toolbox/core/utils/platform/base.dart';
|
||||
import 'package:toolbox/core/utils/share.dart';
|
||||
import 'package:toolbox/data/model/server/snippet.dart';
|
||||
import 'package:toolbox/data/provider/virtual_keyboard.dart';
|
||||
import 'package:toolbox/data/res/provider.dart';
|
||||
@@ -249,7 +250,7 @@ class _SSHPageState extends State<SSHPage> {
|
||||
case VirtualKeyFunc.clipboard:
|
||||
final selected = terminalSelected;
|
||||
if (selected != null) {
|
||||
copy2Clipboard(selected);
|
||||
Shares.copy(selected);
|
||||
} else {
|
||||
_paste();
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import 'package:toolbox/core/extension/context/common.dart';
|
||||
import 'package:toolbox/core/extension/context/dialog.dart';
|
||||
import 'package:toolbox/core/extension/context/locale.dart';
|
||||
import 'package:toolbox/core/extension/context/snackbar.dart';
|
||||
import 'package:toolbox/core/utils/share.dart';
|
||||
import 'package:toolbox/data/model/server/server_private_info.dart';
|
||||
import 'package:toolbox/data/model/sftp/req.dart';
|
||||
import 'package:toolbox/data/res/misc.dart';
|
||||
@@ -303,7 +304,7 @@ class _LocalStoragePageState extends State<LocalStoragePage> {
|
||||
leading: const Icon(Icons.open_in_new),
|
||||
title: Text(l10n.open),
|
||||
onTap: () {
|
||||
shareFiles([file.absolute.path]);
|
||||
Shares.files([file.absolute.path]);
|
||||
},
|
||||
),
|
||||
],
|
||||
|
||||
@@ -5,10 +5,10 @@ import 'package:toolbox/core/extension/context/locale.dart';
|
||||
import 'package:toolbox/core/extension/datetime.dart';
|
||||
import 'package:toolbox/core/extension/context/dialog.dart';
|
||||
import 'package:toolbox/core/route.dart';
|
||||
import 'package:toolbox/core/utils/share.dart';
|
||||
import 'package:toolbox/data/res/provider.dart';
|
||||
|
||||
import '../../../core/extension/numx.dart';
|
||||
import '../../../core/utils/misc.dart';
|
||||
import '../../../data/model/sftp/req.dart';
|
||||
import '../../../data/provider/sftp.dart';
|
||||
import '../../../data/res/ui.dart';
|
||||
@@ -72,7 +72,7 @@ class _SftpMissionPageState extends State<SftpMissionPage> {
|
||||
},
|
||||
icon: const Icon(Icons.file_open)),
|
||||
IconButton(
|
||||
onPressed: () => shareFiles([status.req.localPath]),
|
||||
onPressed: () => Shares.files([status.req.localPath]),
|
||||
icon: const Icon(Icons.open_in_new),
|
||||
)
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user