diff --git a/.metadata b/.metadata
index 6ac2303..56bfc2c 100644
--- a/.metadata
+++ b/.metadata
@@ -4,7 +4,7 @@
# This file should be version controlled and should not be manually edited.
version:
- revision: f7a6a7906be96d2288f5d63a5a54c515a6e987fe
+ revision: f4abaa0735eba4dfd8f33f73363911d63931fe03
channel: stable
project_type: app
diff --git a/README.md b/README.md
index 8d57857..cc8b706 100644
--- a/README.md
+++ b/README.md
@@ -1,2 +1,16 @@
# fcs
+A new Flutter project.
+
+## Getting Started
+
+This project is a starting point for a Flutter application.
+
+A few resources to get you started if this is your first Flutter project:
+
+- [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab)
+- [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook)
+
+For help getting started with Flutter, view our
+[online documentation](https://flutter.dev/docs), which offers tutorials,
+samples, guidance on mobile development, and a full API reference.
diff --git a/android/.gitignore b/android/.gitignore
index bc2100d..0a741cb 100644
--- a/android/.gitignore
+++ b/android/.gitignore
@@ -5,3 +5,7 @@ gradle-wrapper.jar
/gradlew.bat
/local.properties
GeneratedPluginRegistrant.java
+
+# Remember to never publicly share your keystore.
+# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
+key.properties
diff --git a/android/.project b/android/.project
deleted file mode 100644
index 3964dd3..0000000
--- a/android/.project
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
- android
- Project android created by Buildship.
-
-
-
-
- org.eclipse.buildship.core.gradleprojectbuilder
-
-
-
-
-
- org.eclipse.buildship.core.gradleprojectnature
-
-
diff --git a/android/.settings/org.eclipse.buildship.core.prefs b/android/.settings/org.eclipse.buildship.core.prefs
deleted file mode 100644
index d19d611..0000000
--- a/android/.settings/org.eclipse.buildship.core.prefs
+++ /dev/null
@@ -1,13 +0,0 @@
-arguments=
-auto.sync=false
-build.scans.enabled=false
-connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER)
-connection.project.dir=
-eclipse.preferences.version=1
-gradle.user.home=
-java.home=/usr/lib/jvm/java-8-openjdk-amd64
-jvm.arguments=
-offline.mode=false
-override.workspace.settings=true
-show.console.view=true
-show.executions.view=true
diff --git a/android/app/.classpath b/android/app/.classpath
deleted file mode 100644
index eb19361..0000000
--- a/android/app/.classpath
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
diff --git a/android/app/.project b/android/app/.project
deleted file mode 100644
index ac485d7..0000000
--- a/android/app/.project
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
- app
- Project app created by Buildship.
-
-
-
-
- org.eclipse.jdt.core.javabuilder
-
-
-
-
- org.eclipse.buildship.core.gradleprojectbuilder
-
-
-
-
-
- org.eclipse.jdt.core.javanature
- org.eclipse.buildship.core.gradleprojectnature
-
-
diff --git a/android/app/.settings/org.eclipse.buildship.core.prefs b/android/app/.settings/org.eclipse.buildship.core.prefs
deleted file mode 100644
index b1886ad..0000000
--- a/android/app/.settings/org.eclipse.buildship.core.prefs
+++ /dev/null
@@ -1,2 +0,0 @@
-connection.project.dir=..
-eclipse.preferences.version=1
diff --git a/android/app/build.gradle b/android/app/build.gradle
index 5492e81..0e9c8c7 100644
--- a/android/app/build.gradle
+++ b/android/app/build.gradle
@@ -24,26 +24,17 @@ if (flutterVersionName == null) {
apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
-def keystoreProperties = new Properties()
-def keystorePropertiesFile = rootProject.file('key.properties')
-if (keystorePropertiesFile.exists()) {
- keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
-}
-
android {
- compileSdkVersion 28
-
- lintOptions {
- disable 'InvalidPackage'
- }
+ compileSdkVersion 30
defaultConfig {
+ // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
+ applicationId "com.mokkon.fcs.fcs"
minSdkVersion 21
- targetSdkVersion 28
+ targetSdkVersion 30
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
multiDexEnabled true
- testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
@@ -92,17 +83,8 @@ flutter {
source '../..'
}
-apply plugin: 'kotlin-android'
-
dependencies {
- testImplementation 'junit:junit:4.12'
- androidTestImplementation 'com.android.support.test:runner:1.0.2'
- androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
- implementation 'com.android.support:multidex:1.0.3'
- implementation 'com.google.firebase:firebase-analytics:17.5.0'
- implementation 'com.google.firebase:firebase-auth:19.0.0'
- implementation 'com.google.firebase:firebase-messaging:20.1.0'
- implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
+ implementation 'com.android.support:multidex:1.0.3'
}
apply plugin: 'com.google.gms.google-services'
diff --git a/android/app/src/debug/AndroidManifest.xml b/android/app/src/debug/AndroidManifest.xml
index 64c388e..e5bd26c 100644
--- a/android/app/src/debug/AndroidManifest.xml
+++ b/android/app/src/debug/AndroidManifest.xml
@@ -1,5 +1,5 @@
+ package="com.mokkon.fcs.fcs">
diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml
index e32dd3b..890efd6 100644
--- a/android/app/src/main/AndroidManifest.xml
+++ b/android/app/src/main/AndroidManifest.xml
@@ -1,43 +1,41 @@
-
-
-
-
-
-
-
-
+ package="com.mokkon.fcs.fcs">
+
-
+
+ android:name="io.flutter.embedding.android.NormalTheme"
+ android:resource="@style/NormalTheme"
+ />
+
+
-
-
-
-
+
+
diff --git a/android/app/src/main/java/com/mokkon/fcs/fcs/MainActivity.java b/android/app/src/main/java/com/mokkon/fcs/fcs/MainActivity.java
new file mode 100644
index 0000000..2069e10
--- /dev/null
+++ b/android/app/src/main/java/com/mokkon/fcs/fcs/MainActivity.java
@@ -0,0 +1,6 @@
+package com.mokkon.fcs.fcs;
+
+import io.flutter.embedding.android.FlutterActivity;
+
+public class MainActivity extends FlutterActivity {
+}
diff --git a/android/app/src/main/java/com/mokkon/fcs_dev/fcs/Application.java b/android/app/src/main/java/com/mokkon/fcs_dev/fcs/Application.java
deleted file mode 100644
index 1fe18f1..0000000
--- a/android/app/src/main/java/com/mokkon/fcs_dev/fcs/Application.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package com.mokkon.fcs_dev.fcs;
-
- 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;
-
- public class Application extends FlutterApplication implements PluginRegistrantCallback {
- @Override
- public void onCreate() {
- super.onCreate();
- FlutterFirebaseMessagingService.setPluginRegistrant(this);
- }
-
- @Override
- public void registerWith(PluginRegistry registry) {
- GeneratedPluginRegistrant.registerWith(registry);
- }
- }
diff --git a/android/app/src/main/java/com/mokkon/fcs_dev/fcs/MainActivity.java b/android/app/src/main/java/com/mokkon/fcs_dev/fcs/MainActivity.java
deleted file mode 100644
index 4a8f859..0000000
--- a/android/app/src/main/java/com/mokkon/fcs_dev/fcs/MainActivity.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package com.mokkon.fcs_dev.fcs;
-
-import android.os.Bundle;
-import io.flutter.app.FlutterActivity;
-import io.flutter.plugins.GeneratedPluginRegistrant;
-
-public class MainActivity extends FlutterActivity {
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- GeneratedPluginRegistrant.registerWith(this);
- }
-}
diff --git a/android/app/src/main/res/drawable-v21/launch_background.xml b/android/app/src/main/res/drawable-v21/launch_background.xml
new file mode 100644
index 0000000..f74085f
--- /dev/null
+++ b/android/app/src/main/res/drawable-v21/launch_background.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
diff --git a/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
index b1da307..db77bb4 100644
Binary files a/android/app/src/main/res/mipmap-hdpi/ic_launcher.png and b/android/app/src/main/res/mipmap-hdpi/ic_launcher.png differ
diff --git a/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
index cdf697f..17987b7 100644
Binary files a/android/app/src/main/res/mipmap-mdpi/ic_launcher.png and b/android/app/src/main/res/mipmap-mdpi/ic_launcher.png differ
diff --git a/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
index a8316e6..09d4391 100644
Binary files a/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png and b/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ
diff --git a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
index 2b85987..d5f1c8d 100644
Binary files a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png and b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ
diff --git a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
index 7e0c447..4d6372e 100644
Binary files a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png and b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ
diff --git a/android/app/src/main/res/values-night/styles.xml b/android/app/src/main/res/values-night/styles.xml
new file mode 100644
index 0000000..449a9f9
--- /dev/null
+++ b/android/app/src/main/res/values-night/styles.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
diff --git a/android/app/src/main/res/values/strings.xml b/android/app/src/main/res/values/strings.xml
deleted file mode 100644
index 0a46b50..0000000
--- a/android/app/src/main/res/values/strings.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
- FCS
-
diff --git a/android/app/src/main/res/values/styles.xml b/android/app/src/main/res/values/styles.xml
index 1f83a33..d74aa35 100644
--- a/android/app/src/main/res/values/styles.xml
+++ b/android/app/src/main/res/values/styles.xml
@@ -1,7 +1,7 @@
-
-
diff --git a/android/app/src/profile/AndroidManifest.xml b/android/app/src/profile/AndroidManifest.xml
index 64c388e..e5bd26c 100644
--- a/android/app/src/profile/AndroidManifest.xml
+++ b/android/app/src/profile/AndroidManifest.xml
@@ -1,5 +1,5 @@
+ package="com.mokkon.fcs.fcs">
diff --git a/android/build.gradle b/android/build.gradle
index b2c3f03..9070705 100644
--- a/android/build.gradle
+++ b/android/build.gradle
@@ -1,15 +1,12 @@
buildscript {
- ext.kotlin_version = '1.3.61'
repositories {
google()
jcenter()
}
dependencies {
- classpath 'com.android.tools.build:gradle:3.5.3'
- classpath 'com.google.gms:google-services:4.3.3'
- classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
- classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.12' //add this line
+ classpath 'com.android.tools.build:gradle:4.1.0'
+ classpath 'com.google.gms:google-services:4.3.8'
}
}
@@ -23,8 +20,6 @@ allprojects {
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
-}
-subprojects {
project.evaluationDependsOn(':app')
}
diff --git a/android/gradle.properties b/android/gradle.properties
index 38c8d45..94adc3a 100644
--- a/android/gradle.properties
+++ b/android/gradle.properties
@@ -1,4 +1,3 @@
org.gradle.jvmargs=-Xmx1536M
-android.enableR8=true
android.useAndroidX=true
android.enableJetifier=true
diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties
index 296b146..bc6a58a 100644
--- a/android/gradle/wrapper/gradle-wrapper.properties
+++ b/android/gradle/wrapper/gradle-wrapper.properties
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip
diff --git a/android/proguard-rules.pro b/android/proguard-rules.pro
deleted file mode 100644
index 70885bd..0000000
--- a/android/proguard-rules.pro
+++ /dev/null
@@ -1,7 +0,0 @@
-## Flutter wrapper
--keep class io.flutter.app.** { *; }
--keep class io.flutter.plugin.** { *; }
--keep class io.flutter.util.** { *; }
--keep class io.flutter.view.** { *; }
--keep class io.flutter.** { *; }
--keep class io.flutter.plugins.** { *; }
\ No newline at end of file
diff --git a/android/settings.gradle b/android/settings.gradle
index 5a2f14f..44e62bc 100644
--- a/android/settings.gradle
+++ b/android/settings.gradle
@@ -1,15 +1,11 @@
include ':app'
-def flutterProjectRoot = rootProject.projectDir.parentFile.toPath()
+def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
+def properties = new Properties()
-def plugins = new Properties()
-def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins')
-if (pluginsFile.exists()) {
- pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) }
-}
+assert localPropertiesFile.exists()
+localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
-plugins.each { name, path ->
- def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile()
- include ":$name"
- project(":$name").projectDir = pluginDirectory
-}
+def flutterSdkPath = properties.getProperty("flutter.sdk")
+assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
+apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"
diff --git a/android/settings_aar.gradle b/android/settings_aar.gradle
deleted file mode 100644
index e7b4def..0000000
--- a/android/settings_aar.gradle
+++ /dev/null
@@ -1 +0,0 @@
-include ':app'
diff --git a/lib/data/provider/messaging_fcm.dart b/lib/data/provider/messaging_fcm.dart
index a184004..c008ecd 100644
--- a/lib/data/provider/messaging_fcm.dart
+++ b/lib/data/provider/messaging_fcm.dart
@@ -1,57 +1,53 @@
-import 'dart:io';
-
import 'package:fcs/data/services/messaging_service.dart';
+import 'package:firebase_core/firebase_core.dart';
import 'package:firebase_messaging/firebase_messaging.dart';
import 'package:logging/logging.dart';
final msgLog = Logger('backgroundMessageHandler');
-Future backgroundMessageHandler(Map message) async {
- if (message.containsKey('data')) {
- // Handle data message
- final dynamic data = message['data'];
- msgLog.info("background onMessage: $message");
- }
-
- if (message.containsKey('notification')) {
- // Handle notification message
- final dynamic notification = message['notification'];
- }
+Future backgroundMessageHandler(RemoteMessage message) async {
+ await Firebase.initializeApp();
+ msgLog.info("background onMessage: $message");
}
class MessagingFCM {
final log = Logger('MessagingFCM');
- FirebaseMessaging _firebaseMessaging;
+ late FirebaseMessaging _firebaseMessaging;
MessagingFCM(OnNotify onMessage,
- {OnNotify onLaunch, OnNotify onResume, OnSetupComplete onSetupComplete}) {
- _firebaseMessaging = FirebaseMessaging();
- _firebaseMessaging.configure(
- onMessage: (Map message) async {
- log.info("onMessage: $message");
- if (onMessage != null) _onNotify(message, onMessage);
- },
- onBackgroundMessage: Platform.isIOS ? null : backgroundMessageHandler,
- onLaunch: (Map message) async {
- log.info("onLaunch: $message");
- if (onLaunch != null) _onNotify(message, onLaunch);
- },
- onResume: (Map message) async {
- log.info("onResume: $message");
- if (onResume != null) _onNotify(message, onResume);
- },
+ {OnNotify? onLaunch,
+ OnNotify? onResume,
+ OnSetupComplete? onSetupComplete}) {
+ _firebaseMessaging = FirebaseMessaging.instance;
+ init(onMessage: onMessage, onSetupComplete: onSetupComplete);
+ }
+
+ init({OnNotify? onMessage, OnSetupComplete? onSetupComplete}) async {
+ NotificationSettings settings = await _firebaseMessaging.requestPermission(
+ alert: true,
+ announcement: false,
+ badge: true,
+ carPlay: false,
+ criticalAlert: false,
+ provisional: false,
+ sound: true,
);
- _firebaseMessaging
- .requestNotificationPermissions(const IosNotificationSettings());
- _firebaseMessaging.onIosSettingsRegistered
- .listen((IosNotificationSettings settings) {
- log.info("Settings registered: $settings");
- });
- _firebaseMessaging.getToken().then((String token) {
- if (onSetupComplete != null) onSetupComplete(token);
- log.info("Messaging Token:$token");
+
+ print('User granted permission: ${settings.authorizationStatus}');
+
+ FirebaseMessaging.onMessage.listen((RemoteMessage message) {
+ log.info("onMessage: $message");
+ if (onMessage != null) _onNotify(message.data, onMessage);
+
+ if (message.notification != null) {
+ print('Message also contained a notification: ${message.notification}');
+ }
});
+
+ String? token = await _firebaseMessaging.getToken();
+ if (onSetupComplete != null && token != null) onSetupComplete(token);
+ log.info("Messaging Token:$token");
}
Future subscribeToTopic(String topic) {
diff --git a/lib/data/services/messaging_imp.dart b/lib/data/services/messaging_imp.dart
index ceb6e57..9b41260 100644
--- a/lib/data/services/messaging_imp.dart
+++ b/lib/data/services/messaging_imp.dart
@@ -5,11 +5,13 @@ import 'messaging_service.dart';
class MessagingServiceImp implements MessagingService {
MessagingServiceImp();
- static MessagingFCM messagingFCM;
+ late MessagingFCM messagingFCM;
@override
void init(onMessage,
- {OnNotify onLaunch, OnNotify onResume, OnSetupComplete onSetupComplete}) {
+ {OnNotify? onLaunch,
+ OnNotify? onResume,
+ OnSetupComplete? onSetupComplete}) {
messagingFCM = MessagingFCM(onMessage,
onLaunch: onLaunch,
onResume: onResume,
diff --git a/lib/domain/entities/invoice.dart b/lib/domain/entities/invoice.dart
index 3ac1c9e..a15e905 100644
--- a/lib/domain/entities/invoice.dart
+++ b/lib/domain/entities/invoice.dart
@@ -28,7 +28,7 @@ class Invoice {
List customDuties;
List cartons;
List cargoTypes;
- List shipments;
+ List? shipments;
List payments;
Discount? discount;
PaymentMethod? paymentMethod;
@@ -85,9 +85,9 @@ class Invoice {
}
double getHandlingFee() {
- return shipments
- .where((sh) => sh.isSelected)
- .fold(0, (p, s) => p + (s.handlingFee - s.paidHandlingFee));
+ return shipments!
+ .where((sh) => sh!.isSelected)
+ .fold(0, (p, s) => p + (s!.handlingFee - s.paidHandlingFee));
}
double getTotalBalance(Rate rate) {
@@ -176,7 +176,7 @@ class Invoice {
List _cargoTypes = cargoTypes.map((c) => c.toMap()).toList();
List _customDuties = customDuties.map((c) => c.toMap()).toList();
List _cartons = cartons.map((c) => c.toMap()).toList();
- List _shipments = shipments.map((s) => s.toMap()).toList();
+ List _shipments = shipments!.map((s) => s!.toMap()).toList();
return {
"id": id,
"invoice_date": invoiceDate?.toUtc().toIso8601String(),
diff --git a/lib/domain/entities/package.dart b/lib/domain/entities/package.dart
index c583de1..2df0c7d 100644
--- a/lib/domain/entities/package.dart
+++ b/lib/domain/entities/package.dart
@@ -36,7 +36,7 @@ class Package {
DeliveryAddress? deliveryAddress;
//for packages in processing
- List photoFiles;
+ List photoFiles;
int get amount => rate != null && weight != null ? rate * weight : 0;
diff --git a/lib/helpers/firebase_helper.dart b/lib/helpers/firebase_helper.dart
index 0fd5b84..4014aa8 100644
--- a/lib/helpers/firebase_helper.dart
+++ b/lib/helpers/firebase_helper.dart
@@ -24,20 +24,24 @@ Future