Add SecureStorageController
This commit is contained in:
parent
4798ae0554
commit
c3376bf780
10 changed files with 136 additions and 188 deletions
|
|
@ -10,7 +10,9 @@
|
|||
android:label="Nexus"
|
||||
android:name="${applicationName}"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:roundIcon="@mipmap/nexus_round">
|
||||
android:roundIcon="@mipmap/nexus_round"
|
||||
android:allowBackup="false"
|
||||
android:fullBackupContent="false">
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:exported="true"
|
||||
|
|
|
|||
31
flake.nix
31
flake.nix
|
|
@ -38,27 +38,30 @@
|
|||
};
|
||||
|
||||
devShells.default =
|
||||
# let
|
||||
# android = pkgs.callPackage ./nix/android.nix { };
|
||||
# in
|
||||
let
|
||||
android = pkgs.callPackage ./nix/android.nix { };
|
||||
in
|
||||
pkgs.mkShell {
|
||||
packages = with pkgs; [
|
||||
# jdk17
|
||||
jdk17
|
||||
cargo
|
||||
flutter
|
||||
# android.platform-tools
|
||||
(flutter.override { extraPkgConfigPackages = [ pkgs.libsecret ]; })
|
||||
|
||||
android.platform-tools
|
||||
(pkgs.writeShellScriptBin "rustup" (builtins.readFile ./nix/fake-rustup.sh))
|
||||
];
|
||||
env = {
|
||||
# env = rec {
|
||||
LD_LIBRARY_PATH = "${pkgs.lib.makeLibraryPath (with pkgs; [ sqlite ])}";
|
||||
|
||||
# ANDROID_HOME = "${android.androidsdk}/libexec/android-sdk";
|
||||
# ANDROID_SDK_ROOT = ANDROID_HOME;
|
||||
# JAVA_HOME = pkgs.jdk17;
|
||||
env = rec {
|
||||
LD_LIBRARY_PATH = "${pkgs.lib.makeLibraryPath ([
|
||||
pkgs.sqlite
|
||||
])}";
|
||||
|
||||
# TOOLS = "${ANDROID_HOME}/build-tools/${"36.0.0"}";
|
||||
# GRADLE_OPTS = "-Dorg.gradle.project.android.aapt2FromMavenOverride=${TOOLS}/aapt2";
|
||||
ANDROID_HOME = "${android.androidsdk}/libexec/android-sdk";
|
||||
ANDROID_SDK_ROOT = ANDROID_HOME;
|
||||
JAVA_HOME = pkgs.jdk17;
|
||||
|
||||
TOOLS = "${ANDROID_HOME}/build-tools/${"36.0.0"}";
|
||||
GRADLE_OPTS = "-Dorg.gradle.project.android.aapt2FromMavenOverride=${TOOLS}/aapt2";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ class ClientController extends AsyncNotifier<Client> {
|
|||
identifier: AuthenticationUserIdentifier(user: username),
|
||||
password: password,
|
||||
);
|
||||
//TODO: refresh
|
||||
ref.invalidateSelf();
|
||||
return true;
|
||||
} catch (_) {
|
||||
return false;
|
||||
|
|
|
|||
12
lib/controllers/secure_storage_controller.dart
Normal file
12
lib/controllers/secure_storage_controller.dart
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
import "package:matrix/matrix.dart";
|
||||
import "package:flutter_riverpod/flutter_riverpod.dart";
|
||||
import "package:simple_secure_storage/simple_secure_storage.dart";
|
||||
|
||||
class SecureStorageController extends AsyncNotifier<void> {
|
||||
@override
|
||||
Future<void> build() => SimpleSecureStorage.initialize();
|
||||
|
||||
static final provider = AsyncNotifierProvider<SecureStorageController, void>(
|
||||
SecureStorageController.new,
|
||||
);
|
||||
}
|
||||
|
|
@ -3,14 +3,13 @@ import "package:nexus/controllers/client_controller.dart";
|
|||
import "package:nexus/helpers/extension_helper.dart";
|
||||
import "package:nexus/pages/home_page.dart";
|
||||
import "package:nexus/pages/login_page.dart";
|
||||
import "package:scaled_app/scaled_app.dart";
|
||||
import "package:window_manager/window_manager.dart";
|
||||
import "package:flutter/material.dart";
|
||||
import "package:dynamic_system_colors/dynamic_system_colors.dart";
|
||||
import "package:window_size/window_size.dart";
|
||||
|
||||
void main() async {
|
||||
ScaledWidgetsFlutterBinding.ensureInitialized(scaleFactor: (size) => 1);
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
|
||||
await windowManager.ensureInitialized();
|
||||
await windowManager.waitUntilReadyToShow(
|
||||
|
|
|
|||
|
|
@ -55,24 +55,26 @@ class LoginPage extends HookConsumerWidget {
|
|||
appBar: Appbar(),
|
||||
body: Center(
|
||||
child: ConstrainedBox(
|
||||
constraints: BoxConstraints.tight(Size.fromWidth(500)),
|
||||
constraints: BoxConstraints(maxWidth: 600),
|
||||
child: ListView(
|
||||
padding: EdgeInsets.symmetric(horizontal: 16, vertical: 48),
|
||||
padding: EdgeInsets.symmetric(horizontal: 16, vertical: 64),
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
SvgPicture.asset("assets/icon.svg"),
|
||||
SizedBox(width: 12),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text("Nexus", style: theme.textTheme.displayMedium),
|
||||
Text(
|
||||
"A Simple Matrix Client",
|
||||
style: theme.textTheme.headlineMedium,
|
||||
),
|
||||
],
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text("Nexus", style: theme.textTheme.displayMedium),
|
||||
Text(
|
||||
"A Simple Matrix Client",
|
||||
style: theme.textTheme.headlineMedium,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
|
|
|||
|
|
@ -8,9 +8,10 @@
|
|||
|
||||
#include <dynamic_system_colors/dynamic_color_plugin.h>
|
||||
#include <file_selector_linux/file_selector_plugin.h>
|
||||
#include <gtk/gtk_plugin.h>
|
||||
#include <screen_retriever_linux/screen_retriever_linux_plugin.h>
|
||||
#include <simple_secure_storage_linux/simple_secure_storage_linux_plugin.h>
|
||||
#include <url_launcher_linux/url_launcher_plugin.h>
|
||||
#include <webcrypto/webcrypto_plugin.h>
|
||||
#include <window_manager/window_manager_plugin.h>
|
||||
#include <window_size/window_size_plugin.h>
|
||||
|
||||
|
|
@ -21,15 +22,18 @@ void fl_register_plugins(FlPluginRegistry* registry) {
|
|||
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);
|
||||
g_autoptr(FlPluginRegistrar) gtk_registrar =
|
||||
fl_plugin_registry_get_registrar_for_plugin(registry, "GtkPlugin");
|
||||
gtk_plugin_register_with_registrar(gtk_registrar);
|
||||
g_autoptr(FlPluginRegistrar) screen_retriever_linux_registrar =
|
||||
fl_plugin_registry_get_registrar_for_plugin(registry, "ScreenRetrieverLinuxPlugin");
|
||||
screen_retriever_linux_plugin_register_with_registrar(screen_retriever_linux_registrar);
|
||||
g_autoptr(FlPluginRegistrar) simple_secure_storage_linux_registrar =
|
||||
fl_plugin_registry_get_registrar_for_plugin(registry, "SimpleSecureStorageLinuxPlugin");
|
||||
simple_secure_storage_linux_plugin_register_with_registrar(simple_secure_storage_linux_registrar);
|
||||
g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar =
|
||||
fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin");
|
||||
url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar);
|
||||
g_autoptr(FlPluginRegistrar) webcrypto_registrar =
|
||||
fl_plugin_registry_get_registrar_for_plugin(registry, "WebcryptoPlugin");
|
||||
webcrypto_plugin_register_with_registrar(webcrypto_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);
|
||||
|
|
|
|||
|
|
@ -5,9 +5,10 @@
|
|||
list(APPEND FLUTTER_PLUGIN_LIST
|
||||
dynamic_system_colors
|
||||
file_selector_linux
|
||||
gtk
|
||||
screen_retriever_linux
|
||||
simple_secure_storage_linux
|
||||
url_launcher_linux
|
||||
webcrypto
|
||||
window_manager
|
||||
window_size
|
||||
)
|
||||
|
|
|
|||
226
pubspec.lock
226
pubspec.lock
|
|
@ -33,38 +33,6 @@ packages:
|
|||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.13.11"
|
||||
app_links:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: app_links
|
||||
sha256: "5f88447519add627fe1cbcab4fd1da3d4fed15b9baf29f28b22535c95ecee3e8"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "6.4.1"
|
||||
app_links_linux:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: app_links_linux
|
||||
sha256: f5f7173a78609f3dfd4c2ff2c95bd559ab43c80a87dc6a095921d96c05688c81
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.0.3"
|
||||
app_links_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: app_links_platform_interface
|
||||
sha256: "05f5379577c513b534a29ddea68176a4d4802c46180ee8e2e966257158772a3f"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.0.2"
|
||||
app_links_web:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: app_links_web
|
||||
sha256: af060ed76183f9e2b87510a9480e56a5352b6c249778d07bd2c95fc35632a555
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.0.4"
|
||||
archive:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
@ -664,7 +632,7 @@ packages:
|
|||
source: hosted
|
||||
version: "2.1.3"
|
||||
gpt_markdown:
|
||||
dependency: "direct main"
|
||||
dependency: transitive
|
||||
description:
|
||||
name: gpt_markdown
|
||||
sha256: "8174983f2ed7d8576d25810913e3afe3f8ffdaa3172c0c823b7cfc289b67f380"
|
||||
|
|
@ -679,14 +647,6 @@ packages:
|
|||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.3.2"
|
||||
gtk:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: gtk
|
||||
sha256: e8ce9ca4b1df106e4d72dad201d345ea1a036cc12c360f1a7d5a758f78ffa42c
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.0"
|
||||
hooks_riverpod:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
|
@ -855,6 +815,14 @@ packages:
|
|||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "4.9.0"
|
||||
just_throttle_it:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: just_throttle_it
|
||||
sha256: af2d0c1e5c7f4e0bef79a55edf3d74c180908253f89203467bc432730f5fac5b
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.0.1"
|
||||
leak_tracker:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
@ -1031,54 +999,6 @@ packages:
|
|||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.3.0"
|
||||
permission_handler:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: permission_handler
|
||||
sha256: bc917da36261b00137bbc8896bf1482169cd76f866282368948f032c8c1caae1
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "12.0.1"
|
||||
permission_handler_android:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: permission_handler_android
|
||||
sha256: "1e3bc410ca1bf84662104b100eb126e066cb55791b7451307f9708d4007350e6"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "13.0.1"
|
||||
permission_handler_apple:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: permission_handler_apple
|
||||
sha256: f000131e755c54cf4d84a5d8bd6e4149e262cc31c5a8b1d698de1ac85fa41023
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "9.4.7"
|
||||
permission_handler_html:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: permission_handler_html
|
||||
sha256: "38f000e83355abb3392140f6bc3030660cfaef189e1f87824facb76300b4ff24"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.1.3+5"
|
||||
permission_handler_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: permission_handler_platform_interface
|
||||
sha256: eb99b295153abce5d683cac8c02e22faab63e50679b937fa1bf67d58bb282878
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "4.3.0"
|
||||
permission_handler_windows:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: permission_handler_windows
|
||||
sha256: "1a790728016f79a41216d88672dbc5df30e686e811ad4e698bfc51f76ad91f1e"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.2.1"
|
||||
petitparser:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
@ -1191,14 +1111,6 @@ packages:
|
|||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.28.0"
|
||||
scaled_app:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: scaled_app
|
||||
sha256: a2ad9f22cf2200a5ce455b59c5ea7bfb09a84acfc52452d1db54f4958c99d76a
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.3.0"
|
||||
screen_retriever:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
@ -1263,62 +1175,14 @@ packages:
|
|||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.8.5+2"
|
||||
shared_preferences:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: shared_preferences
|
||||
sha256: "6e8bf70b7fef813df4e9a36f658ac46d107db4b4cfe1048b477d4e453a8159f5"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.5.3"
|
||||
shared_preferences_android:
|
||||
sembast_web:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: shared_preferences_android
|
||||
sha256: "34266009473bf71d748912da4bf62d439185226c03e01e2d9687bc65bbfcb713"
|
||||
name: sembast_web
|
||||
sha256: "0362c7c241ad6546d3e27b4cfffaae505e5a9661e238dbcdd176756cc960fe7a"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.4.15"
|
||||
shared_preferences_foundation:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: shared_preferences_foundation
|
||||
sha256: "1c33a907142607c40a7542768ec9badfd16293bac51da3a4482623d15845f88b"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.5.5"
|
||||
shared_preferences_linux:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: shared_preferences_linux
|
||||
sha256: "580abfd40f415611503cae30adf626e6656dfb2f0cee8f465ece7b6defb40f2f"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.4.1"
|
||||
shared_preferences_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: shared_preferences_platform_interface
|
||||
sha256: "57cbf196c486bc2cf1f02b85784932c6094376284b3ad5779d1b1c6c6a816b80"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.4.1"
|
||||
shared_preferences_web:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: shared_preferences_web
|
||||
sha256: c49bd060261c9a3f0ff445892695d6212ff603ef3115edbb448509d407600019
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.4.3"
|
||||
shared_preferences_windows:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: shared_preferences_windows
|
||||
sha256: "94ef0f72b2d71bc3e700e025db3710911bd51a71cefb65cc609dd0d9a982e3c1"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.4.1"
|
||||
version: "2.4.2"
|
||||
shelf:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
@ -1351,6 +1215,62 @@ packages:
|
|||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.0.0"
|
||||
simple_secure_storage:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: simple_secure_storage
|
||||
sha256: dfbfab98807687ff8b03e4b68866d24d0554a340f471b96c91cd18a18a8beabd
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.3.6"
|
||||
simple_secure_storage_android:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: simple_secure_storage_android
|
||||
sha256: "982463b42ffd96a22c97769ef1670d146f0c04c7d73d281cc1598ef0b59672cc"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.3.0"
|
||||
simple_secure_storage_darwin:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: simple_secure_storage_darwin
|
||||
sha256: "3e8aa0ac60cd5892236a74edbcdfa853bfc4f5a21fd1030272abfcf80d5fc018"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.2.1"
|
||||
simple_secure_storage_linux:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: simple_secure_storage_linux
|
||||
sha256: "67b6da9372b050acd0a64458a4db3eebd532cb3b63d33cc89ea3a430ead6f3c3"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.2.4"
|
||||
simple_secure_storage_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: simple_secure_storage_platform_interface
|
||||
sha256: eb287f3afbdfa5c505c1ddcbaff1824258c789a1f178450a23b5ae32e0300504
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.2.2"
|
||||
simple_secure_storage_web:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: simple_secure_storage_web
|
||||
sha256: "646324e57c13080e85209a91f98eafed45c6147bcdb2e4612fa62b96b19b0925"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.2.2"
|
||||
simple_secure_storage_windows:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: simple_secure_storage_windows
|
||||
sha256: "54b980ef57a7fdf436e293a6802190a8d385ada32082ec53d132784290c3d09d"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.3.1"
|
||||
sky_engine:
|
||||
dependency: transitive
|
||||
description: flutter
|
||||
|
|
@ -1692,6 +1612,14 @@ packages:
|
|||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.0.3"
|
||||
webcrypto:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: webcrypto
|
||||
sha256: e393b3d0b01694a8f81efecf278ed7392877130e6e7b29f578863e4f2d0b2ebd
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.5.8"
|
||||
webkit_inspection_protocol:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
|
|||
|
|
@ -24,11 +24,8 @@ dependencies:
|
|||
flutter_riverpod: ^3.0.3
|
||||
hooks_riverpod: ^3.0.3
|
||||
intl: ^0.20.1
|
||||
app_links: ^6.1.1
|
||||
fast_immutable_collections: ^11.0.0
|
||||
path_provider: ^2.1.3
|
||||
permission_handler: ^12.0.1
|
||||
shared_preferences: ^2.2.3
|
||||
url_launcher: ^6.2.6
|
||||
freezed_annotation: ^3.1.0
|
||||
image_picker: ^1.1.2
|
||||
|
|
@ -57,10 +54,10 @@ dependencies:
|
|||
matrix: ^3.0.2
|
||||
sqflite_common_ffi: ^2.3.6
|
||||
color_hash: ^1.0.1
|
||||
scaled_app: ^2.3.0
|
||||
flutter_vodozemac: ^0.4.1
|
||||
flutter_widget_from_html_core: ^0.17.0
|
||||
flutter_svg: ^2.2.2
|
||||
simple_secure_storage: ^0.3.6
|
||||
|
||||
dev_dependencies:
|
||||
build_runner: ^2.4.11
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue