Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

Fixed push on iOS

Michael Rademaker13b20eb89f7c
diff --git a/console/generic_app/ios/Podfile b/console/generic_app/ios/Podfile
index e72e0b480..10f3c9b47 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'
diff --git a/console/generic_app/ios/Podfile.lock b/console/generic_app/ios/Podfile.lock
index 352bcf142..60dac9835 100644
--- a/console/generic_app/ios/Podfile.lock
+++ b/console/generic_app/ios/Podfile.lock
@@ -160,6 +160,6 @@ SPEC CHECKSUMS:
url_launcher: 6fef411d543ceb26efce54b05a0a40bfd74cbbef
webview_flutter: d2b4d6c66968ad042ad94cbb791f5b72b4678a96
-PODFILE CHECKSUM: 0dbd5a87e0ace00c9610d2037ac22083a01f861d
+PODFILE CHECKSUM: cc1f88378b4bfcf93a6ce00d2c587857c6008d3b
COCOAPODS: 1.9.1
diff --git a/console/generic_app/ios/Runner.xcodeproj/project.pbxproj b/console/generic_app/ios/Runner.xcodeproj/project.pbxproj
index 8a5224e0c..54779b457 100644
--- a/console/generic_app/ios/Runner.xcodeproj/project.pbxproj
+++ b/console/generic_app/ios/Runner.xcodeproj/project.pbxproj
@@ -9,7 +9,6 @@
/* Begin PBXBuildFile section */
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
- 4C2C8B3B251B466B008F5DA5 /* mapstogpx20200923_085404.gpx in Resources */ = {isa = PBXBuildFile; fileRef = 4C2C8B3A251B466B008F5DA5 /* mapstogpx20200923_085404.gpx */; };
4CD7187324C9968C00692984 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 4CD7187224C9968C00692984 /* GoogleService-Info.plist */; };
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; };
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
@@ -37,7 +36,6 @@
1CFF1733714D5E6047310E9F /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; };
22F4AECA8DB2788DCE5E11F8 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
- 4C2C8B3A251B466B008F5DA5 /* mapstogpx20200923_085404.gpx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = mapstogpx20200923_085404.gpx; sourceTree = "<group>"; };
4CD7187224C9968C00692984 /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = "<group>"; };
4CD7187424C996B000692984 /* Runner.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Runner.entitlements; sourceTree = "<group>"; };
584E2B9AD7744102DD3DFD0E /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; };
@@ -118,7 +116,6 @@
97C146F01CF9000F007C117D /* Runner */ = {
isa = PBXGroup;
children = (
- 4C2C8B3A251B466B008F5DA5 /* mapstogpx20200923_085404.gpx */,
4CD7187424C996B000692984 /* Runner.entitlements */,
97C146FA1CF9000F007C117D /* Main.storyboard */,
97C146FD1CF9000F007C117D /* Assets.xcassets */,
@@ -206,7 +203,6 @@
files = (
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */,
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */,
- 4C2C8B3B251B466B008F5DA5 /* mapstogpx20200923_085404.gpx in Resources */,
4CD7187324C9968C00692984 /* GoogleService-Info.plist in Resources */,
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */,
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */,
diff --git a/console/generic_app/lib/config/current_console_app_config.dart b/console/generic_app/lib/config/current_console_app_config.dart
index 1d819c3bd..e2116b753 100644
--- a/console/generic_app/lib/config/current_console_app_config.dart
+++ b/console/generic_app/lib/config/current_console_app_config.dart
@@ -2,7 +2,7 @@ import 'dart:ui';
import 'package:generic_app/models/console_app_config.dart';
import 'package:generic_app/models/link_config.dart';
-import 'package:generic_app/utils/HexColor.dart';
+import 'package:generic_app/utils/hex_color.dart';
class CurrentConsoleAppConfig {
static final CurrentConsoleAppConfig instance =
diff --git a/console/generic_app/lib/main.dart b/console/generic_app/lib/main.dart
index c5d68c645..ba0a2bd30 100644
--- a/console/generic_app/lib/main.dart
+++ b/console/generic_app/lib/main.dart
@@ -9,11 +9,11 @@ void main() {
WidgetsFlutterBinding.ensureInitialized();
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp])
.then((_) async {
- runApp(new ORApp());
+ runApp(ORApp());
});
}
class ORApp extends StatelessWidget {
- static final GlobalKey<NavigatorState> navigatorKey = new GlobalKey<NavigatorState>();
+ static final GlobalKey<NavigatorState> navigatorKey = GlobalKey<NavigatorState>();
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
@@ -31,7 +31,7 @@ class ORApp extends StatelessWidget {
GlobalCupertinoLocalizations.delegate,
],
supportedLocales: S.delegate.supportedLocales,
- home: SplashPage(),
+ home: const SplashPage(),
);
}
}
diff --git a/console/generic_app/lib/network/api_manager.dart b/console/generic_app/lib/network/api_manager.dart
index 9f072f641..b4e1ee6d9 100644
--- a/console/generic_app/lib/network/api_manager.dart
+++ b/console/generic_app/lib/network/api_manager.dart
@@ -17,8 +17,6 @@ class ApiManager {
ApiManager(this.baseUrl, {this.baseHeaders});
- /*********************************Private functions*******************************/
-
Future<T> get<T>(List<String> pathComponents, ResponseParser responseParser,
{Map<String, dynamic> queryParameters,
Map<String, String> additionalHeaders}) async {
@@ -63,7 +61,7 @@ class ApiManager {
if (jsonData is List) {
return List<T>.from(jsonData.map((item) => responseParser(item)));
} else {
- throw new Exception("Expected array in body");
+ throw Exception("Expected array in body");
}
} catch (e) {
print(e);
diff --git a/console/generic_app/lib/services/push_notification_service.dart b/console/generic_app/lib/services/push_notification_service.dart
index 3359423e2..54c61ff19 100644
--- a/console/generic_app/lib/services/push_notification_service.dart
+++ b/console/generic_app/lib/services/push_notification_service.dart
@@ -3,9 +3,11 @@ import 'dart:io';
import 'package:awesome_dialog/awesome_dialog.dart';
import 'package:firebase_messaging/firebase_messaging.dart';
+import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:generic_app/ConsoleProviders/geofence_provider.dart';
import 'package:generic_app/ConsoleProviders/storage_provider.dart';
+import 'package:generic_app/config/current_console_app_config.dart';
import 'package:generic_app/events/open_web_page_event.dart';
import 'package:generic_app/models/alert_action.dart';
import 'package:generic_app/models/alert_button.dart';
@@ -67,7 +69,8 @@ class PushNotificationService {
Map<String, dynamic> remoteMessage, bool onResume, bool onLaunch) async {
Map<dynamic, dynamic> messageData = remoteMessage["data"] ?? remoteMessage;
if (messageData != null) {
- bool isSilent = !messageData.containsKey("or-title");
+ bool isSilent = (Platform.isAndroid && !messageData.containsKey("or-title"))
+ || (Platform.isIOS && messageData["aps"]["alert"] == null);
if (isSilent) {
String action = messageData["action"];
@@ -85,8 +88,8 @@ class PushNotificationService {
break;
}
} else {
- String title = messageData["or-title"];
- String body = messageData["or-body"];
+ String title = Platform.isAndroid ? messageData["or-title"] : messageData["aps"]["alert"]["title"];
+ String body = Platform.isAndroid ? messageData["or-body"] : messageData["aps"]["alert"]["body"];
List<AlertButton> buttons;
AlertButton confirmButton;
@@ -123,7 +126,7 @@ class PushNotificationService {
title: title,
desc: body,
btnOkText: confirmButton?.title ?? "Ok",
- btnCancelText: declineButton?.title,
+ btnOkColor: CurrentConsoleAppConfig.instance.primaryColor,
btnOkOnPress: confirmButton != null ? () {
if (confirmButton != null && confirmButton.action != null) {
performAlertAction(confirmButton.action);
@@ -132,6 +135,8 @@ class PushNotificationService {
performAlertAction(action);
}
} : null,
+ btnCancelText: declineButton?.title,
+ btnCancelColor: Colors.black54,
btnCancelOnPress: declineButton != null ? () {
} : null
).show();
diff --git a/console/generic_app/lib/ui/splash_page.dart b/console/generic_app/lib/ui/splash_page.dart
index 3807b0c28..f9634ae86 100644
--- a/console/generic_app/lib/ui/splash_page.dart
+++ b/console/generic_app/lib/ui/splash_page.dart
@@ -51,7 +51,7 @@ class _SplashPageState extends State<SplashPage> {
builder: (BuildContext context, AsyncSnapshot snapshot) {
if (snapshot.hasData) {
Future.delayed(Duration.zero, () {
- if (snapshot.data != null) {
+ if (snapshot.data) {
Navigator.pushReplacement(
context,
MaterialPageRoute(
@@ -59,7 +59,7 @@ class _SplashPageState extends State<SplashPage> {
initialUrl: CurrentConsoleAppConfig.instance.initialUrl)));
} else {
Navigator.pushReplacement(context,
- MaterialPageRoute(builder: (context) => ProjectPage()));
+ MaterialPageRoute(builder: (context) => const ProjectPage()));
}
});
}
diff --git a/console/generic_app/lib/utils/HexColor.dart b/console/generic_app/lib/utils/HexColor.dart
deleted file mode 100644
index 379eb45f5..000000000
--- a/console/generic_app/lib/utils/HexColor.dart
+++ /dev/null
@@ -1,13 +0,0 @@
-import 'dart:ui';
-
-class HexColor extends Color {
- static int _getColorFromHex(String hexColor) {
- hexColor = hexColor.toUpperCase().replaceAll("#", "");
- if (hexColor.length == 6) {
- hexColor = "FF" + hexColor;
- }
- return int.parse(hexColor, radix: 16);
- }
-
- HexColor(final String hexColor) : super(_getColorFromHex(hexColor));
-}
\ No newline at end of file
diff --git a/console/generic_app/lib/utils/hex_color.dart b/console/generic_app/lib/utils/hex_color.dart
new file mode 100644
index 000000000..33fe7669e
--- /dev/null
+++ b/console/generic_app/lib/utils/hex_color.dart
@@ -0,0 +1,13 @@
+import 'dart:ui';
+
+class HexColor extends Color {
+ static int _getColorFromHex(String hexColor) {
+ String parsedHexColor = hexColor.toUpperCase().replaceAll("#", "");
+ if (parsedHexColor.length == 6) {
+ parsedHexColor = "FF$parsedHexColor";
+ }
+ return int.parse(parsedHexColor, radix: 16);
+ }
+
+ HexColor(final String hexColor) : super(_getColorFromHex(hexColor));
+}
\ No newline at end of file
diff --git a/console/generic_app/pubspec.yaml b/console/generic_app/pubspec.yaml
index 8a5654927..baf9e0906 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.1+15
+version: 1.0.1+16
environment:
sdk: ">=2.2.0 <3.0.0"