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 d3e44cb9..19d22b13 100644
--- a/android/app/build.gradle
+++ b/android/app/build.gradle
@@ -27,7 +27,7 @@ apply plugin: 'com.google.gms.google-services'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
- compileSdkVersion 30
+ compileSdkVersion 28
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
@@ -41,7 +41,7 @@ android {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.cloud.diplomaticquarterapp"
minSdkVersion 21
- targetSdkVersion 30
+ targetSdkVersion 28
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
multiDexEnabled true
@@ -78,13 +78,21 @@ dependencies {
// 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.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'
- implementation 'com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava'
-
-
+
+
+ // 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/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 d0751535..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,6 +21,14 @@
+
+
+
+
+
+
+
+
-
@@ -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 100755
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 100755
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