Merge branch 'alfred-bottomsheet' of github.com:navi-medici/address-verification-app into alfred-bottomsheet

This commit is contained in:
aman.singh
2023-10-12 20:18:46 +05:30
3 changed files with 11 additions and 76 deletions

View File

@@ -313,7 +313,7 @@ dependencies {
implementation "com.github.anrwatchdog:anrwatchdog:1.4.0"
implementation 'com.navi.medici:alfred:v1.0.1-20231009.124735-1'
implementation 'com.navi.medici:alfred:v1.0.2'
//noinspection GradleDynamicVersion
implementation "com.facebook.react:react-native:+" // From node_modules

View File

@@ -158,37 +158,30 @@ public class DeviceUtilsModule extends ReactContextBaseJavaModule {
}
}
@ReactMethod
public void setBottomSheetView(Integer refID) {
if (refID != null) {
UIManagerModule uiManagerModule = RNContext.getNativeModule(UIManagerModule.class);
if (uiManagerModule != null) {
uiManagerModule.addUIBlock(nativeViewHierarchyManager -> {
Log.d("Alfred", "setBottomSheetView nativeViewHierarchyManager:" + nativeViewHierarchyManager);
View view = nativeViewHierarchyManager.resolveView(refID);
Log.d("Alfred", "setBottomSheetView view:" + view);
AlfredManager.INSTANCE.setBottomSheetView(view);
});
try {
uiManagerModule.addUIBlock(nativeViewHierarchyManager -> {
Log.d("Alfred", "setBottomSheetView nativeViewHierarchyManager:" + nativeViewHierarchyManager);
View view = nativeViewHierarchyManager.resolveView(refID);
Log.d("Alfred", "setBottomSheetView view:" + view);
AlfredManager.INSTANCE.setBottomSheetView(view);
});
} catch (Exception error) {
Log.d("Alfred", "setBottomSheetView error:" + error);
}
}
// UIManagerModule uiManager = RNContext.getNativeModule(UIManagerModule.class);
// Executor executor = Executors.newCachedThreadPool();
// uiManager.addUIBlock(new ViewShot(refID, RNContext, executor));
}
// AlfredManager.INSTANCE.clearBottomSheetView();
}
@ReactMethod
public void clearBottomSheet() {
AlfredManager.INSTANCE.clearBottomSheetView();
}
@ReactMethod
public void sendBottomSheetOpenSignal(Boolean isBottomSheetOpen) {
}
private static File convertBase64ToFile(Context context,String base64Data) {
try {
byte[] decodedBytes = Base64.decode(base64Data, Base64.DEFAULT);

View File

@@ -1,58 +0,0 @@
package com.avapp;
import android.app.Activity;
import android.util.Log;
import android.view.View;
import com.facebook.react.bridge.Promise;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.uimanager.NativeViewHierarchyManager;
import com.facebook.react.uimanager.UIBlock;
import java.util.concurrent.Executor;
/**
* Snapshot utility class allow to screenshot a view.
*/
public class ViewShot implements UIBlock {
private final int tag;
@SuppressWarnings({"unused", "FieldCanBeLocal"})
private final ReactApplicationContext reactContext;
private final Executor executor;
//region Constructors
@SuppressWarnings("WeakerAccess")
public ViewShot(
final int tag,
final ReactApplicationContext reactContext,
final Executor executor) {
this.tag = tag;
this.reactContext = reactContext;
this.executor = executor;
}
@Override
public void execute(final NativeViewHierarchyManager nativeViewHierarchyManager) {
Log.d("Alfred", "ViewShot execute NativeViewHierarchyManager:" + nativeViewHierarchyManager + executor);
executor.execute(new Runnable() {
@Override
public void run() {
try {
final View view;
view = nativeViewHierarchyManager.resolveView(tag);
Log.d("Alfred", "Bottomsheet view: " + view);
// if (tag == -1) {
// view = currentActivity.getWindow().getDecorView().findViewById(android.R.id.content);
// } else {
// view = nativeViewHierarchyManager.resolveView(tag);
// }
} catch (final Throwable ex) {
}
}
});
}
}