Merge remote-tracking branch 'origin/dev_v3.13.6_CS' into dev_v3.13.6_vital_sign
# Conflicts: # android/settings.gradle # ios/Podfile # lib/config/localized_values.dart # lib/pages/landing/widgets/services_view.dart # lib/uitl/translations_delegate_base.dart # lib/vital_signs/vital_sign.dartdev_v3.13.6_CS_V2
@ -0,0 +1,81 @@
|
||||
/*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
package com.cloud.diplomaticquarterapp.whatsapp;
|
||||
|
||||
import static java.sql.DriverManager.println;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.ContextWrapper;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.Signature;
|
||||
import android.util.Base64;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class AppSignatureRetriever {
|
||||
|
||||
private static final String HASH_TYPE = "SHA-256";
|
||||
public static final int NUM_HASHED_BYTES = 9;
|
||||
public static final int NUM_BASE64_CHAR = 11;
|
||||
|
||||
|
||||
public void logSignatures(Context context) {
|
||||
Collection<String> appSignatures = getAppSignatures(context);
|
||||
appSignatures.forEach(signature -> println("Signature: " + signature));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all the app signatures for the current package.
|
||||
*
|
||||
* @return signatures for current app
|
||||
*/
|
||||
public Collection<String> getAppSignatures(Context context) {
|
||||
try {
|
||||
// Get all package signatures for the current package
|
||||
String packageName = context.getPackageName();
|
||||
println("Package name: " + packageName);
|
||||
PackageManager packageManager = context.getPackageManager();
|
||||
Signature[] signatures = packageManager.getPackageInfo(packageName,
|
||||
PackageManager.GET_SIGNATURES).signatures;
|
||||
|
||||
// For each signature create a compatible hash
|
||||
Collection<String> appCodes = Arrays.stream(signatures)
|
||||
.map(signature -> hash(packageName, signature.toCharsString()))
|
||||
.collect(Collectors.toList());
|
||||
return appCodes;
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
println("Unable to find package to obtain hash.");
|
||||
throw new RuntimeException("Unable to find package to obtain hash.", e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private String hash(String packageName, String signature) {
|
||||
String appInfo = packageName + " " + signature;
|
||||
try {
|
||||
MessageDigest messageDigest = MessageDigest.getInstance(HASH_TYPE);
|
||||
messageDigest.update(appInfo.getBytes(StandardCharsets.UTF_8));
|
||||
byte[] hashSignature = messageDigest.digest();
|
||||
|
||||
// truncated into NUM_HASHED_BYTES
|
||||
hashSignature = Arrays.copyOfRange(hashSignature, 0, NUM_HASHED_BYTES);
|
||||
// encode into Base64
|
||||
String base64Hash = Base64.encodeToString(hashSignature, Base64.NO_PADDING | Base64.NO_WRAP);
|
||||
base64Hash = base64Hash.substring(0, NUM_BASE64_CHAR);
|
||||
|
||||
println(String.format("pkg: %s -- hash: %s", packageName, base64Hash));
|
||||
return base64Hash;
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
throw new RuntimeException("Unable to generate hash for application", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
package com.ejada.hmg
|
||||
import android.app.PendingIntent
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import com.cloud.diplomaticquarterapp.whatsapp.WhatsApp
|
||||
import com.cloud.diplomaticquarterapp.whatsapp.WhatsAppOtpPlatformBridge
|
||||
import io.flutter.embedding.android.FlutterFragmentActivity
|
||||
|
||||
class WhatsAppCodeActivity : FlutterFragmentActivity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
WhatsApp.handleOTP(intent){code ->
|
||||
WhatsAppOtpPlatformBridge.result?.success(code);
|
||||
finish()
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,52 @@
|
||||
package com.cloud.diplomaticquarterapp.whatsapp
|
||||
|
||||
import android.os.Build
|
||||
import android.util.Log
|
||||
import androidx.annotation.RequiresApi
|
||||
import com.cloud.diplomaticquarterapp.penguin.PenguinView
|
||||
import com.ejada.hmg.MainActivity
|
||||
import io.flutter.embedding.engine.FlutterEngine
|
||||
import io.flutter.plugin.common.MethodCall
|
||||
import io.flutter.plugin.common.MethodChannel
|
||||
import java.lang.ref.WeakReference
|
||||
|
||||
class WhatsAppOtpPlatformBridge(
|
||||
private var flutterEngine: FlutterEngine,
|
||||
private var mainActivity: MainActivity
|
||||
) {
|
||||
|
||||
|
||||
private lateinit var channel: MethodChannel
|
||||
|
||||
companion object {
|
||||
private const val CHANNEL = "whats_app_otp"
|
||||
var result: MethodChannel.Result? = null
|
||||
}
|
||||
|
||||
fun invoke() {
|
||||
channel = MethodChannel(flutterEngine.dartExecutor.binaryMessenger, CHANNEL)
|
||||
channel.setMethodCallHandler { call: MethodCall, result: MethodChannel.Result ->
|
||||
when (call.method) {
|
||||
"isWhatsAppInstalled" -> {
|
||||
val isAppInstalled =
|
||||
WhatsApp.isWhatsAppInstalled(WeakReference(mainActivity))
|
||||
result.success(isAppInstalled)
|
||||
}
|
||||
|
||||
"performHandShake" -> {
|
||||
WhatsApp.performHandShake(WeakReference(mainActivity))
|
||||
}
|
||||
|
||||
|
||||
"startListening" -> {
|
||||
WhatsAppOtpPlatformBridge.result = result
|
||||
}
|
||||
|
||||
else -> {
|
||||
result.notImplemented()
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/main"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".WhatsAppCodeActivity">
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 7.3 KiB |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 3.9 KiB |
|
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 5.6 KiB After Width: | Height: | Size: 36 KiB |
@ -1,23 +1,23 @@
|
||||
<resources>
|
||||
<string name="app_name">HMG Patient App</string>
|
||||
<string name="app_name">HMG Patient App</string>
|
||||
|
||||
<string name="geofence_unknown_error">
|
||||
<string name="geofence_unknown_error">
|
||||
Unknown error: the Geofence service is not available now.
|
||||
</string>
|
||||
<string name="geofence_not_available">
|
||||
<string name="geofence_not_available">
|
||||
Geofence service is not available now. Go to Settings>Location>Mode and choose High accuracy.
|
||||
</string>
|
||||
<string name="geofence_too_many_geofences">
|
||||
<string name="geofence_too_many_geofences">
|
||||
Your app has registered too many geofences.
|
||||
</string>
|
||||
<string name="geofence_too_many_pending_intents">
|
||||
<string name="geofence_too_many_pending_intents">
|
||||
You have provided too many PendingIntents to the addGeofences() call.
|
||||
</string>
|
||||
<string name="GEOFENCE_INSUFFICIENT_LOCATION_PERMISSION">
|
||||
<string name="GEOFENCE_INSUFFICIENT_LOCATION_PERMISSION">
|
||||
App do not have permission to access location service.
|
||||
</string>
|
||||
<string name="GEOFENCE_REQUEST_TOO_FREQUENT">
|
||||
<string name="GEOFENCE_REQUEST_TOO_FREQUENT">
|
||||
Geofence requests happened too frequently.
|
||||
</string>
|
||||
<string name="mapbox_access_token" translatable="false">sk.eyJ1IjoicndhaWQiLCJhIjoiY2x6NWo0bTMzMWZodzJrcGZpemYzc3Z4dSJ9.uSSZuwNSGCcCdPAiORECmg</string>
|
||||
<string name="mapbox_access_token" translatable="false">sk.eyJ1IjoicndhaWQiLCJhIjoiY2x6NWo0bTMzMWZodzJrcGZpemYzc3Z4dSJ9.uSSZuwNSGCcCdPAiORECmg</string>
|
||||
</resources>
|
||||
|
||||
@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg id="Capa_1" xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 512 512">
|
||||
<!-- Generator: Adobe Illustrator 29.2.1, SVG Export Plug-In . SVG Version: 2.1.0 Build 116) -->
|
||||
<defs>
|
||||
<style>
|
||||
.st0 {
|
||||
fill: #d12127;
|
||||
}
|
||||
</style>
|
||||
</defs>
|
||||
<path class="st0" d="M8.5,119.5c2.3,0,4.4-.9,6-2.5s2.5-3.8,2.5-6V25.6c0-4.7,3.8-8.5,8.5-8.5h85.3c4.7,0,8.5-3.8,8.5-8.5s-3.8-8.5-8.5-8.5H25.6C11.5,0,0,11.5,0,25.6v85.3c0,2.3.9,4.4,2.5,6,1.6,1.6,3.8,2.5,6,2.5Z"/>
|
||||
<path class="st0" d="M486.4,0h-85.3c-4.7,0-8.5,3.8-8.5,8.5s3.8,8.5,8.5,8.5h85.3c4.7,0,8.5,3.8,8.5,8.5v85.3c0,4.7,3.8,8.5,8.5,8.5s8.5-3.8,8.5-8.5V25.6c0-14.1-11.5-25.6-25.6-25.6Z"/>
|
||||
<path class="st0" d="M503.5,392.5c-2.3,0-4.4.9-6,2.5-1.6,1.6-2.5,3.8-2.5,6v85.3c0,4.7-3.8,8.5-8.5,8.5h-85.3c-4.7,0-8.5,3.8-8.5,8.5s3.8,8.5,8.5,8.5h85.3c14.1,0,25.6-11.5,25.6-25.6v-85.3c0-2.3-.9-4.4-2.5-6-1.6-1.6-3.8-2.5-6-2.5Z"/>
|
||||
<path class="st0" d="M110.9,494.9H25.6c-4.7,0-8.5-3.8-8.5-8.5v-85.3c0-4.7-3.8-8.5-8.5-8.5s-8.5,3.8-8.5,8.5v85.3c0,14.1,11.5,25.6,25.6,25.6h85.3c4.7,0,8.5-3.8,8.5-8.5s-3.8-8.5-8.5-8.5Z"/>
|
||||
<path d="M503.5,162.1h-86.4c-.5-16.5-4-32.7-10.1-48-17.5-35.6-69.2-88.5-139.6-88.5h-22.7c-70.5,0-122.1,52.9-139.6,88.5-6.1,15.3-9.6,31.6-10.1,48H8.5c-4.7,0-8.5,3.8-8.5,8.5s3.8,8.5,8.5,8.5h85.5c-.2,6.3-.2,12.4-.2,18.4-1.6-.5-3.1-.9-4.8-1.1-8.2-1-16.4,1.8-22.1,7.7-6.7,8.6-9.1,19.8-6.5,30.4,2.2,11.5,5.4,22.7,9.6,33.6l1.4,4.2c1,2.9,1.9,6,2.7,9.1,1.9,8.6,5.2,16.7,9.9,24.1,3.7,5.7,9.8,9.4,16.6,10.1.4,0,.8,0,1.3,0s.8,0,1.2-.1c.6,7.8.9,14.8.9,19.9,0,29.2,27.5,64.9,43.7,81.4,9.4,9.1,19.2,17.7,29.5,25.7,9.8,7.7,19.2,15.8,28.2,24.5,10.1,11.2,24.1,18,39.1,19.3h22.7c15-1.2,29-8.1,39.1-19.3,9-8.6,18.4-16.8,28.2-24.5,10.3-8.1,20.2-16.6,29.6-25.8,16.2-16.5,43.7-52.2,43.7-81.3s.4-12.1.9-19.9c.4,0,.8.1,1.2.1s.9,0,1.3,0c6.8-.7,12.8-4.4,16.6-10.1,4.7-7.4,8-15.5,9.9-24.1.9-3.1,1.7-6.2,2.7-9.1l1.5-4.2c4.1-10.9,7.4-22.1,9.6-33.6,2.6-10.6.3-21.8-6.5-30.4-5.7-5.9-13.9-8.7-22.1-7.7-1.6.2-3.2.6-4.7,1.1,0-5.9,0-12.1-.2-18.4h85.5c4.7,0,8.5-3.8,8.5-8.5s-3.8-8.5-8.5-8.5ZM98.1,295.6c-3.4-5.8-5.9-12.1-7.3-18.7-1-3.5-1.9-6.9-3.1-10.1l-1.5-4.2c-3.8-10-6.8-20.3-8.9-30.9-1.5-5.2-.9-10.7,1.7-15.4,2.1-2.2,5.1-3.2,8.1-2.9,2.7.4,5.2,1.6,7.1,3.4.6,15.3,1.5,26.3,1.7,27.7,0,.4,3.4,28.1,5.8,54.1-1.6-.5-2.9-1.6-3.7-3ZM111.6,210.9c-.1-.2-.3-.3-.4-.5-.3-9.8-.3-20.6,0-31.3h16.8v27.8l-16.4,4.1s0-.1,0-.1ZM136.5,375.3c-8.5-11.7-13.8-25.4-15.3-39.7,0-7.9-.8-19.7-1.9-32.3,0-.5,0-1-.1-1.5-1.8-20.5-4.3-42.5-5.6-52.9l22.8,27.4v99.1ZM117.8,227.1l19.2-4.8,60.4,7.5,5.8,34.7h-54.2l-31.2-37.4ZM145.1,206.1v-26.9h28.8l16.2,32.5-45-5.6ZM193,179.2h42.5l-28.3,28.5-14.2-28.5ZM153.6,291.9l48.2,42.1-18.3,24.4h-29.9v-66.5ZM165.3,409.9c-1.8-1.7-3.6-3.4-5.3-5-2-2.1-4.2-4.4-6.4-7v-22.5h29.9l16.2,21.6-34.4,12.9ZM217.8,455.1c-9.4-9.1-19.3-17.7-29.6-25.8-2.7-2.2-5.5-4.5-8.2-6.7l29.5-11,31.8,57.2c-9-2.1-17.2-6.9-23.5-13.7ZM247.5,444.9l-19.6-35.3h19.6v35.3ZM247.5,392.5h-29.9l-19.2-25.6,19.2-25.6h29.9v51.2ZM247.5,324.3h-30.9l-48.8-42.7h43.3l36.3,14.5v28.1h0ZM247.5,277.7l-26.5-10.6-7-42.1,33.5-33.7v86.4h0ZM112.1,162.1c.4-13.9,3.2-27.6,8.3-40.5,15-30.5,62.1-79,124.3-79h22.7c62.2,0,109.3,48.4,124.3,79,5,12.9,7.8,26.6,8.3,40.5H112.1ZM366.9,179.2v26.9l-45,5.6,16.2-32.5h28.8ZM264.5,324.3v-28.1l36.3-14.5h43.3l-48.8,42.7h-30.9ZM313.6,366.9l-19.2,25.6h-29.9v-51.2h29.9l19.2,25.6ZM264.5,277.7v-86.4l33.5,33.7-7,42.1-26.5,10.6ZM276.5,179.2h42.5l-14.2,28.5-28.3-28.5ZM264.5,444.9v-35.3h19.6l-19.6,35.3ZM323.8,429.4h0c-10.3,8.1-20.2,16.7-29.6,25.8-6.3,6.8-14.5,11.6-23.5,13.7l31.8-57.2,29.5,11c-2.7,2.2-5.5,4.5-8.2,6.7ZM358.4,398c-2.2,2.5-4.4,4.9-6.4,6.9-1.6,1.7-3.4,3.4-5.3,5l-34.4-12.9,16.2-21.6h29.9v22.5ZM358.4,358.4h-29.9l-18.3-24.4,48.2-42.1v66.5h0ZM362.9,264.5h-54.2l5.8-34.7,60.4-7.5,19.2,4.8-31.2,37.4ZM392.8,301.7c0,.5-.1,1-.1,1.5-1.1,12.6-1.9,24.4-1.9,32.3-1.5,14.4-6.8,28.1-15.3,39.7v-99.1l22.8-27.4c-1.3,10.6-3.8,32.5-5.6,52.9ZM400.8,210.5c-.1.2-.3.3-.4.5,0,0,0,.1,0,.1l-16.4-4.1v-27.8h16.8c.3,10.7.3,21.4,0,31.3ZM424.8,213.4h0c3-.4,6,.7,8.1,2.8,2.6,4.7,3.2,10.3,1.7,15.5-2.1,10.5-5,20.8-8.9,30.8l-1.5,4.2c-1.1,3.3-2.1,6.7-3,10.1-1.4,6.6-3.8,12.9-7.3,18.7-.8,1.4-2.2,2.5-3.8,3,2.4-26.1,5.8-53.8,5.9-54.4.1-1.3,1.1-12.2,1.6-27.4,2-1.8,4.4-3,7.1-3.4Z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 4.2 KiB |
|
After Width: | Height: | Size: 16 KiB |