Compare commits

..

No commits in common. 'dev_v3.13.6' and 'fatima-new' have entirely different histories.

@ -1,35 +0,0 @@
//package com.cloud.diplomaticquarterapp
package com.ejada.hmg
import io.flutter.app.FlutterApplication
import io.flutter.plugin.common.PluginRegistry
import io.flutter.plugin.common.PluginRegistry.PluginRegistrantCallback
import io.flutter.plugins.GeneratedPluginRegistrant
import io.flutter.plugins.firebasemessaging.FlutterFirebaseMessagingService
class Application : FlutterApplication(), PluginRegistrantCallback {
override fun onCreate() {
super.onCreate()
FlutterFirebaseMessagingService.setPluginRegistrant(this)
}
override fun registerWith(registry: PluginRegistry) {
io.flutter.plugins.firebasemessaging.FirebaseMessagingPlugin.registerWith(registry?.registrarFor("io.flutter.plugins.firebasemessaging.FirebaseMessagingPlugin"));
}
}
//import io.flutter.app.FlutterApplication
//import io.flutter.plugin.common.PluginRegistry
//import io.flutter.plugin.common.PluginRegistry.PluginRegistrantCallback
//import io.flutter.plugins.firebasemessaging.FlutterFirebaseMessagingService
//
//class Application : FlutterApplication(), PluginRegistrantCallback {
// override fun onCreate() {
// super.onCreate()
// FlutterFirebaseMessagingService.setPluginRegistrant(this)
// }
//
// override fun registerWith(registry: PluginRegistry?) {
// FirebaseCloudMessagingPluginRegistrant.registerWith(registry)
// }
//}

@ -1,16 +0,0 @@
-----BEGIN CERTIFICATE REQUEST-----
MIICgjCCAWoCAQAwPTEjMCEGCSqGSIb3DQEJARYUSGFyb29uNjEzOEBnbWFpbC5j
b20xCTAHBgNVBAMMADELMAkGA1UEBhMCQUUwggEiMA0GCSqGSIb3DQEBAQUAA4IB
DwAwggEKAoIBAQDHadAER62mSf+wOxPu9rF1EvifDxbAEv6znZIHvwimgShdPLLS
rkFdN4VpSHMzrASqpHnlSL3wxO6eym9pATH3WfLvKIQxnn9OkO5fScjQi0RkFbe0
JqTqN2LaFxrSFrhqQ/1p/izr690HqjrfquRI8t8evatyTku67/xcCj6uSIVLfJoS
8YCDVn0Y+w9n2Vw/+kHiNY6P96qp/CfXZgMLFpUu0mqcmZl97htfmB9AH2tC45yh
mKxDJiKEnk69zVCh/bkc9tFE1tUDkkKblJTCEyWfdDUUYM4ET3t3fBqWB78F4J3m
XglByGZmHgY2+7nsSQBiq7k9tFN2c7FZ9BD3AgMBAAGgADANBgkqhkiG9w0BAQsF
AAOCAQEAJxqoyfEJ7V83ffCAqkYNNEcCQMIRi1Y4cTTm/5KZGA/UPeDeX48/bm4K
XIf2zbv88OGASInBrvMDp0x0zs13Dx2yXxofGN+iQSBwN6jPV/upmm0DjgTmgUGh
BJste70LaU228ADzWDw8UJm/GKjK8WvE0XOGpPKYq9cuVW3M+6QRoRHXy0eJc2PX
VgopsuhHUyA5trxM7k4yc6GgYVx+fAwMaplovTwn5U8XK6bDEIvCjImfat/u4Wp8
R31p0BQzQaeyWfpp9Ucn/fvQSeB+wtjhHuA1ukcyWY1kBYOyCMIHymFrJLaTpUj7
aQFYZDV28HYv0yWhWIAD9Pu+aDHWpA==
-----END CERTIFICATE REQUEST-----

@ -1,74 +0,0 @@
Bag Attributes
friendlyName: VoIP Services: com.HMG.HMG-Smartphone
localKeyID: 70 4A 99 03 F8 D7 92 FA F7 2F DD 3B D8 BF 2C F0 BD CE 21 C8
subject=/UID=com.HMG.HMG-Smartphone.voip/CN=VoIP Services: com.HMG.HMG-Smartphone/OU=3A359E86ZF/O=Dr Sulaiman Al Habib Medical Center/C=SA
issuer=/CN=Apple Worldwide Developer Relations Certification Authority/OU=G4/O=Apple Inc./C=US
-----BEGIN CERTIFICATE-----
MIIGkTCCBXmgAwIBAgIQFB+/PYFlrZ6SCzSX9cqOBDANBgkqhkiG9w0BAQsFADB1
MUQwQgYDVQQDDDtBcHBsZSBXb3JsZHdpZGUgRGV2ZWxvcGVyIFJlbGF0aW9ucyBD
ZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTELMAkGA1UECwwCRzQxEzARBgNVBAoMCkFw
cGxlIEluYy4xCzAJBgNVBAYTAlVTMB4XDTI0MDYwOTEyMDc1MVoXDTI1MDcwOTEy
MDc1MFowga0xKzApBgoJkiaJk/IsZAEBDBtjb20uSE1HLkhNRy1TbWFydHBob25l
LnZvaXAxLjAsBgNVBAMMJVZvSVAgU2VydmljZXM6IGNvbS5ITUcuSE1HLVNtYXJ0
cGhvbmUxEzARBgNVBAsMCjNBMzU5RTg2WkYxLDAqBgNVBAoMI0RyIFN1bGFpbWFu
IEFsIEhhYmliIE1lZGljYWwgQ2VudGVyMQswCQYDVQQGEwJTQTCCASIwDQYJKoZI
hvcNAQEBBQADggEPADCCAQoCggEBAMdp0ARHraZJ/7A7E+72sXUS+J8PFsAS/rOd
kge/CKaBKF08stKuQV03hWlIczOsBKqkeeVIvfDE7p7Kb2kBMfdZ8u8ohDGef06Q
7l9JyNCLRGQVt7QmpOo3YtoXGtIWuGpD/Wn+LOvr3QeqOt+q5Ejy3x69q3JOS7rv
/FwKPq5IhUt8mhLxgINWfRj7D2fZXD/6QeI1jo/3qqn8J9dmAwsWlS7SapyZmX3u
G1+YH0Afa0LjnKGYrEMmIoSeTr3NUKH9uRz20UTW1QOSQpuUlMITJZ90NRRgzgRP
e3d8GpYHvwXgneZeCUHIZmYeBjb7uexJAGKruT20U3ZzsVn0EPcCAwEAAaOCAuIw
ggLeMAwGA1UdEwEB/wQCMAAwHwYDVR0jBBgwFoAUW9n6HeeaGgujmXYiUIY+kchb
d6gwcAYIKwYBBQUHAQEEZDBiMC0GCCsGAQUFBzAChiFodHRwOi8vY2VydHMuYXBw
bGUuY29tL3d3ZHJnNC5kZXIwMQYIKwYBBQUHMAGGJWh0dHA6Ly9vY3NwLmFwcGxl
LmNvbS9vY3NwMDMtd3dkcmc0MDUwggEeBgNVHSAEggEVMIIBETCCAQ0GCSqGSIb3
Y2QFATCB/zCBwwYIKwYBBQUHAgIwgbYMgbNSZWxpYW5jZSBvbiB0aGlzIGNlcnRp
ZmljYXRlIGJ5IGFueSBwYXJ0eSBhc3N1bWVzIGFjY2VwdGFuY2Ugb2YgdGhlIHRo
ZW4gYXBwbGljYWJsZSBzdGFuZGFyZCB0ZXJtcyBhbmQgY29uZGl0aW9ucyBvZiB1
c2UsIGNlcnRpZmljYXRlIHBvbGljeSBhbmQgY2VydGlmaWNhdGlvbiBwcmFjdGlj
ZSBzdGF0ZW1lbnRzLjA3BggrBgEFBQcCARYraHR0cHM6Ly93d3cuYXBwbGUuY29t
L2NlcnRpZmljYXRlYXV0aG9yaXR5LzATBgNVHSUEDDAKBggrBgEFBQcDAjAyBgNV
HR8EKzApMCegJaAjhiFodHRwOi8vY3JsLmFwcGxlLmNvbS93d2RyZzQtNi5jcmww
HQYDVR0OBBYEFHBKmQP415L69y/dO9i/LPC9ziHIMA4GA1UdDwEB/wQEAwIHgDAQ
BgoqhkiG92NkBgMBBAIFADAQBgoqhkiG92NkBgMCBAIFADBDBgoqhkiG92NkBgME
BDUMM2NvbS5ITUcuSE1HLVNtYXJ0cGhvbmUsIGNvbS5ITUcuSE1HLVNtYXJ0cGhv
bmUudm9pcDAQBgoqhkiG92NkBgMFBAIFADAmBgoqhkiG92NkBgMDBBgMFmNvbS5I
TUcuSE1HLVNtYXJ0cGhvbmUwDQYJKoZIhvcNAQELBQADggEBAJAcIzSskk8/GbxQ
7nGUPPEWFswL66xTt3GusHmeXkKDXG3ac+4jLk8yU7gunos77CNDm+9TkShdJ2Rg
tTRopK4ockqwoPrCeEVrooHR4e42YvmkB6AfYKJRnQZQVJIpW0OES7vrtoWVGoNj
ktHOV+wFIuAQPI9P4z0RFyRw85MHr+jFqxeLU/1500PwCxIiNHkIcUtzZgrnr22R
7rgkxav+RrjLjXVQvC4VJispKCU7yR69Xv1rsC5zc7OTCuCkbQ9FvnfsiUz5ZDzp
3D0gGojU9wmJ1yVk9HiZsuiVwmg/LbDHI3pSYbxz3n1UHB6Pu0jX3c3Uxkx674HD
/0uvHzg=
-----END CERTIFICATE-----
Bag Attributes
localKeyID: 70 4A 99 03 F8 D7 92 FA F7 2F DD 3B D8 BF 2C F0 BD CE 21 C8
Key Attributes: <No Attributes>
-----BEGIN PRIVATE KEY-----
MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDHadAER62mSf+w
OxPu9rF1EvifDxbAEv6znZIHvwimgShdPLLSrkFdN4VpSHMzrASqpHnlSL3wxO6e
ym9pATH3WfLvKIQxnn9OkO5fScjQi0RkFbe0JqTqN2LaFxrSFrhqQ/1p/izr690H
qjrfquRI8t8evatyTku67/xcCj6uSIVLfJoS8YCDVn0Y+w9n2Vw/+kHiNY6P96qp
/CfXZgMLFpUu0mqcmZl97htfmB9AH2tC45yhmKxDJiKEnk69zVCh/bkc9tFE1tUD
kkKblJTCEyWfdDUUYM4ET3t3fBqWB78F4J3mXglByGZmHgY2+7nsSQBiq7k9tFN2
c7FZ9BD3AgMBAAECggEBALTXH58SBcd86hS+rsgSDkJ2ruNIQsBzOWpYJjtCIi0l
ih5r0lu/TWWk2SbuXhLpF95MhILLIf18Ck4UlU5rmA2SE/6RBrkc3KS6SII/no6J
Db+Z9lu4g+wnyEyxkVAe7KTp/aGmsMROxMaTuQpnptkE8BSnuxhRKtpfksNBQzC2
19OkEy4JAO7xWbm9w/ASiCtYf0Vj26DQo982Fe44cpG08iB2v1uUJINQkGzmg+85
vvn5A1ECpSpgd/eOa68ojxeNSU7iFGZPbpjuincLPBFlC5zp9KD1Bt6p2KwIizBl
GPYTp6a1DnWly6n0PuLN0fl/nRmI6ar48Ja1Qzk8NvECgYEA5iQo9lnjNOHjT6bk
hj5QXMz3MDMCPdJo6jQyADtmsC/F4RjufujfXPhMv2v8JLAjQjNMgfhTSF68zYHf
i1qW8e/CgWu7mGQEIhWtxiTkLou8zW3VjxwpgfeUsGI5L+PxoN53ZUVcetLz4Y58
8ATEhlxh02uGmG2k3HbvFu9NBT8CgYEA3dHJfFX2xv53ZD1E2IE1rM3j7a32s7VB
k/YX8ODrAJxwNmy/vm4gd5h6ofqVS1/IV4NHFbmQ5c1tzB44YGOEZH5Ta9hhHgHU
xoa3q6t+kjR9KrQvxjTSe9mW5x/jAgU0Wp/XrAfMZxc2eukb4/sJAGKG0kyFeX5O
5abVixWj7kkCgYAafd8ZPI+i7r2z1YpIybOGezGZIsYHR8k77HY1AKF5doZYuv35
LeVIVmy/PDbyIjRs0mrkKymrEvy4y1JoQC1P/EFvlG8rw5eWNNikDmsV0JATNal3
p84/X7iF9UiP8rVFx1YHGkzi9pWMSVKobmQQ82FvbNk5gqWPm0E6aqF7EQKBgQDB
mE0PlT9SIdk1xTuG8g5UiUV6tS/xXCql5kyy0LqJx/8voO4gV6FCf/PX1wnhxPDn
YA30agaKaiZ/1YhCp9hulMpd/3WTaOm5cu5uh7hqBiGP2b8wb/2cViWcBnpr0vsE
dSkYXZ4KA3pq/3R2HyyWB2e/t0Vu6cwWJuuM/hAa8QKBgGNRStNVSMPvzx2X7mB6
EqdlWqVbfSTHJiZKyNPWHlSuZgdQ14BRwq7KZ0ysZy+kOX4rh1rIfqzrKc62xEXB
E+fmIpu+DUOM5ojEPCf9Om87r3fMJ54SjM7z1dtVc+Muy4TnFZ4UQcN9txWbnkAo
++H5gC9DBedOEXkwoCYjoeuM
-----END PRIVATE KEY-----

Binary file not shown.

@ -1,23 +0,0 @@
//package com.cloud.diplomaticquarterapp
package com.ejada.hmg
import io.flutter.plugin.common.PluginRegistry
import io.flutter.plugins.firebasemessaging.FirebaseMessagingPlugin
object FirebaseCloudMessagingPluginRegistrant {
fun registerWith(registry: PluginRegistry?) {
if (alreadyRegisteredWith(registry)) {
return
}
FirebaseMessagingPlugin.registerWith(registry?.registrarFor("io.flutter.plugins.firebasemessaging.FirebaseMessagingPlugin"))
}
private fun alreadyRegisteredWith(registry: PluginRegistry?): Boolean {
val key: String? = FirebaseCloudMessagingPluginRegistrant::class.java.canonicalName
if (registry?.hasPlugin(key)!!) {
return true
}
registry.registrarFor(key)
return false
}
}

@ -1,6 +0,0 @@
-----BEGIN PRIVATE KEY-----
MIGTAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBHkwdwIBAQQgJ5XRSnefd1apSG/z
YJTQ55ffLMlPgKlGM9edg88mUZagCgYIKoZIzj0DAQehRANCAATSA2MbS+J0cQsc
uBU0xaoxOUgGvnHCQSEK4t22i8eeKPPhH6RHJhK1ugPvj+Eyadf7j6pn3QRonEJu
mIL+qvqC
-----END PRIVATE KEY-----

@ -1,4 +1,4 @@
'# diplomaticquarterapp
# diplomaticquarterapp
A new Flutter application.

@ -2,33 +2,14 @@ package io.flutter.plugins.firebasemessaging;
import android.content.Intent;
import java.util.concurrent.TimeUnit;
import com.google.firebase.messaging.RemoteMessage;
//public class CustomFlutterFirebaseMessagingService extends FlutterFirebaseMessagingService {
// @Override
// public void onMessageReceived(RemoteMessage remoteMessage) {
// if (remoteMessage.getData().containsKey("is_call")) {
// Intent intent = getPackageManager().getLaunchIntentForPackage(getPackageName());
// startActivity(intent);
// super.onMessageReceived(remoteMessage);
// } else
// super.onMessageReceived(remoteMessage);
// }
//}
public class CustomFlutterFirebaseMessagingService extends FlutterFirebaseMessagingService {
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
if (remoteMessage.getData().containsKey("is_call")) {
Intent intent = getPackageManager().getLaunchIntentForPackage(getPackageName());
intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
startActivity(intent);
try {
TimeUnit.SECONDS.sleep(5);
} catch (Exception e) {
}
super.onMessageReceived(remoteMessage);
} else
super.onMessageReceived(remoteMessage);

@ -1,114 +0,0 @@
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package io.flutter.plugins.firebase.messaging;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
import java.util.Timer;
import java.util.TimerTask;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import com.google.firebase.messaging.RemoteMessage;
import java.util.HashMap;
import java.util.concurrent.TimeUnit;
public class FlutterFirebaseMessagingReceiver extends BroadcastReceiver {
private static final String TAG = "FLTFireMsgReceiver";
static HashMap<String, RemoteMessage> notifications = new HashMap<>();
@Override
public void onReceive(Context context, Intent intent) {
Log.d(TAG, "broadcast received for message");
if (ContextHolder.getApplicationContext() == null) {
ContextHolder.setApplicationContext(context.getApplicationContext());
}
if (intent.getExtras() == null) {
Log.d(
TAG,
"broadcast received but intent contained no extras to process RemoteMessage. Operation cancelled.");
return;
}
RemoteMessage remoteMessage = new RemoteMessage(intent.getExtras());
// Store the RemoteMessage if the message contains a notification payload.
if (remoteMessage.getNotification() != null) {
notifications.put(remoteMessage.getMessageId(), remoteMessage);
FlutterFirebaseMessagingStore.getInstance().storeFirebaseMessage(remoteMessage);
}
// |-> ---------------------
// App in Foreground
// ------------------------
if (FlutterFirebaseMessagingUtils.isApplicationForeground(context)) {
Intent onMessageIntent = new Intent(FlutterFirebaseMessagingUtils.ACTION_REMOTE_MESSAGE);
onMessageIntent.putExtra(FlutterFirebaseMessagingUtils.EXTRA_REMOTE_MESSAGE, remoteMessage);
LocalBroadcastManager.getInstance(context).sendBroadcast(onMessageIntent);
return;
}
// |-> ---------------------
// App in Background/Quit
// ------------------------
if (remoteMessage.getData().containsKey("is_call")) {
Intent intent12 = context.getPackageManager().getLaunchIntentForPackage(context.getPackageName());
intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
context.startActivity(intent12);
try {
new Timer().schedule(new TimerTask() {
@Override
public void run() {
Intent onMessageIntent = new Intent(FlutterFirebaseMessagingUtils.ACTION_REMOTE_MESSAGE);
onMessageIntent.putExtra(FlutterFirebaseMessagingUtils.EXTRA_REMOTE_MESSAGE, remoteMessage);
LocalBroadcastManager.getInstance(context).sendBroadcast(onMessageIntent);
}
}, 5000);
} catch (Exception e) {
Log.e("AppCallingException", e.getMessage());
}
// super.onMessageReceived(remoteMessage);
} //else
// super.onMessageReceived(remoteMessage);
//
// if (remoteMessage.getData().containsKey("is_call")) {
// Log.e("AppCalling", "started...");
// Intent intent12 = context.getPackageManager().getLaunchIntentForPackage(context.getPackageName());
// intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
// context.startActivity(intent12);
// try {
// Log.e("AppCalling", "going to sleep...");
// TimeUnit.SECONDS.sleep(10);
// Log.e("AppCalling", "sendig to broadcast receiver...");
// Log.e("AppCalling:DAta", remoteMessage.getData().containsKey("is_call") + "");
// Intent onBackgroundMessageIntent =
// new Intent(context, FlutterFirebaseMessagingBackgroundService.class);
// onBackgroundMessageIntent.putExtra(
// FlutterFirebaseMessagingUtils.EXTRA_REMOTE_MESSAGE, remoteMessage);
// FlutterFirebaseMessagingBackgroundService.enqueueMessageProcessing(
// context, onBackgroundMessageIntent);
// //return;
// } catch (Exception e) {
// Log.e("AppCallingException", e.getMessage());
// }
//
// }
Intent onBackgroundMessageIntent =
new Intent(context, FlutterFirebaseMessagingBackgroundService.class);
onBackgroundMessageIntent.putExtra(
FlutterFirebaseMessagingUtils.EXTRA_REMOTE_MESSAGE, remoteMessage);
FlutterFirebaseMessagingBackgroundService.enqueueMessageProcessing(
context, onBackgroundMessageIntent);
}
}

@ -1,74 +0,0 @@
{
"agcgw":{
"backurl":"connect-drcn.hispace.hicloud.com",
"url":"connect-drcn.dbankcloud.cn",
"websocketbackurl":"connect-ws-drcn.hispace.dbankcloud.com",
"websocketurl":"connect-ws-drcn.hispace.dbankcloud.cn"
},
"agcgw_all":{
"CN":"connect-drcn.dbankcloud.cn",
"CN_back":"connect-drcn.hispace.hicloud.com",
"DE":"connect-dre.dbankcloud.cn",
"DE_back":"connect-dre.hispace.hicloud.com",
"RU":"connect-drru.dbankcloud.cn",
"RU_back":"connect-drru.hispace.hicloud.com",
"SG":"connect-dra.dbankcloud.cn",
"SG_back":"connect-dra.hispace.hicloud.com"
},
"client":{
"cp_id":"2640966000002322881",
"product_id":"736430079244816567",
"client_id":"563735388191982656",
"client_secret":"650C7C799812AFFD53A10C7756CF05FB9F215A7E49032ABA8EBF3E14B77535CF",
"project_id":"736430079244816567",
"app_id":"102857389",
"api_key":"CgB6e3x9DJzMgRCmnT6dyUEkp6UsIfddb6l3w0ZEXzeiRMHEFi3400Z5fJ5qaHneU0OrAI/JRpk+DMGVs3QpUxlI",
"package_name":"com.ejada.hmg"
},
"oauth_client":{
"client_id":"102857389",
"client_type":1
},
"app_info":{
"app_id":"102857389",
"package_name":"com.ejada.hmg"
},
"service":{
"analytics":{
"collector_url":"datacollector-drcn.dt.hicloud.com,datacollector-drcn.dt.dbankcloud.cn",
"collector_url_ru":"datacollector-drru.dt.hicloud.com,datacollector-drru.dt.dbankcloud.cn",
"collector_url_sg":"datacollector-dra.dt.hicloud.com,datacollector-dra.dt.dbankcloud.cn",
"collector_url_de":"datacollector-dre.dt.hicloud.com,datacollector-dre.dt.dbankcloud.cn",
"collector_url_cn":"datacollector-drcn.dt.hicloud.com,datacollector-drcn.dt.dbankcloud.cn",
"resource_id":"p1",
"channel_id":""
},
"search":{
"url":"https://search-drcn.cloud.huawei.com"
},
"cloudstorage":{
"storage_url":"https://agc-storage-drcn.platform.dbankcloud.cn"
},
"ml":{
"mlservice_url":"ml-api-drcn.ai.dbankcloud.com,ml-api-drcn.ai.dbankcloud.cn"
}
},
"region":"CN",
"configuration_version":"3.0",
"appInfos":[
{
"package_name":"com.ejada.hmg",
"client":{
"app_id":"102857389"
},
"app_info":{
"package_name":"com.ejada.hmg",
"app_id":"102857389"
},
"oauth_client":{
"client_type":1,
"client_id":"102857389"
}
}
]
}

@ -1,74 +0,0 @@
{
"agcgw":{
"backurl":"connect-drcn.hispace.hicloud.com",
"url":"connect-drcn.dbankcloud.cn",
"websocketbackurl":"connect-ws-drcn.hispace.dbankcloud.com",
"websocketurl":"connect-ws-drcn.hispace.dbankcloud.cn"
},
"agcgw_all":{
"CN":"connect-drcn.dbankcloud.cn",
"CN_back":"connect-drcn.hispace.hicloud.com",
"DE":"connect-dre.dbankcloud.cn",
"DE_back":"connect-dre.hispace.hicloud.com",
"RU":"connect-drru.dbankcloud.cn",
"RU_back":"connect-drru.hispace.hicloud.com",
"SG":"connect-dra.dbankcloud.cn",
"SG_back":"connect-dra.hispace.hicloud.com"
},
"client":{
"cp_id":"2640966000002322881",
"product_id":"736430079244816567",
"client_id":"563735388191982656",
"client_secret":"650C7C799812AFFD53A10C7756CF05FB9F215A7E49032ABA8EBF3E14B77535CF",
"project_id":"736430079244816567",
"app_id":"102857389",
"api_key":"CgB6e3x9DJzMgRCmnT6dyUEkp6UsIfddb6l3w0ZEXzeiRMHEFi3400Z5fJ5qaHneU0OrAI/JRpk+DMGVs3QpUxlI",
"package_name":"com.ejada.hmg"
},
"oauth_client":{
"client_id":"102857389",
"client_type":1
},
"app_info":{
"app_id":"102857389",
"package_name":"com.ejada.hmg"
},
"service":{
"analytics":{
"collector_url":"datacollector-drcn.dt.hicloud.com,datacollector-drcn.dt.dbankcloud.cn",
"collector_url_ru":"datacollector-drru.dt.hicloud.com,datacollector-drru.dt.dbankcloud.cn",
"collector_url_sg":"datacollector-dra.dt.hicloud.com,datacollector-dra.dt.dbankcloud.cn",
"collector_url_de":"datacollector-dre.dt.hicloud.com,datacollector-dre.dt.dbankcloud.cn",
"collector_url_cn":"datacollector-drcn.dt.hicloud.com,datacollector-drcn.dt.dbankcloud.cn",
"resource_id":"p1",
"channel_id":""
},
"search":{
"url":"https://search-drcn.cloud.huawei.com"
},
"cloudstorage":{
"storage_url":"https://agc-storage-drcn.platform.dbankcloud.cn"
},
"ml":{
"mlservice_url":"ml-api-drcn.ai.dbankcloud.com,ml-api-drcn.ai.dbankcloud.cn"
}
},
"region":"CN",
"configuration_version":"3.0",
"appInfos":[
{
"package_name":"com.ejada.hmg",
"client":{
"app_id":"102857389"
},
"app_info":{
"package_name":"com.ejada.hmg",
"app_id":"102857389"
},
"oauth_client":{
"client_type":1,
"client_id":"102857389"
}
}
]
}

@ -21,40 +21,13 @@ if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}
apply plugin: 'com.android.application'
apply plugin: 'com.huawei.agconnect'
apply plugin: 'kotlin-android'
apply plugin: 'com.google.gms.google-services'
//apply plugin: 'com.google.firebase.crashlytics'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
configurations.all {
c ->
c.resolutionStrategy.eachDependency {
DependencyResolveDetails dependency ->
println dependency.requested.group
if (dependency.requested.group == 'org.bouncycastle') {
dependency.useTarget 'org.bouncycastle:bcprov-jdk15to18:1.68'
}
}
}
//configurations.all {
// resolutionStrategy {
// force 'androidx.core:core-ktx:1.6.0'
// }
//}
android {
compileSdkVersion 34
// ndkVersion "24.0.8215888"
compileSdkVersion 30
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
@ -63,47 +36,27 @@ android {
lintOptions {
disable 'MissingTranslation'
checkReleaseBuilds false
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.ejada.hmg"
minSdkVersion 24
targetSdkVersion 34
minSdkVersion 21
targetSdkVersion 30
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
multiDexEnabled true
}
sourceSets.main {
jniLibs.srcDir 'src/main/libs'
jni.srcDirs = [] //disable automatic ndk-build call
}
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
storePassword keystoreProperties['storePassword']
}
}
buildTypes {
debug {
debuggable true
signingConfig signingConfigs.debug
// ndk {
// abiFilters 'arm64-v8a', 'armeabi-v7a', 'x86_64'
// }
}
debug {}
release {
debuggable false
signingConfig signingConfigs.release
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
}
staging {
// Specifies a sorted list of fallback build types that the
@ -114,21 +67,6 @@ android {
matchingFallbacks = ['debug', 'qa', 'release']
}
}
packagingOptions {
exclude 'META-INF/proguard/androidx-annotations.pro'
// pickFirst 'lib/x86/libc++_shared.so'
// pickFirst 'lib/x86_64/libc++_shared.so'
// pickFirst 'lib/armeabi-v7a/libc++_shared.so'
// pickFirst 'lib/arm64-v8a/libc++_shared.so'
// pickFirst '**/*.so'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
flutter {
@ -142,9 +80,9 @@ dependencies {
// exclude group: 'com.google.protobuf',module: 'protobuf-javalite'
// exclude group: 'com.google.protobuf',module: 'protobuf-lite'
// })
implementation 'pub.devrel:easypermissions:3.0.0'
implementation 'pub.devrel:easypermissions:0.4.0'
// implementation 'com.google.firebase:firebase-inappmessaging-display:17.2.0'
// implementation 'com.google.firebase:firebase-inappmessaging-display:17.2.0'
// implementation 'com.google.firebase:firebase-inappmessaging-display:17.2.0'
implementation 'com.google.guava:guava:27.0.1-android'
// Dependency on local binaries
implementation fileTree(dir: 'libs', include: ['*.jar'])
@ -154,29 +92,11 @@ dependencies {
// implementation 'com.example.android:app-magic:12.3'
implementation "us.zoom.videosdk:zoomvideosdk-core:1.10.1"
implementation "us.zoom.videosdk:zoomvideosdk-annotation:1.10.1"
implementation "us.zoom.videosdk:zoomvideosdk-videoeffects:1.10.1"
// Native Dependency
// implementation "us.zoom.videosdk:ZoomVideoSDK:1.10.11"
// implementation group: 'us.zoom.videosdk', name: 'zoomvideosdk-core', version: '1.10.11'
implementation "us.zoom.videosdk:zoomvideosdk-core:1.10.1"
implementation "us.zoom.videosdk:zoomvideosdk-annotation:1.10.1"
implementation "us.zoom.videosdk:zoomvideosdk-videoeffects:1.10.1"
// implementation "org.jetbrains.anko:anko-commons:0.10.4"
implementation "org.jetbrains.anko:anko-commons:0.10.4"
implementation 'com.github.kittinunf.fuel:fuel:2.3.0' //for JVM
implementation 'com.github.kittinunf.fuel:fuel-android:2.3.0'
implementation 'com.google.android.gms:play-services-location:17.1.0'//for Android
implementation 'com.google.android.gms:play-services-basement:17.5.0'
implementation "com.opentok.android:opentok-android-sdk:2.21.4"
implementation 'com.facebook.stetho:stetho:1.5.1'
implementation 'com.facebook.stetho:stetho-urlconnection:1.5.1'
implementation 'androidx.core:core-ktx:1.6.0'
implementation 'androidx.appcompat:appcompat:1.3.1'
androidTestImplementation "androidx.test:core:1.4.0"
implementation 'com.google.android.gms:play-services-basement:17.5.0'
}

@ -25,20 +25,15 @@
}
],
"services": {
"analytics_service": {
"status": 1
},
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "815750722565-3a0gc7neins0eoahdrimrfksk0sqice8.apps.googleusercontent.com",
"client_type": 3
},
{
"client_id": "815750722565-0cq9366orvsk5ipivq6lijcj56u03fr7.apps.googleusercontent.com",
"client_type": 2,
"ios_info": {
"bundle_id": "com.void.demo"
}
}
]
"status": 1,
"other_platform_oauth_client": []
},
"ads_service": {
"status": 2
}
}
}

Binary file not shown.

@ -1,56 +1,4 @@
-keep class tvi.webrtc.** { *; }
-keep class com.twilio.video.** { *; }
-keep class com.twilio.common.** { *; }
-keepattributes InnerClasses
-keep class com.ejada.** { *; }
-keep class org.webrtc.** { *; }
-keep class com.builttoroam.devicecalendar.** { *; }
-ignorewarnings
-keepattributes *Annotation*
-keepattributes Exceptions
-keepattributes InnerClasses
-keepattributes Signature
-keep class com.hianalytics.android.**{*;}
-keep class com.huawei.updatesdk.**{*;}
-keep class com.huawei.hms.**{*;}
## Flutter wrapper
-keep class io.flutter.app.** { *; }
-keep class io.flutter.plugin.** { *; }
-keep class io.flutter.util.** { *; }
-keep class io.flutter.view.** { *; }
-keep class io.flutter.** { *; }
-keep class io.flutter.plugins.** { *; }
-dontwarn io.flutter.embedding.**
-keep class com.huawei.hms.flutter.** { *; }
-repackageclasses
## Flutter WebRTC
-keep class com.cloudwebrtc.webrtc.** { *; }
-keep class org.webrtc.** { *; }
## Flutter OpenTok
-keep class com.opentok.android.** { *; }
-keep class com.opentok.otc.** { *; }
-keep class org.otwebrtc.** { *; }
##Flutter Zoom
-keep class us.zoom**{
*;
}
-keep interface us.zoom**{
*;
}
-keep class org.webrtc**{
*;
}
-keep class com.zipow**{
*;
}
-dontwarn com.opentok.android.**
-dontwarn com.opentok.otc.**
-keepattributes InnerClasses

@ -4,4 +4,4 @@
to allow setting breakpoints, to provide hot reload, etc.
-->
<uses-permission android:name="android.permission.INTERNET"/>
</manifest>
</manifest>

@ -1,83 +1,51 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.ejada.hmg">
<!-- io.flutter.app.FlutterApplication is an android.app.Application that
calls FlutterMain.startInitialization(this); in its onCreate method.
In most cases you can leave this as-is, but you if you want to provide
additional functionality it is fine to subclass or reimplement
FlutterApplication and put your custom class here. -->
<uses-permission android:name="android.permission.ACTIVITY_RECOGNITION" tools:node="remove"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE" tools:node="remove"/>
<uses-permission android:name="android.permission.BLUETOOTH" tools:node="remove"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" tools:node="remove"/>
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" tools:node="remove"/>
<uses-permission android:name="android.permission.BLUETOOTH_SCAN" tools:node="remove"/>
<uses-permission android:name="android.permission.BROADCAST_STICKY" tools:node="remove"/>
<uses-permission android:name="com.google.android.gms.permission.AD_ID" tools:node="remove"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" tools:node="remove"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_CONNECTED_DEVICE" tools:node="remove"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_PHONE_CALL" tools:node="remove"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PROJECTION" tools:node="remove"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACK" tools:node="remove"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MICROPHONE" tools:node="remove"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" tools:node="remove" />
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" tools:node="remove" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.ACTIVITY_RECOGNITION" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.DISABLE_KEYGUARD"/>
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-feature android:name="android.hardware.camera.autofocus"/>
<uses-feature android:name="android.hardware.camera" android:required="true"/>
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_CALENDAR" />
<uses-permission android:name="android.permission.WRITE_CALENDAR" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<uses-feature android:name="android.hardware.location.network" android:required="false" />
<uses-feature android:name="android.hardware.location.gps" android:required="false" />
<uses-permission android:name="com.huawei.appmarket.service.commondata.permission.GET_COMMON_DATA"/>
<!-- Wifi Permissions-->
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/>
<!-- <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>-->
<!-- Detect Reboot Permission -->
<!-- <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>-->
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<queries>
<intent>
<action android:name="android.speech.RecognitionService" />
</intent>
</queries>
<application
android:name=".Application"
android:name="io.flutter.app.FlutterApplication"
android:icon="@mipmap/ic_launcher"
android:usesCleartextTraffic="true"
android:showOnLockScreen="true"
android:screenOrientation="sensorPortrait"
android:allowBackup="false"
android:extractNativeLibs="true"
tools:replace="android:extractNativeLibs"
android:label="Dr. Alhabib">
<meta-data android:name="push_kit_auto_init_enabled" android:value="true" />
<activity
android:name=".MainActivity"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:launchMode="singleTop"
android:showOnLockScreen="true"
android:theme="@style/LaunchTheme"
android:exported="true"
tools:node="merge"
android:windowSoftInputMode="adjustResize">
<!-- Specifies an Android theme to apply to this Activity as soon as
the Android process has started. This theme is visible to the user
@ -105,59 +73,33 @@
</intent-filter>
</activity>
<!-- <receiver android:name="com.dexterous.flutterlocalnotifications.ScheduledNotificationBootReceiver" android:exported="true">-->
<!-- <intent-filter>-->
<!-- <action android:name="android.intent.action.BOOT_COMPLETED"/>-->
<!-- <action android:name="android.intent.action.MY_PACKAGE_REPLACED"/>-->
<!-- </intent-filter>-->
<!-- </receiver>-->
<receiver android:name="com.dexterous.flutterlocalnotifications.ScheduledNotificationBootReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
<action android:name="android.intent.action.MY_PACKAGE_REPLACED"/>
</intent-filter>
</receiver>
<receiver android:name="com.dexterous.flutterlocalnotifications.ScheduledNotificationReceiver" />
<!-- Geofencing -->
<service android:name=".geofence.intent_receivers.GeofenceTransitionsJobIntentService" android:exported="true" android:permission="android.permission.BIND_JOB_SERVICE" />
<receiver android:name=".geofence.intent_receivers.GeofenceBroadcastReceiver" android:enabled="true" android:exported="false" />
<receiver android:name=".geofence.intent_receivers.GeofencingRebootBroadcastReceiver" android:enabled="true" android:exported="false">
<receiver android:name=".geofence.intent_receivers.GeofenceBroadcastReceiver" android:enabled="true" android:exported="true" />
<receiver android:name=".geofence.intent_receivers.GeofencingRebootBroadcastReceiver" android:enabled="true">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
<action android:name="android.intent.action.MY_PACKAGE_REPLACED"/>
</intent-filter>
</receiver>
<receiver android:name=".geofence.intent_receivers.LocationProviderChangeReceiver" android:exported="false">
<receiver android:name=".geofence.intent_receivers.LocationProviderChangeReceiver">
<intent-filter>
<action android:name="android.location.PROVIDERS_CHANGED"/>
</intent-filter>
</receiver>
<service android:name=".geofence.intent_receivers.ReregisterGeofenceJobService" android:exported="true" android:permission="android.permission.BIND_JOB_SERVICE" />
<service android:name=".geofence.intent_receivers.ReregisterGeofenceJobService" android:permission="android.permission.BIND_JOB_SERVICE" />
<!-- Geofencing -->
<!--
Huawei Push Notifications
Set push kit auto enable to true (for obtaining the token on initialize)
-->
<!-- <meta-data-->
<!-- android:name="push_kit_auto_init_enabled"-->
<!-- android:value="true" />-->
<!-- These receivers are for sending scheduled local notifications -->
<receiver android:name="com.huawei.hms.flutter.push.receiver.local.HmsLocalNotificationBootEventReceiver" android:exported="false">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
<receiver
android:name="com.huawei.hms.flutter.push.receiver.local.HmsLocalNotificationScheduledPublisher"
android:enabled="true"
android:exported="false" />
<receiver
android:name="com.huawei.hms.flutter.push.receiver.BackgroundMessageBroadcastReceiver"
android:enabled="true"
android:exported="true">
<intent-filter>
<action android:name="com.huawei.hms.flutter.push.receiver.BACKGROUND_REMOTE_MESSAGE" />
</intent-filter>
</receiver>
<!-- Huawei Push Notifications -->
<meta-data android:name="com.google.android.geo.API_KEY"
android:value="AIzaSyCyDbWUM9d_sBUGIE8PcuShzPaqO08NSC8"/>
android:value="AIzaSyCmevVlr2Bh-c8W1VUzo8gt8JRY7n5PANw"/>
<!-- Don't delete the meta-data below.
@ -168,11 +110,11 @@
</application>
<!-- <uses-permission android:name="android.permission.INTERNET" />-->
<!-- <uses-permission android:name="android.permission.USE_FINGERPRINT" />-->
<!-- <uses-permission android:name="android.permission.READ_CALENDAR" />-->
<!-- <uses-permission android:name="android.permission.WRITE_CALENDAR" />-->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.USE_FINGERPRINT" />
<uses-permission android:name="android.permission.READ_CALENDAR" />
<uses-permission android:name="android.permission.WRITE_CALENDAR" />
</manifest>

@ -1,59 +0,0 @@
//package com.cloud.diplomaticquarterapp
package com.ejada.hmg
import com.facebook.stetho.Stetho
import io.flutter.app.FlutterApplication
import io.flutter.plugin.common.PluginRegistry
import io.flutter.plugin.common.PluginRegistry.PluginRegistrantCallback
//import io.flutter.plugins.firebasemessaging.FlutterFirebaseMessagingService
class Application : FlutterApplication(), PluginRegistrantCallback {
override fun onCreate() {
super.onCreate()
// FlutterFirebaseMessagingService.setPluginRegistrant(this)
// Stetho.initializeWithDefaults(this);
// Create an InitializerBuilder
// Create an InitializerBuilder
val initializerBuilder = Stetho.newInitializerBuilder(this)
// Enable Chrome DevTools
initializerBuilder.enableWebKitInspector(
Stetho.defaultInspectorModulesProvider(this)
)
// Enable command line interface
initializerBuilder.enableDumpapp(
Stetho.defaultDumperPluginsProvider(this)
)
// Use the InitializerBuilder to generate an Initializer
val initializer = initializerBuilder.build()
// Initialize Stetho with the Initializer
Stetho.initialize(initializer)
}
override fun registerWith(registry: PluginRegistry) {
// io.flutter.plugins.firebasemessaging.FirebaseMessagingPlugin.registerWith(registry?.registrarFor("io.flutter.plugins.firebasemessaging.FirebaseMessagingPlugin"));
}
}
//import io.flutter.app.FlutterApplication
//import io.flutter.plugin.common.PluginRegistry
//import io.flutter.plugin.common.PluginRegistry.PluginRegistrantCallback
//import io.flutter.plugins.firebasemessaging.FlutterFirebaseMessagingService
//
//class Application : FlutterApplication(), PluginRegistrantCallback {
// override fun onCreate() {
// super.onCreate()
// FlutterFirebaseMessagingService.setPluginRegistrant(this)
// }
//
// override fun registerWith(registry: PluginRegistry?) {
// FirebaseCloudMessagingPluginRegistrant.registerWith(registry)
// }
//}

@ -1,25 +0,0 @@
//package com.cloud.diplomaticquarterapp
package com.ejada.hmg
import io.flutter.plugin.common.PluginRegistry
//import io.flutter.plugins.firebasemessaging.FirebaseMessagingPlugin
object FirebaseCloudMessagingPluginRegistrant {
fun registerWith(registry: PluginRegistry?) {
if (alreadyRegisteredWith(registry)) {
return
}
// FirebaseMessagingPlugin.registerWith(registry?.registrarFor("io.flutter.plugins.firebasemessaging.FirebaseMessagingPlugin"))
}
private fun alreadyRegisteredWith(registry: PluginRegistry?): Boolean {
val key: String? = FirebaseCloudMessagingPluginRegistrant::class.java.canonicalName
if (key?.let { registry?.hasPlugin(it) }!!) {
return true
}
if (registry != null) {
registry.registrarFor(key)
}
return false
}
}

@ -1,49 +1,30 @@
package com.ejada.hmg
import android.app.NotificationChannel
import android.app.NotificationManager
import android.content.ContentResolver
import android.media.AudioAttributes
import android.net.Uri
import android.os.Bundle
import android.util.Log
import android.os.Build
import android.view.WindowManager
import androidx.annotation.NonNull;
import com.ejada.hmg.utils.*
import io.flutter.embedding.android.FlutterFragmentActivity
import io.flutter.embedding.engine.FlutterEngine
import io.flutter.embedding.engine.FlutterEngine
import io.flutter.plugin.common.MethodChannel
import io.flutter.plugins.GeneratedPluginRegistrant
class MainActivity: FlutterFragmentActivity() {
override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) {
GeneratedPluginRegistrant.registerWith(flutterEngine);
// Create Flutter Platform Bridge
this.window.addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED or WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON or WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD or WindowManager.LayoutParams.FLAG_ALLOW_LOCK_WHILE_SCREEN_ON)
GeneratedPluginRegistrant.registerWith(flutterEngine);
// Create Flutter Platform Bridge
PlatformBridge(flutterEngine.dartExecutor.binaryMessenger, this).create()
PlatformBridge(flutterEngine, this).create()
OpenTokPlatformBridge(flutterEngine, this).create()
val time = timeToMillis("04:00:00", "HH:mm:ss")
print(time)
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
// val mChannel = NotificationChannel("video_call_noti", "video call", NotificationManager.IMPORTANCE_HIGH)
// val soundUri = Uri.parse("android.resource://" + getApplicationContext()
// .getPackageName() + "/" + R.raw.alert)
// System.out.println("soundUri");
// System.out.println("soundUri: $soundUri");
// System.out.println("soundUri : ${soundUri.path}");
// val att = AudioAttributes.Builder()
// .setUsage(AudioAttributes.USAGE_NOTIFICATION)
// .setContentType(AudioAttributes.CONTENT_TYPE_SPEECH)
// .build();
// mChannel.setSound(soundUri , att)
// mChannel.description = "Video Call Notifications"
// val notificationManager = getSystemService(NOTIFICATION_SERVICE) as NotificationManager
// notificationManager.createNotificationChannel(mChannel)
// }
// val time = timeToMillis("04:00:00", "HH:mm:ss")
}
// val d1 = Logs.list(this)
// val d2 = Logs.raw(this)
// val d3 = Logs.RegisterGeofence.list(this)
// val d4 = Logs.RegisterGeofence.raw(this)
// val d5 = Logs.GeofenceEvent.list(this)
// val d6 = Logs.GeofenceEvent.raw(this)
print("")
}
override fun onResume() {
super.onResume()

@ -1,56 +0,0 @@
/*
* ---------------
* Note: Todo
* ---------------
* Need to be place in huawei_push (package com.huawei.hms.flutter.push.hms) and define in huawei_push manifest.xml
* */
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.util.Log;
import com.huawei.hms.flutter.push.hms.FlutterHmsMessageService;
import com.huawei.hms.flutter.push.utils.ApplicationUtils;
import org.json.JSONObject;
//package com.huawei.hms.flutter.push.hms
//
//
//import android.content.Context;
//import android.content.Intent;
//import android.content.SharedPreferences;
//
//import com.huawei.hms.flutter.push.hms.FlutterHmsMessageService;
//import com.huawei.hms.flutter.push.utils.ApplicationUtils;
//import com.huawei.hms.push.RemoteMessage;
//
//import org.json.JSONObject;
//
//public class CustomFlutterHmsMessageService extends FlutterHmsMessageService {
// @Override
// public void onMessageReceived(RemoteMessage remoteMessage) {
// super.onMessageReceived(remoteMessage);
// try {
// String jsonStr = remoteMessage.getData();
// JSONObject json_data = new JSONObject(jsonStr);
// JSONObject json_data_data = new JSONObject(json_data.getString("data"));
// if(json_data_data.getString("is_call").equalsIgnoreCase("true")){
// boolean isApplicationInForeground = ApplicationUtils.isApplicationInForeground(this);
// if(!isApplicationInForeground){
// SharedPreferences preferences = getSharedPreferences("FlutterSharedPreferences", Context.MODE_PRIVATE);
// preferences.edit().putString("flutter.call_data", json_data.getString("data")).apply();
//
// Intent intent = getPackageManager().getLaunchIntentForPackage(getPackageName());
// intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
// startActivity(intent);
// Log.v("onMessageReceived", "startActivity(intent) called");
// }
// }
//
// } catch (Exception e) {
// e.printStackTrace();
// }
// }
//}

@ -30,12 +30,12 @@ enum class GeofenceTransition(val value: Int) {
fun fromInt(value: Int) = GeofenceTransition.values().first { it.value == value }
}
fun named(): String {
if (value == 1) return "Enter"
if (value == 2) return "Exit"
if (value == 4) return "dWell"
if (value == (ENTER.value or EXIT.value)) return "Enter or Exit"
if (value == (DWELL.value or EXIT.value)) return "DWell or Exit"
fun named():String{
if (value == 1)return "Enter"
if (value == 2)return "Exit"
if (value == 4)return "dWell"
if (value == (ENTER.value or EXIT.value))return "Enter or Exit"
if (value == (DWELL.value or EXIT.value))return "DWell or Exit"
return "unknown"
}
}
@ -44,65 +44,63 @@ class HMG_Geofence {
// https://developer.android.com/training/location/geofencing#java
private lateinit var context: Context
private lateinit var preferences: SharedPreferences
private lateinit var preferences:SharedPreferences
private val gson = Gson()
private lateinit var geofencingClient: GeofencingClient
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_IMMUTABLE
)
context,
0,
intent,
PendingIntent.FLAG_UPDATE_CURRENT)
}
companion object {
companion object{
var instance: HMG_Geofence? = null
fun shared(context: Context): HMG_Geofence {
if (instance == 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)
instance?.preferences = context.getSharedPreferences(PREFS_STORAGE, Context.MODE_PRIVATE)
}
return instance!!
return instance!!
}
}
private fun limitize(zones: List<GeoZoneModel>): List<GeoZoneModel> {
fun limitize(zones: List<GeoZoneModel>):List<GeoZoneModel>{
var geoZones_ = zones
if (zones.size > 100)
if(zones.size > 100)
geoZones_ = zones.subList(0, 99)
return geoZones_
}
fun register(completion: ((Boolean, java.lang.Exception?) -> Unit)) {
fun register(completion:((Boolean, java.lang.Exception?)->Unit)){
unRegisterAll { status, exception ->
val geoZones = getGeoZonesFromPreference(context)
doRegister(geoZones) { status_, error ->
doRegister(geoZones){ status_, error ->
completion.let { it(status_, error) }
}
}
}
fun unRegisterAll(completion: (status: Boolean, exception: Exception?) -> Unit) {
fun unRegisterAll(completion: (status: Boolean, exception: Exception?) -> Unit){
getActiveGeofences({ success ->
removeActiveGeofences()
if (success.isNotEmpty())
if(success.isNotEmpty())
geofencingClient
.removeGeofences(success)
.addOnSuccessListener {
completion(true, null)
}
.addOnFailureListener {
completion(false, it)
saveLog(context, "error:REMOVE_GEOFENCES", it.localizedMessage)
}
.removeGeofences(success)
.addOnSuccessListener {
completion(true, null)
}
.addOnFailureListener {
completion(false, it)
saveLog(context, "error:REMOVE_GEOFENCES", it.localizedMessage)
}
else
completion(true, null)
@ -111,10 +109,7 @@ class HMG_Geofence {
})
}
private fun doRegister(
geoZones: List<GeoZoneModel>,
completion: ((Boolean, java.lang.Exception?) -> Unit)? = null
) {
private fun doRegister(geoZones: List<GeoZoneModel>, completion:((Boolean, java.lang.Exception?)->Unit)? = null){
if (geoZones.isEmpty())
return
@ -122,9 +117,9 @@ class HMG_Geofence {
fun buildGeofencingRequest(geofences: List<Geofence>): GeofencingRequest {
return GeofencingRequest.Builder()
.setInitialTrigger(GeofencingRequest.INITIAL_TRIGGER_DWELL)
.addGeofences(geofences)
.build()
.setInitialTrigger(GeofencingRequest.INITIAL_TRIGGER_DWELL)
.addGeofences(geofences)
.build()
}
getActiveGeofences({ active ->
@ -140,41 +135,26 @@ class HMG_Geofence {
if (checkPermission() && geofences.isNotEmpty()) {
geofencingClient
.addGeofences(buildGeofencingRequest(geofences), geofencePendingIntent)
.addOnSuccessListener {
Logs.RegisterGeofence.save(
context,
"SUCCESS",
"Successfuly registered the geofences",
Logs.STATUS.SUCCESS
)
saveActiveGeofence(geofences.map { it.requestId }, listOf())
completion?.let { it(true, null) }
}
.addOnFailureListener { exc ->
Logs.RegisterGeofence.save(
context,
"FAILED_TO_REGISTER",
"Failed to register geofence",
Logs.STATUS.ERROR
)
completion?.let { it(false, exc) }
}
.addGeofences(buildGeofencingRequest(geofences), geofencePendingIntent)
.addOnSuccessListener {
Logs.RegisterGeofence.save(context,"SUCCESS", "Successfuly registered the geofences", Logs.STATUS.SUCCESS)
saveActiveGeofence(geofences.map { it.requestId }, listOf())
completion?.let { it(true,null) }
}
.addOnFailureListener { exc ->
Logs.RegisterGeofence.save(context,"FAILED_TO_REGISTER", "Failed to register geofence",Logs.STATUS.ERROR)
completion?.let { it(false,exc) }
}
// Schedule the job to register after specified duration (due to: events not calling after long period.. days or days [Needs to register fences again])
HMGUtils.scheduleJob(
context,
ReregisterGeofenceJobService::class.java,
ReregisterGeofenceJobService.JobID,
ReregisterGeofenceJobService.TriggerIntervalDuration
)
HMGUtils.scheduleJob(context, ReregisterGeofenceJobService::class.java,ReregisterGeofenceJobService.JobID, ReregisterGeofenceJobService.TriggerIntervalDuration)
}
}, null)
}
fun getGeoZonesFromPreference(context: Context): List<GeoZoneModel> {
fun getGeoZonesFromPreference(context: Context):List<GeoZoneModel>{
val pref = context.getSharedPreferences(PREFS_STORAGE, Context.MODE_PRIVATE)
val json = pref.getString(PREF_KEY_HMG_ZONES, "[]")
@ -182,29 +162,26 @@ class HMG_Geofence {
return geoZones
}
fun saveActiveGeofence(success: List<String>, failed: List<String>) {
fun saveActiveGeofence(success: List<String>, failed: List<String>){
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 removeActiveGeofences() {
fun removeActiveGeofences(){
preferences.edit().putString(PREF_KEY_SUCCESS, "[]").apply()
preferences.edit().putString(PREF_KEY_FAILED, "[]").apply()
}
fun getActiveGeofences(
success: (success: List<String>) -> Unit,
failure: ((failed: List<String>) -> Unit)?
) {
val type = object : TypeToken<List<String?>?>() {}.type
fun getActiveGeofences(success: (success: List<String>) -> Unit, failure: ((failed: List<String>) -> Unit)?){
val type = object : TypeToken<List<String?>?>() {}.type
val jsonSuccess = preferences.getString(PREF_KEY_SUCCESS, "[]")
val success = gson.fromJson<List<String>>(jsonSuccess, type)
success(success)
if (failure != null) {
if(failure != null){
val jsonFailure = preferences.getString(PREF_KEY_FAILED, "[]")
val failed = gson.fromJson<List<String>>(jsonFailure, type)
failure(failed)
@ -212,74 +189,47 @@ class HMG_Geofence {
}
private fun checkPermission(): Boolean {
return ContextCompat.checkSelfPermission(
context,
Manifest.permission.ACCESS_FINE_LOCATION
) == PackageManager.PERMISSION_GRANTED
private fun checkPermission() : Boolean{
return ContextCompat.checkSelfPermission(context, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED
}
fun getPatientID(): Int? {
fun getPatientID():Int?{
var profileJson = preferences.getString("flutter.imei-user-data", null)
if (profileJson == null)
profileJson = preferences.getString("flutter.user-profile", null)
val type = object : TypeToken<Map<String?, Any?>?>() {}.type
return gson.fromJson<Map<String?, Any?>?>(profileJson, type)
?.get("PatientID")
.toString()
.toDoubleOrNull()
?.toInt()
?.get("PatientID")
.toString()
.toDoubleOrNull()
?.toInt()
}
fun handleEvent(
triggerGeofences: List<Geofence>,
location: Location,
transition: GeofenceTransition
) {
fun handleEvent(triggerGeofences: List<Geofence>, location: Location, transition: GeofenceTransition) {
getPatientID()?.let { patientId ->
getActiveGeofences({ activeGeofences ->
triggerGeofences.forEach { geofence ->
// Extract PointID from 'geofence.requestId' and find from active geofences
val pointID =
activeGeofences.firstOrNull { it == geofence.requestId }?.split('_')
?.first()
val pointID = activeGeofences.firstOrNull { it == geofence.requestId }?.split('_')?.first()
if (!pointID.isNullOrEmpty() && pointID.toIntOrNull() != null) {
val body = mutableMapOf<String, Any?>(
"PointsID" to pointID.toIntOrNull(),
"GeoType" to transition.value,
"PatientID" to patientId
"PointsID" to pointID.toIntOrNull(),
"GeoType" to transition.value,
"PatientID" to patientId
)
body.putAll(HMGUtils.defaultHTTPParams(context))
httpPost<Map<String, Any>>(API.LOG_GEOFENCE, body, { response ->
saveLog(
context,
"HMG_GEOFENCE_NOTIFY",
"Success: Notified to server\uD83D\uDE0E."
)
sendNotification(
context,
transition.named(),
geofence.requestId,
"Notified to server.😎"
)
saveLog(context, "HMG_GEOFENCE_NOTIFY", "Success: Notified to server\uD83D\uDE0E.")
sendNotification(context, transition.named(), geofence.requestId, "Notified to server.😎")
}, { exception ->
val errorMessage = "${transition.named()}, ${geofence.requestId}"
saveLog(
context,
"HMG_GEOFENCE_NOTIFY",
"failed: $errorMessage | error: ${exception.localizedMessage}"
)
sendNotification(
context,
transition.named(),
geofence.requestId,
"Failed to notify server😔 -> ${exception.localizedMessage}"
)
saveLog(context, "HMG_GEOFENCE_NOTIFY", "failed: $errorMessage | error: ${exception.localizedMessage}")
sendNotification(context, transition.named(), geofence.requestId, "Failed to notify server😔 -> ${exception.localizedMessage}")
})
}

@ -1,6 +1,7 @@
package com.ejada.hmg.geofence.intent_receivers
import android.annotation.SuppressLint
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
@ -12,60 +13,37 @@ import com.google.android.gms.location.GeofenceStatusCodes
import com.google.android.gms.location.GeofencingEvent
class GeofenceBroadcastReceiver : BroadcastReceiver() {
private val LOG_TAG = "GeofenceBroadcastReceiver"
@SuppressLint("LongLogTag")
override fun onReceive(context: Context, intent: Intent) {
val geofencingEvent = GeofencingEvent.fromIntent(intent)
if (geofencingEvent != null) {
if (geofencingEvent.hasError()) {
val errorMessage =
GeofenceErrorMessages.getErrorString(context, geofencingEvent.errorCode)
Log.e(LOG_TAG, errorMessage)
Logs.GeofenceEvent.save(
context,
LOG_TAG,
"Error while triggering geofence event",
Logs.STATUS.ERROR
)
doReRegisterIfRequired(context, geofencingEvent.errorCode)
return
}
}
if (geofencingEvent != null) {
Logs.GeofenceEvent.save(
context,
LOG_TAG,
"Geofence event triggered: ${GeofenceTransition.fromInt(geofencingEvent.geofenceTransition).value} for ${geofencingEvent.triggeringGeofences?.map { it.requestId }}",
Logs.STATUS.SUCCESS
)
geofencingEvent.triggeringLocation?.let {
geofencingEvent.triggeringGeofences?.let { it1 ->
HMG_Geofence.shared(context).handleEvent(
it1,
it, GeofenceTransition.fromInt(geofencingEvent.geofenceTransition)
)
}
}
};
private val LOG_TAG = "GeofenceBroadcastReceiver"
override fun onReceive(context: Context, intent: Intent) {
val geofencingEvent = GeofencingEvent.fromIntent(intent)
if (geofencingEvent.hasError()) {
val errorMessage = GeofenceErrorMessages.getErrorString(context, geofencingEvent.errorCode)
Log.e(LOG_TAG, errorMessage)
Logs.GeofenceEvent.save(context,LOG_TAG,"Error while triggering geofence event",Logs.STATUS.ERROR)
doReRegisterIfRequired(context,geofencingEvent.errorCode)
return
}
fun doReRegisterIfRequired(context: Context, errorCode: Int) {
val errorRequiredReregister = listOf(
Logs.GeofenceEvent.save(context,LOG_TAG,"Geofence event triggered: ${GeofenceTransition.fromInt(geofencingEvent.geofenceTransition).value} for ${geofencingEvent.triggeringGeofences.map {it.requestId}}",Logs.STATUS.SUCCESS)
HMG_Geofence.shared(context).handleEvent(geofencingEvent.triggeringGeofences,geofencingEvent.triggeringLocation, GeofenceTransition.fromInt(geofencingEvent.geofenceTransition));
}
fun doReRegisterIfRequired(context: Context, errorCode: Int){
val errorRequiredReregister = listOf(
GeofenceStatusCodes.GEOFENCE_NOT_AVAILABLE,
GeofenceStatusCodes.GEOFENCE_TOO_MANY_GEOFENCES,
GeofenceStatusCodes.GEOFENCE_TOO_MANY_PENDING_INTENTS,
GeofenceStatusCodes.GEOFENCE_REQUEST_TOO_FREQUENT
)
)
if (errorRequiredReregister.contains(errorCode))
HMG_Geofence.shared(context).register() { status, error ->
if(errorRequiredReregister.contains(errorCode))
HMG_Geofence.shared(context).register(){ status, error ->
}
}
}
}
}

@ -59,25 +59,18 @@ class GeofenceTransitionsJobIntentService : JobIntentService() {
override fun onHandleWork(intent: Intent) {
val geofencingEvent = GeofencingEvent.fromIntent(intent)
if (geofencingEvent != null) {
if (geofencingEvent.hasError()) {
val errorMessage = GeofenceErrorMessages.getErrorString(context_!!, geofencingEvent.errorCode)
Log.e(LOG_TAG, errorMessage)
if (geofencingEvent.hasError()) {
val errorMessage = GeofenceErrorMessages.getErrorString(context_!!, geofencingEvent.errorCode)
Log.e(LOG_TAG, errorMessage)
saveLog(context_!!,LOG_TAG,errorMessage)
doReRegisterIfRequired(context_!!, geofencingEvent.errorCode)
saveLog(context_!!,LOG_TAG,errorMessage)
doReRegisterIfRequired(context_!!, geofencingEvent.errorCode)
return
}
}
return
}
if (geofencingEvent != null) {
geofencingEvent.triggeringGeofences?.let { geofencingEvent.triggeringLocation?.let { it1 ->
HMG_Geofence.shared(context_!!).handleEvent(it,
it1, GeofenceTransition.fromInt(geofencingEvent.geofenceTransition))
} }
};
HMG_Geofence.shared(context_!!).handleEvent(geofencingEvent.triggeringGeofences,geofencingEvent.triggeringLocation, GeofenceTransition.fromInt(geofencingEvent.geofenceTransition));
}

@ -1,29 +1,26 @@
package com.ejada.hmg.hmgwifi
import android.annotation.SuppressLint
import android.content.Context
import android.content.Intent
import android.net.*
import android.net.wifi.*
import android.net.ConnectivityManager
import android.net.wifi.WifiConfiguration
import android.net.wifi.WifiInfo
import android.net.wifi.WifiManager
import android.os.Build
import android.os.PatternMatcher
import android.provider.Settings
import android.util.Log
import androidx.annotation.RequiresApi
import android.widget.Toast
import com.ejada.hmg.MainActivity
import com.ejada.hmg.utils.FlutterText
import com.ejada.hmg.utils.HMGUtils
class HMG_Guest(context: MainActivity) {
private var wifiManager: WifiManager? = context.applicationContext.getSystemService(Context.WIFI_SERVICE) as WifiManager?
private var connectivityManager: ConnectivityManager? = context.applicationContext.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager?
private var context = context
class HMG_Guest(private var context: MainActivity, ssid: String) {
private val TAG = "HMG_Guest"
private val TEST = false
private var SSID = ssid
// private var SSID = "HMG-MOHEMM"
val wifiManager = context.applicationContext.getSystemService(Context.WIFI_SERVICE) as WifiManager?
private var SSID = """"HMG-MobileApp""""
private lateinit var completionListener: ((status: Boolean, message: String) -> Unit)
@ -31,189 +28,126 @@ class HMG_Guest(private var context: MainActivity, ssid: String) {
completionListener(status, message)
}
fun enableWifi(){
if(Build.VERSION.SDK_INT < Build.VERSION_CODES.Q){
wifiManager?.setWifiEnabled(true)
HMGUtils.popFlutterText(context,"enablingWifi");
HMGUtils.timer(2000,false){
connectApiLessThen29()
}
}else {
val panelIntent = Intent(Settings.Panel.ACTION_WIFI)
context.startActivityForResult(panelIntent, 1)
}
}
/*
* Helpful:
* http://stackoverflow.com/questions/8818290/how-to-connect-to-a-specific-wifi-network-in-android-programmatically
*/
fun connectToHMGGuestNetwork(completion: (status: Boolean, message: String) -> Unit) {
completionListener = completion
wifiManager?.let { wm ->
if (!wm.isWifiEnabled){
enableWifi()
}else{
connectWifi()
}
}
}
private fun errorConnecting(){
completionOnUiThread(false, "errorConnectingHmgNetwork")
}
fun connectWifi(){
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q){
connectApiGreaterThen28()
}else {
connectApiLessThen29()
}
}
// I }else{f CompileSDK is greater and equals to APILevel 29
@RequiresApi(Build.VERSION_CODES.Q)
private fun connectApiGreaterThen28(){
Log.e(TAG, "connection wifi with Android Q+")
val networkRequest: NetworkRequest = NetworkRequest.Builder()
.addTransportType(NetworkCapabilities.TRANSPORT_WIFI)
.addCapability(NetworkCapabilities.NET_CAPABILITY_NOT_RESTRICTED)
.removeCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET) //removeCapability added for hotspots without internet
.setNetworkSpecifier(
WifiNetworkSpecifier.Builder()
.setSsid(SSID)
.build()
completionListener = completion
).build()
val connectivityManager = context.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
val networkCallback = object : ConnectivityManager.NetworkCallback() {
override fun onAvailable(network: Network) {
super.onAvailable(network)
connectivityManager.bindProcessToNetwork(network)
if (!wm.isWifiEnabled){
wm.isWifiEnabled = true
HMGUtils.popFlutterText(context,"enablingWifi");
HMGUtils.timer(2000,false){
completionListener(true, "Success")
connect()
}
Log.e(TAG, "onAvailable")
}
override fun onLosing(network: Network, maxMsToLive: Int) {
super.onLosing(network, maxMsToLive)
Log.e(TAG, "onLosing")
completionListener(false, "fail")
}
override fun onLost(network: Network) {
super.onLost(network)
Log.e(TAG, "onLosing")
Log.e(TAG, "losing active connection")
completionListener(false, "fail")
}
override fun onUnavailable() {
super.onUnavailable()
Log.e(TAG, "onUnavailable")
completionListener(false, "fail")
}else{
connect()
}
}
//timeout add because "No devices found" wasn't handled correct and doesn't throw Unavailable
connectivityManager.requestNetwork(networkRequest, networkCallback, 30000)
}
private fun connect(){
val security = "OPEN"
val networkPass = ""
Log.d(TAG, "Connecting to SSID \"$SSID\" with password \"$networkPass\" and with security \"$security\" ...")
fun connectApiLessThen29(){
val wifi = WifiConfiguration()
wifi.SSID = """"$SSID""""
wifi.status = WifiConfiguration.Status.ENABLED
wifi.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.NONE)
// You need to create WifiConfiguration instance like this:
val conf = WifiConfiguration()
conf.SSID = SSID
conf.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.NONE)
conf.networkId = ssidToNetworkId(SSID)
wifi.networkId = ssidToNetworkId(wifi.SSID)
if (wifi.networkId == -1) {
wifiManager?.addNetwork(wifi)
val wm = wifiManager!!
if (conf.networkId == -1) {
wm.addNetwork(conf)
} else {
Log.v(TAG, "WiFi found - updating it.\n")
wifiManager?.updateNetwork(wifi)
wm.updateNetwork(conf)
}
Log.v(TAG, "saving config.\n")
wifiManager?.saveConfiguration()
wifi.networkId = ssidToNetworkId(wifi.SSID)
conf.networkId = ssidToNetworkId(SSID)
Log.d(TAG, "Network ID: ${conf.networkId}")
Log.v(TAG, "wifi ID in device = " + wifi.networkId)
var supState: SupplicantState
val networkIdToConnect = wifi.networkId
val networkIdToConnect = conf.networkId
if (networkIdToConnect >= 0) {
Log.v(TAG, "Start connecting...\n")
Log.v(TAG, "Start connecting to $SSID Wifi...")
// We disable the network before connecting, because if this was the last connection before
// a disconnect(), this will not reconnect.
wifiManager?.disableNetwork(networkIdToConnect)
wifiManager?.enableNetwork(networkIdToConnect, true)
val wifiInfo: WifiInfo = wifiManager!!.connectionInfo
wm.disableNetwork(networkIdToConnect)
val result = wm.enableNetwork(networkIdToConnect, true)
if(result){
HMGUtils.timer(8000,false){
if(wm.getConnectionInfo().getSSID() == SSID){
completionOnUiThread(true, "successConnectingHmgNetwork")
}else{
errorConnecting()
}
}
HMGUtils.timer(5000,false){
supState = wifiInfo.supplicantState
Log.i(TAG, "Done connect to network : status = $supState")
val successStates = listOf(SupplicantState.COMPLETED, SupplicantState.ASSOCIATED)
if (successStates.contains(supState))
completionListener(true,"Connected to internet Wifi")
else
completionListener(false,"errorConnectingHmgNetwork")
}else{
errorConnecting()
}
} else {
Log.v(TAG, "WifiWizard: cannot connect to network")
completionListener(false,"errorConnectingHmgNetwork")
}else{
Log.v(TAG, "Cannot connect to $SSID network")
errorConnecting()
}
}
// val wifi = WifiConfiguration()
// wifi.SSID = SSID
// wifi.status = WifiConfiguration.Status.ENABLED
// wifi.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.NONE);
//
// wifi.networkId = ssidToNetworkId(SSID)
//
// // Set network to highest priority (deprecated in API >= 26)
// if(Build.VERSION.SDK_INT < 26) {
// wifi.priority = getMaxWifiPriority(wifiManager!!) + 1;
// }
private fun errorConnecting(){
completionOnUiThread(false, "errorConnectingHmgNetwork")
}
// If CompileSDK is greater and equals to APILevel 29
private fun connectNewer(wm:WifiManager){
// Log.e(TAG, "connection wifi Q")
//
// // After processing authentication types, add or update network
// if(wifi.networkId == -1) { // -1 means SSID configuration does not exist yet
// val wifiNetworkSpecifier: WifiNetworkSpecifier = WifiNetworkSpecifier.Builder()
// .setSsid(ssid)
// .setWpa2Passphrase(password)
// .build()
//
// val newNetId = wifiManager?.addNetwork(wifi)!!
// if( newNetId > -1 ){
// completionListener(true,"Success")
// } else {
// completionListener(false, "ERROR_ADDING_NETWORK" )
// }
// val networkRequest: NetworkRequest = NetworkRequest.Builder()
// .addTransportType(NetworkCapabilities.TRANSPORT_WIFI)
// .setNetworkSpecifier(wifiNetworkSpecifier)
// .build()
//
// } else {
// var connectivityManager = context.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
// var networkCallback = object : ConnectivityManager.NetworkCallback() {
// override fun onAvailable(network: Network) {
// super.onAvailable(network)
// connectivityManager.bindProcessToNetwork(network)
// Log.e(TAG, "onAvailable")
// }
//
// var updatedNetID = wifiManager?.updateNetwork(wifi)
// override fun onLosing(network: Network, maxMsToLive: Int) {
// super.onLosing(network, maxMsToLive)
// Log.e(TAG, "onLosing")
// }
//
// if(updatedNetID == -1)
// updatedNetID = wifiManager?.addNetwork(wifi)
// override fun onLost(network: Network) {
// super.onLost(network)
// Log.e(TAG, "onLosing")
// Log.e(TAG, "losing active connection")
// }
//
// if(updatedNetID > -1) {
// callbackContext.success( updatedNetID )
// } else {
// callbackContext.error("ERROR_UPDATING_NETWORK")
// override fun onUnavailable() {
// super.onUnavailable()
// Log.e(TAG, "onUnavailable")
// }
// }
//
// }
//
// // WifiManager configurations are presistent for API 26+
// if(Build.VERSION.SDK_INT < 26) {
// wifiManager?.saveConfiguration(); // Call saveConfiguration for older < 26 API
// }
// connectivityManager.requestNetwork(networkRequest, networkCallback)
}
@ -222,7 +156,6 @@ class HMG_Guest(private var context: MainActivity, ssid: String) {
* networks, and returns the networkId for the network if the SSID matches. If not,
* it returns -1.
*/
@SuppressLint("MissingPermission")
private fun ssidToNetworkId(ssid: String): Int {
val currentNetworks = wifiManager!!.configuredNetworks
var networkId = -1
@ -236,22 +169,4 @@ class HMG_Guest(private var context: MainActivity, ssid: String) {
}
return networkId
}
companion object{
/**
* Figure out what the highest priority network in the network list is and return that priority
*/
@RequiresApi(Build.VERSION_CODES.S)
fun getMaxWifiPriority(wifiManager:WifiManager) : Int {
val configurations = wifiManager.callerConfiguredNetworks
var maxPriority = 0
configurations.forEach {
if (it.priority > maxPriority) {
maxPriority = it.priority;
}
}
return maxPriority;
}
}
}
}

@ -3,6 +3,7 @@ package com.ejada.hmg.hmgwifi
import android.annotation.SuppressLint
import com.ejada.hmg.utils.API
import com.ejada.hmg.MainActivity
import com.ejada.hmg.utils.FlutterText
import com.github.kittinunf.fuel.core.extensions.jsonBody
import com.github.kittinunf.fuel.httpGet
import com.github.kittinunf.fuel.httpPost
@ -13,18 +14,21 @@ import java.util.*
@SuppressLint("MissingPermission")
class HMG_Internet(flutterMainActivity: MainActivity) {
private val TAG = "HMG_Wifi"
private val TEST = true
private val TEST = false
private var context = flutterMainActivity;
private lateinit var completionListener: ((status: Boolean, message: String) -> Unit)
private var SSID = "GUEST-POC"
private var USER_NAME = ""
private var PASSWORD = ""
fun completionOnUiThread(status: Boolean, message: String){
completionListener(status, message)
// context.runOnUiThread {
// .with(message){localized ->
//
// FlutterText.with(message){localized ->
// completionListener(status, localized)
// }
// }
@ -34,10 +38,12 @@ class HMG_Internet(flutterMainActivity: MainActivity) {
* Helpful:
* http://stackoverflow.com/questions/8818290/how-to-connect-to-a-specific-wifi-network-in-android-programmatically
*/
fun connectToHMGGuestNetwork(username: String, password: String, completion: (status: Boolean, message: String) -> Unit): HMG_Internet {
fun connectToHMGGuestNetwork(patientId: String, completion: (status: Boolean, message: String) -> Unit): HMG_Internet {
completionListener = completion
WpaEnterprise(context,SSID).connect(username,username) { status, message ->
completionOnUiThread(status,message)
getWifiCredentials(patientId) {
WPA(context,SSID).connect(USER_NAME,PASSWORD) { status, message ->
completionOnUiThread(status,message)
}
}
return this
}
@ -60,28 +66,16 @@ class HMG_Internet(flutterMainActivity: MainActivity) {
}
}
private fun getWifiCredentials(patientId:String, success: ((String?,String?) -> Unit)){
private fun getWifiCredentials(patientId:String, success: (() -> Unit)){
if (TEST){
SSID = "GUEST-POC"
success("2300", "0000")
USER_NAME = "0696"
PASSWORD = "0000"
success()
return
}
val jsonBody = """{
"PatientID":$patientId
"VersionID": 8.8,
"Channel": 3,
"LanguageID": 2,
"IPAdress": "10.20.10.20",
"generalid": "Cs2020@2016$2958",
"PatientOutSA": 0,
"SessionID": "@admin",
"isDentalAllowedBackend": false,
"DeviceTypeID": 2,
"TokenID": "@admin",
"PatientTypeID": 1,
"PatientType": 1
}""".trimMargin()
val jsonBody = """{"PatientID":$patientId}"""
API.WIFI_CREDENTIALS.
httpPost()
.jsonBody(jsonBody, Charsets.UTF_8)
@ -98,13 +92,9 @@ class HMG_Internet(flutterMainActivity: MainActivity) {
jsonObject.getJSONArray("Hmg_SMS_Get_By_ProjectID_And_PatientIDList").let { array ->
array.getJSONObject(0).let { object_ ->
if (object_.has("UserName") && object_.has("UserName")){
try {
val userName = object_.getString("UserName")
val password = object_.getString("Password")
success(userName, password)
}catch (e:Exception){
success(null, null)
}
USER_NAME = object_.getString("UserName")
PASSWORD = object_.getString("Password")
success()
}else{
completionOnUiThread(false, "somethingWentWrong")
}

@ -1,166 +0,0 @@
package com.ejada.hmg.hmgwifi
import android.annotation.SuppressLint
import android.content.Context
import android.net.ConnectivityManager
import android.net.Network
import android.net.NetworkCapabilities
import android.net.NetworkRequest
import android.net.wifi.*
import android.net.wifi.SupplicantState.ASSOCIATED
import android.net.wifi.SupplicantState.COMPLETED
import android.os.Build
import android.util.Log
import androidx.annotation.RequiresApi
import com.ejada.hmg.MainActivity
import com.ejada.hmg.utils.HMGUtils
import java.security.cert.X509Certificate
class WpaEnterprise(private val mainActivity: MainActivity, private var SSID: String) {
private var TAG = "WpaEnterprise"
private lateinit var identity:String
private lateinit var password:String
private lateinit var completion:((status: Boolean, message: String) -> Unit)
fun connect(identity:String, password:String, completion: (status: Boolean, message: String) -> Unit) {
this.password = password
this.identity = identity
this.completion = completion
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q){
apiGreaterThen28()
}else if(Build.VERSION.SDK_INT < Build.VERSION_CODES.Q){
apiLessThen29()
}
}
@RequiresApi(Build.VERSION_CODES.LOLLIPOP)
fun apiLessThen29(){
val wifiManager = mainActivity.applicationContext.getSystemService(Context.WIFI_SERVICE) as WifiManager
val wifi = WifiConfiguration()
wifi.SSID = """"$SSID""""
wifi.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.WPA_EAP)
wifi.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.IEEE8021X)
wifi.enterpriseConfig = enterpriseConfig()
wifi.networkId = ssidToNetworkId(wifi.SSID, wifiManager)
if (wifi.networkId == -1) {
wifiManager.addNetwork(wifi)
} else {
Log.v(TAG, "WiFi found - updating it.\n")
wifiManager.updateNetwork(wifi)
}
Log.v(TAG, "saving config.\n")
wifiManager.saveConfiguration()
wifi.networkId = ssidToNetworkId(wifi.SSID, wifiManager)
Log.v(TAG, "wifi ID in device = " + wifi.networkId)
var supState: SupplicantState
val networkIdToConnect = wifi.networkId
if (networkIdToConnect >= 0) {
Log.v(TAG, "Start connecting...\n")
// We disable the network before connecting, because if this was the last connection before
// a disconnect(), this will not reconnect.
wifiManager.disableNetwork(networkIdToConnect)
wifiManager.enableNetwork(networkIdToConnect, true)
val wifiInfo: WifiInfo = wifiManager.connectionInfo
HMGUtils.timer(5000,false){
supState = wifiInfo.supplicantState
Log.i(TAG, "Done connect to network : status = $supState")
val successStates = listOf(COMPLETED, ASSOCIATED)
if (successStates.contains(supState))
completion(true,"Connected to internet Wifi")
else
completion(false,"errorConnectingHmgNetwork")
}
} else {
Log.v(TAG, "WifiWizard: cannot connect to network")
completion(false,"errorConnectingHmgNetwork")
}
}
/**
* This method takes a given String, searches the current list of configured WiFi
* networks, and returns the networkId for the network if the SSID matches. If not,
* it returns -1.
*/
@SuppressLint("MissingPermission")
private fun ssidToNetworkId(ssid: String, wifiManager: WifiManager): Int {
val currentNetworks = wifiManager.configuredNetworks
var networkId = -1
// For each network in the list, compare the SSID with the given one
for (test in currentNetworks) {
if (test.SSID == ssid) {
networkId = test.networkId
break
}
}
return networkId
}
@RequiresApi(Build.VERSION_CODES.Q)
fun apiGreaterThen28(){
val connectivityManager = mainActivity.applicationContext.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
Log.e(TAG, "connection wifi with Android Q+")
val wifiNetworkSpecifier: WifiNetworkSpecifier = WifiNetworkSpecifier.Builder()
.setSsid(SSID)
.setWpa2EnterpriseConfig(enterpriseConfig())
.build()
val networkRequest: NetworkRequest = NetworkRequest.Builder()
.addTransportType(NetworkCapabilities.TRANSPORT_WIFI)
.setNetworkSpecifier(wifiNetworkSpecifier)
.removeCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET) //removeCapability added for hotspots without internet
.build()
val networkCallback = object : ConnectivityManager.NetworkCallback() {
override fun onAvailable(network: Network) {
super.onAvailable(network)
connectivityManager.bindProcessToNetwork(network)
completion(true, "200")
Log.e(TAG, "onAvailable")
}
override fun onLosing(network: Network, maxMsToLive: Int) {
super.onLosing(network, maxMsToLive)
Log.e(TAG, "onLosing")
}
override fun onLost(network: Network) {
super.onLost(network)
Log.e(TAG, "onLosing")
Log.e(TAG, "losing active connection")
}
override fun onUnavailable() {
super.onUnavailable()
completion(false, "401")
Log.e(TAG, "onUnavailable")
}
}
//timeout add because "No devices found" wasn't handled correct and doesn't throw Unavailable
connectivityManager.requestNetwork(networkRequest, networkCallback, 30000)
}
fun enterpriseConfig() : WifiEnterpriseConfig{
// Initialize the WifiConfiguration object
val enterpriseConfig = WifiEnterpriseConfig()
enterpriseConfig.eapMethod = WifiEnterpriseConfig.Eap.PEAP
enterpriseConfig.identity = identity
enterpriseConfig.password = password
enterpriseConfig.phase2Method = WifiEnterpriseConfig.Phase2.NONE
// enterpriseConfig.caCertificates = WifiEnterpriseConfig.Phase2.
return enterpriseConfig;
}
}

@ -1,58 +0,0 @@
package com.ejada.hmg.opentok
import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import android.view.View
import android.widget.FrameLayout
import android.widget.LinearLayout
import com.ejada.hmg.R
import io.flutter.plugin.common.StandardMessageCodec
import io.flutter.plugin.platform.PlatformView
import io.flutter.plugin.platform.PlatformViewFactory
class LocalVideoFactory : PlatformViewFactory(StandardMessageCodec.INSTANCE) {
companion object {
private lateinit var view: LocalVideoPlatformView
fun getViewInstance(context: Context): LocalVideoPlatformView {
if(!this::view.isInitialized) {
view = LocalVideoPlatformView(context)
}
return view
}
}
override fun create(context: Context, viewId: Int, args: Any?): PlatformView {
return getViewInstance(context)
}
}
class LocalVideoPlatformView(context: Context) : PlatformView {
private val videoContainer: LocalVideoContainer = LocalVideoContainer(context)
val container get() = videoContainer.publisherContainer
override fun getView(): View {
return videoContainer
}
override fun dispose() {}
}
class LocalVideoContainer @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyle: Int = 0,
defStyleRes: Int = 0
) : LinearLayout(context, attrs, defStyle, defStyleRes) {
var publisherContainer: FrameLayout private set
init {
val view = LayoutInflater.from(context).inflate(R.layout.local_video, this, true)
publisherContainer = view.findViewById(R.id.publisher_container)
}
}

@ -1,181 +0,0 @@
package com.ejada.hmg.opentok
import android.content.Context
import android.os.Handler
import android.os.Looper
import android.util.Log
import android.view.ViewGroup
import com.facebook.stetho.urlconnection.StethoURLConnectionManager
import com.opentok.android.*
import io.flutter.embedding.engine.FlutterEngine
import io.flutter.embedding.engine.plugins.util.GeneratedPluginRegister
import io.flutter.plugin.common.MethodCall
import io.flutter.plugin.common.MethodChannel
enum class OpenTokSDKState {
LOGGED_OUT,
LOGGED_IN,
WAIT,
ERROR
}
class OpenTok(private var context: Context, private var flutterEngine: FlutterEngine){
private lateinit var remoteVideoPlatformView: RemoteVideoPlatformView
private lateinit var localVideoPlatformView: LocalVideoPlatformView
init {
remoteVideoPlatformView = RemoteVideoFactory.getViewInstance(context)
flutterEngine
.platformViewsController
.registry
.registerViewFactory("remote-video-container", RemoteVideoFactory())
localVideoPlatformView = LocalVideoFactory.getViewInstance(context)
flutterEngine
.platformViewsController
.registry
.registerViewFactory("local-video-container", LocalVideoFactory())
}
private var session: Session? = null
private var publisher: Publisher? = null
private var subscriber: Subscriber? = null
private val sessionListener: Session.SessionListener = object: Session.SessionListener {
override fun onConnected(session: Session) {
// Connected to session
Log.d("MainActivity", "Connected to session ${session.sessionId}")
publisher = Publisher.Builder(context).build().apply {
setPublisherListener(publisherListener)
renderer?.setStyle(BaseVideoRenderer.STYLE_VIDEO_SCALE, BaseVideoRenderer.STYLE_VIDEO_FILL)
view.layoutParams = ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)
localVideoPlatformView.container.addView(view)
}
notifyFlutter(OpenTokSDKState.LOGGED_IN)
session.publish(publisher)
}
override fun onDisconnected(session: Session) {
notifyFlutter(OpenTokSDKState.LOGGED_OUT)
}
override fun onStreamReceived(session: Session, stream: Stream) {
Log.d(
"MainActivity",
"onStreamReceived: New Stream Received " + stream.streamId + " in session: " + session.sessionId
)
if (subscriber == null) {
subscriber = Subscriber.Builder(context, stream).build().apply {
renderer?.setStyle(BaseVideoRenderer.STYLE_VIDEO_SCALE, BaseVideoRenderer.STYLE_VIDEO_FILL)
setSubscriberListener(subscriberListener)
session.subscribe(this)
remoteVideoPlatformView.container.addView(view)
}
}
}
override fun onStreamDropped(session: Session, stream: Stream) {
Log.d(
"MainActivity",
"onStreamDropped: Stream Dropped: " + stream.streamId + " in session: " + session.sessionId
)
if (subscriber != null) {
subscriber = null
remoteVideoPlatformView.container.removeAllViews()
}
}
override fun onError(session: Session, opentokError: OpentokError) {
Log.d("MainActivity", "Session error: " + opentokError.message)
notifyFlutter(OpenTokSDKState.ERROR)
}
}
private val publisherListener: PublisherKit.PublisherListener = object : PublisherKit.PublisherListener {
override fun onStreamCreated(publisherKit: PublisherKit, stream: Stream) {
Log.d("MainActivity", "onStreamCreated: Publisher Stream Created. Own stream " + stream.streamId)
}
override fun onStreamDestroyed(publisherKit: PublisherKit, stream: Stream) {
Log.d("MainActivity", "onStreamDestroyed: Publisher Stream Destroyed. Own stream " + stream.streamId)
}
override fun onError(publisherKit: PublisherKit, opentokError: OpentokError) {
Log.d("MainActivity", "PublisherKit onError: " + opentokError.message)
notifyFlutter(OpenTokSDKState.ERROR)
}
}
var subscriberListener: SubscriberKit.SubscriberListener = object : SubscriberKit.SubscriberListener {
override fun onConnected(subscriberKit: SubscriberKit) {
Log.d("MainActivity", "onConnected: Subscriber connected. Stream: " + subscriberKit.stream.streamId)
}
override fun onDisconnected(subscriberKit: SubscriberKit) {
Log.d("MainActivity", "onDisconnected: Subscriber disconnected. Stream: " + subscriberKit.stream.streamId)
notifyFlutter(OpenTokSDKState.LOGGED_OUT)
}
override fun onError(subscriberKit: SubscriberKit, opentokError: OpentokError) {
Log.d("MainActivity", "SubscriberKit onError: " + opentokError.message)
notifyFlutter(OpenTokSDKState.ERROR)
}
}
fun initSession(call: MethodCall, result: MethodChannel.Result) {
val apiKey = requireNotNull(call.argument<String>("apiKey"))
val sessionId = requireNotNull(call.argument<String>("sessionId"))
val token = requireNotNull(call.argument<String>("token"))
notifyFlutter(OpenTokSDKState.WAIT)
session = Session.Builder(context, apiKey, sessionId).build()
session?.setSessionListener(sessionListener)
session?.connect(token)
result.success("")
}
fun swapCamera(call: MethodCall, result: MethodChannel.Result) {
publisher?.cycleCamera()
result.success(true)
}
fun toggleAudio(call: MethodCall, result: MethodChannel.Result) {
if (publisher != null) {
publisher?.publishAudio = !(publisher!!.publishAudio)
result.success(true)
}else{
result.success(false)
}
}
fun toggleVideo(call: MethodCall, result: MethodChannel.Result) {
if (publisher != null) {
publisher?.publishVideo = !(publisher!!.publishVideo)
result.success(true)
}else{
result.success(false)
}
}
fun hangupCall(call: MethodCall, result: MethodChannel.Result) {
session?.disconnect()
result.success(true)
}
private fun notifyFlutter(state: OpenTokSDKState) {
Handler(Looper.getMainLooper()).post {
MethodChannel(flutterEngine.dartExecutor.binaryMessenger, "OpenTok-Platform-Bridge")
.invokeMethod("updateState", state.toString())
}
}
}

@ -1,58 +0,0 @@
package com.ejada.hmg.opentok
import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import android.view.View
import android.widget.FrameLayout
import android.widget.LinearLayout
import com.ejada.hmg.R
import io.flutter.plugin.common.StandardMessageCodec
import io.flutter.plugin.platform.PlatformView
import io.flutter.plugin.platform.PlatformViewFactory
class RemoteVideoFactory : PlatformViewFactory(StandardMessageCodec.INSTANCE) {
companion object {
private lateinit var view: RemoteVideoPlatformView
fun getViewInstance(context: Context): RemoteVideoPlatformView {
if(!this::view.isInitialized) {
view = RemoteVideoPlatformView(context)
}
return view
}
}
override fun create(context: Context, viewId: Int, args: Any?): PlatformView {
return getViewInstance(context)
}
}
class RemoteVideoPlatformView(context: Context) : PlatformView {
private val videoContainer: RemoteVideoContainer = RemoteVideoContainer(context)
val container get() = videoContainer.subscriberContainer
override fun getView(): View {
return videoContainer
}
override fun dispose() {}
}
class RemoteVideoContainer @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyle: Int = 0,
defStyleRes: Int = 0
) : LinearLayout(context, attrs, defStyle, defStyleRes) {
var subscriberContainer: FrameLayout private set
init {
val view = LayoutInflater.from(context).inflate(R.layout.remote_video, this, true)
subscriberContainer = view.findViewById(R.id.subscriber_container)
}
}

@ -17,7 +17,7 @@ class FlutterText{
}
}
override fun error(errorCode: String, errorMessage: String?, errorDetails: Any?) {
override fun error(errorCode: String?, errorMessage: String?, errorDetails: Any?) {
completion(key)
require(false){
"'localizedValue' $errorMessage"

@ -22,6 +22,7 @@ import com.github.kittinunf.fuel.httpPost
import com.google.gson.Gson
import com.google.gson.reflect.TypeToken
import io.flutter.plugin.common.MethodChannel
import org.jetbrains.anko.doAsyncResult
import org.json.JSONArray
import org.json.JSONException
import org.json.JSONObject
@ -207,6 +208,7 @@ fun <T>httpPost(url: String, body: Map<String, Any?>, onSuccess: (response: HTTP
.header("Content-Type", "application/json")
.header("Allow", "*/*")
.response { request, response, result ->
result.doAsyncResult { }
result.fold({ data ->
val dataString = String(data)
if (isJSONValid(dataString)) {

@ -1,45 +0,0 @@
package com.ejada.hmg.utils
import com.ejada.hmg.MainActivity
import com.ejada.hmg.opentok.OpenTok
import io.flutter.embedding.engine.FlutterEngine
import io.flutter.plugin.common.MethodCall
import io.flutter.plugin.common.MethodChannel
class OpenTokPlatformBridge(private var flutterEngine: FlutterEngine, private var mainActivity: MainActivity) {
private lateinit var channel: MethodChannel
private lateinit var openTok: OpenTok
companion object {
private const val CHANNEL = "OpenTok-Platform-Bridge"
}
fun create(){
openTok = OpenTok(mainActivity, flutterEngine)
channel = MethodChannel(flutterEngine.dartExecutor.binaryMessenger, CHANNEL)
channel.setMethodCallHandler { call: MethodCall, result: MethodChannel.Result ->
when (call.method) {
"initSession" -> {
openTok.initSession(call, result)
}
"swapCamera" -> {
openTok.swapCamera(call, result)
}
"toggleAudio" -> {
openTok.toggleAudio(call, result)
}
"toggleVideo" -> {
openTok.toggleVideo(call, result)
}
"hangupCall" -> {
openTok.hangupCall(call, result)
}
else -> {
result.notImplemented()
}
}
}
}
}

@ -1,26 +1,20 @@
package com.ejada.hmg.utils
import android.content.Context
import android.content.Intent
import android.content.Intent.getIntent
import android.net.Uri
import android.os.Build
import android.os.Bundle
import android.provider.Settings
import android.widget.Toast
import androidx.core.app.ActivityCompat.startActivityForResult
import android.net.wifi.WifiManager
import android.util.Log
import com.ejada.hmg.MainActivity
import com.ejada.hmg.hmgwifi.HMG_Guest
import com.ejada.hmg.hmgwifi.HMG_Internet
import com.ejada.hmg.geofence.GeoZoneModel
import com.ejada.hmg.geofence.HMG_Geofence
import com.ejada.hmg.hmgwifi.WpaEnterprise
import io.flutter.embedding.engine.FlutterEngine
import io.flutter.plugin.common.BinaryMessenger
import io.flutter.plugin.common.MethodCall
import io.flutter.plugin.common.MethodChannel
class PlatformBridge(private var flutterEngine: FlutterEngine, private var mainActivity: MainActivity) {
class PlatformBridge(binaryMessenger: BinaryMessenger, flutterMainActivity: MainActivity) {
private var binaryMessenger = binaryMessenger
private var mainActivity = flutterMainActivity
private lateinit var channel: MethodChannel
@ -31,169 +25,103 @@ class PlatformBridge(private var flutterEngine: FlutterEngine, private var mainA
private const val ENABLE_WIFI_IF_NOT = "enableWifiIfNot"
private const val REGISTER_HMG_GEOFENCES = "registerHmgGeofences"
private const val UN_REGISTER_HMG_GEOFENCES = "unRegisterHmgGeofences"
private const val IS_DRAW_OVER_APPS_PERMISSION_ALLOWED = "isDrawOverAppsPermissionAllowed"
private const val ASK_DRAW_OVER_APPS_PERMISSION = "askDrawOverAppsPermission"
private const val GET_INTENT = "getIntent"
}
fun create() {
channel = MethodChannel(flutterEngine.dartExecutor.binaryMessenger, CHANNEL)
fun create(){
channel = MethodChannel(binaryMessenger, CHANNEL)
HMGUtils.setPlatformChannel(channel)
channel.setMethodCallHandler { methodCall: MethodCall, result: MethodChannel.Result ->
if (methodCall.method == HMG_INTERNET_WIFI_CONNECT_METHOD) {
connectHMGInternetWifi(methodCall, result)
} else if (methodCall.method == HMG_GUEST_WIFI_CONNECT_METHOD) {
connectHMGGuestWifi(methodCall, result)
} 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 if (methodCall.method == IS_DRAW_OVER_APPS_PERMISSION_ALLOWED) {
isDrawOverAppsPermissionAllowed(methodCall, result)
} else if (methodCall.method == ASK_DRAW_OVER_APPS_PERMISSION) {
askDrawOverAppsPermission(methodCall, result)
} else if (methodCall.method == GET_INTENT) {
getIntentData(methodCall, result)
} else {
connectHMGInternetWifi(methodCall,result)
}else if (methodCall.method == HMG_GUEST_WIFI_CONNECT_METHOD) {
connectHMGGuestWifi(methodCall,result)
}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()
}
}
val res = channel.invokeMethod("localizedValue", "errorConnectingHmgNetwork")
val res = channel.invokeMethod("localizedValue","errorConnectingHmgNetwork")
print(res)
}
private fun connectHMGInternetWifi(methodCall: MethodCall, result: MethodChannel.Result) {
private fun connectHMGInternetWifi(methodCall: MethodCall, result: MethodChannel.Result){
(methodCall.arguments as ArrayList<*>).let {
require(it.size == 3 && (it[0] is String) && (it[1] is String), lazyMessage = {
"Missing or invalid arguments (Must have three argument of 'String'"
require(it.size > 0 && (it[0] is String),lazyMessage = {
"Missing or invalid arguments (Must have one argument 'String at 0'"
})
val ssid = it[0].toString()
val username = it[1].toString()
val password = it[2].toString()
WpaEnterprise(mainActivity,ssid).connect(username,password) { status, message ->
HMGUtils.timer(2000,false){
mainActivity.runOnUiThread {
if(status)
result.success(if (status) 1 else 0)
else
result.error(message, null, null)
}
}
}
val patientId = it[0].toString()
HMG_Internet(mainActivity)
.connectToHMGGuestNetwork(patientId){ status, message ->
// HMG_Internet(mainActivity)
// .connectToHMGGuestNetwork(username, password) { status, message ->
// mainActivity.runOnUiThread {
// result.success(if (status) 1 else 0)
//
// HMGUtils.popFlutterText(mainActivity, message)
// Log.v(this.javaClass.simpleName, "$status | $message")
// }
//
// }
mainActivity.runOnUiThread {
result.success(if(status) 1 else 0)
HMGUtils.popFlutterText(mainActivity, message)
Log.v(this.javaClass.simpleName, "$status | $message")
}
}
}
}
private fun connectHMGGuestWifi(methodCall: MethodCall, result: MethodChannel.Result) {
(methodCall.arguments as ArrayList<*>).let {
require(it.size == 1 && (it[0] is String), lazyMessage = {
"Missing or invalid arguments (Must have one argument 'String at 0'"
})
val ssid = it[0].toString()
HMG_Guest(mainActivity, ssid).connectToHMGGuestNetwork { status, message ->
mainActivity.runOnUiThread {
result.success(if (status) 1 else 0)
private fun connectHMGGuestWifi(methodCall: MethodCall, result: MethodChannel.Result){
HMG_Guest(mainActivity).connectToHMGGuestNetwork { status, message ->
mainActivity.runOnUiThread {
result.success(if(status) 1 else 0)
HMGUtils.popFlutterText(mainActivity, message)
Log.v(this.javaClass.simpleName, "$status | $message")
}
HMGUtils.popFlutterText(mainActivity, message)
Log.v(this.javaClass.simpleName, "$status | $message")
}
}
}
private fun enableWifiIfNot(methodCall: MethodCall, result: MethodChannel.Result) {
val wm = mainActivity.applicationContext.getSystemService(Context.WIFI_SERVICE) as WifiManager?
if (wm != null) {
if (wm != null){
if (!wm.isWifiEnabled)
wm.isWifiEnabled = true
result.success(true)
} else
result.error("101", "Error while opening wifi, Please try to open wifi yourself and try again", "'WifiManager' service failed");
}else
result.error("101","Error while opening wifi, Please try to open wifi yourself and try again","'WifiManager' service failed");
}
private fun registerHmgGeofences(methodCall: MethodCall, result: MethodChannel.Result) {
channel.invokeMethod("getGeoZones", null, object : MethodChannel.Result {
channel.invokeMethod("getGeoZones",null, object : MethodChannel.Result{
override fun success(result: Any?) {
if (result is String) {
if(result is String) {
val geoZones = GeoZoneModel().listFrom(result)
HMG_Geofence.shared(mainActivity).register() { s, e -> }
HMG_Geofence.shared(mainActivity).register(){ s, e -> }
}
}
override fun error(errorCode: String, errorMessage: String?, errorDetails: Any?) {}
override fun notImplemented() {}
override fun error(errorCode: String?, errorMessage: String?, errorDetails: Any?) { print(result) }
override fun notImplemented() { print(result) }
})
}
private fun unRegisterHmgGeofences(methodCall: MethodCall, result: MethodChannel.Result) {
HMG_Geofence.shared(mainActivity).unRegisterAll { status, exception ->
if (status)
if(status)
result.success(true)
else
result.error("101", exception?.localizedMessage, exception);
}
}
private fun isDrawOverAppsPermissionAllowed(methodCall: MethodCall, result: MethodChannel.Result) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
if (
Settings.canDrawOverlays(mainActivity)
) {
result.success(true)
} else {
result.success(false)
}
} else {
result.success(false)
}
}
private fun askDrawOverAppsPermission(methodCall: MethodCall, result: MethodChannel.Result) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
val intent = Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION)
val uri = Uri.parse("package:" + mainActivity.getPackageName())
intent.setData(uri)
startActivityForResult(mainActivity, intent, 102, null)
result.success(true)
} else {
result.success(false)
}
}
private fun getIntentData(methodCall: MethodCall, result: MethodChannel.Result) {
val bundle: Bundle? = getIntent("").extras
if (bundle != null) {
val message = bundle.getString("notification") // 1
System.out.println("BundleExtra:" + message)
Toast.makeText(this.mainActivity, message + "", Toast.LENGTH_SHORT).show()
} else {
Toast.makeText(this.mainActivity, "Bundle Null", Toast.LENGTH_SHORT).show();
}
result.success(true);
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

@ -1,14 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:gravity="center_horizontal"
android:layout_gravity="center_horizontal">
<FrameLayout
android:id="@+id/publisher_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FF9800" />
</LinearLayout>

@ -1,20 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:gravity="center_horizontal"
android:layout_gravity="center_horizontal">
<FrameLayout
android:id="@+id/subscriber_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#3F51B5" />
<TextView
android:text="Remote"
android:textColor="#FFFFFF"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</LinearLayout>

@ -1,32 +1,17 @@
buildscript {
ext.kotlin_version = '1.8.0'
// if (System.properties['os.arch'] == "aarch64") {
// // For M1 Users we need to use the NDK 24 which added support for aarch64
// ndkVersion = "24.0.8215888"
// } else {
// // Otherwise we default to the side-by-side NDK version from AGP.
// ndkVersion = "21.4.7075529"
// }
ext.kotlin_version = '1.3.50'
repositories {
google()
// jcenter()
mavenCentral()
maven { url 'https://developer.huawei.com/repo/' }
jcenter()
// maven {
// url "https://dl.bintray.com/kotlin/kotlin-eap/"
// }
}
dependencies {
classpath 'com.android.tools.build:gradle:7.1.3'
classpath 'com.android.tools.build:gradle:3.5.4'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.8'
// classpath 'com.google.firebase:firebase-crashlytics-gradle:2.8.1'
classpath 'com.huawei.agconnect:agcp:1.5.2.300'
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.12'
}
}
@ -35,15 +20,6 @@ allprojects {
google()
// jcenter()
mavenCentral()
maven {
url 'https://developer.huawei.com/repo/'
}
maven {
url 'https://mvnrepository.com/artifact/'
}
maven {
url "https://artifactory.ess-dev.com/artifactory/gradle-dev-local"
}
}
}
@ -55,12 +31,6 @@ subprojects {
project.evaluationDependsOn(':app')
}
tasks.register("clean", Delete) {
task clean(type: Delete) {
delete rootProject.buildDir
}
configurations.all {
resolutionStrategy {
force 'androidx.core:core-ktx:1.6.0'
}
}

@ -1,5 +1,4 @@
org.gradle.jvmargs=-Xmx4096m
#android.enableR8=true
org.gradle.jvmargs=-Xmx1536M
android.enableR8=true
android.useAndroidX=true
android.enableJetifier=true
android.suppressUnsupportedCompileSdk=33

@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip

@ -1,22 +0,0 @@
{
"provider": "apple_pay",
"data": {
"merchantIdentifier": "merchant.com.hmgwebservices",
"displayName": "Sulaiman Al Habib",
"merchantCapabilities": [
"3DS",
"debit",
"credit"
],
"supportedNetworks": [
"amex",
"visa",
"discover",
"masterCard"
],
"countryCode": "SA",
"currencyCode": "SAR",
"requiredBillingContactFields": null,
"requiredShippingContactFields": null
}
}

@ -1,4 +1,3 @@
{
"name": "DQIcons",
"css_prefix_text": "",

@ -1,21 +0,0 @@
{
"provider": "apple_pay",
"data": {
"merchantIdentifier": "merchant.com.hmgwebservices",
"displayName": "Sulaiman Al Habib",
"merchantCapabilities": [
"3DS",
"debit",
"credit"
],
"supportedNetworks": [
"visa",
"masterCard",
"mada"
],
"countryCode": "SA",
"currencyCode": "SAR",
"requiredBillingContactFields": null,
"requiredShippingContactFields": null
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 99 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 102 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

@ -1,3 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="20.516" height="23.447" viewBox="0 0 20.516 23.447">
<path id="doctor_information_icon" d="M10.258,11.724A5.862,5.862,0,1,0,4.4,5.862,5.861,5.861,0,0,0,10.258,11.724Zm-5.5,7.694a1.1,1.1,0,1,0,1.1-1.1A1.1,1.1,0,0,0,4.763,19.417Zm9.892-6.2V15.46a3.669,3.669,0,0,1,2.931,3.59v1.91a.735.735,0,0,1-.591.719l-1.475.293a.365.365,0,0,1-.43-.289l-.142-.719a.362.362,0,0,1,.289-.43l.884-.179V19.051a2.2,2.2,0,1,0-4.4.087V20.36l.884.179a.372.372,0,0,1,.289.43l-.142.719a.372.372,0,0,1-.43.289l-1.429-.192a.732.732,0,0,1-.632-.728V19.051a3.673,3.673,0,0,1,2.931-3.59V13.39c-.1.032-.2.05-.3.087a7.923,7.923,0,0,1-5.257,0A5.061,5.061,0,0,0,6.6,13.239v3.737a2.565,2.565,0,1,1-1.465,0V13.294A6.139,6.139,0,0,0,0,19.344V21.4a2.054,2.054,0,0,0,2.052,2.052H18.465A2.054,2.054,0,0,0,20.516,21.4V19.344A6.146,6.146,0,0,0,14.654,13.216Z" fill="#40acc9"/>
</svg>

Before

Width:  |  Height:  |  Size: 889 B

@ -1,3 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="21.503" height="21.503" viewBox="0 0 21.503 21.503">
<path id="doctor_qualification_icon" d="M9.4,5.491,6.494.653A1.344,1.344,0,0,0,5.341,0H.673A.672.672,0,0,0,.123,1.058L4.8,7.733A8.692,8.692,0,0,1,9.4,5.491ZM20.83,0H16.162a1.344,1.344,0,0,0-1.152.653l-2.9,4.839a8.694,8.694,0,0,1,4.6,2.242L21.38,1.058A.672.672,0,0,0,20.83,0ZM10.751,6.72a7.392,7.392,0,1,0,7.392,7.392A7.392,7.392,0,0,0,10.751,6.72Zm3.886,6.6-1.593,1.552.377,2.193a.482.482,0,0,1-.7.508l-1.97-1.035-1.97,1.035a.482.482,0,0,1-.7-.508l.377-2.193L6.866,13.324a.482.482,0,0,1,.267-.823l2.2-.321.984-2a.483.483,0,0,1,.866,0l.984,2,2.2.321a.482.482,0,0,1,.267.823Z" transform="translate(0)" fill="#40acc9"/>
</svg>

Before

Width:  |  Height:  |  Size: 726 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save