WD: doctor list by region and sorting by name and distance

merge-update-with-lab-changes
taha.alam 1 year ago
parent 615f3bfa8e
commit c6787ff966

@ -6,7 +6,7 @@ import android.util.Log
import android.view.WindowManager
import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi
import com.cloud.diplomaticquarterapp.PenguinInPlatformBridge
//import com.cloud.diplomaticquarterapp.PenguinInPlatformBridge
import com.ejada.hmg.utils.*
import io.flutter.embedding.android.FlutterFragmentActivity
import io.flutter.embedding.engine.FlutterEngine
@ -21,7 +21,7 @@ class MainActivity: FlutterFragmentActivity() {
PlatformBridge(flutterEngine, this).create()
OpenTokPlatformBridge(flutterEngine, this).create()
PenguinInPlatformBridge(flutterEngine, this).create()
// PenguinInPlatformBridge(flutterEngine, this).create()
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
// val mChannel = NotificationChannel("video_call_noti", "video call", NotificationManager.IMPORTANCE_HIGH)

@ -1,52 +1,52 @@
package com.cloud.diplomaticquarterapp
import com.ejada.hmg.MainActivity
import android.os.Build
import android.util.Log
import androidx.annotation.RequiresApi
import com.cloud.diplomaticquarterapp.penguin.PenguinView
import io.flutter.embedding.engine.FlutterEngine
import io.flutter.plugin.common.MethodCall
import io.flutter.plugin.common.MethodChannel
class PenguinInPlatformBridge(
private var flutterEngine: FlutterEngine,
private var mainActivity: MainActivity
) {
private lateinit var channel: MethodChannel
companion object {
private const val CHANNEL = "launch_penguin_ui"
}
@RequiresApi(Build.VERSION_CODES.O)
fun create() {
// openTok = OpenTok(mainActivity, flutterEngine)
channel = MethodChannel(flutterEngine.dartExecutor.binaryMessenger, CHANNEL)
channel.setMethodCallHandler { call: MethodCall, result: MethodChannel.Result ->
when (call.method) {
"launchPenguin" -> {
print("the platform channel is being called")
val args = call.arguments as Map<String, Any>?
Log.d("TAG", "configureFlutterEngine: $args")
println("args")
args?.let {
PenguinView(
mainActivity,
100,
args,
flutterEngine.dartExecutor.binaryMessenger,
activity = mainActivity,
channel
)
}
}
else -> {
result.notImplemented()
}
}
}
}
}
//package com.cloud.diplomaticquarterapp
//import com.ejada.hmg.MainActivity
//import android.os.Build
//import android.util.Log
//import androidx.annotation.RequiresApi
//import com.cloud.diplomaticquarterapp.penguin.PenguinView
//import io.flutter.embedding.engine.FlutterEngine
//import io.flutter.plugin.common.MethodCall
//import io.flutter.plugin.common.MethodChannel
//
//class PenguinInPlatformBridge(
// private var flutterEngine: FlutterEngine,
// private var mainActivity: MainActivity
//) {
//
// private lateinit var channel: MethodChannel
//
// companion object {
// private const val CHANNEL = "launch_penguin_ui"
// }
//
// @RequiresApi(Build.VERSION_CODES.O)
// fun create() {
//// openTok = OpenTok(mainActivity, flutterEngine)
// channel = MethodChannel(flutterEngine.dartExecutor.binaryMessenger, CHANNEL)
// channel.setMethodCallHandler { call: MethodCall, result: MethodChannel.Result ->
// when (call.method) {
// "launchPenguin" -> {
// print("the platform channel is being called")
// val args = call.arguments as Map<String, Any>?
// Log.d("TAG", "configureFlutterEngine: $args")
// println("args")
// args?.let {
// PenguinView(
// mainActivity,
// 100,
// args,
// flutterEngine.dartExecutor.binaryMessenger,
// activity = mainActivity,
// channel
// )
// }
// }
//
// else -> {
// result.notImplemented()
// }
// }
// }
// }
//
//}

@ -1,97 +1,97 @@
package com.cloud.diplomaticquarterapp.penguin
import android.content.Context
import com.google.gson.Gson
import com.peng.pennavmap.PlugAndPlaySDK
import com.peng.pennavmap.connections.ApiController
import com.peng.pennavmap.interfaces.RefIdDelegate
import com.peng.pennavmap.models.TokenModel
import com.peng.pennavmap.models.postmodels.PostToken
import com.peng.pennavmap.utils.AppSharedData
import okhttp3.ResponseBody
import retrofit2.Call
import retrofit2.Callback
import retrofit2.Response
import android.util.Log
class PenguinNavigator() {
fun navigateTo(mContext: Context, refID: String, delegate: RefIdDelegate,clientID : String,clientKey : String ) {
val postToken = PostToken(clientID, clientKey)
getToken(mContext, postToken, object : RefIdDelegate {
override fun onRefByIDSuccess(PoiId: String?) {
Log.e("navigateTo", "PoiId is+++++++ $PoiId")
PlugAndPlaySDK.navigateTo(mContext, refID, object : RefIdDelegate {
override fun onRefByIDSuccess(PoiId: String?) {
Log.e("navigateTo", "PoiId 2is+++++++ $PoiId")
delegate.onRefByIDSuccess(refID)
}
override fun onGetByRefIDError(error: String?) {
delegate.onRefByIDSuccess(error)
}
})
}
override fun onGetByRefIDError(error: String?) {
delegate.onRefByIDSuccess(error)
}
})
}
fun getToken(mContext: Context, postToken: PostToken?, apiTokenCallBack: RefIdDelegate) {
try {
// Create the API call
val purposesCall: Call<ResponseBody> = ApiController.getInstance(mContext)
.apiMethods
.getToken(postToken)
// Enqueue the call for asynchronous execution
purposesCall.enqueue(object : Callback<ResponseBody?> {
override fun onResponse(
call: Call<ResponseBody?>,
response: Response<ResponseBody?>
) {
if (response.isSuccessful() && response.body() != null) {
try {
response.body()?.use { responseBody ->
val responseBodyString: String = responseBody.string() // Use `string()` to get the actual response content
if (responseBodyString.isNotEmpty()) {
val tokenModel = Gson().fromJson(responseBodyString, TokenModel::class.java)
if (tokenModel != null && tokenModel.token != null) {
AppSharedData.apiToken = tokenModel.token
apiTokenCallBack.onRefByIDSuccess(tokenModel.token)
} else {
apiTokenCallBack.onGetByRefIDError("Failed to parse token model")
}
} else {
apiTokenCallBack.onGetByRefIDError("Response body is empty")
}
}
} catch (e: Exception) {
apiTokenCallBack.onGetByRefIDError("An error occurred: ${e.message}")
}
} else {
apiTokenCallBack.onGetByRefIDError("Unsuccessful response: " + response.code())
}
}
override fun onFailure(call: Call<ResponseBody?>, t: Throwable) {
apiTokenCallBack.onGetByRefIDError(t.message)
}
})
} catch (error: Exception) {
apiTokenCallBack.onGetByRefIDError("Exception during API call: $error")
}
}
}
//package com.cloud.diplomaticquarterapp.penguin
//
//import android.content.Context
//import com.google.gson.Gson
//import com.peng.pennavmap.PlugAndPlaySDK
//import com.peng.pennavmap.connections.ApiController
//import com.peng.pennavmap.interfaces.RefIdDelegate
//import com.peng.pennavmap.models.TokenModel
//import com.peng.pennavmap.models.postmodels.PostToken
//import com.peng.pennavmap.utils.AppSharedData
//import okhttp3.ResponseBody
//import retrofit2.Call
//import retrofit2.Callback
//import retrofit2.Response
//import android.util.Log
//
//
//class PenguinNavigator() {
//
// fun navigateTo(mContext: Context, refID: String, delegate: RefIdDelegate,clientID : String,clientKey : String ) {
// val postToken = PostToken(clientID, clientKey)
// getToken(mContext, postToken, object : RefIdDelegate {
// override fun onRefByIDSuccess(PoiId: String?) {
// Log.e("navigateTo", "PoiId is+++++++ $PoiId")
//
// PlugAndPlaySDK.navigateTo(mContext, refID, object : RefIdDelegate {
// override fun onRefByIDSuccess(PoiId: String?) {
// Log.e("navigateTo", "PoiId 2is+++++++ $PoiId")
//
// delegate.onRefByIDSuccess(refID)
//
// }
//
// override fun onGetByRefIDError(error: String?) {
// delegate.onRefByIDSuccess(error)
// }
//
// })
//
//
// }
//
// override fun onGetByRefIDError(error: String?) {
// delegate.onRefByIDSuccess(error)
// }
//
// })
//
// }
//
// fun getToken(mContext: Context, postToken: PostToken?, apiTokenCallBack: RefIdDelegate) {
// try {
// // Create the API call
// val purposesCall: Call<ResponseBody> = ApiController.getInstance(mContext)
// .apiMethods
// .getToken(postToken)
//
// // Enqueue the call for asynchronous execution
// purposesCall.enqueue(object : Callback<ResponseBody?> {
// override fun onResponse(
// call: Call<ResponseBody?>,
// response: Response<ResponseBody?>
// ) {
// if (response.isSuccessful() && response.body() != null) {
// try {
// response.body()?.use { responseBody ->
// val responseBodyString: String = responseBody.string() // Use `string()` to get the actual response content
// if (responseBodyString.isNotEmpty()) {
// val tokenModel = Gson().fromJson(responseBodyString, TokenModel::class.java)
// if (tokenModel != null && tokenModel.token != null) {
// AppSharedData.apiToken = tokenModel.token
// apiTokenCallBack.onRefByIDSuccess(tokenModel.token)
// } else {
// apiTokenCallBack.onGetByRefIDError("Failed to parse token model")
// }
// } else {
// apiTokenCallBack.onGetByRefIDError("Response body is empty")
// }
// }
// } catch (e: Exception) {
// apiTokenCallBack.onGetByRefIDError("An error occurred: ${e.message}")
// }
// } else {
// apiTokenCallBack.onGetByRefIDError("Unsuccessful response: " + response.code())
// }
// }
//
// override fun onFailure(call: Call<ResponseBody?>, t: Throwable) {
// apiTokenCallBack.onGetByRefIDError(t.message)
// }
// })
// } catch (error: Exception) {
// apiTokenCallBack.onGetByRefIDError("Exception during API call: $error")
// }
// }
//
//}

@ -1,321 +1,321 @@
package com.cloud.diplomaticquarterapp.penguin
import android.app.Activity
import android.content.Context
import android.content.Context.RECEIVER_EXPORTED
import android.content.IntentFilter
import android.graphics.Color
import android.os.Build
import android.util.Log
import android.view.View
import android.view.ViewGroup
import android.widget.RelativeLayout
import android.widget.Toast
import androidx.annotation.RequiresApi
import com.cloud.diplomaticquarterapp.PermissionManager.PermissionHelper
import com.cloud.diplomaticquarterapp.PermissionManager.PermissionManager
import com.cloud.diplomaticquarterapp.PermissionManager.PermissionResultReceiver
import com.ejada.hmg.MainActivity
import com.peng.pennavmap.PlugAndPlayConfiguration
import com.peng.pennavmap.PlugAndPlaySDK
import com.peng.pennavmap.enums.InitializationErrorType
import com.peng.pennavmap.interfaces.PenNavUIDelegate
import com.peng.pennavmap.utils.Languages
import io.flutter.plugin.common.BinaryMessenger
import io.flutter.plugin.common.MethodCall
import io.flutter.plugin.common.MethodChannel
import io.flutter.plugin.platform.PlatformView
import com.cloud.diplomaticquarterapp.penguin.PenguinNavigator
import com.peng.pennavmap.interfaces.PIEventsDelegate
import com.peng.pennavmap.interfaces.PILocationDelegate
import com.peng.pennavmap.interfaces.RefIdDelegate
import com.peng.pennavmap.models.PIReportIssue
/**
* Custom PlatformView for displaying Penguin UI components within a Flutter app.
* Implements `PlatformView` for rendering the view, `MethodChannel.MethodCallHandler` for handling method calls,
* and `PenNavUIDelegate` for handling SDK events.
*/
@RequiresApi(Build.VERSION_CODES.O)
internal class PenguinView(
context: Context,
id: Int,
val creationParams: Map<String, Any>,
messenger: BinaryMessenger,
activity: MainActivity,
val channel: MethodChannel
) : PlatformView, MethodChannel.MethodCallHandler, PenNavUIDelegate {
// The layout for displaying the Penguin UI
private val mapLayout: RelativeLayout = RelativeLayout(context)
private val _context: Context = context
private val permissionResultReceiver: PermissionResultReceiver
private val permissionIntentFilter = IntentFilter("PERMISSION_RESULT_ACTION")
private companion object {
const val PERMISSIONS_REQUEST_CODE = 1
}
private lateinit var permissionManager: PermissionManager
// Reference to the main activity
private var _activity: Activity = activity
private lateinit var mContext: Context
lateinit var navigator: PenguinNavigator
init {
// Set layout parameters for the mapLayout
mapLayout.layoutParams = ViewGroup.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT
)
mContext = context
permissionResultReceiver = PermissionResultReceiver { granted ->
if (granted) {
onPermissionsGranted()
} else {
onPermissionsDenied()
}
}
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
mContext.registerReceiver(
permissionResultReceiver,
permissionIntentFilter,
RECEIVER_EXPORTED
)
} else {
mContext.registerReceiver(
permissionResultReceiver,
permissionIntentFilter,
)
}
// Set the background color of the layout
mapLayout.setBackgroundColor(Color.RED)
permissionManager = PermissionManager(
context = mContext,
listener = object : PermissionManager.PermissionListener {
override fun onPermissionGranted() {
// Handle permissions granted
onPermissionsGranted()
}
override fun onPermissionDenied() {
// Handle permissions denied
onPermissionsDenied()
}
},
requestCode = PERMISSIONS_REQUEST_CODE,
*PermissionHelper.getRequiredPermissions()
)
if (!permissionManager.arePermissionsGranted()) {
permissionManager.requestPermissions(_activity)
} else {
// Permissions already granted
permissionManager.listener.onPermissionGranted()
}
}
private fun onPermissionsGranted() {
// Handle the actions when permissions are granted
Log.d("PermissionsResult", "onPermissionsGranted")
// Register the platform view factory for creating custom views
// Initialize the Penguin SDK
initPenguin()
}
private fun onPermissionsDenied() {
// Handle the actions when permissions are denied
Log.d("PermissionsResult", "onPermissionsDenied")
}
/**
* Returns the view associated with this PlatformView.
*
* @return The main view for this PlatformView.
*/
override fun getView(): View {
return mapLayout
}
/**
* Cleans up resources associated with this PlatformView.
*/
override fun dispose() {
// Cleanup code if needed
}
/**
* Handles method calls from Dart code.
*
* @param call The method call from Dart.
* @param result The result callback to send responses back to Dart.
*/
override fun onMethodCall(call: MethodCall, result: MethodChannel.Result) {
// Handle method calls from Dart code here
}
/**
* Initializes the Penguin SDK with custom configuration and delegates.
*/
private fun initPenguin() {
navigator = PenguinNavigator()
// Configure the PlugAndPlaySDK
val language = when (creationParams["languageCode"] as String) {
"ar" -> Languages.ar
"en" -> Languages.en
else -> {
Languages.en
}
}
Log.d(
"TAG",
"initPenguin: ${Languages.getLanguageEnum(creationParams["languageCode"] as String)}"
)
PlugAndPlaySDK.configuration = PlugAndPlayConfiguration.Builder()
.setBaseUrl(
creationParams["dataURL"] as String,
creationParams["positionURL"] as String
)
.setServiceName(
creationParams["dataServiceName"] as String,
creationParams["positionServiceName"] as String
)
.setClientData(
creationParams["clientID"] as String,
creationParams["clientKey"] as String
)
.setUserName(creationParams["username"] as String)
// .setLanguageID(Languages.en)
.setLanguageID(language)
.setSimulationModeEnabled(creationParams["isSimulationModeEnabled"] as Boolean)
.setEnableBackButton(true)
// .setDeepLinkData("deeplink")
.setCustomizeColor("#2CA0AF")
.setDeepLinkSchema("")
.setIsEnableReportIssue(true)
.build()
// Set location delegate to handle location updates
// PlugAndPlaySDK.setPiLocationDelegate {
// Example code to handle location updates
// Uncomment and modify as needed
// if (location.size() > 0)
// Toast.makeText(_context, "Location Info Latitude: ${location[0]}, Longitude: ${location[1]}", Toast.LENGTH_SHORT).show()
// }
// Set events delegate for reporting issues
// PlugAndPlaySDK.setPiEventsDelegate(new PIEventsDelegate() {
// @Override
// public void onReportIssue(PIReportIssue issue) {
// Log.e("Issue Reported: ", issue.getReportType());
//package com.cloud.diplomaticquarterapp.penguin
//
//import android.app.Activity
//import android.content.Context
//import android.content.Context.RECEIVER_EXPORTED
//import android.content.IntentFilter
//import android.graphics.Color
//import android.os.Build
//import android.util.Log
//import android.view.View
//import android.view.ViewGroup
//import android.widget.RelativeLayout
//import android.widget.Toast
//import androidx.annotation.RequiresApi
//import com.cloud.diplomaticquarterapp.PermissionManager.PermissionHelper
//import com.cloud.diplomaticquarterapp.PermissionManager.PermissionManager
//import com.cloud.diplomaticquarterapp.PermissionManager.PermissionResultReceiver
//import com.ejada.hmg.MainActivity
//import com.peng.pennavmap.PlugAndPlayConfiguration
//import com.peng.pennavmap.PlugAndPlaySDK
//import com.peng.pennavmap.enums.InitializationErrorType
//import com.peng.pennavmap.interfaces.PenNavUIDelegate
//import com.peng.pennavmap.utils.Languages
//import io.flutter.plugin.common.BinaryMessenger
//import io.flutter.plugin.common.MethodCall
//import io.flutter.plugin.common.MethodChannel
//import io.flutter.plugin.platform.PlatformView
//import com.cloud.diplomaticquarterapp.penguin.PenguinNavigator
//import com.peng.pennavmap.interfaces.PIEventsDelegate
//import com.peng.pennavmap.interfaces.PILocationDelegate
//import com.peng.pennavmap.interfaces.RefIdDelegate
//import com.peng.pennavmap.models.PIReportIssue
///**
// * Custom PlatformView for displaying Penguin UI components within a Flutter app.
// * Implements `PlatformView` for rendering the view, `MethodChannel.MethodCallHandler` for handling method calls,
// * and `PenNavUIDelegate` for handling SDK events.
// */
//@RequiresApi(Build.VERSION_CODES.O)
//internal class PenguinView(
// context: Context,
// id: Int,
// val creationParams: Map<String, Any>,
// messenger: BinaryMessenger,
// activity: MainActivity,
// val channel: MethodChannel
//) : PlatformView, MethodChannel.MethodCallHandler, PenNavUIDelegate {
// // The layout for displaying the Penguin UI
// private val mapLayout: RelativeLayout = RelativeLayout(context)
// private val _context: Context = context
//
// private val permissionResultReceiver: PermissionResultReceiver
// private val permissionIntentFilter = IntentFilter("PERMISSION_RESULT_ACTION")
//
// private companion object {
// const val PERMISSIONS_REQUEST_CODE = 1
// }
//
// private lateinit var permissionManager: PermissionManager
//
// // Reference to the main activity
// private var _activity: Activity = activity
//
// private lateinit var mContext: Context
//
// lateinit var navigator: PenguinNavigator
//
// init {
// // Set layout parameters for the mapLayout
// mapLayout.layoutParams = ViewGroup.LayoutParams(
// ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT
// )
//
// mContext = context
//
//
// permissionResultReceiver = PermissionResultReceiver { granted ->
// if (granted) {
// onPermissionsGranted()
// } else {
// onPermissionsDenied()
// }
// // Implement issue reporting logic here }
// @Override
// public void onSharedLocation(String link) {
// // Implement Shared location logic here
// }
// if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
// mContext.registerReceiver(
// permissionResultReceiver,
// permissionIntentFilter,
// RECEIVER_EXPORTED
// )
// } else {
// mContext.registerReceiver(
// permissionResultReceiver,
// permissionIntentFilter,
// )
// }
//
// // Set the background color of the layout
// mapLayout.setBackgroundColor(Color.RED)
//
// permissionManager = PermissionManager(
// context = mContext,
// listener = object : PermissionManager.PermissionListener {
// override fun onPermissionGranted() {
// // Handle permissions granted
// onPermissionsGranted()
// }
//
// override fun onPermissionDenied() {
// // Handle permissions denied
// onPermissionsDenied()
// }
// })
// Start the Penguin SDK
PlugAndPlaySDK.start(mContext, this)
}
/**
* Navigates to the specified reference ID.
*
* @param refID The reference ID to navigate to.
*/
fun navigateTo(refID: String) {
try {
if (refID.isBlank()) {
Log.e("navigateTo", "Invalid refID: The reference ID is blank.")
}
// referenceId = refID
navigator.navigateTo(mContext, refID,object : RefIdDelegate {
override fun onRefByIDSuccess(PoiId: String?) {
Log.e("navigateTo", "PoiId is penguin view+++++++ $PoiId")
// channelFlutter.invokeMethod(
// PenguinMethod.navigateToPOI.name,
// "navigateTo Success"
// )
}
override fun onGetByRefIDError(error: String?) {
Log.e("navigateTo", "error is penguin view+++++++ $error")
// channelFlutter.invokeMethod(
// PenguinMethod.navigateToPOI.name,
// "navigateTo Failed: Invalid refID"
// )
}
} , creationParams["clientID"] as String, creationParams["clientKey"] as String )
} catch (e: Exception) {
Log.e("navigateTo", "Exception occurred during navigation: ${e.message}", e)
// channelFlutter.invokeMethod(
// PenguinMethod.navigateToPOI.name,
// "Failed: Exception - ${e.message}"
// },
// requestCode = PERMISSIONS_REQUEST_CODE,
// *PermissionHelper.getRequiredPermissions()
// )
//
// if (!permissionManager.arePermissionsGranted()) {
// permissionManager.requestPermissions(_activity)
// } else {
// // Permissions already granted
// permissionManager.listener.onPermissionGranted()
// }
//
//
// }
//
// private fun onPermissionsGranted() {
// // Handle the actions when permissions are granted
// Log.d("PermissionsResult", "onPermissionsGranted")
// // Register the platform view factory for creating custom views
//
// // Initialize the Penguin SDK
// initPenguin()
//
//
// }
//
// private fun onPermissionsDenied() {
// // Handle the actions when permissions are denied
// Log.d("PermissionsResult", "onPermissionsDenied")
//
// }
//
// /**
// * Returns the view associated with this PlatformView.
// *
// * @return The main view for this PlatformView.
// */
// override fun getView(): View {
// return mapLayout
// }
//
// /**
// * Cleans up resources associated with this PlatformView.
// */
// override fun dispose() {
// // Cleanup code if needed
// }
//
// /**
// * Handles method calls from Dart code.
// *
// * @param call The method call from Dart.
// * @param result The result callback to send responses back to Dart.
// */
// override fun onMethodCall(call: MethodCall, result: MethodChannel.Result) {
// // Handle method calls from Dart code here
// }
//
// /**
// * Initializes the Penguin SDK with custom configuration and delegates.
// */
// private fun initPenguin() {
// navigator = PenguinNavigator()
// // Configure the PlugAndPlaySDK
// val language = when (creationParams["languageCode"] as String) {
// "ar" -> Languages.ar
// "en" -> Languages.en
// else -> {
// Languages.en
// }
// }
// Log.d(
// "TAG",
// "initPenguin: ${Languages.getLanguageEnum(creationParams["languageCode"] as String)}"
// )
// PlugAndPlaySDK.configuration = PlugAndPlayConfiguration.Builder()
// .setBaseUrl(
// creationParams["dataURL"] as String,
// creationParams["positionURL"] as String
// )
// .setServiceName(
// creationParams["dataServiceName"] as String,
// creationParams["positionServiceName"] as String
// )
}
}
/**
* Called when Penguin UI setup is successful.
*
* @param warningCode Optional warning code received from the SDK.
*/
override fun onPenNavSuccess(warningCode: String?) {
val clinicId = creationParams["clinicID"] as String
if(clinicId.isEmpty()) return
navigateTo(clinicId)
}
/**
* Called when there is an initialization error with Penguin UI.
*
* @param description Description of the error.
* @param errorType Type of initialization error.
*/
override fun onPenNavInitializationError(
description: String?,
errorType: InitializationErrorType?
) {
val arguments: Map<String, Any?> = mapOf(
"description" to description,
"type" to errorType?.name
)
channel.invokeMethod(PenguinMethod.onPenNavInitializationError.name, arguments)
Toast.makeText(mContext, "Navigation Error: $description", Toast.LENGTH_SHORT).show()
}
/**
* Called when Penguin UI is dismissed.
*/
override fun onPenNavUIDismiss() {
// Handle UI dismissal if needed
try {
mContext.unregisterReceiver(permissionResultReceiver)
dispose();
} catch (e: IllegalArgumentException) {
Log.e("PenguinView", "Receiver not registered: $e")
}
}
}
// .setClientData(
// creationParams["clientID"] as String,
// creationParams["clientKey"] as String
// )
// .setUserName(creationParams["username"] as String)
//// .setLanguageID(Languages.en)
// .setLanguageID(language)
// .setSimulationModeEnabled(creationParams["isSimulationModeEnabled"] as Boolean)
// .setEnableBackButton(true)
//// .setDeepLinkData("deeplink")
// .setCustomizeColor("#2CA0AF")
// .setDeepLinkSchema("")
// .setIsEnableReportIssue(true)
// .build()
//
// // Set location delegate to handle location updates
//// PlugAndPlaySDK.setPiLocationDelegate {
// // Example code to handle location updates
// // Uncomment and modify as needed
// // if (location.size() > 0)
// // Toast.makeText(_context, "Location Info Latitude: ${location[0]}, Longitude: ${location[1]}", Toast.LENGTH_SHORT).show()
//// }
//
// // Set events delegate for reporting issues
//// PlugAndPlaySDK.setPiEventsDelegate(new PIEventsDelegate() {
//// @Override
//// public void onReportIssue(PIReportIssue issue) {
//// Log.e("Issue Reported: ", issue.getReportType());
//// }
//// // Implement issue reporting logic here }
//// @Override
//// public void onSharedLocation(String link) {
//// // Implement Shared location logic here
//// }
//// })
//
// // Start the Penguin SDK
// PlugAndPlaySDK.start(mContext, this)
// }
//
//
// /**
// * Navigates to the specified reference ID.
// *
// * @param refID The reference ID to navigate to.
// */
// fun navigateTo(refID: String) {
// try {
// if (refID.isBlank()) {
// Log.e("navigateTo", "Invalid refID: The reference ID is blank.")
// }
//// referenceId = refID
// navigator.navigateTo(mContext, refID,object : RefIdDelegate {
// override fun onRefByIDSuccess(PoiId: String?) {
// Log.e("navigateTo", "PoiId is penguin view+++++++ $PoiId")
//
//// channelFlutter.invokeMethod(
//// PenguinMethod.navigateToPOI.name,
//// "navigateTo Success"
//// )
// }
//
// override fun onGetByRefIDError(error: String?) {
// Log.e("navigateTo", "error is penguin view+++++++ $error")
//
//// channelFlutter.invokeMethod(
//// PenguinMethod.navigateToPOI.name,
//// "navigateTo Failed: Invalid refID"
//// )
// }
// } , creationParams["clientID"] as String, creationParams["clientKey"] as String )
//
// } catch (e: Exception) {
// Log.e("navigateTo", "Exception occurred during navigation: ${e.message}", e)
//// channelFlutter.invokeMethod(
//// PenguinMethod.navigateToPOI.name,
//// "Failed: Exception - ${e.message}"
//// )
// }
// }
//
// /**
// * Called when Penguin UI setup is successful.
// *
// * @param warningCode Optional warning code received from the SDK.
// */
// override fun onPenNavSuccess(warningCode: String?) {
// val clinicId = creationParams["clinicID"] as String
//
// if(clinicId.isEmpty()) return
//
// navigateTo(clinicId)
// }
//
// /**
// * Called when there is an initialization error with Penguin UI.
// *
// * @param description Description of the error.
// * @param errorType Type of initialization error.
// */
// override fun onPenNavInitializationError(
// description: String?,
// errorType: InitializationErrorType?
// ) {
// val arguments: Map<String, Any?> = mapOf(
// "description" to description,
// "type" to errorType?.name
// )
//
// channel.invokeMethod(PenguinMethod.onPenNavInitializationError.name, arguments)
// Toast.makeText(mContext, "Navigation Error: $description", Toast.LENGTH_SHORT).show()
// }
//
// /**
// * Called when Penguin UI is dismissed.
// */
// override fun onPenNavUIDismiss() {
// // Handle UI dismissal if needed
// try {
// mContext.unregisterReceiver(permissionResultReceiver)
// dispose();
// } catch (e: IllegalArgumentException) {
// Log.e("PenguinView", "Receiver not registered: $e")
// }
// }
//}
//

@ -19,5 +19,5 @@
<string name="GEOFENCE_REQUEST_TOO_FREQUENT">
Geofence requests happened too frequently.
</string>
<string name="mapbox_access_token" translatable="false">sk.eyJ1IjoicndhaWQiLCJhIjoiY2x6NWo0bTMzMWZodzJrcGZpemYzc3Z4dSJ9.uSSZuwNSGCcCdPAiORECmg</string>
<string name="mapbox_access_token" translatable="false">pk.eyJ1IjoicndhaWQiLCJhIjoiY2x5cGo4aHNjMGNsbTJyc2djempobGQxaSJ9.RCaC6WrUt4A4YnZNfxnONQ</string>
</resources>

@ -2141,7 +2141,7 @@ const Map localizedValues = {
"download": {"en": "Download", "ar": "تحميل"},
"share": {"en": "Share", "ar": "يشارك"},
"hmgHospital": {"en": "HMG Hospital", "ar": "مستشفى HMG"},
"hmcHospital": {"en": "HMC Hospital", "ar": "مستشفى HMC"},
"hmcHospitalCount": {"en": "@ HMC Hospital", "ar": "@ مستشفى HMC"},
"hmcHospital": {"en": "HMC", "ar": "HMC"},
"hmcHospitalCount": {"en": "@ HMC", "ar": "@ HMC"},
"hmgHospitalCount": {"en": "@ HMG Hospital", "ar": "@ مستشفى HMC"},
};

@ -276,7 +276,7 @@ class RegionTitle extends StatelessWidget {
Text(
title,
style: TextStyle(
fontSize: 18, color: Colors.black, fontWeight: FontWeight.w700),
fontSize: 22, color: Colors.black, fontWeight: FontWeight.w700),
),
SizedBox(
height: 8,
@ -286,9 +286,9 @@ class RegionTitle extends StatelessWidget {
Text(
"${TranslationBase.of(context).hmgHospitalCount.replaceAll("@", hmgCount)} ,",
style: TextStyle(
fontSize: 12,
color: Colors.red,
fontWeight: FontWeight.w400),
fontSize: 14,
color: Color(0xFFD02127),
fontWeight: FontWeight.w600),
),
SizedBox(
width: 8,
@ -296,9 +296,9 @@ class RegionTitle extends StatelessWidget {
Text(
"${TranslationBase.of(context).hmcHospitalCount.replaceAll("@", hmcCount)}",
style: TextStyle(
fontSize: 12,
color: Colors.greenAccent,
fontWeight: FontWeight.w400),
fontSize: 14,
color: Color(0xFF40ACC9),
fontWeight: FontWeight.w600),
),
],
),
@ -338,7 +338,7 @@ class HospitalTitle extends StatelessWidget {
title,
style: TextStyle(
fontSize: 18,
color: isHMC ? Colors.greenAccent : Colors.red,
color: isHMC ? Color(0xFF40ACC9) : Color(0xFFD02127),
fontWeight: FontWeight.w600),
),
],

@ -105,7 +105,6 @@ class _SearchByDoctorState extends State<SearchByDoctor> {
if (res['MessageStatus'] == 1) {
RegionList regionHospitalList = RegionList();
setState(() async {
if (res['DoctorList'].length != 0) {
res['DoctorList'].forEach((v) {
var reg = region[counter%4];
@ -119,9 +118,11 @@ class _SearchByDoctorState extends State<SearchByDoctor> {
regionHospitalList = await DoctorMapper.getMappedDoctor(doctorsList);
DoctorMapper.sortList(false, regionHospitalList);
regionHospitalList = await DoctorMapper.sortList(true, regionHospitalList);
setState(() {
});
// doctorsList.forEach((element) {
// List<PatientDoctorAppointmentList> doctorByHospital =
// _patientDoctorAppointmentListHospital.where((elementClinic) => elementClinic.filterName == element.getProjectCompleteName()).toList();
@ -141,7 +142,7 @@ class _SearchByDoctorState extends State<SearchByDoctor> {
GifLoaderDialogUtils.hideDialog(context);
AppToast.showErrorToast(message: res['ErrorSearchMsg']);
}
});
GifLoaderDialogUtils.hideDialog(context);
// navigateToSearchResults(context, doctorsList, _patientDoctorAppointmentListHospital);
navigateToSearchResults(context, regionHospitalList);

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save