TP-72939 | Alfred fixes
This commit is contained in:
@@ -161,6 +161,16 @@ public class DeviceUtilsModule extends ReactContextBaseJavaModule {
|
||||
}
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void handleCrash(String message, String screenName) { //<String, Object>
|
||||
if (isAlfredEnabledFromFirebase) {
|
||||
HashMap<String, String> properties = new HashMap<>();
|
||||
properties.put("message", message);
|
||||
properties.put("screenName", screenName);
|
||||
AlfredManager.INSTANCE.handleCrashEvent(properties);
|
||||
}
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void setCodePushVersion(String codePushVersion) {
|
||||
if (isAlfredEnabledFromFirebase && codePushVersion != null) {
|
||||
|
||||
@@ -9,8 +9,9 @@ import VersionNumber from 'react-native-version-number';
|
||||
import Text from '../../RN-UI-LIB/src/components/Text';
|
||||
import { getAppVersion } from '../components/utlis/commonFunctions';
|
||||
import { COLORS } from '../../RN-UI-LIB/src/styles/colors';
|
||||
import { alfredHandleSWWEvent } from '../components/utlis/DeviceUtils';
|
||||
import { handleCrash } from '../components/utlis/DeviceUtils';
|
||||
import crashlytics from '@react-native-firebase/crashlytics';
|
||||
import { getCurrentScreen } from '@components/utlis/navigationUtlis';
|
||||
|
||||
interface IErrorBoundary {
|
||||
children?: ReactNode;
|
||||
@@ -37,7 +38,7 @@ class ErrorBoundary extends Component<IErrorBoundary, IErrorBoundaryState> {
|
||||
});
|
||||
logError(error);
|
||||
crashlytics().recordError(error);
|
||||
alfredHandleSWWEvent(new Error("Error in Alfred recording"));
|
||||
handleCrash({ message: error.message, screenName: getCurrentScreen()?.name });
|
||||
}
|
||||
|
||||
render() {
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
import { buildFlavour } from '@reducers/metadataSlice';
|
||||
import { NativeModules } from 'react-native';
|
||||
|
||||
interface CrashError {
|
||||
message: string;
|
||||
screenName: string;
|
||||
}
|
||||
|
||||
const { DeviceUtilsModule } = NativeModules; // this is the same name we returned in getName function.
|
||||
|
||||
// returns true if enabled, and false if disabled.
|
||||
@@ -15,7 +20,10 @@ export const alfredHandleSWWEvent = (error: Error) => {
|
||||
DeviceUtilsModule.handleSWWEvent(message, stack, name);
|
||||
};
|
||||
|
||||
export const handleCrash = () => DeviceUtilsModule.handleCrash();
|
||||
export const handleCrash = (error: CrashError) => {
|
||||
const { message = '', screenName = '' } = error;
|
||||
DeviceUtilsModule.handleCrash(message, screenName);
|
||||
};
|
||||
|
||||
export const handleANR = () => DeviceUtilsModule.handleANR();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user