100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps
Java asset-managementbuildingdashboarddataplatformdevice-managementedge-computingenergyenergy-managementenergy-monitorfleet-managementfleet-telematicsiotiot-applicationiot-platformmodbusmqttmqtt-brokerota-updaterules-enginesmartcity
Added FCM. Still need to implement message receive functions
Michael Rademakere86f18f03cb2
diff --git a/console/generic_app/android/app/build.gradle b/console/generic_app/android/app/build.gradleindex 27e76355b..6d92be6b6 100644--- a/console/generic_app/android/app/build.gradle+++ b/console/generic_app/android/app/build.gradle@@ -73,6 +73,7 @@ flutter {dependencies {implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"+ implementation 'com.google.firebase:firebase-messaging:20.2.4"testImplementation 'junit:junit:4.12'androidTestImplementation 'androidx.test:runner:1.1.1'androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'diff --git a/console/generic_app/android/app/src/main/AndroidManifest.xml b/console/generic_app/android/app/src/main/AndroidManifest.xmlindex 7231a184a..8c9cad401 100644--- a/console/generic_app/android/app/src/main/AndroidManifest.xml+++ b/console/generic_app/android/app/src/main/AndroidManifest.xml@@ -12,9 +12,10 @@<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" /><application- android:name="io.flutter.app.FlutterApplication"+ android:name=".Application"android:label="OpenRemote"- android:icon="@mipmap/launcher_icon">+ android:icon="@mipmap/launcher_icon"+ android:usesCleartextTraffic="true"><activityandroid:name=".MainActivity"android:launchMode="singleTop"diff --git a/console/generic_app/android/app/src/main/kotlin/io/openremote/generic_app/Application.kts b/console/generic_app/android/app/src/main/kotlin/io/openremote/generic_app/Application.ktsnew file mode 100644index 000000000..294fa22d7--- /dev/null+++ b/console/generic_app/android/app/src/main/kotlin/io/openremote/generic_app/Application.kts@@ -0,0 +1,20 @@+package io.openremote.generic_app++import io.flutter.app.FlutterApplication+import io.flutter.plugin.common.PluginRegistry+import io.flutter.plugin.common.PluginRegistry.PluginRegistrantCallback+import io.flutter.plugins.GeneratedPluginRegistrant+import io.flutter.plugins.firebasemessaging.FlutterFirebaseMessagingService++class Application : FlutterApplication(), PluginRegistrantCallback {+ @Override+ fun onCreate() {+ super.onCreate()+ FlutterFirebaseMessagingService.setPluginRegistrant(this)+ }++ @Override+ fun registerWith(registry: PluginRegistry?) {+ GeneratedPluginRegistrant.registerWith(registry)+ }+}diff --git a/console/generic_app/android/build.gradle b/console/generic_app/android/build.gradleindex 9e5ef632c..f925c0493 100644--- a/console/generic_app/android/build.gradle+++ b/console/generic_app/android/build.gradle@@ -8,7 +8,7 @@ buildscript {dependencies {classpath 'com.android.tools.build:gradle:3.5.3'classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"- classpath 'com.google.gms:google-services:4.2.0'+ classpath 'com.google.gms:google-services:4.3.2'}}diff --git a/console/generic_app/ios/Podfile b/console/generic_app/ios/Podfileindex e7ea559bc..e72e0b480 100644--- a/console/generic_app/ios/Podfile+++ b/console/generic_app/ios/Podfile@@ -1,5 +1,5 @@# Uncomment this line to define a global platform for your project-platform :ios, '13.0'+# platform :ios, '13.0'# CocoaPods analytics sends network stats synchronously affecting flutter build latency.ENV['COCOAPODS_DISABLE_STATS'] = 'true'@@ -10,79 +10,32 @@ project 'Runner', {'Release' => :release,}-def parse_KV_file(file, separator='=')- file_abs_path = File.expand_path(file)- if !File.exists? file_abs_path- return [];+def flutter_root+ generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)+ unless File.exist?(generated_xcode_build_settings_path)+ raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"end- generated_key_values = {}- skip_line_start_symbols = ["#", "/"]- File.foreach(file_abs_path) do |line|- next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ }- plugin = line.split(pattern=separator)- if plugin.length == 2- podname = plugin[0].strip()- path = plugin[1].strip()- podpath = File.expand_path("#{path}", file_abs_path)- generated_key_values[podname] = podpath- else- puts "Invalid plugin specification: #{line}"- end++ File.foreach(generated_xcode_build_settings_path) do |line|+ matches = line.match(/FLUTTER_ROOT\=(.*)/)+ return matches[1].strip if matchesend- generated_key_values+ raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"end+require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)++flutter_ios_podfile_setup+target 'Runner' douse_frameworks!use_modular_headers!- # Flutter Pod-- copied_flutter_dir = File.join(__dir__, 'Flutter')- copied_framework_path = File.join(copied_flutter_dir, 'Flutter.framework')- copied_podspec_path = File.join(copied_flutter_dir, 'Flutter.podspec')- unless File.exist?(copied_framework_path) && File.exist?(copied_podspec_path)- # Copy Flutter.framework and Flutter.podspec to Flutter/ to have something to link against if the xcode backend script has not run yet.- # That script will copy the correct debug/profile/release version of the framework based on the currently selected Xcode configuration.- # CocoaPods will not embed the framework on pod install (before any build phases can generate) if the dylib does not exist.-- generated_xcode_build_settings_path = File.join(copied_flutter_dir, 'Generated.xcconfig')- unless File.exist?(generated_xcode_build_settings_path)- raise "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter pub get is executed first"- end- generated_xcode_build_settings = parse_KV_file(generated_xcode_build_settings_path)- cached_framework_dir = generated_xcode_build_settings['FLUTTER_FRAMEWORK_DIR'];-- unless File.exist?(copied_framework_path)- FileUtils.cp_r(File.join(cached_framework_dir, 'Flutter.framework'), copied_flutter_dir)- end- unless File.exist?(copied_podspec_path)- FileUtils.cp(File.join(cached_framework_dir, 'Flutter.podspec'), copied_flutter_dir)- end- end-- # Keep pod path relative so it can be checked into Podfile.lock.- pod 'Flutter', :path => 'Flutter'-- # Plugin Pods-- # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock- # referring to absolute paths on developers' machines.- system('rm -rf .symlinks')- system('mkdir -p .symlinks/plugins')- plugin_pods = parse_KV_file('../.flutter-plugins')- plugin_pods.each do |name, path|- symlink = File.join('.symlinks', 'plugins', name)- File.symlink(path, symlink)- pod name, :path => File.join(symlink, 'ios')- end+ flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))endpost_install do |installer|installer.pods_project.targets.each do |target|- target.build_configurations.each do |config|- config.build_settings['ENABLE_BITCODE'] = 'NO'- config.build_settings['DEBUG_INFORMATION_FORMAT'] = 'dwarf'- end+ flutter_additional_ios_build_settings(target)endenddiff --git a/console/generic_app/ios/Podfile.lock b/console/generic_app/ios/Podfile.lockindex 4b645378c..930649a51 100644--- a/console/generic_app/ios/Podfile.lock+++ b/console/generic_app/ios/Podfile.lock@@ -1,39 +1,30 @@PODS:- - Firebase/Core (6.24.0):+ - Firebase/CoreOnly (6.26.0):+ - FirebaseCore (= 6.7.2)+ - Firebase/Messaging (6.26.0):- Firebase/CoreOnly- - FirebaseAnalytics (= 6.5.0)- - Firebase/CoreOnly (6.24.0):- - FirebaseCore (= 6.7.0)- - Firebase/Messaging (6.24.0):- - Firebase/CoreOnly- - FirebaseMessaging (~> 4.4.0)- - firebase_messaging (0.0.1):- - Firebase/Core- - Firebase/Messaging+ - FirebaseMessaging (~> 4.4.1)+ - firebase_core (0.5.0):+ - Firebase/CoreOnly (~> 6.26.0)+ - Flutter+ - firebase_messaging (7.0.0):+ - Firebase/CoreOnly (~> 6.26.0)+ - Firebase/Messaging (~> 6.26.0)+ - firebase_core- Flutter- - FirebaseAnalytics (6.5.0):- - FirebaseCore (~> 6.7)- - FirebaseInstallations (~> 1.2)- - GoogleAppMeasurement (= 6.5.0)- - GoogleUtilities/AppDelegateSwizzler (~> 6.0)- - GoogleUtilities/MethodSwizzler (~> 6.0)- - GoogleUtilities/Network (~> 6.0)- - "GoogleUtilities/NSData+zlib (~> 6.0)"- - nanopb (~> 1.30905.0)- FirebaseAnalyticsInterop (1.5.0)- - FirebaseCore (6.7.0):+ - FirebaseCore (6.7.2):- FirebaseCoreDiagnostics (~> 1.3)- FirebaseCoreDiagnosticsInterop (~> 1.2)- GoogleUtilities/Environment (~> 6.5)- GoogleUtilities/Logger (~> 6.5)- - FirebaseCoreDiagnostics (1.3.0):- - FirebaseCoreDiagnosticsInterop (~> 1.2)- - GoogleDataTransportCCTSupport (~> 3.1)- - GoogleUtilities/Environment (~> 6.5)- - GoogleUtilities/Logger (~> 6.5)- - nanopb (~> 1.30905.0)+ - FirebaseCoreDiagnostics (1.6.0):+ - GoogleDataTransport (~> 7.2)+ - GoogleUtilities/Environment (~> 6.7)+ - GoogleUtilities/Logger (~> 6.7)+ - nanopb (~> 1.30906.0)- FirebaseCoreDiagnosticsInterop (1.2.0)- - FirebaseInstallations (1.2.0):+ - FirebaseInstallations (1.3.0):- FirebaseCore (~> 6.6)- GoogleUtilities/Environment (~> 6.6)- GoogleUtilities/UserDefaults (~> 6.6)@@ -43,7 +34,7 @@ PODS:- FirebaseInstallations (~> 1.0)- GoogleUtilities/Environment (~> 6.5)- GoogleUtilities/UserDefaults (~> 6.5)- - FirebaseMessaging (4.4.0):+ - FirebaseMessaging (4.4.1):- FirebaseAnalyticsInterop (~> 1.5)- FirebaseCore (~> 6.6)- FirebaseInstanceID (~> 4.3)@@ -55,76 +46,57 @@ PODS:- Flutter (1.0.0)- flutter_geofence (0.1.1):- Flutter- - GoogleAppMeasurement (6.5.0):- - GoogleUtilities/AppDelegateSwizzler (~> 6.0)- - GoogleUtilities/MethodSwizzler (~> 6.0)- - GoogleUtilities/Network (~> 6.0)- - "GoogleUtilities/NSData+zlib (~> 6.0)"- - nanopb (~> 1.30905.0)- - GoogleDataTransport (6.1.0)- - GoogleDataTransportCCTSupport (3.1.0):- - GoogleDataTransport (~> 6.1)- - nanopb (~> 1.30905.0)- - GoogleUtilities/AppDelegateSwizzler (6.6.0):+ - GoogleDataTransport (7.3.0):+ - nanopb (~> 1.30906.0)+ - GoogleUtilities/AppDelegateSwizzler (6.7.2):- GoogleUtilities/Environment- GoogleUtilities/Logger- GoogleUtilities/Network- - GoogleUtilities/Environment (6.6.0):+ - GoogleUtilities/Environment (6.7.2):- PromisesObjC (~> 1.2)- - GoogleUtilities/Logger (6.6.0):+ - GoogleUtilities/Logger (6.7.2):- GoogleUtilities/Environment- - GoogleUtilities/MethodSwizzler (6.6.0):- - GoogleUtilities/Logger- - GoogleUtilities/Network (6.6.0):+ - GoogleUtilities/Network (6.7.2):- GoogleUtilities/Logger- "GoogleUtilities/NSData+zlib"- GoogleUtilities/Reachability- - "GoogleUtilities/NSData+zlib (6.6.0)"- - GoogleUtilities/Reachability (6.6.0):+ - "GoogleUtilities/NSData+zlib (6.7.2)"+ - GoogleUtilities/Reachability (6.7.2):- GoogleUtilities/Logger- - GoogleUtilities/UserDefaults (6.6.0):+ - GoogleUtilities/UserDefaults (6.7.2):- GoogleUtilities/Logger- location (0.0.1):- Flutter- - location_web (0.0.1):- - Flutter- - nanopb (1.30905.0):- - nanopb/decode (= 1.30905.0)- - nanopb/encode (= 1.30905.0)- - nanopb/decode (1.30905.0)- - nanopb/encode (1.30905.0)+ - nanopb (1.30906.0):+ - nanopb/decode (= 1.30906.0)+ - nanopb/encode (= 1.30906.0)+ - nanopb/decode (1.30906.0)+ - nanopb/encode (1.30906.0)- "permission_handler (5.0.1+1)":- Flutter- - PromisesObjC (1.2.8)- - Protobuf (3.11.4)+ - PromisesObjC (1.2.10)+ - Protobuf (3.13.0)- quick_actions (0.0.1):- Flutter- shared_preferences (0.0.1):- Flutter- - shared_preferences_macos (0.0.1):- - Flutter- - shared_preferences_web (0.0.1):- - Flutter- webview_flutter (0.0.1):- FlutterDEPENDENCIES:+ - firebase_core (from `.symlinks/plugins/firebase_core/ios`)- firebase_messaging (from `.symlinks/plugins/firebase_messaging/ios`)- Flutter (from `Flutter`)- flutter_geofence (from `.symlinks/plugins/flutter_geofence/ios`)- location (from `.symlinks/plugins/location/ios`)- - location_web (from `.symlinks/plugins/location_web/ios`)- permission_handler (from `.symlinks/plugins/permission_handler/ios`)- quick_actions (from `.symlinks/plugins/quick_actions/ios`)- shared_preferences (from `.symlinks/plugins/shared_preferences/ios`)- - shared_preferences_macos (from `.symlinks/plugins/shared_preferences_macos/ios`)- - shared_preferences_web (from `.symlinks/plugins/shared_preferences_web/ios`)- webview_flutter (from `.symlinks/plugins/webview_flutter/ios`)SPEC REPOS:trunk:- Firebase- - FirebaseAnalytics- FirebaseAnalyticsInterop- FirebaseCore- FirebaseCoreDiagnostics@@ -132,15 +104,15 @@ SPEC REPOS:- FirebaseInstallations- FirebaseInstanceID- FirebaseMessaging- - GoogleAppMeasurement- GoogleDataTransport- - GoogleDataTransportCCTSupport- GoogleUtilities- nanopb- PromisesObjC- ProtobufEXTERNAL SOURCES:+ firebase_core:+ :path: ".symlinks/plugins/firebase_core/ios"firebase_messaging::path: ".symlinks/plugins/firebase_messaging/ios"Flutter:@@ -149,50 +121,39 @@ EXTERNAL SOURCES::path: ".symlinks/plugins/flutter_geofence/ios"location::path: ".symlinks/plugins/location/ios"- location_web:- :path: ".symlinks/plugins/location_web/ios"permission_handler::path: ".symlinks/plugins/permission_handler/ios"quick_actions::path: ".symlinks/plugins/quick_actions/ios"shared_preferences::path: ".symlinks/plugins/shared_preferences/ios"- shared_preferences_macos:- :path: ".symlinks/plugins/shared_preferences_macos/ios"- shared_preferences_web:- :path: ".symlinks/plugins/shared_preferences_web/ios"webview_flutter::path: ".symlinks/plugins/webview_flutter/ios"SPEC CHECKSUMS:- Firebase: b28e55c60efd98963cd9011fe2fac5a10c2ba124- firebase_messaging: b8543d17dd9825f4f24a585477f77db103e5228e- FirebaseAnalytics: 7386fc2176e3f93ad8ef34b5b1f2b33a891e4962+ Firebase: 7cf5f9c67f03cb3b606d1d6535286e1080e57eb6+ firebase_core: 3134fe79d257d430f163b558caf52a10a87efe8a+ firebase_messaging: 6061cbdfe4463502a0d4d7049820c25d1757a095FirebaseAnalyticsInterop: 3f86269c38ae41f47afeb43ebf32a001f58fcdae- FirebaseCore: e610482f64097b0e9f056cd97bc6b33dfabcbb6a- FirebaseCoreDiagnostics: 4a773a47bd83bbd5a9b1ccf1ce7caa8b2d535e67+ FirebaseCore: f42e5e5f382cdcf6b617ed737bf6c871a6947b17+ FirebaseCoreDiagnostics: 7415bfb3883b3500c5a95c42b6ba66baae78f600FirebaseCoreDiagnosticsInterop: 296e2c5f5314500a850ad0b83e9e7c10b011a850- FirebaseInstallations: 2119fb3e46b0a88bfdbf12562f855ee3252462fa+ FirebaseInstallations: 6f5f680e65dc374397a483c32d1799ba822a395bFirebaseInstanceID: cef67c4967c7cecb56ea65d8acbb4834825c587b- FirebaseMessaging: 58cb17277641a0084d98d4951ba1f1fb0588c8c6+ FirebaseMessaging: 29543feb343b09546ab3aa04d008ee8595b43c44Flutter: 0e3d915762c693b495b44d77113d4970485de6ecflutter_geofence: 08e5427c56c540ffac97425b8e10dd598912fb3d- GoogleAppMeasurement: 4c644d86835d827bab30ab6aabb9ecaf1f500735- GoogleDataTransport: f6f8eba931df03ebd2232ff4645aa85f8f47b5ab- GoogleDataTransportCCTSupport: d70a561f7d236af529fee598835caad5e25f6d3d- GoogleUtilities: 39530bc0ad980530298e9c4af8549e991fd033b1+ GoogleDataTransport: e85fb700c9b027079ce182c3d08e12e0f9618bb4+ GoogleUtilities: 7f2f5a07f888cdb145101d6042bc4422f57e70b3location: 3a2eed4dd2fab25e7b7baf2a9efefe82b512d740- location_web: b94e7433cfe28c0f7c8923c2ee482824b32e55a7- nanopb: c43f40fadfe79e8b8db116583945847910cbabc9+ nanopb: 59317e09cf1f1a0af72f12af412d54edf52603fcpermission_handler: eac8e15b4a1a3fba55b761d19f3f4e6b005d15b6- PromisesObjC: c119f3cd559f50b7ae681fa59dc1acd19173b7e6- Protobuf: 176220c526ad8bd09ab1fb40a978eac3fef665f7+ PromisesObjC: b14b1c6b68e306650688599de8a45e49fae81151+ Protobuf: 3dac39b34a08151c6d949560efe3f86134a3f748quick_actions: 6cb2390c4dab0e737c94573c27e18d9666710720shared_preferences: af6bfa751691cdc24be3045c43ec037377ada40d- shared_preferences_macos: f3f29b71ccbb56bf40c9dd6396c9acf15e214087- shared_preferences_web: 141cce0c3ed1a1c5bf2a0e44f52d31eeb66e5ea9webview_flutter: d2b4d6c66968ad042ad94cbb791f5b72b4678a96-PODFILE CHECKSUM: b719112225baeacc281d00c2f06c118c38b6b580+PODFILE CHECKSUM: 0dbd5a87e0ace00c9610d2037ac22083a01f861dCOCOAPODS: 1.9.1diff --git a/console/generic_app/ios/Runner.xcodeproj/project.pbxproj b/console/generic_app/ios/Runner.xcodeproj/project.pbxprojindex d889a994f..7fb923090 100644--- a/console/generic_app/ios/Runner.xcodeproj/project.pbxproj+++ b/console/generic_app/ios/Runner.xcodeproj/project.pbxproj@@ -272,7 +272,7 @@"${PODS_ROOT}/../Flutter/Flutter.framework","${BUILT_PRODUCTS_DIR}/GoogleUtilities/GoogleUtilities.framework","${BUILT_PRODUCTS_DIR}/PromisesObjC/FBLPromises.framework",- "${BUILT_PRODUCTS_DIR}/Protobuf/protobuf.framework",+ "${BUILT_PRODUCTS_DIR}/Protobuf/Protobuf.framework","${BUILT_PRODUCTS_DIR}/flutter_geofence/flutter_geofence.framework","${BUILT_PRODUCTS_DIR}/location/location.framework","${BUILT_PRODUCTS_DIR}/nanopb/nanopb.framework",@@ -285,7 +285,7 @@"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Flutter.framework","${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/GoogleUtilities.framework","${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FBLPromises.framework",- "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/protobuf.framework",+ "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Protobuf.framework","${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/flutter_geofence.framework","${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/location.framework","${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/nanopb.framework",@@ -334,7 +334,6 @@/* Begin XCBuildConfiguration section */249021D3217E4FDB00AE95B9 /* Profile */ = {isa = XCBuildConfiguration;- baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;buildSettings = {ALWAYS_SEARCH_USER_PATHS = NO;CLANG_ANALYZER_NONNULL = YES;@@ -414,7 +413,6 @@};97C147031CF9000F007C117D /* Debug */ = {isa = XCBuildConfiguration;- baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;buildSettings = {ALWAYS_SEARCH_USER_PATHS = NO;CLANG_ANALYZER_NONNULL = YES;@@ -470,7 +468,6 @@};97C147041CF9000F007C117D /* Release */ = {isa = XCBuildConfiguration;- baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;buildSettings = {ALWAYS_SEARCH_USER_PATHS = NO;CLANG_ANALYZER_NONNULL = YES;diff --git a/console/generic_app/lib/main.dart b/console/generic_app/lib/main.dartindex ead0dd6ed..e9ca03db9 100644--- a/console/generic_app/lib/main.dart+++ b/console/generic_app/lib/main.dart@@ -1,13 +1,16 @@import 'package:flutter/material.dart';import 'package:flutter/services.dart';import 'package:flutter_localizations/flutter_localizations.dart';+import 'package:generic_app/services/PushNotificationService.dart';import 'package:generic_app/ui/SplashPage.dart';import 'generated/l10n.dart';void main() {WidgetsFlutterBinding.ensureInitialized();SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp])- .then((_) {+ .then((_) async {+ PushNotificationService pushNotificationService = new PushNotificationService();+ await pushNotificationService.initialise();runApp(new ORApp());});}@@ -17,6 +20,7 @@ class ORApp extends StatelessWidget {@overrideWidget build(BuildContext context) {return MaterialApp(+ debugShowCheckedModeBanner: false,navigatorKey: navigatorKey,title: 'OR App',theme: ThemeData(diff --git a/console/generic_app/lib/services/PushNotificationService.dart b/console/generic_app/lib/services/PushNotificationService.dartnew file mode 100644index 000000000..ae20eb61c--- /dev/null+++ b/console/generic_app/lib/services/PushNotificationService.dart@@ -0,0 +1,36 @@+import 'dart:io';++import 'package:firebase_messaging/firebase_messaging.dart';++Future<dynamic> myBackgroundMessageHandler(Map<String, dynamic> message) async {+ if (message.containsKey('data')) {+ // Handle data message+ final dynamic data = message['data'];+ }++ if (message.containsKey('notification')) {+ // Handle notification message+ final dynamic notification = message['notification'];+ }++ // Or do other work.+}++class PushNotificationService {+ final FirebaseMessaging _fcm = FirebaseMessaging();++ Future initialise() async {+ _fcm.configure(+ onMessage: (Map<String, dynamic> message) async {+ print("onMessage: $message");+ },+ onLaunch: (Map<String, dynamic> message) async {+ print("onLaunch: $message");+ },+ onResume: (Map<String, dynamic> message) async {+ print("onResume: $message");+ },+ onBackgroundMessage: Platform.isIOS ? null : myBackgroundMessageHandler,+ );+ }+}diff --git a/console/generic_app/pubspec.lock b/console/generic_app/pubspec.lockindex e5eb83324..e90ad15da 100644--- a/console/generic_app/pubspec.lock+++ b/console/generic_app/pubspec.lock@@ -35,7 +35,7 @@ packages:name: asyncurl: "https://pub.dartlang.org"source: hosted- version: "2.4.1"+ version: "2.4.2"boolean_selector:dependency: transitivedescription:@@ -99,6 +99,13 @@ packages:url: "https://pub.dartlang.org"source: hostedversion: "7.1.0"+ characters:+ dependency: transitive+ description:+ name: characters+ url: "https://pub.dartlang.org"+ source: hosted+ version: "1.0.0"charcode:dependency: transitivedescription:@@ -113,6 +120,13 @@ packages:url: "https://pub.dartlang.org"source: hostedversion: "1.0.2"+ clock:+ dependency: transitive+ description:+ name: clock+ url: "https://pub.dartlang.org"+ source: hosted+ version: "1.0.1"code_builder:dependency: transitivedescription:@@ -126,7 +140,7 @@ packages:name: collectionurl: "https://pub.dartlang.org"source: hosted- version: "1.14.12"+ version: "1.14.13"convert:dependency: transitivedescription:@@ -162,13 +176,48 @@ packages:url: "https://pub.dartlang.org"source: hostedversion: "1.3.6"+ fake_async:+ dependency: transitive+ description:+ name: fake_async+ url: "https://pub.dartlang.org"+ source: hosted+ version: "1.1.0"+ firebase:+ dependency: transitive+ description:+ name: firebase+ url: "https://pub.dartlang.org"+ source: hosted+ version: "7.3.0"+ firebase_core:+ dependency: transitive+ description:+ name: firebase_core+ url: "https://pub.dartlang.org"+ source: hosted+ version: "0.5.0"+ firebase_core_platform_interface:+ dependency: transitive+ description:+ name: firebase_core_platform_interface+ url: "https://pub.dartlang.org"+ source: hosted+ version: "2.0.0"+ firebase_core_web:+ dependency: transitive+ description:+ name: firebase_core_web+ url: "https://pub.dartlang.org"+ source: hosted+ version: "0.2.0"firebase_messaging:dependency: "direct main"description:name: firebase_messagingurl: "https://pub.dartlang.org"source: hosted- version: "5.1.8"+ version: "7.0.0"fixnum:dependency: transitivedescription:@@ -328,7 +377,7 @@ packages:name: matcherurl: "https://pub.dartlang.org"source: hosted- version: "0.12.6"+ version: "0.12.8"meta:dependency: transitivedescription:@@ -370,7 +419,7 @@ packages:name: pathurl: "https://pub.dartlang.org"source: hosted- version: "1.6.4"+ version: "1.7.0"pedantic:dependency: transitivedescription:@@ -522,7 +571,7 @@ packages:name: stack_traceurl: "https://pub.dartlang.org"source: hosted- version: "1.9.3"+ version: "1.9.5"stream_channel:dependency: transitivedescription:@@ -557,7 +606,7 @@ packages:name: test_apiurl: "https://pub.dartlang.org"source: hosted- version: "0.2.15"+ version: "0.2.17"timing:dependency: transitivedescription:@@ -571,7 +620,7 @@ packages:name: typed_dataurl: "https://pub.dartlang.org"source: hosted- version: "1.1.6"+ version: "1.2.0"vector_math:dependency: transitivedescription:@@ -615,5 +664,5 @@ packages:source: hostedversion: "2.2.1"sdks:- dart: ">=2.7.0 <3.0.0"+ dart: ">=2.9.0-14.0.dev <3.0.0"flutter: ">=1.12.13+hotfix.5 <2.0.0"diff --git a/console/generic_app/pubspec.yaml b/console/generic_app/pubspec.yamlindex c3b6af666..45769be7b 100644--- a/console/generic_app/pubspec.yaml+++ b/console/generic_app/pubspec.yaml@@ -11,7 +11,7 @@ description: Generic app of OpenRemote# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.# Read more about iOS versioning at# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html-version: 1.0.0+12+version: 1.0.1+13environment:sdk: ">=2.2.0 <3.0.0"@@ -34,7 +34,7 @@ dependencies:webview_flutter: ^0.3.22+1shared_preferences: ^0.5.7+3permission_handler: ^5.0.1+1- firebase_messaging: ^5.1.4+ firebase_messaging: ^7.0.0quick_actions: 0.4.0+6show_up_animation: ^1.0.2