updated sww bridge

This commit is contained in:
Sayed Owais Ali
2023-09-14 18:05:37 +05:30
parent 75ed51e424
commit 5b280edd97
6 changed files with 40 additions and 31 deletions

View File

@@ -271,7 +271,7 @@ android {
buildConfigField 'String', 'FLAVOR', '"fieldAgentsQa"'
buildConfigField 'String', 'BUILD_FLAVOR', '"qa"'
buildConfigField 'String', 'APP_NAME', '"COSMOS"'
buildConfigField 'String', 'API_KEY', '"qa"'
buildConfigField 'String', 'API_KEY', '"Egsn144zdk4CZBZuhmDBMc4ytV7sLQ1C"'
}
fieldAgentsProd {
applicationId "com.avapp"
@@ -287,7 +287,7 @@ android {
buildConfigField 'String', 'FLAVOR', '"callingAgentsQA"'
buildConfigField 'String', 'BUILD_FLAVOR', '"qa"'
buildConfigField 'String', 'APP_NAME', '"COSMOS"'
buildConfigField 'String', 'API_KEY', '"qa"'
buildConfigField 'String', 'API_KEY', '"Egsn144zdk4CZBZuhmDBMc4ytV7sLQ1C"'
}
callingAgentsProd {
applicationId "com.avapp"
@@ -305,7 +305,7 @@ dependencies {
implementation "com.github.anrwatchdog:anrwatchdog:1.4.0"
implementation 'com.navi.medici:alfred:navi_v1.0.0-20230913.133908-19'
implementation 'com.navi.medici:alfred:navi_v1.0.0-20230914.121744-21'
//noinspection GradleDynamicVersion
implementation "com.facebook.react:react-native:+" // From node_modules

View File

@@ -90,19 +90,19 @@ public class DeviceUtilsModule extends ReactContextBaseJavaModule implements Act
}
@ReactMethod
public void handleSWWEvent(ReadableMap metaData) {
JSONObject jsonObject = new JSONObject(metaData.toHashMap());
Iterator<String> keys = jsonObject.keys();
public void handleSWWEvent(String message, String stack, String name) { //<String, Object>
HashMap<String,String> h = new HashMap<>();
while (keys.hasNext()) {
String key = keys.next();
String idValue = metaData.getString(key);
h.put(key.toString(), idValue.toString());
}
Log.d("incoming SWW",metaData.toString());
Log.d("incoming SWW Generated",h.toString());
h.put("message",message );
h.put("stack",stack );
h.put("name",name );
Log.d("incoming SWW message",message);
Log.d("incoming SWW stack",stack);
Log.d("incoming SWW name",name);
AlfredManager.INSTANCE.handleSWWEvent("Cosmos", h);
}
@ReactMethod
public void setCodePushVersion(String codePushVersion) {
AlfredManager.config.setCodePushVersion(codePushVersion);
}
}

View File

@@ -66,6 +66,7 @@ public class MainActivity extends ReactActivity {
AlfredManager.INSTANCE.measureInflatedView(appBackgroundView);
AlfredManager.INSTANCE.stopRecording(appBackgroundView);
}
Log.d("Alfred", "Alfred session id = " + AlfredManager.config.getAlfredSessionId());
}

View File

@@ -80,8 +80,8 @@ public class MainApplication extends Application implements ReactApplication {
SoLoader.init(this, /* native exopackage */ false);
initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
// AlfredConfig alfredConfig = new AlfredConfig("Cosmos", String.valueOf(BuildConfig.VERSION_CODE), BuildConfig.VERSION_NAME, BuildConfig.BUILD_FLAVOR);
AlfredConfig alfredConfig = new AlfredConfig("AVAPP", "336", "4.0.0","qa");
//AlfredConfig alfredConfig = new AlfredConfig(BuildConfig.APP_NAME, String.valueOf(BuildConfig.VERSION_CODE), BuildConfig.VERSION_NAME, BuildConfig.BUILD_FLAVOR, BuildConfig.API_KEY);
AlfredConfig alfredConfig = new AlfredConfig("COSMOS", "336", "4.0.0","qa", "Egsn144zdk4CZBZuhmDBMc4ytV7sLQ1C");
AlfredManager.INSTANCE.init(alfredConfig, getApplicationContext());
new ANRWatchDog()
@@ -111,6 +111,7 @@ public class MainApplication extends Application implements ReactApplication {
// Crash Reporting to backend
Thread.UncaughtExceptionHandler defaultHandler = Thread.getDefaultUncaughtExceptionHandler();
Thread.setDefaultUncaughtExceptionHandler((thread, exception) -> {
Log.d("Alfred Error", exception.toString());
if ((exception.getStackTrace() == null) || (exception.getStackTrace().length == 0)) {
if (defaultHandler != null) {
defaultHandler.uncaughtException(thread, exception);
@@ -118,6 +119,8 @@ public class MainApplication extends Application implements ReactApplication {
return;
}
try {
Log.d("Alfred try", exception.toString());
Map<String, String> crashEventProperties = new HashMap<>();
crashEventProperties.put("SCREEN_NAME", "Cosmos");
crashEventProperties.put("METHOD_NAME", exception.getStackTrace()[0].getMethodName());
@@ -137,6 +140,8 @@ public class MainApplication extends Application implements ReactApplication {
} finally {
if (defaultHandler != null) {
defaultHandler.uncaughtException(thread, exception);
Log.d("Alfred finally", exception.toString());
}
}
});

View File

@@ -8,4 +8,8 @@ export const locationEnabled = (): Promise<boolean> => DeviceUtilsModule.isLocat
// returns array of all the installed packages.
export const getAllInstalledApp = (): Promise<string> => DeviceUtilsModule.getAllInstalledApp();
export const alfredHandleSWWEvent = (data: any) => DeviceUtilsModule.handleSWWEvent(data);
export const alfredHandleSWWEvent = (error: Error) => {
const {message="", stack="", name=""} = error;
DeviceUtilsModule.handleSWWEvent(message, stack, name)
};

View File

@@ -24,8 +24,9 @@ import { BOTTOM_TAB_ROUTES } from './constants';
import { getSelfieDocument } from '../../action/profileActions';
import Button from '../../../RN-UI-LIB/src/components/Button';
import EmptyList from './EmptyList';
import { handleSwwEvent } from '../../components/utlis/DeviceUtils';
import { alfredHandleSWWEvent } from '../../components/utlis/DeviceUtils';
import { data } from '../../../RN-UI-LIB/src/data';
import ErrorBoundary from '../../common/ErrorBoundary';
const AllCasesMain = () => {
const { pendingList, pinnedList, completedList, loading } = useAppSelector(
@@ -75,25 +76,23 @@ const AllCasesMain = () => {
dispatch(resetSelectedTodoList());
}, []);
const triggerWhileLoop = () => {
while (true) {
console.warn('while loop');
}
};
return (
<Layout>
<FullScreenLoader loading={loading} />
{/* <BottomNavigator
<ErrorBoundary>
<FullScreenLoader loading={loading} />
<BottomNavigator
screens={HOME_SCREENS}
initialRoute={HOME_SCREENS[1].name}
onTabPress={(e) => onTabPressHandler(e)}
/> */}
{/* <CasesActionButtons /> */}
/>
<CasesActionButtons />
<Button title="crash" onPress={triggerWhileLoop} />
<Button title="whileLoop" onPress={() => triggerWhileLoop} />
<Button title="SWW" onPress={handleSwwEvent('aman')} />
{/* <Button title="crash" onPress={triggerWhileLoop} />
<Button title="whileLoop" onPress={() => triggerWhileLoop()} />
<Button title="SWW" onPress={() => handleSwW()} /> */}
</ErrorBoundary>
</Layout>
);
};