diff --git a/.gitignore b/.gitignore
index 4b016310..fd4aca5a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -42,3 +42,4 @@ app.*.map.json
# Exceptions to above rules.
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
+health_calculators.dart
diff --git a/DQKey.jks b/DQKey.jks
deleted file mode 100644
index 7c844584..00000000
Binary files a/DQKey.jks and /dev/null differ
diff --git a/Keystore Pass.rtf b/Keystore Pass.rtf
deleted file mode 100644
index cd33f08e..00000000
--- a/Keystore Pass.rtf
+++ /dev/null
@@ -1,9 +0,0 @@
-{\rtf1\ansi\ansicpg1252\cocoartf2513
-\cocoatextscaling0\cocoaplatform0{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
-{\colortbl;\red255\green255\blue255;}
-{\*\expandedcolortbl;;}
-\paperw11900\paperh16840\margl1440\margr1440\vieww10800\viewh8400\viewkind0
-\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural\partightenfactor0
-
-\f0\fs24 \cf0 keyPassword=HmGsa123\
-storePassword=HmGsa123}
\ No newline at end of file
diff --git a/android/app/build.gradle b/android/app/build.gradle
index e4d2cb78..7a09b3ca 100644
--- a/android/app/build.gradle
+++ b/android/app/build.gradle
@@ -26,12 +26,6 @@ apply plugin: 'kotlin-android'
apply plugin: 'com.google.gms.google-services'
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 30
@@ -40,9 +34,7 @@ android {
}
lintOptions {
-// disable 'InvalidPackage'
- checkReleaseBuilds false
- abortOnError false
+ disable 'InvalidPackage'
}
defaultConfig {
@@ -56,35 +48,21 @@ android {
}
- signingConfigs {
- release {
- keyAlias keystoreProperties['keyAlias']
- keyPassword keystoreProperties['keyPassword']
- storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
- storePassword keystoreProperties['storePassword']
- }
- }
-
buildTypes {
debug {}
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
-// signingConfig signingConfigs.debug
-// useProguard true
-
-// proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
-
- signingConfigs.release
+ signingConfig signingConfigs.debug
+ }
+ staging {
+ // Specifies a sorted list of fallback build types that the
+ // plugin should try to use when a dependency does not include a
+ // "staging" build type. You may specify as many fallbacks as you
+ // like, and the plugin selects the first build type that's
+ // available in the dependency.
+ matchingFallbacks = ['debug', 'qa', 'release']
}
-// staging {
-// // Specifies a sorted list of fallback build types that the
-// // plugin should try to use when a dependency does not include a
-// // "staging" build type. You may specify as many fallbacks as you
-// // like, and the plugin selects the first build type that's
-// // available in the dependency.
-// matchingFallbacks = ['debug', 'qa', 'release']
-// }
}
}
@@ -94,15 +72,28 @@ flutter {
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
- implementation "com.google.firebase:firebase-messaging:20.3.0"
+ implementation "com.google.firebase:firebase-messaging:21.0.0"
+// implementation ('com.google.firebase:firebase-inappmessaging-display:19.1.2',{
+// exclude group: 'com.google.protobuf',module: 'protobuf-javalite'
+// exclude group: 'com.google.protobuf',module: 'protobuf-lite'
+// })
implementation 'pub.devrel:easypermissions:0.4.0'
// implementation 'com.google.firebase:firebase-inappmessaging-display:17.2.0'
+ // implementation 'com.google.firebase:firebase-inappmessaging-display:17.2.0'
implementation 'com.google.guava:guava:27.0.1-android'
// Dependency on local binaries
implementation fileTree(dir: 'libs', include: ['*.jar'])
+ implementation 'com.google.code.gson:gson:2.8.6'
// Dependency on a remote binary
// implementation 'com.example.android:app-magic:12.3'
+ // Native Dependency
+ implementation "org.jetbrains.anko:anko-commons:0.10.4"
+ implementation 'com.github.kittinunf.fuel:fuel:2.3.0' //for JVM
+ implementation 'com.github.kittinunf.fuel:fuel-android:2.3.0'
+ implementation 'com.google.android.gms:play-services-location:17.1.0'//for Android
+
+
}
diff --git a/android/app/google-services.json b/android/app/google-services.json
index a4655794..f86832ad 100644
--- a/android/app/google-services.json
+++ b/android/app/google-services.json
@@ -1,37 +1,39 @@
{
"project_info": {
- "project_number": "864393916058",
- "firebase_url": "https://diplomaticquarter-d2385.firebaseio.com",
- "project_id": "diplomaticquarter-d2385",
- "storage_bucket": "diplomaticquarter-d2385.appspot.com"
+ "project_number": "815750722565",
+ "firebase_url": "https://api-project-815750722565.firebaseio.com",
+ "project_id": "api-project-815750722565",
+ "storage_bucket": "api-project-815750722565.appspot.com"
},
"client": [
{
"client_info": {
- "mobilesdk_app_id": "1:864393916058:android:5b5a65cd6d8c18b4b97923",
+ "mobilesdk_app_id": "1:815750722565:android:62281cd3e5df4063",
"android_client_info": {
"package_name": "com.cloud.diplomaticquarterapp"
}
},
"oauth_client": [
{
- "client_id": "864393916058-tphjrn8j39ntevt32ekcvmll8aue7qql.apps.googleusercontent.com",
+ "client_id": "815750722565-3a0gc7neins0eoahdrimrfksk0sqice8.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
- "current_key": "AIzaSyBdV3mos1BPhUzNKCj2KANJtiO3o2zh9IM"
+ "current_key": "AIzaSyDUfg6AKM1-00WyzpvLImUBC46wFrq9-qw"
}
],
"services": {
+ "analytics_service": {
+ "status": 1
+ },
"appinvite_service": {
- "other_platform_oauth_client": [
- {
- "client_id": "864393916058-tphjrn8j39ntevt32ekcvmll8aue7qql.apps.googleusercontent.com",
- "client_type": 3
- }
- ]
+ "status": 1,
+ "other_platform_oauth_client": []
+ },
+ "ads_service": {
+ "status": 2
}
}
}
diff --git a/android/app/src/debug/AndroidManifest.xml b/android/app/src/debug/AndroidManifest.xml
index beeadd9e..d8fd4e88 100644
--- a/android/app/src/debug/AndroidManifest.xml
+++ b/android/app/src/debug/AndroidManifest.xml
@@ -3,6 +3,5 @@
-
diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml
index 12ced804..1032b29b 100644
--- a/android/app/src/main/AndroidManifest.xml
+++ b/android/app/src/main/AndroidManifest.xml
@@ -7,6 +7,7 @@
FlutterApplication and put your custom class here. -->
+
@@ -20,11 +21,19 @@
+
+
+
+
+
+
+
+
+ android:label="diplomaticquarterapp">
-
@@ -68,13 +75,25 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/MainActivity.kt b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/MainActivity.kt
index b8a87c8c..8b73b0c7 100644
--- a/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/MainActivity.kt
+++ b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/MainActivity.kt
@@ -1,11 +1,23 @@
package com.cloud.diplomaticquarterapp
+import android.os.Bundle
+import android.util.Log
import androidx.annotation.NonNull;
- import io.flutter.embedding.android.FlutterFragmentActivity
+import com.cloud.diplomaticquarterapp.utils.FlutterText
+import com.cloud.diplomaticquarterapp.utils.PlatformBridge
+import io.flutter.embedding.android.FlutterFragmentActivity
import io.flutter.embedding.engine.FlutterEngine
- import io.flutter.plugins.GeneratedPluginRegistrant
+import io.flutter.plugin.common.MethodChannel
+import io.flutter.plugins.GeneratedPluginRegistrant
class MainActivity: FlutterFragmentActivity() {
- override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) {
- GeneratedPluginRegistrant.registerWith(flutterEngine);
- }
+ override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) {
+ GeneratedPluginRegistrant.registerWith(flutterEngine);
+ // Create Flutter Platform Bridge
+ PlatformBridge(flutterEngine.dartExecutor.binaryMessenger, this).create()
+
+ }
+
+ override fun onResume() {
+ super.onResume()
+ }
}
\ No newline at end of file
diff --git a/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/geofence/GeoZoneModel.kt b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/geofence/GeoZoneModel.kt
new file mode 100644
index 00000000..7eba1ead
--- /dev/null
+++ b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/geofence/GeoZoneModel.kt
@@ -0,0 +1,56 @@
+package com.cloud.diplomaticquarterapp.geofence
+
+import com.google.android.gms.location.Geofence
+import com.google.gson.Gson
+import com.google.gson.reflect.TypeToken
+
+class GeoZoneModel {
+ var GEOF_ID:Int = 0
+ var Radius:Int = 0
+ var Type:Int = 0
+ var ProjectID:Int = 0
+
+ var Description:String? = null
+ var DescriptionN:String? = null
+ var Latitude:String? = null
+ var Longitude:String? = null
+ var ImageURL:String? = null
+ var IsCity:String? = null
+
+ fun identifier():String{
+ return "$GEOF_ID" + "_hmg"
+ }
+
+ fun message():String{
+ return Description ?: "nil"
+ }
+
+ fun listFrom(jsonString: String) : List{
+ val type = object : TypeToken?>() {}.getType()
+ return Gson().fromJson(jsonString, type)
+ }
+
+ fun toGeofence() : Geofence?{
+ if (!Latitude.isNullOrEmpty() && !Longitude.isNullOrEmpty() && Radius > 50) {
+ val lat = Latitude!!.trim().toDoubleOrNull()
+ val long = Longitude!!.trim().toDoubleOrNull()
+ val rad = Radius.toFloat()
+ if(lat != null && long != null){
+
+ return Geofence.Builder()
+ .setRequestId(identifier())
+ .setCircularRegion(
+ lat,
+ long,
+ rad
+ )
+ .setTransitionTypes(GeofenceTransition.ENTER_EXIT.value)
+// .setNotificationResponsiveness(0)
+ .setExpirationDuration(Geofence.NEVER_EXPIRE)
+ .build()
+ }
+ }
+ return null
+ }
+
+}
diff --git a/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/geofence/GeofenceBroadcastReceiver.kt b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/geofence/GeofenceBroadcastReceiver.kt
new file mode 100644
index 00000000..8fc1faae
--- /dev/null
+++ b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/geofence/GeofenceBroadcastReceiver.kt
@@ -0,0 +1,13 @@
+
+
+package com.cloud.diplomaticquarterapp.geofence
+
+import android.content.BroadcastReceiver
+import android.content.Context
+import android.content.Intent
+
+class GeofenceBroadcastReceiver : BroadcastReceiver() {
+ override fun onReceive(context: Context, intent: Intent) {
+ GeofenceTransitionsJobIntentService.enqueueWork(context, intent)
+ }
+}
\ No newline at end of file
diff --git a/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/geofence/GeofenceErrorMessages.kt b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/geofence/GeofenceErrorMessages.kt
new file mode 100644
index 00000000..4890f7cb
--- /dev/null
+++ b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/geofence/GeofenceErrorMessages.kt
@@ -0,0 +1,34 @@
+
+
+package com.cloud.diplomaticquarterapp.geofence
+
+import android.content.Context
+import com.cloud.diplomaticquarterapp.R
+import com.google.android.gms.common.api.ApiException
+import com.google.android.gms.location.GeofenceStatusCodes
+
+object GeofenceErrorMessages {
+ fun getErrorString(context: Context, e: Exception): String {
+ return if (e is ApiException) {
+ getErrorString(context, e.statusCode)
+ } else {
+ context.resources.getString(R.string.geofence_unknown_error)
+ }
+ }
+
+ fun getErrorString(context: Context, errorCode: Int): String {
+ val resources = context.resources
+ return when (errorCode) {
+ GeofenceStatusCodes.GEOFENCE_NOT_AVAILABLE ->
+ resources.getString(R.string.geofence_not_available)
+
+ GeofenceStatusCodes.GEOFENCE_TOO_MANY_GEOFENCES ->
+ resources.getString(R.string.geofence_too_many_geofences)
+
+ GeofenceStatusCodes.GEOFENCE_TOO_MANY_PENDING_INTENTS ->
+ resources.getString(R.string.geofence_too_many_pending_intents)
+
+ else -> resources.getString(R.string.geofence_unknown_error)
+ }
+ }
+}
\ No newline at end of file
diff --git a/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/geofence/GeofenceTransitionsJobIntentService.kt b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/geofence/GeofenceTransitionsJobIntentService.kt
new file mode 100644
index 00000000..f28e1720
--- /dev/null
+++ b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/geofence/GeofenceTransitionsJobIntentService.kt
@@ -0,0 +1,106 @@
+/*
+ * Copyright (c) 2018 Razeware LLC
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * Notwithstanding the foregoing, you may not use, copy, modify, merge, publish,
+ * distribute, sublicense, create a derivative work, and/or sell copies of the
+ * Software in any work that is designed, intended, or marketed for pedagogical or
+ * instructional purposes related to programming, coding, application development,
+ * or information technology. Permission for such use, copying, modification,
+ * merger, publication, distribution, sublicensing, creation of derivative works,
+ * or sale is expressly withheld.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+
+package com.cloud.diplomaticquarterapp.geofence
+
+import android.content.Context
+import android.content.Intent
+import android.location.Location
+import android.util.Log
+import androidx.core.app.JobIntentService
+import com.cloud.diplomaticquarterapp.utils.API
+import com.cloud.diplomaticquarterapp.utils.httpPost
+import com.cloud.diplomaticquarterapp.utils.sendNotification
+import com.github.kittinunf.fuel.core.extensions.jsonBody
+import com.github.kittinunf.fuel.core.isSuccessful
+import com.github.kittinunf.fuel.httpPost
+import com.google.android.gms.location.Geofence
+import com.google.android.gms.location.GeofencingEvent
+import com.google.gson.Gson
+
+class GeofenceTransitionsJobIntentService : JobIntentService() {
+
+ companion object {
+ private const val LOG_TAG = "GeoTrIntentService"
+
+ private const val JOB_ID = 573
+
+ fun enqueueWork(context: Context, intent: Intent) {
+ enqueueWork(
+ context,
+ GeofenceTransitionsJobIntentService::class.java, JOB_ID,
+ intent)
+ }
+ }
+
+ override fun onHandleWork(intent: Intent) {
+ val geofencingEvent = GeofencingEvent.fromIntent(intent)
+ if (geofencingEvent.hasError()) {
+ val errorMessage = GeofenceErrorMessages.getErrorString(this, geofencingEvent.errorCode)
+ Log.e(LOG_TAG, errorMessage)
+ return
+ }
+
+ if (geofencingEvent.geofenceTransition == Geofence.GEOFENCE_TRANSITION_ENTER || geofencingEvent.geofenceTransition == Geofence.GEOFENCE_TRANSITION_EXIT) {
+ handleEvent(geofencingEvent.triggeringGeofences,geofencingEvent.triggeringLocation, GeofenceTransition.fromInt(geofencingEvent.geofenceTransition));
+ }
+ }
+
+ private fun handleEvent(triggerGeofences: List, location:Location, transition:GeofenceTransition) {
+ val hmg = HMG_Geofence.shared(this)
+ hmg.getPatientID()?.let { patientId ->
+
+ hmg.getActiveGeofences({ activeGeofences ->
+
+ triggerGeofences.forEach { geofence ->
+ // Extract PointID from 'geofence.requestId' and find from active geofences
+ val pointID = activeGeofences.firstOrNull {it == geofence.requestId}?.split('_')?.first()
+ if(!pointID.isNullOrEmpty() && pointID.toIntOrNull() != null){
+
+ val body = mapOf(
+ "PointsID" to pointID.toIntOrNull(),
+ "GeoType" to transition.value,
+ "PatientID" to patientId
+ )
+
+ httpPost