TP-52463 | Alfred on Cosmos (#694)

Co-authored-by: Sayed Owais Ali <sayed.owais@navi.com>
This commit is contained in:
Shri Prakash Bajpai
2024-01-22 13:18:25 +05:30
committed by GitHub
parent ab2348ead9
commit 421e233067
11 changed files with 440 additions and 198 deletions

View File

@@ -1,4 +1,5 @@
apply plugin: "com.android.application"
apply plugin: "com.google.gms.google-services"
apply plugin: "com.google.firebase.crashlytics"
apply plugin: 'com.google.firebase.firebase-perf'
@@ -315,7 +316,10 @@ dependencies {
implementation "com.github.anrwatchdog:anrwatchdog:1.4.0"
//implementation 'com.navi.medici:alfred:v1.0.2'
implementation 'com.navi.android:alfred:1.1.1'
implementation(platform("com.google.firebase:firebase-bom:32.2.3"))
implementation("com.google.firebase:firebase-config-ktx")
implementation("com.google.firebase:firebase-analytics-ktx")
//noinspection GradleDynamicVersion
implementation "com.facebook.react:react-native:+" // From node_modules

View File

@@ -1,14 +1,14 @@
package com.avapp;
import static android.app.Activity.RESULT_CANCELED;
import static android.app.Activity.RESULT_OK;
import static com.avapp.MainApplication.isAlfredEnabledFromFirebase;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.location.LocationManager;
import androidx.annotation.Nullable;
@@ -20,26 +20,18 @@ import com.facebook.react.bridge.Promise;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactContextBaseJavaModule;
import com.facebook.react.bridge.ReactMethod;
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.uimanager.NativeViewHierarchyManager;
import com.facebook.react.uimanager.UIBlock;
import com.facebook.react.uimanager.UIManagerModule;
import com.navi.alfred.AlfredManager;
import android.content.pm.PackageInfo;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Environment;
import android.os.Handler;
import android.os.Parcelable;
import android.util.Base64;
import android.os.Looper;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
@@ -47,7 +39,6 @@ import java.util.HashMap;
import java.util.List;
import android.net.Uri;
import android.widget.Toast;
import java.io.File;
import java.io.FileOutputStream;
@@ -154,50 +145,52 @@ public class DeviceUtilsModule extends ReactContextBaseJavaModule {
@ReactMethod
public void setUserId(String userId) {
//AlfredManager.config.setUserId(userId);
if (isAlfredEnabledFromFirebase) {
AlfredManager.INSTANCE.getConfig$navi_alfred_release().setUserId(userId);
}
}
@ReactMethod
public void handleSWWEvent(String message, String stack, String name) { //<String, Object>
HashMap<String, String> properties = new HashMap<>();
properties.put("message", message);
properties.put("stack", stack);
properties.put("name", name);
//AlfredManager.INSTANCE.handleSWWEvent("Cosmos", properties);
if (isAlfredEnabledFromFirebase) {
HashMap<String, String> properties = new HashMap<>();
properties.put("message", message);
properties.put("stack", stack);
properties.put("name", name);
AlfredManager.INSTANCE.handleSWWEvent(properties);
}
}
@ReactMethod
public void setCodePushVersion(String codePushVersion) {
if (codePushVersion != null) {
//AlfredManager.config.setCodePushVersion(codePushVersion);
if (isAlfredEnabledFromFirebase && codePushVersion != null) {
AlfredManager.INSTANCE.getConfig$navi_alfred_release().setCodePushVersion(codePushVersion);
}
}
@ReactMethod
public void setPhoneNumber(String phoneNumber) {
if (phoneNumber != null) {
//AlfredManager.config.setPhoneNumber(phoneNumber);
if (isAlfredEnabledFromFirebase && phoneNumber != null) {
AlfredManager.INSTANCE.getConfig$navi_alfred_release().setPhoneNumber(phoneNumber);
}
}
@ReactMethod
public void setEmailId(String emailId) {
if (emailId != null) {
//AlfredManager.config.setAgentEmailId(emailId);
if (isAlfredEnabledFromFirebase && emailId != null) {
AlfredManager.INSTANCE.getConfig$navi_alfred_release().setAgentEmailId(emailId);
}
}
@ReactMethod
public void setBottomSheetView(Integer refID) {
if (refID != null) {
if (isAlfredEnabledFromFirebase && refID != null) {
UIManagerModule uiManagerModule = RNContext.getNativeModule(UIManagerModule.class);
if (uiManagerModule != null) {
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);
AlfredManager.INSTANCE.setBottomSheetView(view);
});
} catch (Exception error) {
Log.d("Alfred", "setBottomSheetView error:" + error);
@@ -208,7 +201,9 @@ public class DeviceUtilsModule extends ReactContextBaseJavaModule {
@ReactMethod
public void clearBottomSheet() {
//AlfredManager.INSTANCE.clearBottomSheetView();
if (isAlfredEnabledFromFirebase) {
AlfredManager.INSTANCE.clearBottomSheetView();
}
}
private static File convertBase64ToFile(Context context, String base64Data, String format, String fileName) {

View File

@@ -1,50 +1,137 @@
package com.avapp;
import static com.avapp.MainApplication.isAlfredEnabledFromFirebase;
import com.avapp.utils.AlfredFirebaseHelper;
import com.avapp.utils.FirebaseRemoteConfigHelper;
import com.facebook.react.ReactActivity;
import com.facebook.react.ReactActivityDelegate;
import com.facebook.react.ReactRootView;
import com.navi.alfred.AlfredManager;
import com.navi.alfred.utils.CommonUtilsKt;
import android.content.IntentFilter;
import android.os.Bundle;
import android.view.MotionEvent;
public class MainActivity extends ReactActivity {
/**
* Returns the name of the main component registered from JavaScript. This is used to schedule
* rendering of the component.
*/
@Override
protected String getMainComponentName() {
return "AVAPP";
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(null);
}
/**
* Returns the instance of the {@link ReactActivityDelegate}. There the RootView is created and
* you can specify the renderer you wish to use - the new renderer (Fabric) or the old renderer
* (Paper).
*/
@Override
protected ReactActivityDelegate createReactActivityDelegate() {
return new MainActivityDelegate(this, getMainComponentName());
}
public static class MainActivityDelegate extends ReactActivityDelegate {
public MainActivityDelegate(ReactActivity activity, String mainComponentName) {
super(activity, mainComponentName);
}
public class MainActivity extends ReactActivity implements AlfredFirebaseHelper {
private static int appInForegroundCounter = 0;
private boolean cruiseApiCalled = false;
public static boolean hasAlfredRecordingStarted = false;
/**
* Returns the name of the main component registered from JavaScript. This is used to schedule
* rendering of the component.
*/
@Override
protected ReactRootView createRootView() {
ReactRootView reactRootView = new ReactRootView(getContext());
// If you opted-in for the New Architecture, we enable the Fabric Renderer.
reactRootView.setIsFabric(BuildConfig.IS_NEW_ARCHITECTURE_ENABLED);
return reactRootView;
protected String getMainComponentName() {
return "AVAPP";
}
@Override
protected boolean isConcurrentRootEnabled() {
// If you opted-in for the New Architecture, we enable Concurrent Root (i.e. React 18).
// More on this on https://reactjs.org/blog/2022/03/29/react-v18.html
return BuildConfig.IS_NEW_ARCHITECTURE_ENABLED;
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(null);
FirebaseRemoteConfigHelper.setAlfredFirebaseHelper(this);
}
}
}
/**
* Returns the instance of the {@link ReactActivityDelegate}. There the RootView is created and
* you can specify the renderer you wish to use - the new renderer (Fabric) or the old renderer
* (Paper).
*/
@Override
protected ReactActivityDelegate createReactActivityDelegate() {
return new MainActivityDelegate(this, getMainComponentName());
}
public static class MainActivityDelegate extends ReactActivityDelegate {
public MainActivityDelegate(ReactActivity activity, String mainComponentName) {
super(activity, mainComponentName);
}
@Override
protected ReactRootView createRootView() {
ReactRootView reactRootView = new ReactRootView(getContext());
// If you opted-in for the New Architecture, we enable the Fabric Renderer.
reactRootView.setIsFabric(BuildConfig.IS_NEW_ARCHITECTURE_ENABLED);
return reactRootView;
}
@Override
protected boolean isConcurrentRootEnabled() {
// If you opted-in for the New Architecture, we enable Concurrent Root (i.e. React 18).
// More on this on https://reactjs.org/blog/2022/03/29/react-v18.html
return BuildConfig.IS_NEW_ARCHITECTURE_ENABLED;
}
}
@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
if (isAlfredEnabledFromFirebase && AlfredManager.INSTANCE.isAlfredRecordingEnabled() && cruiseApiCalled) {
AlfredManager.INSTANCE.handleTouchEvent(ev, BuildConfig.APP_NAME, BuildConfig.APP_NAME);
}
return super.dispatchTouchEvent(ev);
}
@Override
protected void onStart() {
super.onStart();
appInForegroundCounter++;
}
@Override
protected void onResume() {
super.onResume();
if (isAlfredEnabledFromFirebase && !hasAlfredRecordingStarted) {
callCruiseAndStartAlfredRecording();
}
}
@Override
protected void onStop() {
super.onStop();
appInForegroundCounter--;
if (isAlfredEnabledFromFirebase && AlfredManager.INSTANCE.isAlfredRecordingEnabled() && cruiseApiCalled) {
if (!isAppInForeground()) {
AlfredManager.INSTANCE.stopRecording();
hasAlfredRecordingStarted = false;
}
}
}
public static Boolean isAppInForeground() {
return appInForegroundCounter >= 1;
}
@Override
public void callCruiseAndStartAlfredRecording() {
if (cruiseApiCalled) {
startAlfredRecording();
} else {
AlfredManager.INSTANCE.getAlfredCruiseInfo(response -> {
cruiseApiCalled = true;
startAlfredRecording();
return null;
});
}
}
public void startAlfredRecording() {
if (AlfredManager.INSTANCE.isAlfredRecordingEnabled() && !hasAlfredRecordingStarted) {
try {
AlfredManager.INSTANCE.startRecording(
this,
this.getWindow().getDecorView().getRootView(),
BuildConfig.APP_NAME,
BuildConfig.APP_NAME,
this
);
hasAlfredRecordingStarted = true;
} catch (Exception e) {
CommonUtilsKt.log(e);
}
}
}
}

View File

@@ -1,9 +1,15 @@
package com.avapp;
import static com.avapp.utils.Constants.APP_IN_FOREGROUND;
import static com.avapp.utils.Constants.LINE_NUMBER;
import static com.avapp.utils.Constants.METHOD_NAME;
import static com.avapp.utils.Constants.STACK_TRACE;
import static com.google.firebase.analytics.FirebaseAnalytics.Param.SCREEN_NAME;
import android.app.Application;
import android.content.Context;
import com.avapp.utils.FirebaseRemoteConfigHelper;
import com.facebook.react.PackageList;
import com.facebook.react.ReactApplication;
import com.facebook.react.ReactInstanceManager;
@@ -12,100 +18,169 @@ import com.facebook.react.ReactPackage;
import com.facebook.react.config.ReactFeatureFlags;
import com.facebook.soloader.SoLoader;
import com.avapp.newarchitecture.MainApplicationReactNativeHost;
import java.lang.reflect.InvocationTargetException;
import java.util.HashMap;
import java.util.List;
import com.github.anrwatchdog.ANRWatchDog;
import com.microsoft.codepush.react.CodePush;
import com.navi.alfred.AlfredConfig;
import com.navi.alfred.AlfredManager;
import android.database.CursorWindow;
import java.lang.reflect.Field;
import java.util.Map;
public class MainApplication extends Application implements ReactApplication {
private final ReactNativeHost mReactNativeHost =
new ReactNativeHost(this) {
@Override
public boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
public static boolean isAlfredEnabledFromFirebase = false;
private final ReactNativeHost mReactNativeHost =
new ReactNativeHost(this) {
@Override
public boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
}
@Override
protected List<ReactPackage> getPackages() {
@SuppressWarnings("UnnecessaryLocalVariable")
List<ReactPackage> packages = new PackageList(this).getPackages();
// Packages that cannot be autolinked yet can be added manually here, for example:
packages.add(new DeviceUtilsModulePackage());
packages.add(new ScreenshotBlockerModulePackage());
return packages;
}
@Override
protected String getJSMainModuleName() {
return "index";
}
@Override
protected String getJSBundleFile() {
return CodePush.getJSBundleFile();
}
};
private final ReactNativeHost mNewArchitectureNativeHost =
new MainApplicationReactNativeHost(this);
@Override
public ReactNativeHost getReactNativeHost() {
if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
return mNewArchitectureNativeHost;
} else {
return mReactNativeHost;
}
@Override
protected List<ReactPackage> getPackages() {
@SuppressWarnings("UnnecessaryLocalVariable")
List<ReactPackage> packages = new PackageList(this).getPackages();
// Packages that cannot be autolinked yet can be added manually here, for example:
packages.add(new DeviceUtilsModulePackage());
packages.add(new ScreenshotBlockerModulePackage());
return packages;
}
@Override
protected String getJSMainModuleName() {
return "index";
}
@Override
protected String getJSBundleFile() {
return CodePush.getJSBundleFile();
}
};
private final ReactNativeHost mNewArchitectureNativeHost =
new MainApplicationReactNativeHost(this);
@Override
public ReactNativeHost getReactNativeHost() {
if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
return mNewArchitectureNativeHost;
} else {
return mReactNativeHost;
}
}
@Override
public void onCreate() {
super.onCreate();
// If you opted-in for the New Architecture, we enable the TurboModule system
ReactFeatureFlags.useTurboModules = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED;
SoLoader.init(this, /* native exopackage */ false);
initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
@Override
public void onCreate() {
super.onCreate();
// If you opted-in for the New Architecture, we enable the TurboModule system
ReactFeatureFlags.useTurboModules = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED;
FirebaseRemoteConfigHelper.init();
SoLoader.init(this, /* native exopackage */ false);
initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
AlfredConfig alfredConfig = new AlfredConfig(BuildConfig.APP_NAME, String.valueOf(BuildConfig.VERSION_CODE), BuildConfig.VERSION_NAME, BuildConfig.BUILD_FLAVOR, BuildConfig.API_KEY);
AlfredManager.INSTANCE.init(alfredConfig, this);
setupAlfredANRWatchDog(alfredConfig);
setupAlfredCrashReporting(alfredConfig);
// https://github.com/rt2zz/redux-persist/issues/284#issuecomment-1011214066
try {
Field field = CursorWindow.class.getDeclaredField("sCursorWindowSize");
field.setAccessible(true);
field.set(null, 20 * 1024 * 1024); //20MB
} catch (Exception e) {
if (BuildConfig.DEBUG) {
e.printStackTrace();
}
}
}
// https://github.com/rt2zz/redux-persist/issues/284#issuecomment-1011214066
try {
Field field = CursorWindow.class.getDeclaredField("sCursorWindowSize");
field.setAccessible(true);
field.set(null, 20 * 1024 * 1024); //20MB
} catch (Exception e) {
if (BuildConfig.DEBUG) {
e.printStackTrace();
}
}
}
/**
* Loads Flipper in React Native templates. Call this in the onCreate method with something like
* initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
*
* @param context
* @param reactInstanceManager
*/
private static void initializeFlipper(
Context context, ReactInstanceManager reactInstanceManager) {
if (BuildConfig.DEBUG) {
try {
/**
* Loads Flipper in React Native templates. Call this in the onCreate method with something like
* initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
*
* @param context
* @param reactInstanceManager
*/
private static void initializeFlipper(
Context context, ReactInstanceManager reactInstanceManager) {
if (BuildConfig.DEBUG) {
try {
/*
We use reflection here to pick up the class that initializes Flipper,
since Flipper library is not available in release mode
*/
Class<?> aClass = Class.forName("com.avapp.ReactNativeFlipper");
aClass
.getMethod("initializeFlipper", Context.class, ReactInstanceManager.class)
.invoke(null, context, reactInstanceManager);
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (NoSuchMethodException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
Class<?> aClass = Class.forName("com.avapp.ReactNativeFlipper");
aClass
.getMethod("initializeFlipper", Context.class, ReactInstanceManager.class)
.invoke(null, context, reactInstanceManager);
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (NoSuchMethodException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
}
}
}
}
private void setupAlfredANRWatchDog(AlfredConfig alfredConfig) {
new ANRWatchDog().setIgnoreDebugger(true).setReportMainThreadOnly().setANRListener(error -> {
if (error.getCause().getStackTrace().length == 0) {
return;
}
Map<String, String> anrEventProperties = new HashMap<>();
anrEventProperties.put(SCREEN_NAME, BuildConfig.APP_NAME);
anrEventProperties.put(METHOD_NAME, error.getCause().getStackTrace()[0].getMethodName());
anrEventProperties.put(LINE_NUMBER, String.valueOf(error.getCause().getStackTrace()[0].getLineNumber()));
anrEventProperties.put(APP_IN_FOREGROUND, MainActivity.isAppInForeground().toString());
if (isAlfredEnabledFromFirebase && AlfredManager.INSTANCE.isAlfredRecordingEnabled() && alfredConfig.getAnrEnableStatus()) {
anrEventProperties.put(STACK_TRACE, error.getCause().getStackTrace()[0].toString());
AlfredManager.INSTANCE.handleAnrEvent(anrEventProperties);
}
}).start();
}
private void setupAlfredCrashReporting(AlfredConfig alfredConfig) {
Thread.UncaughtExceptionHandler defaultHandler = Thread.getDefaultUncaughtExceptionHandler();
Thread.setDefaultUncaughtExceptionHandler((thread, exception) -> {
if ((exception.getStackTrace() == null) || (exception.getStackTrace().length == 0)) {
if (defaultHandler != null) {
defaultHandler.uncaughtException(thread, exception);
}
return;
}
try {
Map<String, String> crashEventProperties = new HashMap<>();
crashEventProperties.put(SCREEN_NAME, BuildConfig.APP_NAME);
crashEventProperties.put(METHOD_NAME, exception.getStackTrace()[0].getMethodName());
crashEventProperties.put(LINE_NUMBER, String.valueOf(exception.getStackTrace()[0].getLineNumber()));
crashEventProperties.put(APP_IN_FOREGROUND, MainActivity.isAppInForeground().toString());
if (isAlfredEnabledFromFirebase && AlfredManager.INSTANCE.isAlfredRecordingEnabled() && alfredConfig.getCrashEnableStatus()) {
StackTraceElement stackTraceElement = exception.getStackTrace()[0];
if (stackTraceElement != null) {
crashEventProperties.put(STACK_TRACE, stackTraceElement.toString());
}
AlfredManager.INSTANCE.handleCrashEvent(crashEventProperties);
}
} finally {
if (defaultHandler != null) {
defaultHandler.uncaughtException(thread, exception);
}
}
});
}
}

View File

@@ -0,0 +1,5 @@
package com.avapp.utils;
public interface AlfredFirebaseHelper {
void callCruiseAndStartAlfredRecording();
}

View File

@@ -0,0 +1,89 @@
package com.avapp.utils;
import static com.avapp.MainActivity.hasAlfredRecordingStarted;
import static com.avapp.MainApplication.isAlfredEnabledFromFirebase;
import com.avapp.BuildConfig;
import com.avapp.R;
import com.google.firebase.remoteconfig.FirebaseRemoteConfig;
import com.google.firebase.remoteconfig.FirebaseRemoteConfigValue;
import com.google.firebase.remoteconfig.FirebaseRemoteConfigSettings;
public class FirebaseRemoteConfigHelper {
private static FirebaseRemoteConfig remoteConfig;
private static final long CONFIG_SYNC_INTERVAL = 60 * 60;
public static final String DISABLE_ALFRED_LOGS = "DISABLE_ALFRED_LOGS";
public static final String ALFRED_ENABLED = "ALFRED_ENABLED";
private static AlfredFirebaseHelper alfredFirebaseHelper;
public static void setAlfredFirebaseHelper(AlfredFirebaseHelper alfredFirebaseHelper) {
FirebaseRemoteConfigHelper.alfredFirebaseHelper = alfredFirebaseHelper;
}
public static void init() {
remoteConfig = getFirebaseRemoteConfig();
}
private static FirebaseRemoteConfig getFirebaseRemoteConfig() {
FirebaseRemoteConfig remoteConfig = FirebaseRemoteConfig.getInstance();
FirebaseRemoteConfigSettings configSettings = new FirebaseRemoteConfigSettings.Builder().setMinimumFetchIntervalInSeconds(BuildConfig.DEBUG ? 0 : CONFIG_SYNC_INTERVAL).build();
remoteConfig.setConfigSettingsAsync(configSettings);
remoteConfig.setDefaultsAsync(R.xml.default_xml_config);
remoteConfig.fetchAndActivate().addOnCompleteListener(task -> {
isAlfredEnabledFromFirebase = FirebaseRemoteConfigHelper.getBoolean(ALFRED_ENABLED);
if (alfredFirebaseHelper != null && isAlfredEnabledFromFirebase && !hasAlfredRecordingStarted) {
alfredFirebaseHelper.callCruiseAndStartAlfredRecording();
}
});
return remoteConfig;
}
private static FirebaseRemoteConfigValue getRawValue(String key) {
try {
FirebaseRemoteConfigValue rawValue = remoteConfig.getValue(key);
return rawValue.getSource() == FirebaseRemoteConfig.VALUE_SOURCE_STATIC ? null : rawValue;
} catch (Exception e) {
return null;
}
}
public static Boolean getRawBoolean(String key) {
FirebaseRemoteConfigValue rawValue = getRawValue(key);
return rawValue != null ? rawValue.asBoolean() : null;
}
public static String getString(String key) {
try {
return remoteConfig.getString(key);
} catch (Exception e) {
return FirebaseRemoteConfig.DEFAULT_VALUE_FOR_STRING;
}
}
public static boolean getBoolean(String key) {
try {
return remoteConfig.getBoolean(key);
} catch (Exception e) {
return FirebaseRemoteConfig.DEFAULT_VALUE_FOR_BOOLEAN;
}
}
public static double getDouble(String key) {
try {
return remoteConfig.getDouble(key);
} catch (Exception e) {
return FirebaseRemoteConfig.DEFAULT_VALUE_FOR_DOUBLE;
}
}
public static long getLong(String key) {
try {
return remoteConfig.getLong(key);
} catch (Exception e) {
return FirebaseRemoteConfig.DEFAULT_VALUE_FOR_LONG;
}
}
}

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~
~ * Copyright © 2019-2023 by Navi Technologies Limited
~ * All rights reserved. Strictly confidential
~
-->
<defaultsMap>
<entry>
<key>ALFRED_ENABLED</key>
<value>false</value>
</entry>
</defaultsMap>

View File

@@ -39,7 +39,7 @@ reactNativeArchitectures=armeabi-v7a,arm64-v8a,x86,x86_64
# to write custom TurboModules/Fabric components OR use libraries that
# are providing them.
newArchEnabled=false
hermesEnabled=true
MYAPP_UPLOAD_STORE_FILE=my-upload-key.keystore
MYAPP_UPLOAD_KEY_ALIAS=my-key-alias
MYAPP_UPLOAD_STORE_PASSWORD=Navi@123

View File

@@ -4,37 +4,37 @@ import { NativeModules } from 'react-native';
const { DeviceUtilsModule } = NativeModules; // this is the same name we returned in getName function.
// returns true if enabled, and false if disabled.
export const locationEnabled = (): Promise<boolean> => DeviceUtilsModule?.isLocationEnabled();
export const locationEnabled = (): Promise<boolean> => DeviceUtilsModule.isLocationEnabled();
// returns array of all the installed packages.
export const getAllInstalledApp = (): Promise<string> => DeviceUtilsModule?.getAllInstalledApp();
export const getAllInstalledApp = (): Promise<string> => DeviceUtilsModule.getAllInstalledApp();
// export const alfredHandleSWWEvent = (error: Error) => {
// const { message = '', stack = '', name = '' } = error;
export const alfredHandleSWWEvent = (error: Error) => {
const { message = '', stack = '', name = '' } = error;
// DeviceUtilsModule.handleSWWEvent(message, stack, name);
// };
DeviceUtilsModule.handleSWWEvent(message, stack, name);
};
// export const handleCrash = () => DeviceUtilsModule.handleCrash();
export const handleCrash = () => DeviceUtilsModule.handleCrash();
// export const handleANR = () => DeviceUtilsModule.handleANR();
export const handleANR = () => DeviceUtilsModule.handleANR();
// export const alfredSetPhoneNumber = (phoneNumber: string) =>
// DeviceUtilsModule.setPhoneNumber(phoneNumber);
export const alfredSetPhoneNumber = (phoneNumber: string) =>
DeviceUtilsModule.setPhoneNumber(phoneNumber);
// export const alfredSetCodePushVersion = (codePushVersion: string) =>
// DeviceUtilsModule.setCodePushVersion(codePushVersion);
export const alfredSetCodePushVersion = (codePushVersion: string) =>
DeviceUtilsModule.setCodePushVersion(codePushVersion);
// export const alfredSetUserId = (userId: string) => DeviceUtilsModule.setUserId(userId);
export const alfredSetUserId = (userId: string) => DeviceUtilsModule.setUserId(userId);
// export const sendBottomSheetOpenSignal = (e: boolean) =>
// DeviceUtilsModule.sendBottomSheetOpenSignal(e);
export const sendBottomSheetOpenSignal = (e: boolean) =>
DeviceUtilsModule.sendBottomSheetOpenSignal(e);
// export const setBottomSheetView = (id: number | null) => DeviceUtilsModule.setBottomSheetView(id);
export const setBottomSheetView = (id: number | null) => DeviceUtilsModule.setBottomSheetView(id);
// export const clearBottomSheet = () => DeviceUtilsModule.clearBottomSheet();
export const clearBottomSheet = () => DeviceUtilsModule.clearBottomSheet();
// export const alfredSetEmailId = (emailId: string) => DeviceUtilsModule.setEmailId(emailId);
export const alfredSetEmailId = (emailId: string) => DeviceUtilsModule.setEmailId(emailId);
// sends content to whatsapp.
export const sendContentToWhatsapp = (
@@ -46,32 +46,4 @@ export const sendContentToWhatsapp = (
): Promise<boolean> =>
DeviceUtilsModule?.sendContentToWhatsapp(message, imageUrl, mimeType, format, fileName);
const noop = () => {};
export const alfredHandleSWWEvent = (error: Error) => {
const { message = '', stack = '', name = '' } = error;
noop();
};
export const handleCrash = () => noop();
export const handleANR = () => noop();
export const alfredSetPhoneNumber = (phoneNumber: string) =>
noop();
export const alfredSetCodePushVersion = (codePushVersion: string) =>
noop();
export const alfredSetUserId = (userId: string) => noop();
export const sendBottomSheetOpenSignal = (e: boolean) =>
noop();
export const setBottomSheetView = (id: number | null) => noop();
export const clearBottomSheet = () => noop();
export const alfredSetEmailId = (emailId: string) => noop();
export const getBuildFlavour = (): Promise<buildFlavour> => DeviceUtilsModule.getBuildFlavour();
export const getBuildFlavour = (): Promise<buildFlavour> => DeviceUtilsModule.getBuildFlavour();

View File

@@ -97,7 +97,7 @@ function AuthRouter() {
}
alfredSetCodePushVersion(getAppVersion());
NetworkStatusService.listenForOnline(dispatch);
}, []);
}, [user.user]);
// for setting user token in global.ts for api calling's
setGlobalUserData({

View File

@@ -49,7 +49,7 @@ const CaseDetails: React.FC<ICaseDetails> = (props) => {
setShowCallingBottomSheet(true);
};
const opacityAnimation = useRef(new Animated.Value(0.8, {useNativeDriver: true})).current;
const opacityAnimation = useRef(new Animated.Value(0.8)).current;
const slideInUpJourney = useRef(new Animated.Value(5, { useNativeDriver: true })).current;
const duration = 300;
@@ -134,4 +134,4 @@ export const styles = StyleSheet.create({
},
});
export default CaseDetails;
export default CaseDetails;