TODO done
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
|
||||
|
||||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
import 'dart:typed_data';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:file_saver/file_saver.dart';
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
import 'package:gwid/api_service.dart';
|
||||
import 'package:gwid/proxy_service.dart';
|
||||
import 'package:gwid/spoofing_service.dart';
|
||||
@@ -23,7 +24,6 @@ class _ExportSessionScreenState extends State<ExportSessionScreen> {
|
||||
bool _isExporting = false;
|
||||
bool _saveProxySettings = false;
|
||||
|
||||
|
||||
Future<void> _exportAndSaveSession() async {
|
||||
if (!mounted) return;
|
||||
setState(() => _isExporting = true);
|
||||
@@ -73,32 +73,30 @@ class _ExportSessionScreenState extends State<ExportSessionScreen> {
|
||||
|
||||
Uint8List bytes = Uint8List.fromList(utf8.encode(finalFileContent));
|
||||
|
||||
String? filePath = await FileSaver.instance.saveAs(
|
||||
name: 'komet_session_${DateTime.now().millisecondsSinceEpoch}',
|
||||
bytes: bytes,
|
||||
fileExtension: 'json',
|
||||
mimeType: MimeType.json,
|
||||
);
|
||||
final Directory directory = await getDownloadsDirectory() ?? await getApplicationDocumentsDirectory();
|
||||
final String filePath = '${directory.path}/komet_session_${DateTime.now().millisecondsSinceEpoch}.ksession';
|
||||
|
||||
final File file = File(filePath);
|
||||
await file.writeAsBytes(bytes);
|
||||
|
||||
if (filePath != null && mounted) {
|
||||
if (mounted) {
|
||||
messenger.showSnackBar(
|
||||
const SnackBar(
|
||||
content: Text('Файл сессии успешно сохранен'),
|
||||
SnackBar(
|
||||
content: Text('Файл сессии успешно сохранен: $filePath'),
|
||||
backgroundColor: Colors.green,
|
||||
),
|
||||
);
|
||||
} else if (mounted) {
|
||||
messenger.showSnackBar(
|
||||
const SnackBar(content: Text('Сохранение файла было отменено.')),
|
||||
);
|
||||
}
|
||||
} catch (e) {
|
||||
messenger.showSnackBar(
|
||||
SnackBar(
|
||||
backgroundColor: Colors.red,
|
||||
content: Text('Не удалось экспортировать сессию: $e'),
|
||||
),
|
||||
);
|
||||
if (mounted) {
|
||||
messenger.showSnackBar(
|
||||
SnackBar(
|
||||
backgroundColor: Colors.red,
|
||||
content: Text('Не удалось экспортировать сессию: $e'),
|
||||
),
|
||||
);
|
||||
}
|
||||
rethrow;
|
||||
} finally {
|
||||
if (mounted) {
|
||||
setState(() => _isExporting = false);
|
||||
|
||||
@@ -104,7 +104,7 @@ class _TokenAuthScreenState extends State<TokenAuthScreen> {
|
||||
|
||||
FilePickerResult? result = await FilePicker.platform.pickFiles(
|
||||
type: FileType.custom,
|
||||
allowedExtensions: ['json'],
|
||||
allowedExtensions: ['json','ksession'],
|
||||
);
|
||||
if (result == null || result.files.single.path == null) return;
|
||||
final filePath = result.files.single.path!;
|
||||
@@ -322,7 +322,7 @@ class _TokenAuthScreenState extends State<TokenAuthScreen> {
|
||||
icon: Icons.file_open_outlined,
|
||||
title: 'Вход по файлу сессии',
|
||||
subtitle:
|
||||
'Загрузите ранее экспортированный .json файл для восстановления сессии.',
|
||||
'Загрузите ранее экспортированный .json или .ksession файл для восстановления сессии.',
|
||||
buttonLabel: 'Загрузить файл',
|
||||
onPressed: _loadSessionFile,
|
||||
isOutlined: true,
|
||||
|
||||
@@ -55,6 +55,7 @@ add_subdirectory(${FLUTTER_MANAGED_DIR})
|
||||
# System-level dependencies.
|
||||
find_package(PkgConfig REQUIRED)
|
||||
pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0)
|
||||
pkg_check_modules(GTK3 REQUIRED IMPORTED_TARGET gtk+-3.0)
|
||||
|
||||
# Check for Wayland support in GTK
|
||||
#pkg_check_modules(GTK_WAYLAND REQUIRED IMPORTED_TARGET gtk+-3.0)
|
||||
@@ -132,10 +133,10 @@ install(CODE "
|
||||
install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}"
|
||||
DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime)
|
||||
|
||||
## Install the AOT library on non-Debug builds only.
|
||||
#if(NOT CMAKE_BUILD_TYPE MATCHES "Debug")
|
||||
# install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
|
||||
# COMPONENT Runtime)
|
||||
#endif()
|
||||
# Install the AOT library on non-Debug builds only.
|
||||
if(NOT CMAKE_BUILD_TYPE MATCHES "Debug")
|
||||
install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
|
||||
COMPONENT Runtime)
|
||||
endif()
|
||||
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
#include "generated_plugin_registrant.h"
|
||||
|
||||
#include <dynamic_color/dynamic_color_plugin.h>
|
||||
#include <file_saver/file_saver_plugin.h>
|
||||
#include <file_selector_linux/file_selector_plugin.h>
|
||||
#include <flutter_secure_storage_linux/flutter_secure_storage_linux_plugin.h>
|
||||
#include <flutter_timezone/flutter_timezone_plugin.h>
|
||||
@@ -20,9 +19,6 @@ void fl_register_plugins(FlPluginRegistry* registry) {
|
||||
g_autoptr(FlPluginRegistrar) dynamic_color_registrar =
|
||||
fl_plugin_registry_get_registrar_for_plugin(registry, "DynamicColorPlugin");
|
||||
dynamic_color_plugin_register_with_registrar(dynamic_color_registrar);
|
||||
g_autoptr(FlPluginRegistrar) file_saver_registrar =
|
||||
fl_plugin_registry_get_registrar_for_plugin(registry, "FileSaverPlugin");
|
||||
file_saver_plugin_register_with_registrar(file_saver_registrar);
|
||||
g_autoptr(FlPluginRegistrar) file_selector_linux_registrar =
|
||||
fl_plugin_registry_get_registrar_for_plugin(registry, "FileSelectorPlugin");
|
||||
file_selector_plugin_register_with_registrar(file_selector_linux_registrar);
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
|
||||
list(APPEND FLUTTER_PLUGIN_LIST
|
||||
dynamic_color
|
||||
file_saver
|
||||
file_selector_linux
|
||||
flutter_secure_storage_linux
|
||||
flutter_timezone
|
||||
|
||||
@@ -9,7 +9,6 @@ import app_links
|
||||
import device_info_plus
|
||||
import dynamic_color
|
||||
import file_picker
|
||||
import file_saver
|
||||
import file_selector_macos
|
||||
import flutter_inappwebview_macos
|
||||
import flutter_secure_storage_macos
|
||||
@@ -31,7 +30,6 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
||||
DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin"))
|
||||
DynamicColorPlugin.register(with: registry.registrar(forPlugin: "DynamicColorPlugin"))
|
||||
FilePickerPlugin.register(with: registry.registrar(forPlugin: "FilePickerPlugin"))
|
||||
FileSaverPlugin.register(with: registry.registrar(forPlugin: "FileSaverPlugin"))
|
||||
FileSelectorPlugin.register(with: registry.registrar(forPlugin: "FileSelectorPlugin"))
|
||||
InAppWebViewFlutterPlugin.register(with: registry.registrar(forPlugin: "InAppWebViewFlutterPlugin"))
|
||||
FlutterSecureStoragePlugin.register(with: registry.registrar(forPlugin: "FlutterSecureStoragePlugin"))
|
||||
|
||||
24
pubspec.lock
24
pubspec.lock
@@ -209,22 +209,6 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "7.0.3"
|
||||
dio:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: dio
|
||||
sha256: d90ee57923d1828ac14e492ca49440f65477f4bb1263575900be731a3dac66a9
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "5.9.0"
|
||||
dio_web_adapter:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: dio_web_adapter
|
||||
sha256: "7586e476d70caecaf1686d21eee7247ea43ef5c345eab9e0cc3583ff13378d78"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.1"
|
||||
disable_battery_optimization:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@@ -297,14 +281,6 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "10.3.3"
|
||||
file_saver:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: file_saver
|
||||
sha256: "9d93db09bd4da9e43238f9dd485360fc51a5c138eea5ef5f407ec56e58079ac0"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.3.1"
|
||||
file_selector_linux:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
||||
@@ -65,7 +65,7 @@ dependencies:
|
||||
|
||||
http: ^1.5.0
|
||||
image_picker: ^1.1.2
|
||||
path_provider: ^2.1.4
|
||||
path_provider: ^2.1.5
|
||||
path: ^1.9.0
|
||||
crypto: ^3.0.3
|
||||
|
||||
@@ -81,7 +81,6 @@ dependencies:
|
||||
|
||||
timezone: ^0.9.2
|
||||
|
||||
file_saver: ^0.3.1
|
||||
|
||||
file_picker: ^10.3.3
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
|
||||
#include <app_links/app_links_plugin_c_api.h>
|
||||
#include <dynamic_color/dynamic_color_plugin_c_api.h>
|
||||
#include <file_saver/file_saver_plugin.h>
|
||||
#include <file_selector_windows/file_selector_windows.h>
|
||||
#include <flutter_inappwebview_windows/flutter_inappwebview_windows_plugin_c_api.h>
|
||||
#include <flutter_secure_storage_windows/flutter_secure_storage_windows_plugin.h>
|
||||
@@ -23,8 +22,6 @@ void RegisterPlugins(flutter::PluginRegistry* registry) {
|
||||
registry->GetRegistrarForPlugin("AppLinksPluginCApi"));
|
||||
DynamicColorPluginCApiRegisterWithRegistrar(
|
||||
registry->GetRegistrarForPlugin("DynamicColorPluginCApi"));
|
||||
FileSaverPluginRegisterWithRegistrar(
|
||||
registry->GetRegistrarForPlugin("FileSaverPlugin"));
|
||||
FileSelectorWindowsRegisterWithRegistrar(
|
||||
registry->GetRegistrarForPlugin("FileSelectorWindows"));
|
||||
FlutterInappwebviewWindowsPluginCApiRegisterWithRegistrar(
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
list(APPEND FLUTTER_PLUGIN_LIST
|
||||
app_links
|
||||
dynamic_color
|
||||
file_saver
|
||||
file_selector_windows
|
||||
flutter_inappwebview_windows
|
||||
flutter_secure_storage_windows
|
||||
|
||||
Reference in New Issue
Block a user