AuthLogsRouter basecode, windows base code

This commit is contained in:
DASHU
2024-10-08 00:25:23 +08:00
parent c121370c3b
commit f18e044ab7
10 changed files with 141 additions and 27 deletions

View File

@@ -9,4 +9,5 @@ class RouterPath {
static const String APP_DETAIL = "/appDetail";
static const String HISTORY = "/history";
static const String BOOKMARK = "/bookmark";
static const String AUTH_LOGS = "/authLogs";
}

View File

@@ -6,6 +6,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:nostr_sdk/utils/platform_util.dart';
import 'package:nostr_sdk/utils/string_util.dart';
import 'package:nowser/data/db.dart';
import 'package:nowser/provider/android_signer_mixin.dart';
@@ -16,6 +17,7 @@ import 'package:nowser/provider/web_provider.dart';
import 'package:nowser/router/app_detail/app_detail_router.dart';
import 'package:nowser/router/apps/add_remote_app_router.dart';
import 'package:nowser/router/apps/apps_router.dart';
import 'package:nowser/router/auth_log/auth_logs_router.dart';
import 'package:nowser/router/bookmark/bookmark_router.dart';
import 'package:nowser/router/history/history_router.dart';
import 'package:nowser/router/index/index_router.dart';
@@ -25,6 +27,8 @@ import 'package:nowser/router/web_tabs_select/web_tabs_select_router.dart';
import 'package:nowser/router/web_url_input/web_url_input_router.dart';
import 'package:provider/provider.dart';
import 'package:receive_intent/receive_intent.dart' as receiveIntent;
import 'package:sqflite_common_ffi/sqflite_ffi.dart';
import 'package:window_manager/window_manager.dart';
import 'const/base.dart';
import 'const/colors.dart';
@@ -50,6 +54,30 @@ late Map<String, WidgetBuilder> routes;
Future<void> main() async {
WidgetsBinding widgetsBinding = WidgetsFlutterBinding.ensureInitialized();
if (!PlatformUtil.isWeb() && PlatformUtil.isPC()) {
await windowManager.ensureInitialized();
WindowOptions windowOptions = WindowOptions(
size: Size(1280, 800),
center: true,
backgroundColor: Colors.transparent,
skipTaskbar: false,
titleBarStyle: TitleBarStyle.normal,
title: Base.APP_NAME,
);
windowManager.waitUntilReadyToShow(windowOptions, () async {
await windowManager.show();
await windowManager.focus();
});
}
if (PlatformUtil.isWindowsOrLinux()) {
// Initialize FFI
sqfliteFfiInit();
// Change the default factory
databaseFactory = databaseFactoryFfi;
}
keyProvider = KeyProvider();
appProvider = AppProvider();
@@ -106,6 +134,7 @@ class _MyApp extends State<MyApp> {
RouterPath.APP_DETAIL: (context) => AppDetailRouter(),
RouterPath.HISTORY: (context) => HistoryRouter(),
RouterPath.BOOKMARK: (context) => BookmarkRouter(),
RouterPath.AUTH_LOGS: (context) => AuthLogsRouter(),
};
return MultiProvider(

View File

@@ -0,0 +1,33 @@
import 'package:flutter/material.dart';
import '../../component/appbar_back_btn_component.dart';
import '../../component/deletable_list_mixin.dart';
class AuthLogsRouter extends StatefulWidget {
@override
State<StatefulWidget> createState() {
return _AuthLogsRouter();
}
}
class _AuthLogsRouter extends State<AuthLogsRouter> with DeletableListMixin {
@override
Widget build(BuildContext context) {
var themeData = Theme.of(context);
return Scaffold(
appBar: AppBar(
leading: AppbarBackBtnComponent(),
title: Text(
"Auth Logs",
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: themeData.textTheme.bodyLarge!.fontSize,
),
),
actions: genAppBarActions(context),
),
body: Container(),
);
}
}

View File

@@ -7,9 +7,17 @@
#include "generated_plugin_registrant.h"
#include <flutter_secure_storage_linux/flutter_secure_storage_linux_plugin.h>
#include <screen_retriever/screen_retriever_plugin.h>
#include <window_manager/window_manager_plugin.h>
void fl_register_plugins(FlPluginRegistry* registry) {
g_autoptr(FlPluginRegistrar) flutter_secure_storage_linux_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "FlutterSecureStorageLinuxPlugin");
flutter_secure_storage_linux_plugin_register_with_registrar(flutter_secure_storage_linux_registrar);
g_autoptr(FlPluginRegistrar) screen_retriever_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "ScreenRetrieverPlugin");
screen_retriever_plugin_register_with_registrar(screen_retriever_registrar);
g_autoptr(FlPluginRegistrar) window_manager_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "WindowManagerPlugin");
window_manager_plugin_register_with_registrar(window_manager_registrar);
}

View File

@@ -4,6 +4,8 @@
list(APPEND FLUTTER_PLUGIN_LIST
flutter_secure_storage_linux
screen_retriever
window_manager
)
list(APPEND FLUTTER_FFI_PLUGIN_LIST

View File

@@ -10,8 +10,10 @@ import device_info_plus
import flutter_inappwebview_macos
import flutter_secure_storage_macos
import path_provider_foundation
import screen_retriever
import shared_preferences_foundation
import sqflite
import window_manager
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
CryptographyFlutterPlugin.register(with: registry.registrar(forPlugin: "CryptographyFlutterPlugin"))
@@ -19,6 +21,8 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
InAppWebViewFlutterPlugin.register(with: registry.registrar(forPlugin: "InAppWebViewFlutterPlugin"))
FlutterSecureStoragePlugin.register(with: registry.registrar(forPlugin: "FlutterSecureStoragePlugin"))
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
ScreenRetrieverPlugin.register(with: registry.registrar(forPlugin: "ScreenRetrieverPlugin"))
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin"))
WindowManagerPlugin.register(with: registry.registrar(forPlugin: "WindowManagerPlugin"))
}

View File

@@ -282,18 +282,18 @@ packages:
dependency: "direct main"
description:
name: flutter_inappwebview
sha256: "3e9a443a18ecef966fb930c3a76ca5ab6a7aafc0c7b5e14a4a850cf107b09959"
sha256: "9f023eaa11c91330344aca4c45cd537aba9ccd92ef74b41cd9e112a862530a4f"
url: "https://pub.dev"
source: hosted
version: "6.0.0"
version: "6.1.2"
flutter_inappwebview_android:
dependency: transitive
description:
name: flutter_inappwebview_android
sha256: d247f6ed417f1f8c364612fa05a2ecba7f775c8d0c044c1d3b9ee33a6515c421
sha256: "6b24fbbaa69168da2d2ab4ddb2d65677468e2a0a0d593d629558537f710786dc"
url: "https://pub.dev"
source: hosted
version: "1.0.13"
version: "1.1.0+4"
flutter_inappwebview_internal_annotations:
dependency: transitive
description:
@@ -306,34 +306,42 @@ packages:
dependency: transitive
description:
name: flutter_inappwebview_ios
sha256: f363577208b97b10b319cd0c428555cd8493e88b468019a8c5635a0e4312bd0f
sha256: "571b0bfdb963548fcb945b9abe357352b4a523c249b4f9816fc5a83e2a71d9ec"
url: "https://pub.dev"
source: hosted
version: "1.0.13"
version: "1.1.0+3"
flutter_inappwebview_macos:
dependency: transitive
description:
name: flutter_inappwebview_macos
sha256: b55b9e506c549ce88e26580351d2c71d54f4825901666bd6cfa4be9415bb2636
sha256: e5e7f09dabd7b5b2ef15b00c07ed4da4a45bd597db0c4221702485665b6628b7
url: "https://pub.dev"
source: hosted
version: "1.0.11"
version: "1.1.0+3"
flutter_inappwebview_platform_interface:
dependency: transitive
description:
name: flutter_inappwebview_platform_interface
sha256: "545fd4c25a07d2775f7d5af05a979b2cac4fbf79393b0a7f5d33ba39ba4f6187"
sha256: da6c7bf193beba655bdfcd825b6c7f7b51da4944e1eb76bf9faddf685ca15fa2
url: "https://pub.dev"
source: hosted
version: "1.0.10"
version: "1.1.1"
flutter_inappwebview_web:
dependency: transitive
description:
name: flutter_inappwebview_web
sha256: d8c680abfb6fec71609a700199635d38a744df0febd5544c5a020bd73de8ee07
sha256: ee1389bfec8c9ef07ba4be48a117207c9392dbdbf366330aa26d69f67a826978
url: "https://pub.dev"
source: hosted
version: "1.0.8"
version: "1.1.0+2"
flutter_inappwebview_windows:
dependency: transitive
description:
name: flutter_inappwebview_windows
sha256: "3ad92e93bafc2984f90f627783c3f5fc705842fb8d4f7213f92bb9027c6eac94"
url: "https://pub.dev"
source: hosted
version: "0.3.0+1"
flutter_launcher_icons:
dependency: "direct dev"
description:
@@ -505,18 +513,18 @@ packages:
dependency: transitive
description:
name: leak_tracker
sha256: "7f0df31977cb2c0b88585095d168e689669a2cc9b97c309665e3386f3e9d341a"
sha256: "3f87a60e8c63aecc975dda1ceedbc8f24de75f09e4856ea27daf8958f2f0ce05"
url: "https://pub.dev"
source: hosted
version: "10.0.4"
version: "10.0.5"
leak_tracker_flutter_testing:
dependency: transitive
description:
name: leak_tracker_flutter_testing
sha256: "06e98f569d004c1315b991ded39924b21af84cf14cc94791b8aea337d25b57f8"
sha256: "932549fb305594d82d7183ecd9fa93463e9914e1b67cacc34bc40906594a1806"
url: "https://pub.dev"
source: hosted
version: "3.0.3"
version: "3.0.5"
leak_tracker_testing:
dependency: transitive
description:
@@ -545,18 +553,18 @@ packages:
dependency: transitive
description:
name: material_color_utilities
sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a"
sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec
url: "https://pub.dev"
source: hosted
version: "0.8.0"
version: "0.11.1"
meta:
dependency: transitive
description:
name: meta
sha256: "7687075e408b093f36e6bbf6c91878cc0d4cd10f409506f7bc996f68220b9136"
sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7
url: "https://pub.dev"
source: hosted
version: "1.12.0"
version: "1.15.0"
mime:
dependency: transitive
description:
@@ -756,6 +764,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "0.28.0"
screen_retriever:
dependency: transitive
description:
name: screen_retriever
sha256: "6ee02c8a1158e6dae7ca430da79436e3b1c9563c8cf02f524af997c201ac2b90"
url: "https://pub.dev"
source: hosted
version: "0.1.9"
shared_preferences:
dependency: "direct main"
description:
@@ -925,10 +941,10 @@ packages:
dependency: transitive
description:
name: test_api
sha256: "9955ae474176f7ac8ee4e989dadfb411a58c30415bcfb648fa04b2b8a03afa7f"
sha256: "5b8a98dafc4d5c4c9c72d8b31ab2b23fc13422348d2997120294d3bac86b4ddb"
url: "https://pub.dev"
source: hosted
version: "0.7.0"
version: "0.7.2"
typed_data:
dependency: transitive
description:
@@ -965,10 +981,10 @@ packages:
dependency: transitive
description:
name: vm_service
sha256: "3923c89304b715fb1eb6423f017651664a03bf5f4b29983627c4da791f74a4ec"
sha256: "5c5f338a667b4c644744b661f309fb8080bb94b18a7e91ef1dbd343bed00ed6d"
url: "https://pub.dev"
source: hosted
version: "14.2.1"
version: "14.2.5"
web:
dependency: transitive
description:
@@ -1009,6 +1025,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.1.4"
window_manager:
dependency: "direct main"
description:
name: window_manager
sha256: ab8b2a7f97543d3db2b506c9d875e637149d48ee0c6a5cb5f5fd6e0dac463792
url: "https://pub.dev"
source: hosted
version: "0.4.2"
xdg_directories:
dependency: transitive
description:
@@ -1034,5 +1058,5 @@ packages:
source: hosted
version: "3.1.2"
sdks:
dart: ">=3.4.1 <4.0.0"
flutter: ">=3.22.0"
dart: ">=3.5.0 <4.0.0"
flutter: ">=3.24.0"

View File

@@ -38,7 +38,7 @@ dependencies:
receive_intent: ^0.2.5
provider: ^6.1.2
flutter_inappwebview: ^6.0.0
flutter_inappwebview: ^6.1.2
bot_toast: ^4.1.3
intl: ^0.19.0
cached_network_image: ^3.3.1
@@ -49,6 +49,7 @@ dependencies:
pretty_qr_code: ^3.3.0
qr_code_scanner: ^1.0.1
flutter_slidable: ^3.1.1
window_manager: ^0.4.2
dev_dependencies:
flutter_launcher_icons: ^0.13.1

View File

@@ -6,9 +6,18 @@
#include "generated_plugin_registrant.h"
#include <flutter_inappwebview_windows/flutter_inappwebview_windows_plugin_c_api.h>
#include <flutter_secure_storage_windows/flutter_secure_storage_windows_plugin.h>
#include <screen_retriever/screen_retriever_plugin.h>
#include <window_manager/window_manager_plugin.h>
void RegisterPlugins(flutter::PluginRegistry* registry) {
FlutterInappwebviewWindowsPluginCApiRegisterWithRegistrar(
registry->GetRegistrarForPlugin("FlutterInappwebviewWindowsPluginCApi"));
FlutterSecureStorageWindowsPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("FlutterSecureStorageWindowsPlugin"));
ScreenRetrieverPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("ScreenRetrieverPlugin"));
WindowManagerPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("WindowManagerPlugin"));
}

View File

@@ -3,7 +3,10 @@
#
list(APPEND FLUTTER_PLUGIN_LIST
flutter_inappwebview_windows
flutter_secure_storage_windows
screen_retriever
window_manager
)
list(APPEND FLUTTER_FFI_PLUGIN_LIST