Compare commits
No commits in common. 'dev_v3.13.6' and 'fix_er' have entirely different histories.
dev_v3.13.
...
fix_er
@ -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-----
|
|
||||||
@ -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,38 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
||||||
<plist version="1.0">
|
|
||||||
<dict>
|
|
||||||
<key>CLIENT_ID</key>
|
|
||||||
<string>815750722565-da8p56le8bd6apsbm9eft0jjl1rtpgkt.apps.googleusercontent.com</string>
|
|
||||||
<key>REVERSED_CLIENT_ID</key>
|
|
||||||
<string>com.googleusercontent.apps.815750722565-da8p56le8bd6apsbm9eft0jjl1rtpgkt</string>
|
|
||||||
<key>ANDROID_CLIENT_ID</key>
|
|
||||||
<string>815750722565-m14h8mkosm7cnq6uh6rhqr54dn02d705.apps.googleusercontent.com</string>
|
|
||||||
<key>API_KEY</key>
|
|
||||||
<string>AIzaSyDiXnCO00li4V7Ioa2YZ_M4ECxRsu_P9tA</string>
|
|
||||||
<key>GCM_SENDER_ID</key>
|
|
||||||
<string>815750722565</string>
|
|
||||||
<key>PLIST_VERSION</key>
|
|
||||||
<string>1</string>
|
|
||||||
<key>BUNDLE_ID</key>
|
|
||||||
<string>com.HMG.Smartphone</string>
|
|
||||||
<key>PROJECT_ID</key>
|
|
||||||
<string>api-project-815750722565</string>
|
|
||||||
<key>STORAGE_BUCKET</key>
|
|
||||||
<string>api-project-815750722565.appspot.com</string>
|
|
||||||
<key>IS_ADS_ENABLED</key>
|
|
||||||
<false></false>
|
|
||||||
<key>IS_ANALYTICS_ENABLED</key>
|
|
||||||
<false></false>
|
|
||||||
<key>IS_APPINVITE_ENABLED</key>
|
|
||||||
<true></true>
|
|
||||||
<key>IS_GCM_ENABLED</key>
|
|
||||||
<true></true>
|
|
||||||
<key>IS_SIGNIN_ENABLED</key>
|
|
||||||
<true></true>
|
|
||||||
<key>GOOGLE_APP_ID</key>
|
|
||||||
<string>1:815750722565:ios:328ec247a81a2ca23c186c</string>
|
|
||||||
<key>DATABASE_URL</key>
|
|
||||||
<string>https://api-project-815750722565.firebaseio.com</string>
|
|
||||||
</dict>
|
|
||||||
</plist>
|
|
||||||
@ -1,6 +0,0 @@
|
|||||||
-----BEGIN PRIVATE KEY-----
|
|
||||||
MIGTAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBHkwdwIBAQQgJ5XRSnefd1apSG/z
|
|
||||||
YJTQ55ffLMlPgKlGM9edg88mUZagCgYIKoZIzj0DAQehRANCAATSA2MbS+J0cQsc
|
|
||||||
uBU0xaoxOUgGvnHCQSEK4t22i8eeKPPhH6RHJhK1ugPvj+Eyadf7j6pn3QRonEJu
|
|
||||||
mIL+qvqC
|
|
||||||
-----END PRIVATE KEY-----
|
|
||||||
@ -1,14 +0,0 @@
|
|||||||
{
|
|
||||||
"client":{
|
|
||||||
"appType":"1",
|
|
||||||
"cp_id":"2640966000002322881",
|
|
||||||
"product_id":"736430079244816576",
|
|
||||||
"client_id":"563737844552565952",
|
|
||||||
"client_secret":"9C9A2C272576B8AE6E886C78AF944E8354B91F0AF3381129BB8369FB35E41C47",
|
|
||||||
"project_id":"736430079244816576",
|
|
||||||
"app_id":"103856487",
|
|
||||||
"api_key":"CgB6e3x90XxBrOCMun809w+DOzcFEettcBDUF3fqaLry1ViqTeJqoPwpfaOq/uGw//x0oYwucu9aWazs+Rdj0GUF",
|
|
||||||
"package_name":"com.cloud.diplomaticquarterapp"
|
|
||||||
},
|
|
||||||
"configuration_version":"1.0"
|
|
||||||
}
|
|
||||||
@ -1,14 +0,0 @@
|
|||||||
{
|
|
||||||
"client":{
|
|
||||||
"appType":"1",
|
|
||||||
"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"
|
|
||||||
},
|
|
||||||
"configuration_version":"1.0"
|
|
||||||
}
|
|
||||||
@ -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"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@ -1,56 +0,0 @@
|
|||||||
-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.**
|
|
||||||
@ -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,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();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
@ -0,0 +1,13 @@
|
|||||||
|
|
||||||
|
|
||||||
|
package com.cloud.diplomaticquarterapp.geofence
|
||||||
|
|
||||||
|
import android.content.BroadcastReceiver
|
||||||
|
import android.content.Context
|
||||||
|
import android.content.Intent
|
||||||
|
|
||||||
|
class GeofenceBroadcastReceiver : BroadcastReceiver() {
|
||||||
|
override fun onReceive(context: Context, intent: Intent) {
|
||||||
|
GeofenceTransitionsJobIntentService.enqueueWork(context, intent)
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,34 @@
|
|||||||
|
|
||||||
|
|
||||||
|
package com.cloud.diplomaticquarterapp.geofence
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import com.cloud.diplomaticquarterapp.R
|
||||||
|
import com.google.android.gms.common.api.ApiException
|
||||||
|
import com.google.android.gms.location.GeofenceStatusCodes
|
||||||
|
|
||||||
|
object GeofenceErrorMessages {
|
||||||
|
fun getErrorString(context: Context, e: Exception): String {
|
||||||
|
return if (e is ApiException) {
|
||||||
|
getErrorString(context, e.statusCode)
|
||||||
|
} else {
|
||||||
|
context.resources.getString(R.string.geofence_unknown_error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getErrorString(context: Context, errorCode: Int): String {
|
||||||
|
val resources = context.resources
|
||||||
|
return when (errorCode) {
|
||||||
|
GeofenceStatusCodes.GEOFENCE_NOT_AVAILABLE ->
|
||||||
|
resources.getString(R.string.geofence_not_available)
|
||||||
|
|
||||||
|
GeofenceStatusCodes.GEOFENCE_TOO_MANY_GEOFENCES ->
|
||||||
|
resources.getString(R.string.geofence_too_many_geofences)
|
||||||
|
|
||||||
|
GeofenceStatusCodes.GEOFENCE_TOO_MANY_PENDING_INTENTS ->
|
||||||
|
resources.getString(R.string.geofence_too_many_pending_intents)
|
||||||
|
|
||||||
|
else -> resources.getString(R.string.geofence_unknown_error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,106 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2018 Razeware LLC
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in
|
||||||
|
* all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* Notwithstanding the foregoing, you may not use, copy, modify, merge, publish,
|
||||||
|
* distribute, sublicense, create a derivative work, and/or sell copies of the
|
||||||
|
* Software in any work that is designed, intended, or marketed for pedagogical or
|
||||||
|
* instructional purposes related to programming, coding, application development,
|
||||||
|
* or information technology. Permission for such use, copying, modification,
|
||||||
|
* merger, publication, distribution, sublicensing, creation of derivative works,
|
||||||
|
* or sale is expressly withheld.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
* THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
package com.cloud.diplomaticquarterapp.geofence
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.content.Intent
|
||||||
|
import android.location.Location
|
||||||
|
import android.util.Log
|
||||||
|
import androidx.core.app.JobIntentService
|
||||||
|
import com.cloud.diplomaticquarterapp.utils.API
|
||||||
|
import com.cloud.diplomaticquarterapp.utils.httpPost
|
||||||
|
import com.cloud.diplomaticquarterapp.utils.sendNotification
|
||||||
|
import com.github.kittinunf.fuel.core.extensions.jsonBody
|
||||||
|
import com.github.kittinunf.fuel.core.isSuccessful
|
||||||
|
import com.github.kittinunf.fuel.httpPost
|
||||||
|
import com.google.android.gms.location.Geofence
|
||||||
|
import com.google.android.gms.location.GeofencingEvent
|
||||||
|
import com.google.gson.Gson
|
||||||
|
|
||||||
|
class GeofenceTransitionsJobIntentService : JobIntentService() {
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
private const val LOG_TAG = "GeoTrIntentService"
|
||||||
|
|
||||||
|
private const val JOB_ID = 573
|
||||||
|
|
||||||
|
fun enqueueWork(context: Context, intent: Intent) {
|
||||||
|
enqueueWork(
|
||||||
|
context,
|
||||||
|
GeofenceTransitionsJobIntentService::class.java, JOB_ID,
|
||||||
|
intent)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onHandleWork(intent: Intent) {
|
||||||
|
val geofencingEvent = GeofencingEvent.fromIntent(intent)
|
||||||
|
if (geofencingEvent.hasError()) {
|
||||||
|
val errorMessage = GeofenceErrorMessages.getErrorString(this, geofencingEvent.errorCode)
|
||||||
|
Log.e(LOG_TAG, errorMessage)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (geofencingEvent.geofenceTransition == Geofence.GEOFENCE_TRANSITION_ENTER || geofencingEvent.geofenceTransition == Geofence.GEOFENCE_TRANSITION_EXIT) {
|
||||||
|
handleEvent(geofencingEvent.triggeringGeofences,geofencingEvent.triggeringLocation, GeofenceTransition.fromInt(geofencingEvent.geofenceTransition));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun handleEvent(triggerGeofences: List<Geofence>, location:Location, transition:GeofenceTransition) {
|
||||||
|
val hmg = HMG_Geofence.shared(this)
|
||||||
|
hmg.getPatientID()?.let { patientId ->
|
||||||
|
|
||||||
|
hmg.getActiveGeofences({ activeGeofences ->
|
||||||
|
|
||||||
|
triggerGeofences.forEach { geofence ->
|
||||||
|
// Extract PointID from 'geofence.requestId' and find from active geofences
|
||||||
|
val pointID = activeGeofences.firstOrNull {it == geofence.requestId}?.split('_')?.first()
|
||||||
|
if(!pointID.isNullOrEmpty() && pointID.toIntOrNull() != null){
|
||||||
|
|
||||||
|
val body = mapOf(
|
||||||
|
"PointsID" to pointID.toIntOrNull(),
|
||||||
|
"GeoType" to transition.value,
|
||||||
|
"PatientID" to patientId
|
||||||
|
)
|
||||||
|
|
||||||
|
httpPost<Map<String,Any>>(API.LOG_GEOFENCE, body, { response ->
|
||||||
|
sendNotification(this, transition.named(), geofence.requestId, "Notified to server.😎")
|
||||||
|
},{ exception ->
|
||||||
|
sendNotification(this, transition.named(), geofence.requestId, "Failed to notify server.😔")
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
},null)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,27 @@
|
|||||||
|
|
||||||
|
|
||||||
|
package com.cloud.diplomaticquarterapp.geofence
|
||||||
|
|
||||||
|
import android.content.BroadcastReceiver
|
||||||
|
import android.content.Context
|
||||||
|
import android.content.Intent
|
||||||
|
import android.os.Handler
|
||||||
|
import android.os.Message
|
||||||
|
import com.cloud.diplomaticquarterapp.geofence.HMG_Geofence
|
||||||
|
import com.cloud.diplomaticquarterapp.utils.HMGUtils
|
||||||
|
|
||||||
|
class GeofencingRebootBroadcastReceiver : BroadcastReceiver(){
|
||||||
|
override fun onReceive(context: Context, intent: Intent) {
|
||||||
|
|
||||||
|
if (Intent.ACTION_BOOT_COMPLETED.equals(intent.action)) {
|
||||||
|
val pref = context.getSharedPreferences(PREFS_STORAGE, Context.MODE_PRIVATE)
|
||||||
|
pref.edit().putString("REBOOT_DETECTED","YES").apply()
|
||||||
|
|
||||||
|
HMG_Geofence.shared(context).unRegisterAll { status, exception ->
|
||||||
|
val geoZones = HMGUtils.getGeoZonesFromPreference(context)
|
||||||
|
HMG_Geofence.shared(context).register(geoZones)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -1,71 +0,0 @@
|
|||||||
package com.ejada.hmg.geofence.intent_receivers
|
|
||||||
|
|
||||||
import android.annotation.SuppressLint
|
|
||||||
import android.content.BroadcastReceiver
|
|
||||||
import android.content.Context
|
|
||||||
import android.content.Intent
|
|
||||||
import android.util.Log
|
|
||||||
import com.ejada.hmg.geofence.GeofenceTransition
|
|
||||||
import com.ejada.hmg.geofence.HMG_Geofence
|
|
||||||
import com.ejada.hmg.utils.Logs
|
|
||||||
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)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
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 ->
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,16 +0,0 @@
|
|||||||
|
|
||||||
|
|
||||||
package com.ejada.hmg.geofence.intent_receivers
|
|
||||||
|
|
||||||
import android.content.BroadcastReceiver
|
|
||||||
import android.content.Context
|
|
||||||
import android.content.Intent
|
|
||||||
import com.ejada.hmg.geofence.HMG_Geofence
|
|
||||||
import com.google.android.gms.location.GeofenceStatusCodes
|
|
||||||
|
|
||||||
class GeofenceBroadcastReceiverWithJobService : BroadcastReceiver() {
|
|
||||||
override fun onReceive(context: Context, intent: Intent) {
|
|
||||||
GeofenceTransitionsJobIntentService.enqueueWork(context, intent)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,43 +0,0 @@
|
|||||||
|
|
||||||
|
|
||||||
package com.ejada.hmg.geofence.intent_receivers
|
|
||||||
|
|
||||||
import android.content.Context
|
|
||||||
import com.ejada.hmg.R
|
|
||||||
import com.ejada.hmg.geofence.HMG_Geofence
|
|
||||||
import com.google.android.gms.common.api.ApiException
|
|
||||||
import com.google.android.gms.location.GeofenceStatusCodes
|
|
||||||
|
|
||||||
object GeofenceErrorMessages {
|
|
||||||
fun getErrorString(context: Context, e: Exception): String {
|
|
||||||
return if (e is ApiException) {
|
|
||||||
getErrorString(context, e.statusCode)
|
|
||||||
} else {
|
|
||||||
context.resources.getString(R.string.geofence_unknown_error)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun getErrorString(context: Context, errorCode: Int): String {
|
|
||||||
val resources = context.resources
|
|
||||||
val errorMessage = when (errorCode) {
|
|
||||||
GeofenceStatusCodes.GEOFENCE_NOT_AVAILABLE ->
|
|
||||||
resources.getString(R.string.geofence_not_available)
|
|
||||||
|
|
||||||
GeofenceStatusCodes.GEOFENCE_TOO_MANY_GEOFENCES ->
|
|
||||||
resources.getString(R.string.geofence_too_many_geofences)
|
|
||||||
|
|
||||||
GeofenceStatusCodes.GEOFENCE_TOO_MANY_PENDING_INTENTS ->
|
|
||||||
resources.getString(R.string.geofence_too_many_pending_intents)
|
|
||||||
|
|
||||||
GeofenceStatusCodes.GEOFENCE_INSUFFICIENT_LOCATION_PERMISSION ->
|
|
||||||
resources.getString(R.string.GEOFENCE_INSUFFICIENT_LOCATION_PERMISSION)
|
|
||||||
|
|
||||||
GeofenceStatusCodes.GEOFENCE_REQUEST_TOO_FREQUENT ->
|
|
||||||
resources.getString(R.string.GEOFENCE_REQUEST_TOO_FREQUENT)
|
|
||||||
|
|
||||||
else -> resources.getString(R.string.geofence_unknown_error)
|
|
||||||
}
|
|
||||||
|
|
||||||
return errorMessage
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,97 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2018 Razeware LLC
|
|
||||||
*
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
|
||||||
* in the Software without restriction, including without limitation the rights
|
|
||||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
* copies of the Software, and to permit persons to whom the Software is
|
|
||||||
* furnished to do so, subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be included in
|
|
||||||
* all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* Notwithstanding the foregoing, you may not use, copy, modify, merge, publish,
|
|
||||||
* distribute, sublicense, create a derivative work, and/or sell copies of the
|
|
||||||
* Software in any work that is designed, intended, or marketed for pedagogical or
|
|
||||||
* instructional purposes related to programming, coding, application development,
|
|
||||||
* or information technology. Permission for such use, copying, modification,
|
|
||||||
* merger, publication, distribution, sublicensing, creation of derivative works,
|
|
||||||
* or sale is expressly withheld.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
* THE SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
package com.ejada.hmg.geofence.intent_receivers
|
|
||||||
|
|
||||||
import android.content.Context
|
|
||||||
import android.content.Intent
|
|
||||||
import android.util.Log
|
|
||||||
import androidx.core.app.JobIntentService
|
|
||||||
import com.ejada.hmg.geofence.GeofenceTransition
|
|
||||||
import com.ejada.hmg.geofence.HMG_Geofence
|
|
||||||
import com.ejada.hmg.utils.saveLog
|
|
||||||
import com.google.android.gms.location.GeofenceStatusCodes
|
|
||||||
import com.google.android.gms.location.GeofencingEvent
|
|
||||||
|
|
||||||
class GeofenceTransitionsJobIntentService : JobIntentService() {
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
private const val LOG_TAG = "GeoTrIntentService"
|
|
||||||
|
|
||||||
private const val JOB_ID = 95902
|
|
||||||
var context_: Context? = null
|
|
||||||
fun enqueueWork(context: Context, intent: Intent) {
|
|
||||||
context_ = context
|
|
||||||
enqueueWork(
|
|
||||||
context,
|
|
||||||
GeofenceTransitionsJobIntentService::class.java, JOB_ID,
|
|
||||||
intent)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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)
|
|
||||||
|
|
||||||
|
|
||||||
saveLog(context_!!,LOG_TAG,errorMessage)
|
|
||||||
doReRegisterIfRequired(context_!!, geofencingEvent.errorCode)
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (geofencingEvent != null) {
|
|
||||||
geofencingEvent.triggeringGeofences?.let { geofencingEvent.triggeringLocation?.let { it1 ->
|
|
||||||
HMG_Geofence.shared(context_!!).handleEvent(it,
|
|
||||||
it1, 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, exc -> }
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,23 +0,0 @@
|
|||||||
|
|
||||||
|
|
||||||
package com.ejada.hmg.geofence.intent_receivers
|
|
||||||
|
|
||||||
import android.content.BroadcastReceiver
|
|
||||||
import android.content.Context
|
|
||||||
import android.content.Intent
|
|
||||||
import com.ejada.hmg.geofence.HMG_Geofence
|
|
||||||
import com.ejada.hmg.utils.PREFS_STORAGE
|
|
||||||
|
|
||||||
class GeofencingRebootBroadcastReceiver : BroadcastReceiver(){
|
|
||||||
override fun onReceive(context: Context, intent: Intent) {
|
|
||||||
|
|
||||||
if (Intent.ACTION_BOOT_COMPLETED.equals(intent.action)) {
|
|
||||||
// if (intent.action.equals("android.intent.action.BOOT_COMPLETE")) {
|
|
||||||
val pref = context.getSharedPreferences(PREFS_STORAGE, Context.MODE_PRIVATE)
|
|
||||||
pref.edit().putString("REBOOT_DETECTED","YES").apply()
|
|
||||||
|
|
||||||
HMG_Geofence.shared(context).register(){ status, error -> }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,25 +0,0 @@
|
|||||||
|
|
||||||
|
|
||||||
package com.ejada.hmg.geofence.intent_receivers
|
|
||||||
|
|
||||||
import android.content.BroadcastReceiver
|
|
||||||
import android.content.Context
|
|
||||||
import android.content.Intent
|
|
||||||
import android.location.LocationManager
|
|
||||||
import com.ejada.hmg.geofence.HMG_Geofence
|
|
||||||
import com.ejada.hmg.utils.HMGUtils
|
|
||||||
import com.ejada.hmg.utils.PREFS_STORAGE
|
|
||||||
|
|
||||||
class LocationProviderChangeReceiver : BroadcastReceiver() {
|
|
||||||
private val LOG_TAG = "LocationProviderChangeReceiver"
|
|
||||||
override fun onReceive(context: Context, intent: Intent) {
|
|
||||||
|
|
||||||
if (LocationManager.PROVIDERS_CHANGED_ACTION.equals(intent.action)) {
|
|
||||||
val pref = context.getSharedPreferences(PREFS_STORAGE, Context.MODE_PRIVATE)
|
|
||||||
pref.edit().putString("LOCATION_PROVIDER_CHANGE","YES").apply()
|
|
||||||
|
|
||||||
HMG_Geofence.shared(context).register(){ s, e -> }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,24 +0,0 @@
|
|||||||
package com.ejada.hmg.geofence.intent_receivers
|
|
||||||
|
|
||||||
import android.app.job.JobParameters
|
|
||||||
import android.app.job.JobService
|
|
||||||
import com.ejada.hmg.geofence.HMG_Geofence
|
|
||||||
import com.ejada.hmg.utils.Logs
|
|
||||||
|
|
||||||
class ReregisterGeofenceJobService : JobService(){
|
|
||||||
companion object{
|
|
||||||
val TriggerIntervalDuration:String = "06:00:00"
|
|
||||||
val JobID = 918273
|
|
||||||
}
|
|
||||||
override fun onStartJob(params: JobParameters?): Boolean {
|
|
||||||
Logs.save(applicationContext,"ReregisterGeofenceJobService.onStartJob", "triggered to re-register the geofences after $TriggerIntervalDuration >> [HH:mm:ss]")
|
|
||||||
HMG_Geofence.shared(applicationContext).register(){ status, error ->
|
|
||||||
jobFinished(params, true)
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onStopJob(params: JobParameters?): Boolean {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -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)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,8 +0,0 @@
|
|||||||
package com.ejada.hmg.utils
|
|
||||||
|
|
||||||
|
|
||||||
const val PREFS_STORAGE = "FlutterSharedPreferences"
|
|
||||||
const val PREF_KEY_SUCCESS = "HMG_GEOFENCE_SUCCESS"
|
|
||||||
const val PREF_KEY_FAILED = "HMG_GEOFENCE_FAILED"
|
|
||||||
const val PREF_KEY_HMG_ZONES = "flutter.hmg-geo-fences"
|
|
||||||
const val PREF_KEY_LANGUAGE = "flutter.language"
|
|
||||||
@ -1,145 +0,0 @@
|
|||||||
package com.ejada.hmg.utils
|
|
||||||
|
|
||||||
import android.content.Context
|
|
||||||
import android.content.SharedPreferences
|
|
||||||
import android.os.Build
|
|
||||||
import com.ejada.hmg.BuildConfig
|
|
||||||
import com.google.gson.Gson
|
|
||||||
|
|
||||||
class Logs {
|
|
||||||
|
|
||||||
enum class STATUS{
|
|
||||||
SUCCESS,
|
|
||||||
ERROR;
|
|
||||||
}
|
|
||||||
class GeofenceEvent{
|
|
||||||
companion object{
|
|
||||||
fun save(context: Context, tag:String, message:String, status:Logs.STATUS = STATUS.SUCCESS){
|
|
||||||
Logs.Common.save(context,"GeofenceEvent", tag, message, status)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun list(context: Context, tag:String? = null, status:Logs.STATUS? = null):List<LogModel>{
|
|
||||||
return Logs.Common.list(context,"GeofenceEvent", tag, status)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun raw(context: Context):String{
|
|
||||||
return Logs.Common.raw(context,"GeofenceEvent")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class RegisterGeofence{
|
|
||||||
companion object{
|
|
||||||
fun save(context: Context, tag:String, message:String, status:Logs.STATUS = STATUS.SUCCESS){
|
|
||||||
Logs.Common.save(context,"RegisterGeofence", tag, message, status)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun list(context: Context, tag:String? = null, status:Logs.STATUS? = null):List<LogModel>{
|
|
||||||
return Logs.Common.list(context,"RegisterGeofence", tag, status)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun raw(context: Context):String{
|
|
||||||
return Logs.Common.raw(context,"RegisterGeofence");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
companion object{
|
|
||||||
private var pref:SharedPreferences? = null
|
|
||||||
fun save(context: Context, tag:String, message:String, status:Logs.STATUS = STATUS.SUCCESS){
|
|
||||||
Logs.Common.save(context,"Logs", tag, message, status)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun list(context: Context, tag:String? = null, status:Logs.STATUS? = null):List<LogModel>{
|
|
||||||
return Logs.Common.list(context,"Logs", tag, status)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun raw(context: Context):String{
|
|
||||||
return Logs.Common.raw(context,"Logs");
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun storage(context: Context):SharedPreferences{
|
|
||||||
if(pref == null) {
|
|
||||||
pref = context.getSharedPreferences(PREFS_STORAGE, Context.MODE_PRIVATE)
|
|
||||||
}
|
|
||||||
return pref!!
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private class Common{
|
|
||||||
companion object{
|
|
||||||
private val gson = Gson()
|
|
||||||
|
|
||||||
fun save(context: Context, key:String, tag:String, message:String, status:Logs.STATUS = STATUS.SUCCESS){
|
|
||||||
if(!BuildConfig.DEBUG)
|
|
||||||
return
|
|
||||||
|
|
||||||
val pref = Logs.storage(context)
|
|
||||||
|
|
||||||
val string = pref.getString(key,"{}")
|
|
||||||
val json = gson.fromJson<LogsContainerModel>(string,LogsContainerModel::class.java)
|
|
||||||
json.add(
|
|
||||||
LogModel().apply {
|
|
||||||
this.TAG = tag
|
|
||||||
this.MESSAGE = message
|
|
||||||
this.STATUS = status.name
|
|
||||||
this.DATE = DateUtils.dateTimeNow()
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
pref.edit().putString(key,gson.toJson(json)).apply()
|
|
||||||
}
|
|
||||||
|
|
||||||
fun list(context: Context, key:String, tag:String? = null, status:Logs.STATUS? = null):List<LogModel>{
|
|
||||||
val pref = Logs.storage(context)
|
|
||||||
val string = pref.getString(key,"{}")
|
|
||||||
val json = gson.fromJson<LogsContainerModel>(string,LogsContainerModel::class.java)
|
|
||||||
if(tag == null && status == null) {
|
|
||||||
return json.LOGS
|
|
||||||
}else if(tag != null && status != null){
|
|
||||||
return json.LOGS.filter { (it.TAG == tag && it.STATUS == status.name) }
|
|
||||||
}else if(tag != null){
|
|
||||||
return json.LOGS.filter { (it.TAG == tag) }
|
|
||||||
}else if(status != null){
|
|
||||||
return json.LOGS.filter { (it.STATUS == status.name) }
|
|
||||||
}
|
|
||||||
return listOf()
|
|
||||||
}
|
|
||||||
|
|
||||||
fun raw(context: Context, key:String):String{
|
|
||||||
val pref = Logs.storage(context)
|
|
||||||
val string = pref.getString(key,"{}")
|
|
||||||
return string!!
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class LogModel{
|
|
||||||
lateinit var TAG:String
|
|
||||||
lateinit var MESSAGE:String
|
|
||||||
lateinit var STATUS:String
|
|
||||||
lateinit var DATE:String
|
|
||||||
|
|
||||||
companion object{
|
|
||||||
fun with(tag:String, message:String, status:String):LogModel{
|
|
||||||
return LogModel().apply {
|
|
||||||
this.TAG = tag
|
|
||||||
this.MESSAGE = message
|
|
||||||
this.STATUS = status
|
|
||||||
this.DATE = DateUtils.dateTimeNow()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class LogsContainerModel{
|
|
||||||
var LOGS = mutableListOf<LogModel>()
|
|
||||||
fun add(log:LogModel){
|
|
||||||
LOGS.add(log)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -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()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
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>
|
|
||||||
|
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 544 B |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 442 B |
|
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 721 B |
|
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 5.6 KiB After Width: | Height: | Size: 1.4 KiB |
@ -1,6 +1,6 @@
|
|||||||
#Wed Jul 14 15:55:18 AST 2021
|
#Thu Sep 03 16:26:30 EEST 2020
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.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,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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
Before Width: | Height: | Size: 4.4 KiB |
|
Before Width: | Height: | Size: 37 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
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 |
|
After Width: | Height: | Size: 44 KiB |
|
After Width: | Height: | Size: 38 KiB |
|
Before Width: | Height: | Size: 76 KiB |
|
After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 3.4 KiB |
|
After Width: | Height: | Size: 34 KiB |
|
Before Width: | Height: | Size: 2.7 KiB |
|
After Width: | Height: | Size: 57 KiB |
|
After Width: | Height: | Size: 6.0 KiB |