diff --git a/android/app/build.gradle b/android/app/build.gradle
index e0da0b98c..de27b90e6 100644
--- a/android/app/build.gradle
+++ b/android/app/build.gradle
@@ -37,6 +37,8 @@ android {
compileSdk project.compileSdkVersion
+ ndkVersion flutter.ndkVersion
+
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
@@ -109,7 +111,7 @@ dependencies {
implementation 'androidx.fragment:fragment-ktx:1.6.2'
implementation 'androidx.preference:preference-ktx:1.2.1'
- implementation 'com.google.android.material:material:1.10.0'
+ implementation 'com.google.android.material:material:1.11.0'
implementation 'com.github.tony19:logback-android:3.0.0'
diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml
index 3e88cfef6..d5e0587ce 100644
--- a/android/app/src/main/AndroidManifest.xml
+++ b/android/app/src/main/AndroidManifest.xml
@@ -110,6 +110,13 @@
+
+
+
\ No newline at end of file
diff --git a/android/app/src/main/kotlin/com/yubico/authenticator/MainActivity.kt b/android/app/src/main/kotlin/com/yubico/authenticator/MainActivity.kt
index ed28131a3..ea52e058b 100644
--- a/android/app/src/main/kotlin/com/yubico/authenticator/MainActivity.kt
+++ b/android/app/src/main/kotlin/com/yubico/authenticator/MainActivity.kt
@@ -37,6 +37,11 @@ import android.view.WindowManager
import androidx.activity.viewModels
import androidx.core.content.ContextCompat
import androidx.core.view.WindowCompat
+import androidx.lifecycle.ViewModelStore
+import androidx.lifecycle.ViewModelProvider
+import androidx.lifecycle.ViewModelStoreOwner
+import androidx.lifecycle.findViewTreeViewModelStoreOwner
+import androidx.lifecycle.get
import androidx.lifecycle.lifecycleScope
import com.yubico.authenticator.logging.FlutterLog
import com.yubico.authenticator.oath.AppLinkMethodChannel
@@ -48,6 +53,7 @@ import com.yubico.yubikit.android.transport.nfc.NfcNotAvailable
import com.yubico.yubikit.android.transport.nfc.NfcYubiKeyDevice
import com.yubico.yubikit.android.transport.usb.UsbConfiguration
import com.yubico.yubikit.core.YubiKeyDevice
+import io.flutter.embedding.android.FlutterActivity
import io.flutter.embedding.android.FlutterFragmentActivity
import io.flutter.embedding.engine.FlutterEngine
import io.flutter.plugin.common.BinaryMessenger
@@ -58,9 +64,20 @@ import org.slf4j.LoggerFactory
import java.io.Closeable
import java.util.concurrent.Executors
-class MainActivity : FlutterFragmentActivity() {
- private val viewModel: MainViewModel by viewModels()
- private val oathViewModel: OathViewModel by viewModels()
+class MainActivity : FlutterActivity(), ViewModelStoreOwner {
+
+ private val activityViewModelStore: ViewModelStore by lazy {
+ ViewModelStore()
+ }
+
+ override public val viewModelStore: ViewModelStore = activityViewModelStore
+
+ private val viewModel: MainViewModel by lazy {
+ ViewModelProvider(this).get(MainViewModel::class.java)
+ }
+ private val oathViewModel: OathViewModel by lazy {
+ ViewModelProvider(this).get(OathViewModel::class.java)
+ }
private val nfcConfiguration = NfcConfiguration()
diff --git a/android/build.gradle b/android/build.gradle
index d577e110d..e8ae59af8 100644
--- a/android/build.gradle
+++ b/android/build.gradle
@@ -20,7 +20,7 @@ allprojects {
}
project.ext {
- minSdkVersion = 21
+ minSdkVersion = 23
targetSdkVersion = 34
compileSdkVersion = 34
diff --git a/lib/oath/views/add_account_dialog.dart b/lib/oath/views/add_account_dialog.dart
index 06d8d7491..d390ff7ca 100644
--- a/lib/oath/views/add_account_dialog.dart
+++ b/lib/oath/views/add_account_dialog.dart
@@ -56,6 +56,7 @@ class _AddAccountDialogState extends ConsumerState {
padding: const EdgeInsets.symmetric(horizontal: 18.0),
child: FileDropTarget(
onFileDropped: (fileData) async {
+ debugPrint('onFileDropped');
Navigator.of(context).pop();
if (qrScanner != null) {
final b64Image = base64Encode(fileData);
@@ -70,6 +71,8 @@ class _AddAccountDialogState extends ConsumerState {
}
},
);
+ } else {
+ debugPrint('no QR scanner');
}
},
child: Column(
@@ -134,4 +137,16 @@ class _AddAccountDialogState extends ConsumerState {
),
));
}
+
+ @override
+ void dispose() {
+ super.dispose();
+ debugPrint('disposed :(');
+ }
+
+ @override
+ void deactivate() {
+ super.deactivate();
+ debugPrint('deactivated :(');
+ }
}
diff --git a/lib/widgets/file_drop_target.dart b/lib/widgets/file_drop_target.dart
index 70fdc5ec4..16e7e4d03 100755
--- a/lib/widgets/file_drop_target.dart
+++ b/lib/widgets/file_drop_target.dart
@@ -14,10 +14,10 @@
* limitations under the License.
*/
-import 'package:desktop_drop/desktop_drop.dart';
import 'package:flutter/material.dart';
+import 'package:super_drag_and_drop/super_drag_and_drop.dart';
-import '../core/state.dart';
+import '../android/app_methods.dart';
class FileDropTarget extends StatefulWidget {
final Widget child;
@@ -50,23 +50,58 @@ class _FileDropTargetState extends State {
);
@override
- Widget build(BuildContext context) => DropTarget(
- onDragEntered: (_) {
+ Widget build(BuildContext context) => DropRegion(
+ formats: Formats.standardFormats,
+ //hitTestBehavior: HitTestBehavior.opaque,
+ onDropEnter: (_) async {
setState(() {
_hovering = true;
});
},
- onDragExited: (_) {
+ onDropLeave: (_) {
setState(() {
_hovering = false;
});
},
- onDragDone: (details) async {
- for (final file in details.files) {
- widget.onFileDropped(await file.readAsBytes());
+ onDropEnded: (event) async {
+ setState(() {
+ _hovering = false;
+ });
+ await preserveConnectedDeviceWhenPaused();
+ },
+ onDropOver: (event) async {
+ debugPrint('onDropOver');
+ return event.session.allowedOperations.firstOrNull ??
+ DropOperation.none;
+ },
+ onPerformDrop: (PerformDropEvent event) async {
+
+ debugPrint('onPerform');
+ final reader = event.session.items.firstOrNull?.dataReader;
+ if (reader != null) {
+ if (reader.canProvide(Formats.jpeg)) {
+ debugPrint('received jpeg');
+ reader.getFile(Formats.jpeg, (file) async {
+ widget.onFileDropped(await file.readAll());
+ });
+ }
+
+ if (reader.canProvide(Formats.png)) {
+ debugPrint('received png');
+ reader.getFile(Formats.png, (file) async {
+ debugPrint('reading png data');
+ final data = await file.readAll();
+ debugPrint('have the png data: ${data.length}');
+ widget.onFileDropped(data);
+ debugPrint('leaving function');
+ }, onError: (err) {
+ debugPrint('error getting png file');
+ });
+ }
}
+ debugPrint('leaving onPerform');
},
- enable: !isAndroid,
+
child: Stack(
alignment: Alignment.center,
children: [
diff --git a/linux/flutter/generated_plugin_registrant.cc b/linux/flutter/generated_plugin_registrant.cc
index 245f7282c..9c9803501 100755
--- a/linux/flutter/generated_plugin_registrant.cc
+++ b/linux/flutter/generated_plugin_registrant.cc
@@ -6,23 +6,27 @@
#include "generated_plugin_registrant.h"
-#include
+#include
#include
#include
+#include
#include
#include
#include
void fl_register_plugins(FlPluginRegistry* registry) {
- g_autoptr(FlPluginRegistrar) desktop_drop_registrar =
- fl_plugin_registry_get_registrar_for_plugin(registry, "DesktopDropPlugin");
- desktop_drop_plugin_register_with_registrar(desktop_drop_registrar);
+ g_autoptr(FlPluginRegistrar) irondash_engine_context_registrar =
+ fl_plugin_registry_get_registrar_for_plugin(registry, "IrondashEngineContextPlugin");
+ irondash_engine_context_plugin_register_with_registrar(irondash_engine_context_registrar);
g_autoptr(FlPluginRegistrar) local_notifier_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "LocalNotifierPlugin");
local_notifier_plugin_register_with_registrar(local_notifier_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) super_native_extensions_registrar =
+ fl_plugin_registry_get_registrar_for_plugin(registry, "SuperNativeExtensionsPlugin");
+ super_native_extensions_plugin_register_with_registrar(super_native_extensions_registrar);
g_autoptr(FlPluginRegistrar) tray_manager_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "TrayManagerPlugin");
tray_manager_plugin_register_with_registrar(tray_manager_registrar);
diff --git a/linux/flutter/generated_plugins.cmake b/linux/flutter/generated_plugins.cmake
index 72bfabc39..77ba6585e 100755
--- a/linux/flutter/generated_plugins.cmake
+++ b/linux/flutter/generated_plugins.cmake
@@ -3,9 +3,10 @@
#
list(APPEND FLUTTER_PLUGIN_LIST
- desktop_drop
+ irondash_engine_context
local_notifier
screen_retriever
+ super_native_extensions
tray_manager
url_launcher_linux
window_manager
diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift
index e3df04675..3604ce28c 100755
--- a/macos/Flutter/GeneratedPluginRegistrant.swift
+++ b/macos/Flutter/GeneratedPluginRegistrant.swift
@@ -5,21 +5,25 @@
import FlutterMacOS
import Foundation
-import desktop_drop
+import device_info_plus
+import irondash_engine_context
import local_notifier
import path_provider_foundation
import screen_retriever
import shared_preferences_foundation
+import super_native_extensions
import tray_manager
import url_launcher_macos
import window_manager
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
- DesktopDropPlugin.register(with: registry.registrar(forPlugin: "DesktopDropPlugin"))
+ DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin"))
+ IrondashEngineContextPlugin.register(with: registry.registrar(forPlugin: "IrondashEngineContextPlugin"))
LocalNotifierPlugin.register(with: registry.registrar(forPlugin: "LocalNotifierPlugin"))
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
ScreenRetrieverPlugin.register(with: registry.registrar(forPlugin: "ScreenRetrieverPlugin"))
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
+ SuperNativeExtensionsPlugin.register(with: registry.registrar(forPlugin: "SuperNativeExtensionsPlugin"))
TrayManagerPlugin.register(with: registry.registrar(forPlugin: "TrayManagerPlugin"))
UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin"))
WindowManagerPlugin.register(with: registry.registrar(forPlugin: "WindowManagerPlugin"))
diff --git a/pubspec.lock b/pubspec.lock
index 028093140..63cbe3113 100644
--- a/pubspec.lock
+++ b/pubspec.lock
@@ -193,14 +193,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "3.1.1"
- cross_file:
- dependency: transitive
- description:
- name: cross_file
- sha256: fedaadfa3a6996f75211d835aaeb8fede285dae94262485698afd832371b9a5e
- url: "https://pub.dev"
- source: hosted
- version: "0.3.3+8"
crypto:
dependency: "direct main"
description:
@@ -241,14 +233,22 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.3.4"
- desktop_drop:
- dependency: "direct main"
+ device_info_plus:
+ dependency: transitive
+ description:
+ name: device_info_plus
+ sha256: "0042cb3b2a76413ea5f8a2b40cec2a33e01d0c937e91f0f7c211fde4f7739ba6"
+ url: "https://pub.dev"
+ source: hosted
+ version: "9.1.1"
+ device_info_plus_platform_interface:
+ dependency: transitive
description:
- name: desktop_drop
- sha256: d55a010fe46c8e8fcff4ea4b451a9ff84a162217bdb3b2a0aa1479776205e15d
+ name: device_info_plus_platform_interface
+ sha256: d3b01d5868b50ae571cd1dc6e502fc94d956b665756180f7b16ead09e836fd64
url: "https://pub.dev"
source: hosted
- version: "0.4.4"
+ version: "7.0.0"
fake_async:
dependency: transitive
description:
@@ -428,6 +428,22 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.0.4"
+ irondash_engine_context:
+ dependency: transitive
+ description:
+ name: irondash_engine_context
+ sha256: "0e803321935ca7af1a88f1391be9edfdb940df800353670bfc694934c7643ff3"
+ url: "https://pub.dev"
+ source: hosted
+ version: "0.4.1"
+ irondash_message_channel:
+ dependency: transitive
+ description:
+ name: irondash_message_channel
+ sha256: "500daa1fbe679f7d28a5258df3ff47dab6de352e680dc93c1ca9eae1555d8db5"
+ url: "https://pub.dev"
+ source: hosted
+ version: "0.3.1"
js:
dependency: transitive
description:
@@ -603,6 +619,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "6.0.2"
+ pixel_snap:
+ dependency: transitive
+ description:
+ name: pixel_snap
+ sha256: d31591a4f4aa8ed5dc6fc00b8d027338a5614dfbf5ca658b69d1faa7aba80af7
+ url: "https://pub.dev"
+ source: hosted
+ version: "0.1.4"
platform:
dependency: transitive
description:
@@ -839,6 +863,30 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.2.0"
+ super_clipboard:
+ dependency: transitive
+ description:
+ name: super_clipboard
+ sha256: "10774204b35b68f8dc5884ab620f83220d2c12620a8dcf4e6f39c94666f3549f"
+ url: "https://pub.dev"
+ source: hosted
+ version: "0.7.0"
+ super_drag_and_drop:
+ dependency: "direct main"
+ description:
+ name: super_drag_and_drop
+ sha256: cb884e24f75127ddfba7908808ac265249075511c72584148345b259ca99788c
+ url: "https://pub.dev"
+ source: hosted
+ version: "0.7.0"
+ super_native_extensions:
+ dependency: transitive
+ description:
+ name: super_native_extensions
+ sha256: b2fb454a90308f4f25e8ab928272490883d87a28d362307678c76989287cae43
+ url: "https://pub.dev"
+ source: hosted
+ version: "0.7.0"
sync_http:
dependency: transitive
description:
@@ -1046,6 +1094,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "5.1.1"
+ win32_registry:
+ dependency: transitive
+ description:
+ name: win32_registry
+ sha256: "41fd8a189940d8696b1b810efb9abcf60827b6cbfab90b0c43e8439e3a39d85a"
+ url: "https://pub.dev"
+ source: hosted
+ version: "1.1.2"
window_manager:
dependency: "direct main"
description:
diff --git a/pubspec.yaml b/pubspec.yaml
index 79aec45f6..1ba2fdcab 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -53,7 +53,6 @@ dependencies:
qrscanner_zxing:
path: android/flutter_plugins/qrscanner_zxing
screen_retriever: ^0.1.6
- desktop_drop: ^0.4.4
url_launcher: ^6.2.1
path_provider: ^2.1.1
vector_graphics: ^1.1.9+1
@@ -67,6 +66,7 @@ dependencies:
io: ^1.0.4
base32: ^2.1.3
convert: ^3.1.1
+ super_drag_and_drop: ^0.7.0
dev_dependencies:
integration_test:
diff --git a/windows/flutter/generated_plugin_registrant.cc b/windows/flutter/generated_plugin_registrant.cc
index 83aed1fea..584f82257 100755
--- a/windows/flutter/generated_plugin_registrant.cc
+++ b/windows/flutter/generated_plugin_registrant.cc
@@ -6,20 +6,23 @@
#include "generated_plugin_registrant.h"
-#include
+#include
#include
#include
+#include
#include
#include
#include
void RegisterPlugins(flutter::PluginRegistry* registry) {
- DesktopDropPluginRegisterWithRegistrar(
- registry->GetRegistrarForPlugin("DesktopDropPlugin"));
+ IrondashEngineContextPluginCApiRegisterWithRegistrar(
+ registry->GetRegistrarForPlugin("IrondashEngineContextPluginCApi"));
LocalNotifierPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("LocalNotifierPlugin"));
ScreenRetrieverPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("ScreenRetrieverPlugin"));
+ SuperNativeExtensionsPluginCApiRegisterWithRegistrar(
+ registry->GetRegistrarForPlugin("SuperNativeExtensionsPluginCApi"));
TrayManagerPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("TrayManagerPlugin"));
UrlLauncherWindowsRegisterWithRegistrar(
diff --git a/windows/flutter/generated_plugins.cmake b/windows/flutter/generated_plugins.cmake
index 9a6162a72..8b0918633 100755
--- a/windows/flutter/generated_plugins.cmake
+++ b/windows/flutter/generated_plugins.cmake
@@ -3,9 +3,10 @@
#
list(APPEND FLUTTER_PLUGIN_LIST
- desktop_drop
+ irondash_engine_context
local_notifier
screen_retriever
+ super_native_extensions
tray_manager
url_launcher_windows
window_manager