From 1dc9400ffcda5dd3781dbace8341d4ea9208488b Mon Sep 17 00:00:00 2001 From: Zohaib Kambrani Date: Wed, 16 Dec 2020 17:50:25 +0300 Subject: [PATCH] Geofencing work in progress on android --- android/app/build.gradle | 3 +- android/app/src/main/AndroidManifest.xml | 16 +- .../geofence/GeoZoneModel.kt | 56 ++ .../geofence/GeofenceBroadcastReceiver.kt | 41 ++ .../geofence/GeofenceErrorMessages.kt | 62 ++ .../GeofenceTransitionsJobIntentService.kt | 106 +++ .../geofence/HMG_Geofence.kt | 143 ++++ .../cloud/diplomaticquarterapp/utils/API.kt | 1 + .../diplomaticquarterapp/utils/HMGUtils.kt | 47 ++ .../diplomaticquarterapp/utils/HTTPRequest.kt | 46 -- .../utils/PlatformBridge.kt | 35 +- android/app/src/main/res/values/strings.xml | 16 + ios/.gitignore | 2 - ios/Podfile.lock | 2 +- ios/Runner.xcodeproj/project.pbxproj | 697 ++++++++++++++++++ .../contents.xcworkspacedata | 10 + ios/Runner/Helper/GeoZoneModel.swift | 2 +- ios/Runner/Helper/HMG_Geofence.swift | 17 +- ios/gpx.gpx | 2 +- lib/core/service/AuthenticatedUserObject.dart | 2 +- lib/pages/landing/landing_page.dart | 7 +- 21 files changed, 1242 insertions(+), 71 deletions(-) create mode 100644 android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/geofence/GeoZoneModel.kt create mode 100644 android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/geofence/GeofenceBroadcastReceiver.kt create mode 100755 android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/geofence/GeofenceErrorMessages.kt create mode 100755 android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/geofence/GeofenceTransitionsJobIntentService.kt create mode 100644 android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/geofence/HMG_Geofence.kt delete mode 100644 android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/utils/HTTPRequest.kt create mode 100755 android/app/src/main/res/values/strings.xml create mode 100644 ios/Runner.xcodeproj/project.pbxproj create mode 100644 ios/Runner.xcworkspace/contents.xcworkspacedata diff --git a/android/app/build.gradle b/android/app/build.gradle index 91c15cde..99f2b204 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -86,7 +86,8 @@ dependencies { // 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' //for Android + 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/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index b2132a0d..0b8b7998 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -63,8 +63,6 @@ - @@ -74,20 +72,20 @@ - - + + + + + - - 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..8cf31a76 --- /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(Geofence.GEOFENCE_TRANSITION_ENTER or Geofence.GEOFENCE_TRANSITION_EXIT) +// .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..e9accb04 --- /dev/null +++ b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/geofence/GeofenceBroadcastReceiver.kt @@ -0,0 +1,41 @@ +/* + * 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.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..e85c7ea3 --- /dev/null +++ b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/geofence/GeofenceErrorMessages.kt @@ -0,0 +1,62 @@ +/* + * 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 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..0da35b6b --- /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.github.kittinunf.fuel.core.extensions.jsonBody +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) + if (hmg.getPatientID() != null){ + + 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 jsonBody = Gson().toJson( + mapOf("PointsID" to pointID.toIntOrNull(), + "GeoType" to transition.value, + "PatientID" to "") + ) + + API.LOG_GEOFENCE + .httpPost() + .jsonBody(jsonBody,Charsets.UTF_8) + .timeout(10000) + .response { request, response, result -> + + } + + } + } + + },null) + + } + } +} \ No newline at end of file diff --git a/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/geofence/HMG_Geofence.kt b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/geofence/HMG_Geofence.kt new file mode 100644 index 00000000..11af61a5 --- /dev/null +++ b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/geofence/HMG_Geofence.kt @@ -0,0 +1,143 @@ +package com.cloud.diplomaticquarterapp.geofence + +import android.Manifest +import android.app.PendingIntent +import android.content.Context +import android.content.Intent +import android.content.SharedPreferences +import android.content.pm.PackageManager +import androidx.core.content.ContextCompat +import com.google.android.gms.location.Geofence +import com.google.android.gms.location.GeofencingClient +import com.google.android.gms.location.GeofencingRequest +import com.google.android.gms.location.LocationServices +import com.google.gson.Gson +import com.google.gson.reflect.TypeToken + +enum class GeofenceTransition(val value: Int) { + ENTER(1), + EXIT(2); + + companion object { + fun fromInt(value: Int) = GeofenceTransition.values().first { it.value == value } + } +} + +const val PREFS_STORAGE = "FlutterSharedPreferences" +const val PREF_KEY_SUCCESS = "HMG_GEOFENCE_SUCCESS" +const val PREF_KEY_FAILED = "HMG_GEOFENCE_FAILED" + +class HMG_Geofence { + + private lateinit var context: Context + private lateinit var preferences:SharedPreferences + + private lateinit var geofencingClient:GeofencingClient + private val geofencePendingIntent: PendingIntent by lazy { + val intent = Intent(context, GeofenceBroadcastReceiver::class.java) + PendingIntent.getBroadcast( + context, + 0, + intent, + PendingIntent.FLAG_UPDATE_CURRENT) + } + + companion object{ + + var instance: HMG_Geofence? = null + fun shared(context: Context) : HMG_Geofence { + if (instance == null) { + instance = HMG_Geofence() + instance?.context = context + instance?.geofencingClient = LocationServices.getGeofencingClient(context) + instance?.preferences = context.getSharedPreferences(PREFS_STORAGE, Context.MODE_PRIVATE) + } + return instance!! + } + } + + fun register(geoZones: List){ + + fun buildGeofencingRequest(geofences: List): GeofencingRequest { + return GeofencingRequest.Builder() + .setInitialTrigger(0) + .addGeofences(geofences) + .build() + } + + getActiveGeofences({ active -> + + val geofences = mutableListOf() + geoZones.forEach { + it.toGeofence()?.let { geof -> + if(!active.contains(geof.requestId)){ // if not already registered then register + geofences.add(geof) + } + } + } + + if (checkPermission() && geofences.isNotEmpty()) { + geofencingClient + .addGeofences(buildGeofencingRequest(geofences), geofencePendingIntent) + .addOnSuccessListener { + saveGeofenceResults(geofences.map { it.requestId }, listOf()) + } + .addOnFailureListener { + print(it.localizedMessage) + } + } + },null); + } + + fun unRegisterAll(completion: (status: Boolean, message: String?) -> Unit){ + getActiveGeofences({ success -> + geofencingClient + .removeGeofences(success) + .addOnSuccessListener { + completion(true, null) + } + .addOnFailureListener { + completion(false, it.localizedMessage) + } + }, { failed -> + // Nothing to do with failed geofences. + }) + } + + fun saveGeofenceResults(success: List, failed: List){ + val gson = Gson() + val jsonSuccess = gson.toJson(success) + val jsonFailure = gson.toJson(failed) + preferences.edit().putString(PREF_KEY_SUCCESS, jsonSuccess).apply() + preferences.edit().putString(PREF_KEY_FAILED, jsonFailure).apply() + + } + + fun getActiveGeofences(success: (success: List) -> Unit, failure: ((failed: List) -> Unit)?){ + val gson = Gson() + val type = object : TypeToken?>() {}.type + + val jsonSuccess = preferences.getString(PREF_KEY_SUCCESS, "[]") + val success = gson.fromJson>(jsonSuccess, type) + success(success) + + if(failure != null){ + val jsonFailure = preferences.getString(PREF_KEY_FAILED, "[]") + val failed = gson.fromJson>(jsonFailure, type) + failure(failed) + } + + } + + private fun checkPermission() : Boolean{ + return ContextCompat.checkSelfPermission(context, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED + } + + fun getPatientID():Int?{ + val profileJson = preferences.getString("flutter.user-profile", "{}") + val type = object : TypeToken?>() {}.type + return Gson() + .fromJson?>(profileJson,type) + ?.get("PatientID") as? Int + } +} \ No newline at end of file diff --git a/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/utils/API.kt b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/utils/API.kt index 0d5f1e7e..30f57dde 100644 --- a/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/utils/API.kt +++ b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/utils/API.kt @@ -6,5 +6,6 @@ class API { private val SERVICE = "Services/Patients.svc/REST" val WIFI_CREDENTIALS = "$BASE/$SERVICE/Hmg_SMS_Get_By_ProjectID_And_PatientID" + val LOG_GEOFENCE = "$BASE/$SERVICE/GeoF_InsertPatientFileInfo" } } \ No newline at end of file diff --git a/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/utils/HMGUtils.kt b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/utils/HMGUtils.kt index 13d31d74..37c0ffb6 100644 --- a/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/utils/HMGUtils.kt +++ b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/utils/HMGUtils.kt @@ -1,8 +1,19 @@ package com.cloud.diplomaticquarterapp.utils +import android.app.NotificationChannel +import android.app.NotificationManager +import android.app.PendingIntent +import android.content.ClipData.newIntent +import android.content.Context +import android.content.Intent +import android.os.Build import android.view.View import android.widget.Toast +import androidx.core.app.NotificationCompat +import androidx.core.app.TaskStackBuilder +import com.cloud.diplomaticquarterapp.BuildConfig import com.cloud.diplomaticquarterapp.MainActivity +import com.cloud.diplomaticquarterapp.R import io.flutter.plugin.common.MethodChannel import java.util.* import kotlin.concurrent.timerTask @@ -53,3 +64,39 @@ class HMGUtils { private fun Timer.schedule(timerTask: TimerTask) { } +private const val NOTIFICATION_CHANNEL_ID = BuildConfig.APPLICATION_ID + ".channel" + +fun sendNotification(context: Context, message: String) { + val notificationManager = context + .getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager + + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O + && notificationManager.getNotificationChannel(NOTIFICATION_CHANNEL_ID) == null) { + val name = context.getString(R.string.app_name) + val channel = NotificationChannel(NOTIFICATION_CHANNEL_ID, + name, + NotificationManager.IMPORTANCE_DEFAULT) + + notificationManager.createNotificationChannel(channel) + } + + val intent = Intent(context,MainActivity::class.java) + + val stackBuilder = TaskStackBuilder.create(context) + .addParentStack(MainActivity::class.java) + .addNextIntent(intent) + val notificationPendingIntent = stackBuilder + .getPendingIntent(getUniqueId(), PendingIntent.FLAG_UPDATE_CURRENT) + + val notification = NotificationCompat.Builder(context, NOTIFICATION_CHANNEL_ID) + .setSmallIcon(R.mipmap.ic_launcher) + .setContentTitle(message) + .setContentIntent(notificationPendingIntent) + .setAutoCancel(true) + .build() + + notificationManager.notify(getUniqueId(), notification) +} + + +private fun getUniqueId() = ((System.currentTimeMillis() % 10000).toInt()) \ No newline at end of file diff --git a/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/utils/HTTPRequest.kt b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/utils/HTTPRequest.kt deleted file mode 100644 index e34c7c9b..00000000 --- a/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/utils/HTTPRequest.kt +++ /dev/null @@ -1,46 +0,0 @@ -package com.cloud.diplomaticquarterapp.utils - -import android.util.Log -import java.io.BufferedReader -import java.io.InputStreamReader -import java.io.OutputStreamWriter -import java.net.HttpURLConnection -import java.net.URL -import java.net.URLEncoder - -class HTTPRequest { - val TAG = "HTTPRequest" - - fun post(serverURL:String, params:Map){ - - var encodedParamsList = params.map { - URLEncoder.encode(it.key, "UTF-8") + "=" + URLEncoder.encode(it.value,"UTF-8") - } - - val postParam = encodedParamsList.joinToString (separator = "&") - - - val url = URL(serverURL) - - with(url.openConnection() as HttpURLConnection) { - requestMethod = "POST" - - val wr = OutputStreamWriter(outputStream) - wr.write(postParam) - wr.flush() - - BufferedReader(InputStreamReader(inputStream)).use { - val response = StringBuffer() - - var inputLIne = it.readLine() - while(inputLIne != null) { - response.append(inputLIne) - inputLIne = it.readLine() - } - - it.close() - Log.v(TAG,response.toString()) - } - } - } -} \ No newline at end of file diff --git a/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/utils/PlatformBridge.kt b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/utils/PlatformBridge.kt index 0f69a444..cf3b2828 100644 --- a/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/utils/PlatformBridge.kt +++ b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/utils/PlatformBridge.kt @@ -3,11 +3,11 @@ package com.cloud.diplomaticquarterapp.utils import android.content.Context import android.net.wifi.WifiManager import android.util.Log -import android.widget.Toast -import androidx.annotation.UiThread import com.cloud.diplomaticquarterapp.MainActivity import com.cloud.diplomaticquarterapp.hmgwifi.HMG_Guest import com.cloud.diplomaticquarterapp.hmgwifi.HMG_Internet +import com.cloud.diplomaticquarterapp.geofence.GeoZoneModel +import com.cloud.diplomaticquarterapp.geofence.HMG_Geofence import io.flutter.plugin.common.BinaryMessenger import io.flutter.plugin.common.MethodCall import io.flutter.plugin.common.MethodChannel @@ -23,7 +23,8 @@ class PlatformBridge(binaryMessenger: BinaryMessenger, flutterMainActivity: Main private const val HMG_INTERNET_WIFI_CONNECT_METHOD = "connectHMGInternetWifi" private const val HMG_GUEST_WIFI_CONNECT_METHOD = "connectHMGGuestWifi" private const val ENABLE_WIFI_IF_NOT = "enableWifiIfNot" - + private const val REGISTER_HMG_GEOFENCES = "registerHmgGeofences" + private const val UN_REGISTER_HMG_GEOFENCES = "unRegisterHmgGeofences" } fun create(){ @@ -39,6 +40,10 @@ class PlatformBridge(binaryMessenger: BinaryMessenger, flutterMainActivity: Main }else if (methodCall.method == ENABLE_WIFI_IF_NOT) { enableWifiIfNot(methodCall,result) + }else if (methodCall.method == REGISTER_HMG_GEOFENCES) { + registerHmgGeofences(methodCall,result) + }else if (methodCall.method == UN_REGISTER_HMG_GEOFENCES) { + unRegisterHmgGeofences(methodCall,result) }else{ result.notImplemented() @@ -93,4 +98,26 @@ class PlatformBridge(binaryMessenger: BinaryMessenger, flutterMainActivity: Main result.error("101","Error while opening wifi, Please try to open wifi yourself and try again","'WifiManager' service failed"); } } -} \ No newline at end of file + + + private fun registerHmgGeofences(methodCall: MethodCall, result: MethodChannel.Result) { + + channel.invokeMethod("getGeoZones",null, object : MethodChannel.Result{ + override fun success(result: Any?) { + if(result is String) + HMG_Geofence.shared(mainActivity).unRegisterAll { status, message -> + HMG_Geofence.shared(mainActivity).register(GeoZoneModel().listFrom(result)) + } + } + + override fun error(errorCode: String?, errorMessage: String?, errorDetails: Any?) { print(result) } + override fun notImplemented() { print(result) } + }) + + } + + private fun unRegisterHmgGeofences(methodCall: MethodCall, result: MethodChannel.Result) { + + } + +} diff --git a/android/app/src/main/res/values/strings.xml b/android/app/src/main/res/values/strings.xml new file mode 100755 index 00000000..8acc0c12 --- /dev/null +++ b/android/app/src/main/res/values/strings.xml @@ -0,0 +1,16 @@ + + HMG Patient App + + + Unknown error: the Geofence service is not available now. + + + Geofence service is not available now. Go to Settings>Location>Mode and choose High accuracy. + + + Your app has registered too many geofences. + + + You have provided too many PendingIntents to the addGeofences() call. + + diff --git a/ios/.gitignore b/ios/.gitignore index e67828a4..04b5cf29 100644 --- a/ios/.gitignore +++ b/ios/.gitignore @@ -30,6 +30,4 @@ Runner/GeneratedPluginRegistrant.* !default.mode2v3 !default.pbxuser !default.perspectivev3 -/Runner.xcworkspace/contents.xcworkspacedata -/Runner.xcodeproj/project.pbxproj /Flutter/.last_build_id diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 6a965de8..668711ce 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -438,6 +438,6 @@ SPEC CHECKSUMS: webview_flutter: d2b4d6c66968ad042ad94cbb791f5b72b4678a96 wifi: d7d77c94109e36c4175d845f0a5964eadba71060 -PODFILE CHECKSUM: ac5efa1ac3c9555d0008dc18004313c84746da62 +PODFILE CHECKSUM: 5a17be3f8af73a757fa4439c77cf6ab2db29a6e7 COCOAPODS: 1.10.0 diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj new file mode 100644 index 00000000..8c39e92b --- /dev/null +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -0,0 +1,697 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 51; + objects = { + +/* 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 */; }; + 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; + 813F9CBA7DD5ED63B28B8BB6 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 767C165F7ABF3BF1F829B9BF /* Pods_Runner.framework */; }; + 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; + 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; + 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; + E91B5396256AAA6500E96549 /* GlobalHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = E91B538D256AAA6500E96549 /* GlobalHelper.swift */; }; + E91B5397256AAA6500E96549 /* Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = E91B538E256AAA6500E96549 /* Extensions.swift */; }; + E91B5398256AAA6500E96549 /* API.swift in Sources */ = {isa = PBXBuildFile; fileRef = E91B538F256AAA6500E96549 /* API.swift */; }; + E91B539A256AAA6500E96549 /* MainFlutterVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = E91B5392256AAA6500E96549 /* MainFlutterVC.swift */; }; + E91B539B256AAA6500E96549 /* HMG_Internet.swift in Sources */ = {isa = PBXBuildFile; fileRef = E91B5394256AAA6500E96549 /* HMG_Internet.swift */; }; + E91B539C256AAA6500E96549 /* HMG_GUEST_bkp.swift in Sources */ = {isa = PBXBuildFile; fileRef = E91B5395256AAA6500E96549 /* HMG_GUEST_bkp.swift */; }; + E91B539F256AAC1400E96549 /* GuestPOC_Certificate.p12 in Resources */ = {isa = PBXBuildFile; fileRef = E91B539D256AAC1400E96549 /* GuestPOC_Certificate.p12 */; }; + E91B53A0256AAC1400E96549 /* GuestPOC_Certificate.cer in Resources */ = {isa = PBXBuildFile; fileRef = E91B539E256AAC1400E96549 /* GuestPOC_Certificate.cer */; }; + E91B53A3256AAD8200E96549 /* Main_Custom.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = E91B53A1256AAD8200E96549 /* Main_Custom.storyboard */; }; + E923EFD225863FDF00E3E751 /* GeoZoneModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = E923EFD125863FDF00E3E751 /* GeoZoneModel.swift */; }; + E923EFD4258645C100E3E751 /* HMG_Geofence.swift in Sources */ = {isa = PBXBuildFile; fileRef = E923EFD3258645C100E3E751 /* HMG_Geofence.swift */; }; + E923EFD62587443800E3E751 /* HMGPlatformBridge.swift in Sources */ = {isa = PBXBuildFile; fileRef = E923EFD52587443800E3E751 /* HMGPlatformBridge.swift */; }; + E923EFD82588D17700E3E751 /* gpx.gpx in Resources */ = {isa = PBXBuildFile; fileRef = E923EFD72588D17700E3E751 /* gpx.gpx */; }; + E9620805255C2ED100D3A35D /* NetworkExtension.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E9620804255C2ED100D3A35D /* NetworkExtension.framework */; }; + E9C8C136256BACDA00EFFB62 /* HMG_Guest.swift in Sources */ = {isa = PBXBuildFile; fileRef = E9C8C135256BACDA00EFFB62 /* HMG_Guest.swift */; }; + E9E27168256E3A4000F49B69 /* LocalizedFromFlutter.swift in Sources */ = {isa = PBXBuildFile; fileRef = E9E27167256E3A4000F49B69 /* LocalizedFromFlutter.swift */; }; +/* End PBXBuildFile section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 9705A1C41CF9048500538489 /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; + 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; + 308FEC658188F7D588BE7580 /* 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 = ""; }; + 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; + 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; + 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 767C165F7ABF3BF1F829B9BF /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; + 969F0CEC868FD7C196987A3E /* 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 = ""; }; + 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; + 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; + 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + DCFFD369041FFFFA94CF7B26 /* 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 = ""; }; + E91B538D256AAA6500E96549 /* GlobalHelper.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GlobalHelper.swift; sourceTree = ""; }; + E91B538E256AAA6500E96549 /* Extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Extensions.swift; sourceTree = ""; }; + E91B538F256AAA6500E96549 /* API.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = API.swift; sourceTree = ""; }; + E91B5392256AAA6500E96549 /* MainFlutterVC.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MainFlutterVC.swift; sourceTree = ""; }; + E91B5394256AAA6500E96549 /* HMG_Internet.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HMG_Internet.swift; sourceTree = ""; }; + E91B5395256AAA6500E96549 /* HMG_GUEST_bkp.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HMG_GUEST_bkp.swift; sourceTree = ""; }; + E91B539D256AAC1400E96549 /* GuestPOC_Certificate.p12 */ = {isa = PBXFileReference; lastKnownFileType = file; path = GuestPOC_Certificate.p12; sourceTree = ""; }; + E91B539E256AAC1400E96549 /* GuestPOC_Certificate.cer */ = {isa = PBXFileReference; lastKnownFileType = file; path = GuestPOC_Certificate.cer; sourceTree = ""; }; + E91B53A2256AAD8200E96549 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main_Custom.storyboard; sourceTree = ""; }; + E923EFD125863FDF00E3E751 /* GeoZoneModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GeoZoneModel.swift; sourceTree = ""; }; + E923EFD3258645C100E3E751 /* HMG_Geofence.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HMG_Geofence.swift; sourceTree = ""; }; + E923EFD52587443800E3E751 /* HMGPlatformBridge.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HMGPlatformBridge.swift; sourceTree = ""; }; + E923EFD72588D17700E3E751 /* gpx.gpx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = gpx.gpx; sourceTree = ""; }; + E9620803255C2ED100D3A35D /* Runner.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Runner.entitlements; sourceTree = ""; }; + E9620804255C2ED100D3A35D /* NetworkExtension.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = NetworkExtension.framework; path = System/Library/Frameworks/NetworkExtension.framework; sourceTree = SDKROOT; }; + E9C8C135256BACDA00EFFB62 /* HMG_Guest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HMG_Guest.swift; sourceTree = ""; }; + E9E27167256E3A4000F49B69 /* LocalizedFromFlutter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocalizedFromFlutter.swift; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 97C146EB1CF9000F007C117D /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 813F9CBA7DD5ED63B28B8BB6 /* Pods_Runner.framework in Frameworks */, + E9620805255C2ED100D3A35D /* NetworkExtension.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 555EAAA626EFB641859EF0BE /* Frameworks */ = { + isa = PBXGroup; + children = ( + E9620804255C2ED100D3A35D /* NetworkExtension.framework */, + 767C165F7ABF3BF1F829B9BF /* Pods_Runner.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + 605039E5DDF72C245F9765FE /* Pods */ = { + isa = PBXGroup; + children = ( + DCFFD369041FFFFA94CF7B26 /* Pods-Runner.debug.xcconfig */, + 969F0CEC868FD7C196987A3E /* Pods-Runner.release.xcconfig */, + 308FEC658188F7D588BE7580 /* Pods-Runner.profile.xcconfig */, + ); + path = Pods; + sourceTree = ""; + }; + 9740EEB11CF90186004384FC /* Flutter */ = { + isa = PBXGroup; + children = ( + 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, + 9740EEB21CF90195004384FC /* Debug.xcconfig */, + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, + 9740EEB31CF90195004384FC /* Generated.xcconfig */, + ); + name = Flutter; + sourceTree = ""; + }; + 97C146E51CF9000F007C117D = { + isa = PBXGroup; + children = ( + E923EFD72588D17700E3E751 /* gpx.gpx */, + 9740EEB11CF90186004384FC /* Flutter */, + 97C146F01CF9000F007C117D /* Runner */, + 97C146EF1CF9000F007C117D /* Products */, + 605039E5DDF72C245F9765FE /* Pods */, + 555EAAA626EFB641859EF0BE /* Frameworks */, + ); + sourceTree = ""; + }; + 97C146EF1CF9000F007C117D /* Products */ = { + isa = PBXGroup; + children = ( + 97C146EE1CF9000F007C117D /* Runner.app */, + ); + name = Products; + sourceTree = ""; + }; + 97C146F01CF9000F007C117D /* Runner */ = { + isa = PBXGroup; + children = ( + E91B539E256AAC1400E96549 /* GuestPOC_Certificate.cer */, + E91B539D256AAC1400E96549 /* GuestPOC_Certificate.p12 */, + E91B5390256AAA6500E96549 /* Controllers */, + E91B538C256AAA6500E96549 /* Helper */, + E91B5393256AAA6500E96549 /* WifiConnect */, + E9620803255C2ED100D3A35D /* Runner.entitlements */, + E91B53A1256AAD8200E96549 /* Main_Custom.storyboard */, + 97C146FA1CF9000F007C117D /* Main.storyboard */, + 97C146FD1CF9000F007C117D /* Assets.xcassets */, + 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, + 97C147021CF9000F007C117D /* Info.plist */, + 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, + 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, + 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, + 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, + ); + path = Runner; + sourceTree = ""; + }; + E91B538C256AAA6500E96549 /* Helper */ = { + isa = PBXGroup; + children = ( + E91B538D256AAA6500E96549 /* GlobalHelper.swift */, + E91B538E256AAA6500E96549 /* Extensions.swift */, + E91B538F256AAA6500E96549 /* API.swift */, + E9E27167256E3A4000F49B69 /* LocalizedFromFlutter.swift */, + E923EFD125863FDF00E3E751 /* GeoZoneModel.swift */, + E923EFD3258645C100E3E751 /* HMG_Geofence.swift */, + E923EFD52587443800E3E751 /* HMGPlatformBridge.swift */, + ); + path = Helper; + sourceTree = ""; + }; + E91B5390256AAA6500E96549 /* Controllers */ = { + isa = PBXGroup; + children = ( + E91B5392256AAA6500E96549 /* MainFlutterVC.swift */, + ); + path = Controllers; + sourceTree = ""; + }; + E91B5393256AAA6500E96549 /* WifiConnect */ = { + isa = PBXGroup; + children = ( + E9C8C135256BACDA00EFFB62 /* HMG_Guest.swift */, + E91B5394256AAA6500E96549 /* HMG_Internet.swift */, + E91B5395256AAA6500E96549 /* HMG_GUEST_bkp.swift */, + ); + path = WifiConnect; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 97C146ED1CF9000F007C117D /* Runner */ = { + isa = PBXNativeTarget; + buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; + buildPhases = ( + 299B8FE131E5BAE7FA7E2FC9 /* [CP] Check Pods Manifest.lock */, + 9740EEB61CF901F6004384FC /* Run Script */, + 97C146EA1CF9000F007C117D /* Sources */, + 97C146EB1CF9000F007C117D /* Frameworks */, + 97C146EC1CF9000F007C117D /* Resources */, + 9705A1C41CF9048500538489 /* Embed Frameworks */, + 3B06AD1E1E4923F5004D2608 /* Thin Binary */, + 125A739F71A29FBAE7B4D5AC /* [CP] Embed Pods Frameworks */, + 940F4A376A48B060117A1E5D /* [CP] Copy Pods Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = Runner; + productName = Runner; + productReference = 97C146EE1CF9000F007C117D /* Runner.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 97C146E61CF9000F007C117D /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 1020; + ORGANIZATIONNAME = ""; + TargetAttributes = { + 97C146ED1CF9000F007C117D = { + CreatedOnToolsVersion = 7.3.1; + LastSwiftMigration = 1100; + }; + }; + }; + buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 97C146E51CF9000F007C117D; + productRefGroup = 97C146EF1CF9000F007C117D /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 97C146ED1CF9000F007C117D /* Runner */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 97C146EC1CF9000F007C117D /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + E91B53A0256AAC1400E96549 /* GuestPOC_Certificate.cer in Resources */, + 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, + 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, + E923EFD82588D17700E3E751 /* gpx.gpx in Resources */, + E91B539F256AAC1400E96549 /* GuestPOC_Certificate.p12 in Resources */, + 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, + E91B53A3256AAD8200E96549 /* Main_Custom.storyboard in Resources */, + 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 125A739F71A29FBAE7B4D5AC /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Embed Pods Frameworks"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; + 299B8FE131E5BAE7FA7E2FC9 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; + 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Thin Binary"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; + }; + 940F4A376A48B060117A1E5D /* [CP] Copy Pods Resources */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Copy Pods Resources"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh\"\n"; + showEnvVarsInLog = 0; + }; + 9740EEB61CF901F6004384FC /* Run Script */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Run Script"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 97C146EA1CF9000F007C117D /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + E923EFD225863FDF00E3E751 /* GeoZoneModel.swift in Sources */, + E91B539A256AAA6500E96549 /* MainFlutterVC.swift in Sources */, + E91B539C256AAA6500E96549 /* HMG_GUEST_bkp.swift in Sources */, + E91B5396256AAA6500E96549 /* GlobalHelper.swift in Sources */, + E923EFD4258645C100E3E751 /* HMG_Geofence.swift in Sources */, + E923EFD62587443800E3E751 /* HMGPlatformBridge.swift in Sources */, + 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, + E9E27168256E3A4000F49B69 /* LocalizedFromFlutter.swift in Sources */, + 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, + E9C8C136256BACDA00EFFB62 /* HMG_Guest.swift in Sources */, + E91B539B256AAA6500E96549 /* HMG_Internet.swift in Sources */, + E91B5397256AAA6500E96549 /* Extensions.swift in Sources */, + E91B5398256AAA6500E96549 /* API.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + 97C146FA1CF9000F007C117D /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 97C146FB1CF9000F007C117D /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 97C147001CF9000F007C117D /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; + E91B53A1256AAD8200E96549 /* Main_Custom.storyboard */ = { + isa = PBXVariantGroup; + children = ( + E91B53A2256AAD8200E96549 /* Base */, + ); + name = Main_Custom.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 249021D3217E4FDB00AE95B9 /* Profile */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + SUPPORTED_PLATFORMS = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Profile; + }; + 249021D4217E4FDB00AE95B9 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + DEVELOPMENT_TEAM = 3A359E86ZF; + ENABLE_BITCODE = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Flutter", + ); + INFOPLIST_FILE = Runner/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Flutter", + ); + PRODUCT_BUNDLE_IDENTIFIER = "com.HMG.HMG-Smartphone"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_VERSION = 5.0; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Profile; + }; + 97C147031CF9000F007C117D /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 97C147041CF9000F007C117D /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + SUPPORTED_PLATFORMS = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 97C147061CF9000F007C117D /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + DEVELOPMENT_TEAM = 3A359E86ZF; + ENABLE_BITCODE = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Flutter", + ); + INFOPLIST_FILE = Runner/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Flutter", + ); + PRODUCT_BUNDLE_IDENTIFIER = "com.HMG.HMG-Smartphone"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Debug; + }; + 97C147071CF9000F007C117D /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + DEVELOPMENT_TEAM = 3A359E86ZF; + ENABLE_BITCODE = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Flutter", + ); + INFOPLIST_FILE = Runner/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Flutter", + ); + PRODUCT_BUNDLE_IDENTIFIER = "com.HMG.HMG-Smartphone"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_VERSION = 5.0; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 97C147031CF9000F007C117D /* Debug */, + 97C147041CF9000F007C117D /* Release */, + 249021D3217E4FDB00AE95B9 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 97C147061CF9000F007C117D /* Debug */, + 97C147071CF9000F007C117D /* Release */, + 249021D4217E4FDB00AE95B9 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 97C146E61CF9000F007C117D /* Project object */; +} diff --git a/ios/Runner.xcworkspace/contents.xcworkspacedata b/ios/Runner.xcworkspace/contents.xcworkspacedata new file mode 100644 index 00000000..21a3cc14 --- /dev/null +++ b/ios/Runner.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,10 @@ + + + + + + + diff --git a/ios/Runner/Helper/GeoZoneModel.swift b/ios/Runner/Helper/GeoZoneModel.swift index a6e10a45..e703b64c 100644 --- a/ios/Runner/Helper/GeoZoneModel.swift +++ b/ios/Runner/Helper/GeoZoneModel.swift @@ -21,7 +21,7 @@ class GeoZoneModel{ var isCity:String? func identifier() -> String{ - return "\(geofenceId)_hmg_geozone" + return "\(geofenceId)_hmg" } func message() -> String{ diff --git a/ios/Runner/Helper/HMG_Geofence.swift b/ios/Runner/Helper/HMG_Geofence.swift index 85892d3e..fb469165 100644 --- a/ios/Runner/Helper/HMG_Geofence.swift +++ b/ios/Runner/Helper/HMG_Geofence.swift @@ -155,7 +155,7 @@ extension HMG_Geofence{ } func notifyServer(forRegion:CLRegion, transition:Transition, location:CLLocation?){ - showNotification(title: "Notifying server..." , subtitle: forRegion.identifier, message: "") + df.dateFormat = "MMM/dd/yyyy hh:mm:ss" if let userProfileJson = UserDefaults.standard.string(forKey: "flutter.user-profile"), let userProfile = dictionary(from: userProfileJson), let patientId = userProfile["PatientID"] as? Int{ @@ -168,11 +168,22 @@ extension HMG_Geofence{ let url = "https://hmgwebservices.com/Services/Patients.svc/REST/GeoF_InsertPatientFileInfo" httpPostRequest(urlString: url, jsonBody: body){ (status,json) in - showNotification(title: transition.name(), subtitle: forRegion.identifier, message: status ? "Success: notified to server ✔️" : "Failed to notified server ✖️") + let status_ = status ? "Notified" : "Not notified" + showNotification(title: transition.name(), subtitle: forRegion.identifier, message: status_) + + + var logs = UserDefaults.init(suiteName: "GeoFenceLog")?.dictionary(forKey: "LOGS") ?? [:] + if var geo = logs[forRegion.identifier] as? [String]{ + geo.append("\(status_) at \(df.string(from: Date()))") + }else{ + logs.updateValue(["\(status_) at \(df.string(from: Date()))"], forKey: forRegion.identifier) + } + + UserDefaults.init(suiteName: "GeoFenceLog")?.set(logs, forKey: "LOGS") + } } } } - } diff --git a/ios/gpx.gpx b/ios/gpx.gpx index addbfa24..9cc26956 100644 --- a/ios/gpx.gpx +++ b/ios/gpx.gpx @@ -1 +1 @@ - Sverrir Sigmundarson Office Office Panorama Mall Panorama Mall Saudi Architects Crossing Saudi Architects Crossing Office Office \ No newline at end of file + Sverrir Sigmundarson Office Office Mahmoud Home Mahmoud Home Panorama Mall Panorama Mall Saudi Architects Crossing Saudi Architects Crossing Office Office \ No newline at end of file diff --git a/lib/core/service/AuthenticatedUserObject.dart b/lib/core/service/AuthenticatedUserObject.dart index f48b1179..5f992478 100644 --- a/lib/core/service/AuthenticatedUserObject.dart +++ b/lib/core/service/AuthenticatedUserObject.dart @@ -17,7 +17,7 @@ class AuthenticatedUserObject { if (userData != null) user = AuthenticatedUser.fromJson(userData); } - // var isLogin = await sharedPref.getString(LOGIN_TOKEN_ID); + // var isLogin = await sharedPref.getString(LOGIN_TOKEN_ID); this.isLogin = user != null; } diff --git a/lib/pages/landing/landing_page.dart b/lib/pages/landing/landing_page.dart index 4ff2cc9c..b8c88eca 100644 --- a/lib/pages/landing/landing_page.dart +++ b/lib/pages/landing/landing_page.dart @@ -147,12 +147,15 @@ class _LandingPageState extends State with WidgetsBindingObserver { // Flip Permission Checks [Zohaib Kambrani] requestPermissions().then((results) { - if (results[Permission.locationAlways].isGranted || results[Permission.location].isGranted) { + if (results[Permission.location].isGranted) { debugPrint("Fetching GEO ZONES from HMG service..."); locator().getAllGeoZones(GeoZonesRequestModel()).then((geoZones) { debugPrint("Finished Fetching GEO ZONES from HMG service..."); debugPrint("GEO ZONES saved to AppPreferences with key '$HMG_GEOFENCES'"); - if (authProvider.isLogin) { + authProvider.authenticatedUserObject.getUser().then((value) { + debugPrint(value.toString()); + }); + if (authProvider.authenticatedUserObject.user != null) { projectViewModel.platformBridge().registerHmgGeofences(); } });