From a5040b723603ab1edbc08492220beb1360c00c4c Mon Sep 17 00:00:00 2001 From: Dan Ballard Date: Fri, 10 Jun 2022 14:03:15 -0700 Subject: [PATCH 1/8] start of flutter3 migration, update l10n/custom_material_delegate, update cwtchNotifier to user local_notifier --- lib/cwtch/cwtchNotifier.dart | 1 + lib/l10n/custom_material_delegate.dart | 176 +++++++++++++++++++++++++ lib/notification_manager.dart | 62 ++++++++- pubspec.lock | 45 ++++--- pubspec.yaml | 10 +- 5 files changed, 268 insertions(+), 26 deletions(-) diff --git a/lib/cwtch/cwtchNotifier.dart b/lib/cwtch/cwtchNotifier.dart index 66abce25..f5f0f7d6 100644 --- a/lib/cwtch/cwtchNotifier.dart +++ b/lib/cwtch/cwtchNotifier.dart @@ -176,6 +176,7 @@ class CwtchNotifier { seenMessageCallback!(data["ProfileOnion"]!, identifier, DateTime.now().toUtc()); } + print("New Message from peer..."); if (notification == "SimpleEvent") { notificationManager.notify(notificationSimple ?? "New Message", "", 0); } else if (notification == "ContactInfo") { diff --git a/lib/l10n/custom_material_delegate.dart b/lib/l10n/custom_material_delegate.dart index d7609a60..e0cb4fe9 100644 --- a/lib/l10n/custom_material_delegate.dart +++ b/lib/l10n/custom_material_delegate.dart @@ -312,6 +312,182 @@ class MaterialLocalizationLu extends MaterialLocalizations { @override String get viewLicensesButtonLabel => 'LIZENZEN ANZEIGEN'; + // ***** NEW ***** + + @override + String get keyboardKeyAlt => 'Datum'; + + @override + String get keyboardKeyAltGraph => 'Datum'; + + @override + String get keyboardKeyBackspace => 'Datum'; + + @override + String get keyboardKeyCapsLock => 'Datum'; + + @override + String get keyboardKeyChannelDown => 'Datum'; + + @override + String get keyboardKeyChannelUp => 'Datum'; + + @override + String get keyboardKeyControl => 'Datum'; + + @override + String get keyboardKeyDelete => 'Datum'; + + @override + String get keyboardKeyEisu => 'Datum'; + + @override + String get keyboardKeyEject => 'Datum'; + + @override + String get keyboardKeyEnd => 'Datum'; + + @override + String get keyboardKeyEscape => 'Datum'; + + @override + String get keyboardKeyFn => 'Datum'; + + @override + String get keyboardKeyHangulMode => 'Datum'; + + @override + String get keyboardKeyHanjaMode => 'Datum'; + + @override + String get keyboardKeyHankaku => 'Datum'; + + @override + String get keyboardKeyHiragana => 'Datum'; + + @override + String get keyboardKeyHiraganaKatakana => 'Datum'; + + @override + String get keyboardKeyHome => 'Datum'; + + @override + String get keyboardKeyInsert => 'Datum'; + + @override + String get keyboardKeyKanaMode => 'Datum'; + + @override + String get keyboardKeyKanjiMode => 'Datum'; + + @override + String get keyboardKeyKatakana => 'Datum'; + + @override + String get keyboardKeyMeta => 'Datum'; + + @override + String get keyboardKeyMetaMacOs => 'Datum'; + + @override + String get keyboardKeyMetaWindows => 'Datum'; + + @override + String get keyboardKeyNumLock => 'Datum'; + + @override + String get keyboardKeyNumpad1 => 'Datum'; + + @override + String get keyboardKeyNumpad2 => 'Datum'; + + @override + String get keyboardKeyNumpad3 => 'Datum'; + + @override + String get keyboardKeyNumpad4 => 'Datum'; + + @override + String get keyboardKeyNumpad5 => 'Datum'; + + @override + String get keyboardKeyNumpad6 => 'Datum'; + + @override + String get keyboardKeyNumpad7 => 'Datum'; + + @override + String get keyboardKeyNumpad8 => 'Datum'; + + @override + String get keyboardKeyNumpad9 => 'Datum'; + + @override + String get keyboardKeyNumpad0 => 'Datum'; + + @override + String get keyboardKeyNumpadAdd => 'Datum'; + + @override + String get keyboardKeyNumpadComma => 'Datum'; + + @override + String get keyboardKeyNumpadDecimal => 'Datum'; + + @override + String get keyboardKeyNumpadDivide => 'Datum'; + + @override + String get keyboardKeyNumpadEnter => 'Datum'; + + @override + String get keyboardKeyNumpadEqual => 'Datum'; + + @override + String get keyboardKeyNumpadMultiply => 'Datum'; + + @override + String get keyboardKeyNumpadParenLeft => 'Datum'; + + @override + String get keyboardKeyNumpadParenRight => 'Datum'; + + @override + String get keyboardKeyNumpadSubtract => 'Datum'; + + @override + String get keyboardKeyPageDown => 'Datum'; + + @override + String get keyboardKeyPageUp => 'Datum'; + + @override + String get keyboardKeyPower => 'Datum'; + + @override + String get keyboardKeyPowerOff => 'Datum'; + + @override + String get keyboardKeyPrintScreen => 'Datum'; + + @override + String get keyboardKeyRomaji => 'Datum'; + + @override + String get keyboardKeyScrollLock => 'Datum'; + + @override + String get keyboardKeySelect => 'Datum'; + + @override + String get keyboardKeySpace => 'Datum'; + + @override + String get keyboardKeyZenkaku => 'Datum'; + + @override + String get keyboardKeyZenkakuHankaku => 'Datum'; + @override String aboutListTileTitle(String applicationName) { return aboutListTileTitleRaw.replaceFirst("$applicationName", applicationName); diff --git a/lib/notification_manager.dart b/lib/notification_manager.dart index 4e2f58d4..10ab6ee4 100644 --- a/lib/notification_manager.dart +++ b/lib/notification_manager.dart @@ -10,6 +10,8 @@ import 'package:desktop_notifications/desktop_notifications.dart' as linux_notif import 'package:flutter_local_notifications/flutter_local_notifications.dart'; import 'package:flutter_local_notifications_linux/flutter_local_notifications_linux.dart'; import 'package:flutter_local_notifications_linux/src/model/hint.dart'; +import 'package:flutter_local_notifications_linux/src/model/icon.dart'; + import 'package:path/path.dart' as path; @@ -126,32 +128,80 @@ class NotificationPayload { class NixNotificationManager implements NotificationsManager { late FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin; late Future Function(String, int) notificationSelectConvo; + late String linuxAssetsPath; + + + // Cwtch can install in non flutter supported ways on linux, this code detects where the assets are on Linux + Future detectLinuxAssetsPath() async { + //var devStat = FileStat.stat("assets"); + //var localStat = FileStat.stat("data/flutter_assets"); + var homeStat = FileStat.stat((Platform.environment["HOME"] ?? "") + "/.local/share/cwtch/data/flutter_assets"); + var rootStat = FileStat.stat("/usr/share/cwtch/data/flutter_assets"); + + /*if ((await devStat).type == FileSystemEntityType.directory) { + return Directory.current.path; //appPath; + } else if ((await localStat).type == FileSystemEntityType.directory) { + return path.join(Directory.current.path, "data/flutter_assets/"); + } else */if ((await homeStat).type == FileSystemEntityType.directory) { + return (Platform.environment["HOME"] ?? "") + "/.local/share/cwtch/data/flutter_assets/"; + } else if ((await rootStat).type == FileSystemEntityType.directory) { + return "/usr/share/cwtch/data/flutter_assets/"; + } + return ""; + } NixNotificationManager(Future Function(String, int) notificationSelectConvo) { this.notificationSelectConvo = notificationSelectConvo; flutterLocalNotificationsPlugin = FlutterLocalNotificationsPlugin(); - final MacOSInitializationSettings initializationSettingsMacOS = MacOSInitializationSettings(defaultPresentSound: false); - final LinuxInitializationSettings initializationSettingsLinux = - LinuxInitializationSettings(defaultActionName: 'Open notification', defaultIcon: AssetsLinuxIcon('assets/knott.png'), defaultSuppressSound: true); - final InitializationSettings initializationSettings = InitializationSettings(android: null, iOS: null, macOS: initializationSettingsMacOS, linux: initializationSettingsLinux); + scheduleMicrotask(() async { + + if (Platform.isLinux) { + linuxAssetsPath = await detectLinuxAssetsPath(); + print("NixNotificationManager found LinuxAssetsPath!: $linuxAssetsPath"); + } else { + linuxAssetsPath = ""; + } + + final MacOSInitializationSettings initializationSettingsMacOS = MacOSInitializationSettings(defaultPresentSound: false); + var linuxIcon = FilePathLinuxIcon( path.join(linuxAssetsPath, 'assets/knott.png')); + print("NixNotificationManager make linux settings"); + + final LinuxInitializationSettings initializationSettingsLinux = + LinuxInitializationSettings(defaultActionName: 'Open notification', defaultIcon: linuxIcon, defaultSuppressSound: true); + + print("NixNotificationManager InitializationSettings"); + + final InitializationSettings initializationSettings = InitializationSettings(android: null, iOS: null, macOS: initializationSettingsMacOS, linux: initializationSettingsLinux); + + print("NixNotificationManager mac req perms"); + flutterLocalNotificationsPlugin.resolvePlatformSpecificImplementation()?.requestPermissions( alert: true, badge: false, sound: false, ); + print("NixNotificationManager initialize..."); await flutterLocalNotificationsPlugin.initialize(initializationSettings, onSelectNotification: selectNotification); + print("NixNotificationManager initialized!!!"); }); } Future notify(String message, String profile, int conversationId) async { + print("notify if !globalAppState.focus so do? ${!globalAppState.focus}"); if (!globalAppState.focus) { + + print("do notify!"); + // Warning: Only use title field on Linux, body field will render links as clickable - await flutterLocalNotificationsPlugin.show(0, message, '', NotificationDetails(linux: LinuxNotificationDetails(suppressSound: true, category: LinuxNotificationCategory.imReceived())), + await flutterLocalNotificationsPlugin.show(0, message, '', + NotificationDetails(linux: LinuxNotificationDetails(suppressSound: true, category: LinuxNotificationCategory.imReceived(), icon: FilePathLinuxIcon(path.join(linuxAssetsPath, 'assets/knott.png')))), payload: jsonEncode(NotificationPayload(profile, conversationId))); + + print("done notify"); } } @@ -168,7 +218,7 @@ class NixNotificationManager implements NotificationsManager { NotificationsManager newDesktopNotificationsManager(Future Function(String profileOnion, int convoId) notificationSelectConvo) { if (Platform.isLinux && !Platform.isAndroid) { try { - return LinuxNotificationsManager(notificationSelectConvo); + return NixNotificationManager(notificationSelectConvo); } catch (e) { EnvironmentConfig.debugLog("Failed to create LinuxNotificationManager. Switching off notifications."); } diff --git a/pubspec.lock b/pubspec.lock index b393355b..56b9d2a4 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -28,7 +28,7 @@ packages: name: archive url: "https://pub.dartlang.org" source: hosted - version: "3.1.6" + version: "3.1.11" args: dependency: transitive description: @@ -154,7 +154,7 @@ packages: name: collection url: "https://pub.dartlang.org" source: hosted - version: "1.15.0" + version: "1.16.0" convert: dependency: transitive description: @@ -203,7 +203,7 @@ packages: name: fake_async url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "1.3.0" ffi: dependency: "direct main" description: @@ -259,16 +259,16 @@ packages: flutter_local_notifications: dependency: "direct main" description: - name: flutter_local_notifications - url: "https://pub.dartlang.org" - source: hosted - version: "9.3.2" + path: "/home/dan/src/openprivacy/flutter_local_notifications/flutter_local_notifications" + relative: false + source: path + version: "9.5.3+1" flutter_local_notifications_linux: - dependency: transitive + dependency: "direct overridden" description: - name: flutter_local_notifications_linux - url: "https://pub.dartlang.org" - source: hosted + path: "/home/dan/src/openprivacy/flutter_local_notifications/flutter_local_notifications_linux" + relative: false + source: path version: "0.4.2" flutter_local_notifications_platform_interface: dependency: transitive @@ -385,7 +385,7 @@ packages: name: js url: "https://pub.dartlang.org" source: hosted - version: "0.6.3" + version: "0.6.4" json_annotation: dependency: transitive description: @@ -407,6 +407,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.12.11" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.4" meta: dependency: transitive description: @@ -490,7 +497,7 @@ packages: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.8.0" + version: "1.8.1" path_provider: dependency: "direct main" description: @@ -553,7 +560,7 @@ packages: name: platform url: "https://pub.dartlang.org" source: hosted - version: "3.0.2" + version: "3.1.0" plugin_platform_interface: dependency: transitive description: @@ -635,7 +642,7 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.8.1" + version: "1.8.2" stack_trace: dependency: transitive description: @@ -684,7 +691,7 @@ packages: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.4.3" + version: "0.4.9" timezone: dependency: transitive description: @@ -768,14 +775,14 @@ packages: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.1.1" + version: "2.1.2" vm_service: dependency: transitive description: name: vm_service url: "https://pub.dartlang.org" source: hosted - version: "7.3.0" + version: "8.2.2" watcher: dependency: transitive description: @@ -840,5 +847,5 @@ packages: source: hosted version: "3.1.0" sdks: - dart: ">=2.15.0 <3.0.0" + dart: ">=2.17.0-0 <3.0.0" flutter: ">=2.5.0" diff --git a/pubspec.yaml b/pubspec.yaml index 022f539c..676e0aad 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -44,9 +44,17 @@ dependencies: window_manager: ^0.1.4 # notification plugins win_toast: ^0.0.2 - flutter_local_notifications: 9.3.2 + # 9.3.2 + flutter_local_notifications: + path: /home/dan/src/openprivacy/flutter_local_notifications/flutter_local_notifications + + desktop_notifications: ^0.6.3 +dependency_overrides: + flutter_local_notifications_linux: + path: /home/dan/src/openprivacy/flutter_local_notifications/flutter_local_notifications_linux + dev_dependencies: msix: ^2.1.3 flutter_gherkin: ^3.0.0-rc.9 From 03b3d86a415cfc4f88be91333d113620ef263ce9 Mon Sep 17 00:00:00 2001 From: Dan Ballard Date: Fri, 17 Jun 2022 13:24:56 -0700 Subject: [PATCH 2/8] translate lux material stuff; upgrade to fixed local notification package; upgrade provide, scrollable_position --- lib/l10n/custom_material_delegate.dart | 116 +++++++++--------- linux/flutter/generated_plugins.cmake | 8 ++ macos/Flutter/GeneratedPluginRegistrant.swift | 4 + pubspec.lock | 24 ++-- pubspec.yaml | 14 +-- windows/flutter/generated_plugins.cmake | 8 ++ 6 files changed, 93 insertions(+), 81 deletions(-) diff --git a/lib/l10n/custom_material_delegate.dart b/lib/l10n/custom_material_delegate.dart index e0cb4fe9..cd91a907 100644 --- a/lib/l10n/custom_material_delegate.dart +++ b/lib/l10n/custom_material_delegate.dart @@ -315,178 +315,178 @@ class MaterialLocalizationLu extends MaterialLocalizations { // ***** NEW ***** @override - String get keyboardKeyAlt => 'Datum'; + String get keyboardKeyAlt => 'Alt'; @override - String get keyboardKeyAltGraph => 'Datum'; + String get keyboardKeyAltGraph => 'AltGr'; @override - String get keyboardKeyBackspace => 'Datum'; + String get keyboardKeyBackspace => 'Backspace'; @override - String get keyboardKeyCapsLock => 'Datum'; + String get keyboardKeyCapsLock => 'Caps Lock'; @override - String get keyboardKeyChannelDown => 'Datum'; + String get keyboardKeyChannelDown => 'Kanal Erof'; @override - String get keyboardKeyChannelUp => 'Datum'; + String get keyboardKeyChannelUp => 'Kanal Up'; @override - String get keyboardKeyControl => 'Datum'; + String get keyboardKeyControl => 'Ctrl'; @override - String get keyboardKeyDelete => 'Datum'; + String get keyboardKeyDelete => 'Del'; @override - String get keyboardKeyEisu => 'Datum'; + String get keyboardKeyEisu => 'Eisū'; @override - String get keyboardKeyEject => 'Datum'; + String get keyboardKeyEject => 'Eject'; @override - String get keyboardKeyEnd => 'Datum'; + String get keyboardKeyEnd => 'End'; @override - String get keyboardKeyEscape => 'Datum'; + String get keyboardKeyEscape => 'Esc'; @override - String get keyboardKeyFn => 'Datum'; + String get keyboardKeyFn => 'Fn'; @override - String get keyboardKeyHangulMode => 'Datum'; + String get keyboardKeyHangulMode => 'Hangul Mode'; @override - String get keyboardKeyHanjaMode => 'Datum'; + String get keyboardKeyHanjaMode => 'Hanja Mode'; @override - String get keyboardKeyHankaku => 'Datum'; + String get keyboardKeyHankaku => 'Hankaku'; @override - String get keyboardKeyHiragana => 'Datum'; + String get keyboardKeyHiragana => 'Hiragana'; @override - String get keyboardKeyHiraganaKatakana => 'Datum'; + String get keyboardKeyHiraganaKatakana => 'Hiragana Katakana'; @override - String get keyboardKeyHome => 'Datum'; + String get keyboardKeyHome => 'Home'; @override - String get keyboardKeyInsert => 'Datum'; + String get keyboardKeyInsert => 'Insert'; @override - String get keyboardKeyKanaMode => 'Datum'; + String get keyboardKeyKanaMode => 'Kana Mode'; @override - String get keyboardKeyKanjiMode => 'Datum'; + String get keyboardKeyKanjiMode => 'Kanji Mode'; @override - String get keyboardKeyKatakana => 'Datum'; + String get keyboardKeyKatakana => 'Katakana'; @override - String get keyboardKeyMeta => 'Datum'; + String get keyboardKeyMeta => 'Meta'; @override - String get keyboardKeyMetaMacOs => 'Datum'; + String get keyboardKeyMetaMacOs => 'Command'; @override - String get keyboardKeyMetaWindows => 'Datum'; + String get keyboardKeyMetaWindows => 'Win'; @override - String get keyboardKeyNumLock => 'Datum'; + String get keyboardKeyNumLock => 'Num Lock'; @override - String get keyboardKeyNumpad1 => 'Datum'; + String get keyboardKeyNumpad0 => 'Num 0'; @override - String get keyboardKeyNumpad2 => 'Datum'; + String get keyboardKeyNumpad1 => 'Num 1'; @override - String get keyboardKeyNumpad3 => 'Datum'; + String get keyboardKeyNumpad2 => 'Num 2'; @override - String get keyboardKeyNumpad4 => 'Datum'; + String get keyboardKeyNumpad3 => 'Num 3'; @override - String get keyboardKeyNumpad5 => 'Datum'; + String get keyboardKeyNumpad4 => 'Num 4'; @override - String get keyboardKeyNumpad6 => 'Datum'; + String get keyboardKeyNumpad5 => 'Num 5'; @override - String get keyboardKeyNumpad7 => 'Datum'; + String get keyboardKeyNumpad6 => 'Num 6'; @override - String get keyboardKeyNumpad8 => 'Datum'; + String get keyboardKeyNumpad7 => 'Num 7'; @override - String get keyboardKeyNumpad9 => 'Datum'; + String get keyboardKeyNumpad8 => 'Num 8'; @override - String get keyboardKeyNumpad0 => 'Datum'; + String get keyboardKeyNumpad9 => 'Num 9'; @override - String get keyboardKeyNumpadAdd => 'Datum'; + String get keyboardKeyNumpadAdd => 'Num +'; @override - String get keyboardKeyNumpadComma => 'Datum'; + String get keyboardKeyNumpadComma => 'Num ,'; @override - String get keyboardKeyNumpadDecimal => 'Datum'; + String get keyboardKeyNumpadDecimal => 'Num .'; @override - String get keyboardKeyNumpadDivide => 'Datum'; + String get keyboardKeyNumpadDivide => 'Num /'; @override - String get keyboardKeyNumpadEnter => 'Datum'; + String get keyboardKeyNumpadEnter => 'Num Enter'; @override - String get keyboardKeyNumpadEqual => 'Datum'; + String get keyboardKeyNumpadEqual => 'Num ='; @override - String get keyboardKeyNumpadMultiply => 'Datum'; + String get keyboardKeyNumpadMultiply => 'Num *'; @override - String get keyboardKeyNumpadParenLeft => 'Datum'; + String get keyboardKeyNumpadParenLeft => 'Num ('; @override - String get keyboardKeyNumpadParenRight => 'Datum'; + String get keyboardKeyNumpadParenRight => 'Num )'; @override - String get keyboardKeyNumpadSubtract => 'Datum'; + String get keyboardKeyNumpadSubtract => 'Num -'; @override - String get keyboardKeyPageDown => 'Datum'; + String get keyboardKeyPageDown => 'PgDown'; @override - String get keyboardKeyPageUp => 'Datum'; + String get keyboardKeyPageUp => 'PgUp'; @override - String get keyboardKeyPower => 'Datum'; + String get keyboardKeyPower => 'Power'; @override - String get keyboardKeyPowerOff => 'Datum'; + String get keyboardKeyPowerOff => 'Power Off'; @override - String get keyboardKeyPrintScreen => 'Datum'; + String get keyboardKeyPrintScreen => 'Print Screen'; @override - String get keyboardKeyRomaji => 'Datum'; + String get keyboardKeyRomaji => 'Romaji'; @override - String get keyboardKeyScrollLock => 'Datum'; + String get keyboardKeyScrollLock => 'Scroll Lock'; @override - String get keyboardKeySelect => 'Datum'; + String get keyboardKeySelect => 'Select'; @override - String get keyboardKeySpace => 'Datum'; + String get keyboardKeySpace => 'Spasie'; @override - String get keyboardKeyZenkaku => 'Datum'; + String get keyboardKeyZenkaku => 'Zenkaku'; @override - String get keyboardKeyZenkakuHankaku => 'Datum'; + String get keyboardKeyZenkakuHankaku => 'Zenkaku Hankaku'; @override String aboutListTileTitle(String applicationName) { diff --git a/linux/flutter/generated_plugins.cmake b/linux/flutter/generated_plugins.cmake index ec48ebfc..ae841bb2 100644 --- a/linux/flutter/generated_plugins.cmake +++ b/linux/flutter/generated_plugins.cmake @@ -7,6 +7,9 @@ list(APPEND FLUTTER_PLUGIN_LIST window_manager ) +list(APPEND FLUTTER_FFI_PLUGIN_LIST +) + set(PLUGIN_BUNDLED_LIBRARIES) foreach(plugin ${FLUTTER_PLUGIN_LIST}) @@ -15,3 +18,8 @@ foreach(plugin ${FLUTTER_PLUGIN_LIST}) list(APPEND PLUGIN_BUNDLED_LIBRARIES $) list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) endforeach(plugin) + +foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) + add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin}) + list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) +endforeach(ffi_plugin) diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift index c7621f85..14435a7d 100644 --- a/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/macos/Flutter/GeneratedPluginRegistrant.swift @@ -5,12 +5,16 @@ import FlutterMacOS import Foundation +import flutter_local_notifications import package_info_plus_macos import path_provider_macos import url_launcher_macos +import window_manager func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { + FlutterLocalNotificationsPlugin.register(with: registry.registrar(forPlugin: "FlutterLocalNotificationsPlugin")) FLTPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FLTPackageInfoPlusPlugin")) PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin")) + WindowManagerPlugin.register(with: registry.registrar(forPlugin: "WindowManagerPlugin")) } diff --git a/pubspec.lock b/pubspec.lock index 56b9d2a4..f377f459 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -259,17 +259,17 @@ packages: flutter_local_notifications: dependency: "direct main" description: - path: "/home/dan/src/openprivacy/flutter_local_notifications/flutter_local_notifications" - relative: false - source: path - version: "9.5.3+1" + name: flutter_local_notifications + url: "https://pub.dartlang.org" + source: hosted + version: "9.6.1" flutter_local_notifications_linux: - dependency: "direct overridden" + dependency: transitive description: - path: "/home/dan/src/openprivacy/flutter_local_notifications/flutter_local_notifications_linux" - relative: false - source: path - version: "0.4.2" + name: flutter_local_notifications_linux + url: "https://pub.dartlang.org" + source: hosted + version: "0.5.0+1" flutter_local_notifications_platform_interface: dependency: transitive description: @@ -588,7 +588,7 @@ packages: name: provider url: "https://pub.dartlang.org" source: hosted - version: "5.0.0" + version: "6.0.3" pub_semver: dependency: transitive description: @@ -609,7 +609,7 @@ packages: name: scrollable_positioned_list url: "https://pub.dartlang.org" source: hosted - version: "0.2.3" + version: "0.3.2" shelf: dependency: transitive description: @@ -848,4 +848,4 @@ packages: version: "3.1.0" sdks: dart: ">=2.17.0-0 <3.0.0" - flutter: ">=2.5.0" + flutter: ">=2.12.0" diff --git a/pubspec.yaml b/pubspec.yaml index 676e0aad..f6f4a840 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -23,7 +23,7 @@ environment: dependencies: flutter: sdk: flutter - provider: 5.0.0 + provider: ^6.0.3 package_info_plus: ^1.0.0 #intl_translation: any flutter_localizations: @@ -37,24 +37,16 @@ dependencies: crypto: 3.0.1 glob: any - scrollable_positioned_list: ^0.2.0-nullsafety.0 + scrollable_positioned_list: ^0.3.2 file_picker: ^4.3.2 file_picker_desktop: ^1.1.0 url_launcher: ^6.0.18 window_manager: ^0.1.4 # notification plugins win_toast: ^0.0.2 - # 9.3.2 - flutter_local_notifications: - path: /home/dan/src/openprivacy/flutter_local_notifications/flutter_local_notifications - - + flutter_local_notifications: ^9.6.1 desktop_notifications: ^0.6.3 -dependency_overrides: - flutter_local_notifications_linux: - path: /home/dan/src/openprivacy/flutter_local_notifications/flutter_local_notifications_linux - dev_dependencies: msix: ^2.1.3 flutter_gherkin: ^3.0.0-rc.9 diff --git a/windows/flutter/generated_plugins.cmake b/windows/flutter/generated_plugins.cmake index 21bba102..aab3ee94 100644 --- a/windows/flutter/generated_plugins.cmake +++ b/windows/flutter/generated_plugins.cmake @@ -8,6 +8,9 @@ list(APPEND FLUTTER_PLUGIN_LIST window_manager ) +list(APPEND FLUTTER_FFI_PLUGIN_LIST +) + set(PLUGIN_BUNDLED_LIBRARIES) foreach(plugin ${FLUTTER_PLUGIN_LIST}) @@ -16,3 +19,8 @@ foreach(plugin ${FLUTTER_PLUGIN_LIST}) list(APPEND PLUGIN_BUNDLED_LIBRARIES $) list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) endforeach(plugin) + +foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) + add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) + list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) +endforeach(ffi_plugin) From 9857dff9a3ce63ef1ea3b6d9a08454d4e03b9a58 Mon Sep 17 00:00:00 2001 From: Dan Ballard Date: Mon, 20 Jun 2022 15:58:14 -0700 Subject: [PATCH 3/8] upgraded to flutter 3, upgraded kotlin and gradle, some deps --- android/app/build.gradle | 4 +- .../app/FlutterMultiDexApplication.java | 9 +- .../kotlin/im/cwtch/flwtch/MainActivity.kt | 13 +- android/build.gradle | 2 +- .../gradle/wrapper/gradle-wrapper.properties | 6 +- lib/cwtch/cwtchNotifier.dart | 1 - linux/flutter/generated_plugin_registrant.cc | 4 + linux/flutter/generated_plugins.cmake | 1 + macos/Flutter/GeneratedPluginRegistrant.swift | 2 + pubspec.lock | 141 ++++++++++-------- pubspec.yaml | 8 +- .../flutter/generated_plugin_registrant.cc | 3 + windows/flutter/generated_plugins.cmake | 1 + 13 files changed, 118 insertions(+), 77 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index 4899ea9e..7fc72e37 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -33,7 +33,7 @@ if (keystorePropertiesFile.exists()) { } android { - compileSdkVersion 30 + compileSdkVersion 31 sourceSets { main.java.srcDirs += 'src/main/kotlin' @@ -48,7 +48,7 @@ android { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId "im.cwtch.flwtch" minSdkVersion 16 - targetSdkVersion 30 + targetSdkVersion 31 versionCode flutterVersionCode.toInteger() versionName flutterVersionName } diff --git a/android/app/src/main/java/io/flutter/app/FlutterMultiDexApplication.java b/android/app/src/main/java/io/flutter/app/FlutterMultiDexApplication.java index 9213f130..752fc185 100644 --- a/android/app/src/main/java/io/flutter/app/FlutterMultiDexApplication.java +++ b/android/app/src/main/java/io/flutter/app/FlutterMultiDexApplication.java @@ -1,16 +1,21 @@ // Generated file. +// // If you wish to remove Flutter's multidex support, delete this entire file. +// +// Modifications to this file should be done in a copy under a different name +// as this file may be regenerated. package io.flutter.app; +import android.app.Application; import android.content.Context; import androidx.annotation.CallSuper; import androidx.multidex.MultiDex; /** - * Extension of {@link io.flutter.app.FlutterApplication}, adding multidex support. + * Extension of {@link android.app.Application}, adding multidex support. */ -public class FlutterMultiDexApplication extends FlutterApplication { +public class FlutterMultiDexApplication extends Application { @Override @CallSuper protected void attachBaseContext(Context base) { diff --git a/android/app/src/main/kotlin/im/cwtch/flwtch/MainActivity.kt b/android/app/src/main/kotlin/im/cwtch/flwtch/MainActivity.kt index 05e9f5ef..304c704e 100644 --- a/android/app/src/main/kotlin/im/cwtch/flwtch/MainActivity.kt +++ b/android/app/src/main/kotlin/im/cwtch/flwtch/MainActivity.kt @@ -536,10 +536,15 @@ class MainActivity: FlutterActivity() { Log.i("MainActivity.kt", "onResume") if (myReceiver == null) { Log.i("MainActivity.kt", "onResume registering local broadcast receiver / event bus forwarder") - val mc = MethodChannel(flutterEngine?.dartExecutor?.binaryMessenger, CWTCH_EVENTBUS) - val filter = IntentFilter("im.cwtch.flwtch.broadcast.SERVICE_EVENT_BUS") - myReceiver = MyBroadcastReceiver(mc) - LocalBroadcastManager.getInstance(applicationContext).registerReceiver(myReceiver!!, filter) + val bm = flutterEngine?.dartExecutor?.binaryMessenger; + if (bm != null) { + val mc = MethodChannel(bm, CWTCH_EVENTBUS) + + val filter = IntentFilter("im.cwtch.flwtch.broadcast.SERVICE_EVENT_BUS") + myReceiver = MyBroadcastReceiver(mc) + LocalBroadcastManager.getInstance(applicationContext) + .registerReceiver(myReceiver!!, filter) + } } // ReconnectCwtchForeground which will resync counters and settings... diff --git a/android/build.gradle b/android/build.gradle index 0827984d..23c86a79 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -1,5 +1,5 @@ buildscript { - ext.kotlin_version = '1.3.50' + ext.kotlin_version = '1.5.31' repositories { google() // jCenter() no longer exists... https://blog.gradle.org/jcenter-shutdown diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties index 296b146b..0f8346ef 100644 --- a/android/gradle/wrapper/gradle-wrapper.properties +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Fri Jun 23 08:50:38 CEST 2017 +#Mon Jun 20 10:33:21 PDT 2022 distributionBase=GRADLE_USER_HOME +distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-bin.zip distributionPath=wrapper/dists -zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip +zipStoreBase=GRADLE_USER_HOME diff --git a/lib/cwtch/cwtchNotifier.dart b/lib/cwtch/cwtchNotifier.dart index f5f0f7d6..66abce25 100644 --- a/lib/cwtch/cwtchNotifier.dart +++ b/lib/cwtch/cwtchNotifier.dart @@ -176,7 +176,6 @@ class CwtchNotifier { seenMessageCallback!(data["ProfileOnion"]!, identifier, DateTime.now().toUtc()); } - print("New Message from peer..."); if (notification == "SimpleEvent") { notificationManager.notify(notificationSimple ?? "New Message", "", 0); } else if (notification == "ContactInfo") { diff --git a/linux/flutter/generated_plugin_registrant.cc b/linux/flutter/generated_plugin_registrant.cc index 51e7cad4..0cacc750 100644 --- a/linux/flutter/generated_plugin_registrant.cc +++ b/linux/flutter/generated_plugin_registrant.cc @@ -6,10 +6,14 @@ #include "generated_plugin_registrant.h" +#include #include #include void fl_register_plugins(FlPluginRegistry* registry) { + 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) url_launcher_linux_registrar = fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin"); url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar); diff --git a/linux/flutter/generated_plugins.cmake b/linux/flutter/generated_plugins.cmake index ae841bb2..62f151fd 100644 --- a/linux/flutter/generated_plugins.cmake +++ b/linux/flutter/generated_plugins.cmake @@ -3,6 +3,7 @@ # list(APPEND FLUTTER_PLUGIN_LIST + screen_retriever url_launcher_linux window_manager ) diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift index 14435a7d..ea7ef12c 100644 --- a/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/macos/Flutter/GeneratedPluginRegistrant.swift @@ -8,6 +8,7 @@ import Foundation import flutter_local_notifications import package_info_plus_macos import path_provider_macos +import screen_retriever import url_launcher_macos import window_manager @@ -15,6 +16,7 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { FlutterLocalNotificationsPlugin.register(with: registry.registrar(forPlugin: "FlutterLocalNotificationsPlugin")) FLTPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FLTPackageInfoPlusPlugin")) PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) + ScreenRetrieverPlugin.register(with: registry.registrar(forPlugin: "ScreenRetrieverPlugin")) UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin")) WindowManagerPlugin.register(with: registry.registrar(forPlugin: "WindowManagerPlugin")) } diff --git a/pubspec.lock b/pubspec.lock index f377f459..644a5885 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -15,13 +15,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.8.0" - ansicolor: - dependency: transitive - description: - name: ansicolor - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.1" archive: dependency: transitive description: @@ -35,7 +28,7 @@ packages: name: args url: "https://pub.dartlang.org" source: hosted - version: "2.3.0" + version: "2.3.1" async: dependency: transitive description: @@ -56,7 +49,7 @@ packages: name: build url: "https://pub.dartlang.org" source: hosted - version: "2.2.1" + version: "2.3.0" build_config: dependency: transitive description: @@ -70,7 +63,7 @@ packages: name: build_daemon url: "https://pub.dartlang.org" source: hosted - version: "3.0.1" + version: "3.1.0" build_resolvers: dependency: transitive description: @@ -84,7 +77,7 @@ packages: name: build_runner url: "https://pub.dartlang.org" source: hosted - version: "2.1.7" + version: "2.1.11" build_runner_core: dependency: transitive description: @@ -105,7 +98,7 @@ packages: name: built_value url: "https://pub.dartlang.org" source: hosted - version: "8.1.4" + version: "8.3.3" characters: dependency: transitive description: @@ -127,6 +120,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.0.1" + cli_dialog: + dependency: transitive + description: + name: cli_dialog + url: "https://pub.dartlang.org" + source: hosted + version: "0.5.0" cli_util: dependency: transitive description: @@ -161,7 +161,7 @@ packages: name: convert url: "https://pub.dartlang.org" source: hosted - version: "3.0.1" + version: "3.0.2" crypto: dependency: "direct main" description: @@ -175,7 +175,14 @@ packages: name: cupertino_icons url: "https://pub.dartlang.org" source: hosted - version: "1.0.4" + version: "1.0.5" + dart_console: + dependency: transitive + description: + name: dart_console + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.0" dart_style: dependency: transitive description: @@ -189,7 +196,7 @@ packages: name: dbus url: "https://pub.dartlang.org" source: hosted - version: "0.7.1" + version: "0.7.4" desktop_notifications: dependency: "direct main" description: @@ -210,7 +217,7 @@ packages: name: ffi url: "https://pub.dartlang.org" source: hosted - version: "1.1.2" + version: "1.2.1" file: dependency: transitive description: @@ -224,7 +231,7 @@ packages: name: file_picker url: "https://pub.dartlang.org" source: hosted - version: "4.3.3" + version: "4.6.1" file_picker_desktop: dependency: "direct main" description: @@ -238,7 +245,7 @@ packages: name: fixnum url: "https://pub.dartlang.org" source: hosted - version: "1.0.0" + version: "1.0.1" flutter: dependency: "direct main" description: flutter @@ -288,7 +295,7 @@ packages: name: flutter_plugin_android_lifecycle url: "https://pub.dartlang.org" source: hosted - version: "2.0.5" + version: "2.0.6" flutter_test: dependency: transitive description: flutter @@ -305,12 +312,19 @@ packages: name: frontend_server_client url: "https://pub.dartlang.org" source: hosted - version: "2.1.2" + version: "2.1.3" fuchsia_remote_debug_protocol: dependency: transitive description: flutter source: sdk version: "0.0.0" + get_it: + dependency: transitive + description: + name: get_it + url: "https://pub.dartlang.org" + source: hosted + version: "7.2.0" gherkin: dependency: transitive description: @@ -324,7 +338,7 @@ packages: name: glob url: "https://pub.dartlang.org" source: hosted - version: "2.0.2" + version: "2.1.0" graphs: dependency: transitive description: @@ -345,21 +359,21 @@ packages: name: http_multi_server url: "https://pub.dartlang.org" source: hosted - version: "3.0.1" + version: "3.2.1" http_parser: dependency: transitive description: name: http_parser url: "https://pub.dartlang.org" source: hosted - version: "4.0.0" + version: "4.0.1" image: dependency: transitive description: name: image url: "https://pub.dartlang.org" source: hosted - version: "3.1.1" + version: "3.2.0" integration_test: dependency: transitive description: flutter @@ -392,7 +406,7 @@ packages: name: json_annotation url: "https://pub.dartlang.org" source: hosted - version: "4.4.0" + version: "4.5.0" logging: dependency: transitive description: @@ -427,14 +441,14 @@ packages: name: mime url: "https://pub.dartlang.org" source: hosted - version: "1.0.1" + version: "1.0.2" msix: dependency: "direct dev" description: name: msix url: "https://pub.dartlang.org" source: hosted - version: "2.8.3" + version: "3.6.2" nested: dependency: transitive description: @@ -448,21 +462,21 @@ packages: name: package_config url: "https://pub.dartlang.org" source: hosted - version: "2.0.2" + version: "2.1.0" package_info_plus: dependency: "direct main" description: name: package_info_plus url: "https://pub.dartlang.org" source: hosted - version: "1.3.0" + version: "1.4.2" package_info_plus_linux: dependency: transitive description: name: package_info_plus_linux url: "https://pub.dartlang.org" source: hosted - version: "1.0.3" + version: "1.0.5" package_info_plus_macos: dependency: transitive description: @@ -483,14 +497,14 @@ packages: name: package_info_plus_web url: "https://pub.dartlang.org" source: hosted - version: "1.0.4" + version: "1.0.5" package_info_plus_windows: dependency: transitive description: name: package_info_plus_windows url: "https://pub.dartlang.org" source: hosted - version: "1.0.4" + version: "1.0.5" path: dependency: transitive description: @@ -504,56 +518,56 @@ packages: name: path_provider url: "https://pub.dartlang.org" source: hosted - version: "2.0.8" + version: "2.0.11" path_provider_android: dependency: transitive description: name: path_provider_android url: "https://pub.dartlang.org" source: hosted - version: "2.0.11" + version: "2.0.15" path_provider_ios: dependency: transitive description: name: path_provider_ios url: "https://pub.dartlang.org" source: hosted - version: "2.0.7" + version: "2.0.10" path_provider_linux: dependency: transitive description: name: path_provider_linux url: "https://pub.dartlang.org" source: hosted - version: "2.1.5" + version: "2.1.7" path_provider_macos: dependency: transitive description: name: path_provider_macos url: "https://pub.dartlang.org" source: hosted - version: "2.0.5" + version: "2.0.6" path_provider_platform_interface: dependency: transitive description: name: path_provider_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "2.0.3" + version: "2.0.4" path_provider_windows: dependency: transitive description: name: path_provider_windows url: "https://pub.dartlang.org" source: hosted - version: "2.0.5" + version: "2.0.7" petitparser: dependency: transitive description: name: petitparser url: "https://pub.dartlang.org" source: hosted - version: "4.4.0" + version: "5.0.0" platform: dependency: transitive description: @@ -574,7 +588,7 @@ packages: name: pool url: "https://pub.dartlang.org" source: hosted - version: "1.5.0" + version: "1.5.1" process: dependency: transitive description: @@ -595,7 +609,7 @@ packages: name: pub_semver url: "https://pub.dartlang.org" source: hosted - version: "2.1.0" + version: "2.1.1" pubspec_parse: dependency: transitive description: @@ -603,6 +617,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.2.0" + screen_retriever: + dependency: transitive + description: + name: screen_retriever + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.2" scrollable_positioned_list: dependency: "direct main" description: @@ -616,14 +637,14 @@ packages: name: shelf url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "1.3.1" shelf_web_socket: dependency: transitive description: name: shelf_web_socket url: "https://pub.dartlang.org" source: hosted - version: "1.0.1" + version: "1.0.2" sky_engine: dependency: transitive description: flutter @@ -635,7 +656,7 @@ packages: name: source_gen url: "https://pub.dartlang.org" source: hosted - version: "1.2.1" + version: "1.2.2" source_span: dependency: transitive description: @@ -719,56 +740,56 @@ packages: name: url_launcher url: "https://pub.dartlang.org" source: hosted - version: "6.0.18" + version: "6.1.3" url_launcher_android: dependency: transitive description: name: url_launcher_android url: "https://pub.dartlang.org" source: hosted - version: "6.0.14" + version: "6.0.17" url_launcher_ios: dependency: transitive description: name: url_launcher_ios url: "https://pub.dartlang.org" source: hosted - version: "6.0.14" + version: "6.0.17" url_launcher_linux: dependency: transitive description: name: url_launcher_linux url: "https://pub.dartlang.org" source: hosted - version: "2.0.3" + version: "3.0.1" url_launcher_macos: dependency: transitive description: name: url_launcher_macos url: "https://pub.dartlang.org" source: hosted - version: "2.0.3" + version: "3.0.1" url_launcher_platform_interface: dependency: transitive description: name: url_launcher_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "2.0.5" + version: "2.1.0" url_launcher_web: dependency: transitive description: name: url_launcher_web url: "https://pub.dartlang.org" source: hosted - version: "2.0.6" + version: "2.0.12" url_launcher_windows: dependency: transitive description: name: url_launcher_windows url: "https://pub.dartlang.org" source: hosted - version: "2.0.2" + version: "3.0.1" vector_math: dependency: transitive description: @@ -796,7 +817,7 @@ packages: name: web_socket_channel url: "https://pub.dartlang.org" source: hosted - version: "2.1.0" + version: "2.2.0" webdriver: dependency: transitive description: @@ -810,7 +831,7 @@ packages: name: win32 url: "https://pub.dartlang.org" source: hosted - version: "2.3.8" + version: "2.6.1" win_toast: dependency: "direct main" description: @@ -824,7 +845,7 @@ packages: name: window_manager url: "https://pub.dartlang.org" source: hosted - version: "0.1.4" + version: "0.2.5" xdg_directories: dependency: transitive description: @@ -838,14 +859,14 @@ packages: name: xml url: "https://pub.dartlang.org" source: hosted - version: "5.3.1" + version: "6.1.0" yaml: dependency: transitive description: name: yaml url: "https://pub.dartlang.org" source: hosted - version: "3.1.0" + version: "3.1.1" sdks: - dart: ">=2.17.0-0 <3.0.0" - flutter: ">=2.12.0" + dart: ">=2.17.0 <3.0.0" + flutter: ">=3.0.0" diff --git a/pubspec.yaml b/pubspec.yaml index f6f4a840..377ffae7 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -32,23 +32,23 @@ dependencies: # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. cupertino_icons: ^1.0.0 - ffi: ^1.0.0 + ffi: ^1.2.1 path_provider: ^2.0.0 crypto: 3.0.1 glob: any scrollable_positioned_list: ^0.3.2 file_picker: ^4.3.2 - file_picker_desktop: ^1.1.0 + file_picker_desktop: ^1.1.1 url_launcher: ^6.0.18 - window_manager: ^0.1.4 + window_manager: ^0.2.5 # notification plugins win_toast: ^0.0.2 flutter_local_notifications: ^9.6.1 desktop_notifications: ^0.6.3 dev_dependencies: - msix: ^2.1.3 + msix: ^3.6.2 flutter_gherkin: ^3.0.0-rc.9 build_runner: any # integration_test: any diff --git a/windows/flutter/generated_plugin_registrant.cc b/windows/flutter/generated_plugin_registrant.cc index 0177b517..c253d427 100644 --- a/windows/flutter/generated_plugin_registrant.cc +++ b/windows/flutter/generated_plugin_registrant.cc @@ -6,11 +6,14 @@ #include "generated_plugin_registrant.h" +#include #include #include #include void RegisterPlugins(flutter::PluginRegistry* registry) { + ScreenRetrieverPluginRegisterWithRegistrar( + registry->GetRegistrarForPlugin("ScreenRetrieverPlugin")); UrlLauncherWindowsRegisterWithRegistrar( registry->GetRegistrarForPlugin("UrlLauncherWindows")); WinToastPluginRegisterWithRegistrar( diff --git a/windows/flutter/generated_plugins.cmake b/windows/flutter/generated_plugins.cmake index aab3ee94..22680c99 100644 --- a/windows/flutter/generated_plugins.cmake +++ b/windows/flutter/generated_plugins.cmake @@ -3,6 +3,7 @@ # list(APPEND FLUTTER_PLUGIN_LIST + screen_retriever url_launcher_windows win_toast window_manager From 531595e9e9bd2af0e817ce2a55876abe70539720 Mon Sep 17 00:00:00 2001 From: Dan Ballard Date: Mon, 20 Jun 2022 16:10:46 -0700 Subject: [PATCH 4/8] remove notification debugging and linux notifier --- lib/notification_manager.dart | 111 ++++++++-------------------------- 1 file changed, 24 insertions(+), 87 deletions(-) diff --git a/lib/notification_manager.dart b/lib/notification_manager.dart index 10ab6ee4..2761d457 100644 --- a/lib/notification_manager.dart +++ b/lib/notification_manager.dart @@ -57,22 +57,33 @@ class WindowsNotificationManager implements NotificationsManager { } } -// LinuxNotificationsManager uses the desktop_notifications package to implement -// the standard dbus-powered linux desktop notifications. -class LinuxNotificationsManager implements NotificationsManager { - int previous_id = 0; - late linux_notifications.NotificationsClient client; - late Future Function(String, int) notificationSelectConvo; - late String assetsPath; +class NotificationPayload { + late String profileOnion; + late int convoId; - LinuxNotificationsManager(Future Function(String, int) notificationSelectConvo) { - this.client = linux_notifications.NotificationsClient(); - this.notificationSelectConvo = notificationSelectConvo; - scheduleMicrotask(() async { - assetsPath = await detectLinuxAssetsPath(); - }); + NotificationPayload(String po, int cid) { + profileOnion = po; + convoId = cid; } + NotificationPayload.fromJson(Map json) + : profileOnion = json['profileOnion'], + convoId = json['convoId']; + + Map toJson() => { + 'profileOnion': profileOnion, + 'convoId': convoId, + }; +} + +// FlutterLocalNotificationsPlugin based NotificationManager that handles MacOS and Linux +// TODO: Windows support is being worked on, check back and migrate to that too when it lands +class NixNotificationManager implements NotificationsManager { + late FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin; + late Future Function(String, int) notificationSelectConvo; + late String linuxAssetsPath; + + // Cwtch can install in non flutter supported ways on linux, this code detects where the assets are on Linux Future detectLinuxAssetsPath() async { var devStat = FileStat.stat("assets"); @@ -92,116 +103,42 @@ class LinuxNotificationsManager implements NotificationsManager { return ""; } - Future notify(String message, String profile, int conversationId) async { - var iconPath = Uri.file(path.join(assetsPath, "assets/knott.png")); - client.notify(message, appName: "cwtch", appIcon: iconPath.toString(), replacesId: this.previous_id).then((linux_notifications.Notification value) async { - previous_id = value.id; - if ((await value.closeReason) == linux_notifications.NotificationClosedReason.dismissed) { - this.notificationSelectConvo(profile, conversationId); - } - }); - } -} - -class NotificationPayload { - late String profileOnion; - late int convoId; - - NotificationPayload(String po, int cid) { - profileOnion = po; - convoId = cid; - } - - NotificationPayload.fromJson(Map json) - : profileOnion = json['profileOnion'], - convoId = json['convoId']; - - Map toJson() => { - 'profileOnion': profileOnion, - 'convoId': convoId, - }; -} - -// FlutterLocalNotificationsPlugin based NotificationManager that handles MacOS -// Todo: work with author to allow settings of asset_path so we can use this for Linux and deprecate the LinuxNotificationManager -// Todo: it can also handle Android, do we want to migrate away from our manual solution? -class NixNotificationManager implements NotificationsManager { - late FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin; - late Future Function(String, int) notificationSelectConvo; - late String linuxAssetsPath; - - - // Cwtch can install in non flutter supported ways on linux, this code detects where the assets are on Linux - Future detectLinuxAssetsPath() async { - //var devStat = FileStat.stat("assets"); - //var localStat = FileStat.stat("data/flutter_assets"); - var homeStat = FileStat.stat((Platform.environment["HOME"] ?? "") + "/.local/share/cwtch/data/flutter_assets"); - var rootStat = FileStat.stat("/usr/share/cwtch/data/flutter_assets"); - - /*if ((await devStat).type == FileSystemEntityType.directory) { - return Directory.current.path; //appPath; - } else if ((await localStat).type == FileSystemEntityType.directory) { - return path.join(Directory.current.path, "data/flutter_assets/"); - } else */if ((await homeStat).type == FileSystemEntityType.directory) { - return (Platform.environment["HOME"] ?? "") + "/.local/share/cwtch/data/flutter_assets/"; - } else if ((await rootStat).type == FileSystemEntityType.directory) { - return "/usr/share/cwtch/data/flutter_assets/"; - } - return ""; - } - NixNotificationManager(Future Function(String, int) notificationSelectConvo) { this.notificationSelectConvo = notificationSelectConvo; flutterLocalNotificationsPlugin = FlutterLocalNotificationsPlugin(); - - scheduleMicrotask(() async { if (Platform.isLinux) { linuxAssetsPath = await detectLinuxAssetsPath(); - print("NixNotificationManager found LinuxAssetsPath!: $linuxAssetsPath"); } else { linuxAssetsPath = ""; } final MacOSInitializationSettings initializationSettingsMacOS = MacOSInitializationSettings(defaultPresentSound: false); var linuxIcon = FilePathLinuxIcon( path.join(linuxAssetsPath, 'assets/knott.png')); - print("NixNotificationManager make linux settings"); final LinuxInitializationSettings initializationSettingsLinux = LinuxInitializationSettings(defaultActionName: 'Open notification', defaultIcon: linuxIcon, defaultSuppressSound: true); - print("NixNotificationManager InitializationSettings"); - final InitializationSettings initializationSettings = InitializationSettings(android: null, iOS: null, macOS: initializationSettingsMacOS, linux: initializationSettingsLinux); - print("NixNotificationManager mac req perms"); - flutterLocalNotificationsPlugin.resolvePlatformSpecificImplementation()?.requestPermissions( alert: true, badge: false, sound: false, ); - print("NixNotificationManager initialize..."); await flutterLocalNotificationsPlugin.initialize(initializationSettings, onSelectNotification: selectNotification); - print("NixNotificationManager initialized!!!"); }); } Future notify(String message, String profile, int conversationId) async { - print("notify if !globalAppState.focus so do? ${!globalAppState.focus}"); if (!globalAppState.focus) { - - print("do notify!"); - // Warning: Only use title field on Linux, body field will render links as clickable await flutterLocalNotificationsPlugin.show(0, message, '', NotificationDetails(linux: LinuxNotificationDetails(suppressSound: true, category: LinuxNotificationCategory.imReceived(), icon: FilePathLinuxIcon(path.join(linuxAssetsPath, 'assets/knott.png')))), payload: jsonEncode(NotificationPayload(profile, conversationId))); - - print("done notify"); } } From ce5499419f696c72e901955dd26baa3ee22030b6 Mon Sep 17 00:00:00 2001 From: Dan Ballard Date: Mon, 20 Jun 2022 16:43:21 -0700 Subject: [PATCH 5/8] drone test --- .drone.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.drone.yml b/.drone.yml index 71e49b10..ebea0cd9 100644 --- a/.drone.yml +++ b/.drone.yml @@ -8,7 +8,7 @@ clone: steps: - name: clone - image: cirrusci/flutter:2.8.0 + image: cirrusci/flutter:3.0.1 environment: buildbot_key_b64: from_secret: buildbot_key_b64 @@ -24,7 +24,7 @@ steps: - git checkout $DRONE_COMMIT - name: fetch - image: cirrusci/flutter:2.8.0 + image: cirrusci/flutter:3.0.1 volumes: - name: deps path: /root/.pub-cache @@ -47,7 +47,7 @@ steps: # #Todo: fix all the lint errors and add `-set_exit_status` above to enforce linting - name: build-linux - image: openpriv/flutter-desktop:linux-fstable-2.8.0 + image: openpriv/flutter-desktop:linux-fstable-3.0.1-rc1 volumes: - name: deps path: /root/.pub-cache @@ -61,7 +61,7 @@ steps: - rm -r cwtch - name: test-build-android - image: cirrusci/flutter:2.8.0 + image: cirrusci/flutter:3.0.1 when: event: pull_request volumes: @@ -71,7 +71,7 @@ steps: - flutter build apk --debug - name: build-android - image: cirrusci/flutter:2.8.0 + image: cirrusci/flutter:3.0.1 when: event: push environment: @@ -95,7 +95,7 @@ steps: #- cp build/app/outputs/flutter-apk/app-debug.apk deploy/android - name: widget-tests - image: cirrusci/flutter:2.8.0 + image: cirrusci/flutter:3.0.1 volumes: - name: deps path: /root/.pub-cache From 914fe9c300de91776e0277fa1f185c8d516df827 Mon Sep 17 00:00:00 2001 From: Dan Ballard Date: Tue, 21 Jun 2022 11:29:31 -0700 Subject: [PATCH 6/8] updated widget goldens, cwtch label flutter 3 minute change --- test/cwtchlabel01.png | Bin 2182 -> 2193 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/test/cwtchlabel01.png b/test/cwtchlabel01.png index 75279d5418053764bc6f561565b2524b4a8a46eb..89a06c5e298e185a28ff4311f33b1676e27a77bc 100644 GIT binary patch delta 353 zcmZn@oG3WKvEJI##WAE}&f8lXeVH8v+AcxThR?Unl(Z?VhD?chq)dm`g?*@ZLMV z=jmO2hBH?$F63umVE7}?#KOR!q3poG&|rkbtVd##$vk}Wk!9(Jii+s(a@QrJ=gWV8 zz5e~?9?cmn@00I++kM(uo{>Q<|Hk`ulhl8|e)Q#|W^$(Wy}9mNx_fkIu)ViTzV{2{ zz{%z=Uwoe>^#7Z*^XjH!N=i}DNBv#4*xlM3zEAw#@ipI-zSl7(tc$w#UV-6%Z1%)Y orQDkf8UM0PZeU~;|M!jiW?|N(D(?HeK%X*ry85}Sb4q9e0IxWQ$p8QV delta 340 zcmbOz*d{o^vEIPb#WAE}&fDvTUd(|aZ5OQ*nK+$JF!?BoMfPlszG#|}`PyvD)>6)} zNl8K797zg(^ID@T?r=^n7W?q|L1Fj$mu9zxLZ|+|di2${V?o%adt9TSmZ{cf0Ne?Q#Wo{^z1PC7NLbc4*Z{el};ZwvidYoPL-kzvlRZSTdk`%T$r zm;ICy%s1WkE5h#k-$#p&UE6=NQbs9h)9qWEr|*AmcWkeC;G#WOZZU0cWc*K1 dL<8er#uv;vvu`%_=mCAl;OXk;vd$@?2>|W8fExe+ From d9acca7b1be88b1d5dd3405ed084a54b967ef748 Mon Sep 17 00:00:00 2001 From: Dan Ballard Date: Tue, 21 Jun 2022 12:43:38 -0700 Subject: [PATCH 7/8] drone flutter 3.0.1 windows --- .drone.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.drone.yml b/.drone.yml index ebea0cd9..dcd7eea6 100644 --- a/.drone.yml +++ b/.drone.yml @@ -47,7 +47,7 @@ steps: # #Todo: fix all the lint errors and add `-set_exit_status` above to enforce linting - name: build-linux - image: openpriv/flutter-desktop:linux-fstable-3.0.1-rc1 + image: openpriv/flutter-desktop:linux-fstable-3.0.1 volumes: - name: deps path: /root/.pub-cache @@ -177,7 +177,7 @@ clone: steps: - name: clone - image: openpriv/flutter-desktop:windows-sdk30-fstable-2.8.1 + image: openpriv/flutter-desktop:windows-sdk30-fstable-3.0.1 environment: buildbot_key_b64: from_secret: buildbot_key_b64 @@ -195,7 +195,7 @@ steps: - git checkout $Env:DRONE_COMMIT - name: fetch - image: openpriv/flutter-desktop:windows-sdk30-fstable-2.8.1 + image: openpriv/flutter-desktop:windows-sdk30-fstable-3.0.1 commands: - git describe --tags --abbrev=1 > VERSION - powershell -command "Get-Date -Format 'yyyy-MM-dd-HH-mm'" > BUILDDATE @@ -203,7 +203,7 @@ steps: - .\fetch-libcwtch-go.ps1 - name: build-windows - image: openpriv/flutter-desktop:windows-sdk30-fstable-2.8.1 + image: openpriv/flutter-desktop:windows-sdk30-fstable-3.0.1 commands: - flutter pub get - $Env:version += type .\VERSION @@ -260,7 +260,7 @@ steps: - move *.sha512 deploy\$Env:builddir - name: deploy-windows - image: openpriv/flutter-desktop:windows-sdk30-fstable-2.8.1 + image: openpriv/flutter-desktop:windows-sdk30-fstable-3.0.1 when: event: push status: [ success ] From c7e6cfcbc14f0297adc84491a49279c8d85dab77 Mon Sep 17 00:00:00 2001 From: Dan Ballard Date: Tue, 21 Jun 2022 16:58:02 -0400 Subject: [PATCH 8/8] macos podfile lock update for flutter 3 --- macos/Podfile.lock | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/macos/Podfile.lock b/macos/Podfile.lock index e792cbf8..5ead0ac0 100644 --- a/macos/Podfile.lock +++ b/macos/Podfile.lock @@ -1,33 +1,51 @@ PODS: + - flutter_local_notifications (0.0.1): + - FlutterMacOS - FlutterMacOS (1.0.0) - package_info_plus_macos (0.0.1): - FlutterMacOS - path_provider_macos (0.0.1): - FlutterMacOS + - screen_retriever (0.0.1): + - FlutterMacOS - url_launcher_macos (0.0.1): - FlutterMacOS + - window_manager (0.2.0): + - FlutterMacOS DEPENDENCIES: + - flutter_local_notifications (from `Flutter/ephemeral/.symlinks/plugins/flutter_local_notifications/macos`) - FlutterMacOS (from `Flutter/ephemeral`) - package_info_plus_macos (from `Flutter/ephemeral/.symlinks/plugins/package_info_plus_macos/macos`) - path_provider_macos (from `Flutter/ephemeral/.symlinks/plugins/path_provider_macos/macos`) + - screen_retriever (from `Flutter/ephemeral/.symlinks/plugins/screen_retriever/macos`) - url_launcher_macos (from `Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos`) + - window_manager (from `Flutter/ephemeral/.symlinks/plugins/window_manager/macos`) EXTERNAL SOURCES: + flutter_local_notifications: + :path: Flutter/ephemeral/.symlinks/plugins/flutter_local_notifications/macos FlutterMacOS: :path: Flutter/ephemeral package_info_plus_macos: :path: Flutter/ephemeral/.symlinks/plugins/package_info_plus_macos/macos path_provider_macos: :path: Flutter/ephemeral/.symlinks/plugins/path_provider_macos/macos + screen_retriever: + :path: Flutter/ephemeral/.symlinks/plugins/screen_retriever/macos url_launcher_macos: :path: Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos + window_manager: + :path: Flutter/ephemeral/.symlinks/plugins/window_manager/macos SPEC CHECKSUMS: + flutter_local_notifications: 3805ca215b2fb7f397d78b66db91f6a747af52e4 FlutterMacOS: 57701585bf7de1b3fc2bb61f6378d73bbdea8424 package_info_plus_macos: f010621b07802a241d96d01876d6705f15e77c1c - path_provider_macos: a0a3fd666cb7cd0448e936fb4abad4052961002b - url_launcher_macos: 45af3d61de06997666568a7149c1be98b41c95d4 + path_provider_macos: 3c0c3b4b0d4a76d2bf989a913c2de869c5641a19 + screen_retriever: 59634572a57080243dd1bf715e55b6c54f241a38 + url_launcher_macos: 597e05b8e514239626bcf4a850fcf9ef5c856ec3 + window_manager: 3a1844359a6295ab1e47659b1a777e36773cd6e8 PODFILE CHECKSUM: 6eac6b3292e5142cfc23bdeb71848a40ec51c14c