TP-60588 | Merge master

This commit is contained in:
yashmantri
2024-09-22 17:37:59 +05:30
59 changed files with 4692 additions and 997 deletions

View File

@@ -134,8 +134,8 @@ def reactNativeArchitectures() {
return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
}
def VERSION_CODE = 188
def VERSION_NAME = "2.13.0"
def VERSION_CODE = 195
def VERSION_NAME = "2.13.7"
android {
ndkVersion rootProject.ext.ndkVersion
@@ -317,11 +317,14 @@ dependencies {
implementation "com.github.anrwatchdog:anrwatchdog:1.4.0"
implementation 'com.google.android.gms:play-services-location:21.3.0'
implementation 'com.navi.android:alfred:1.1.1'
implementation 'com.navi.android:alfred:1.15.0-20240905.065147-1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
implementation(platform("com.google.firebase:firebase-bom:32.2.3"))
implementation("com.google.firebase:firebase-config-ktx")
implementation("com.google.firebase:firebase-analytics-ktx")
implementation 'androidx.core:core-splashscreen:1.0.1'
implementation 'com.navi.android:pulse:1.0.1-cosmos'
//noinspection GradleDynamicVersion
implementation "com.facebook.react:react-native:+" // From node_modules

View File

@@ -30,7 +30,6 @@
<uses-permission android:name="android.permission.POST_NOTIFICATION" />
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
<uses-permission android:name="android.permission.READ_MEDIA_VIDEO" />
<uses-permission android:name="android.permission.READ_MEDIA_AUDIO" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES"

View File

@@ -0,0 +1,29 @@
package com.avapp;
import android.util.Log;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.navi.alfred.network.AlfredApiLogsProvider;
import com.navi.pulse.PulseManager;
import java.util.HashMap;
import java.util.Map;
import okhttp3.Request;
import okhttp3.Response;
public class AlfredApiLogsProviderImpl implements AlfredApiLogsProvider {
@Override
public void sendApiLog(@NonNull Request request, @NonNull Response response, @Nullable Exception e) {
Map<String, String> alfredEventProperties = new HashMap<>();
alfredEventProperties.put("requestUrl", String.valueOf(request.url()));
alfredEventProperties.put("isSuccess", String.valueOf(response.isSuccessful()));
alfredEventProperties.put("message", response.message());
if (e != null) {
alfredEventProperties.put("exception", String.valueOf(e.getMessage()));
}
PulseManager.INSTANCE.trackEvent("FA_ALFRED_EVENT_API", alfredEventProperties);
}
}

View File

@@ -22,6 +22,7 @@ import com.facebook.react.bridge.ReactContextBaseJavaModule;
import com.facebook.react.bridge.ReactMethod;
import com.facebook.react.uimanager.UIManagerModule;
import com.navi.alfred.AlfredManager;
import com.navi.pulse.PulseManager;
import android.content.pm.PackageInfo;
import android.os.Environment;
@@ -148,6 +149,7 @@ public class DeviceUtilsModule extends ReactContextBaseJavaModule {
if (isAlfredEnabledFromFirebase) {
AlfredManager.INSTANCE.getConfig$navi_alfred_release().setUserId(userId);
}
PulseManager.INSTANCE.setUserId(userId);
}
@ReactMethod

View File

@@ -124,12 +124,11 @@ public class MainActivity extends ReactActivity implements AlfredFirebaseHelper
public void startAlfredRecording() {
if (AlfredManager.INSTANCE.isAlfredRecordingEnabled() && !hasAlfredRecordingStarted) {
try {
AlfredManager.INSTANCE.startRecording(
AlfredManager.INSTANCE.onActivityResumed(
BuildConfig.APP_NAME,
BuildConfig.APP_NAME,
this,
this.getWindow().getDecorView().getRootView(),
BuildConfig.APP_NAME,
BuildConfig.APP_NAME,
this
this.getApplicationContext()
);
hasAlfredRecordingStarted = true;
} catch (Exception e) {

View File

@@ -31,6 +31,9 @@ import com.github.anrwatchdog.ANRWatchDog;
import com.microsoft.codepush.react.CodePush;
import com.navi.alfred.AlfredConfig;
import com.navi.alfred.AlfredManager;
import com.navi.alfred.network.AlfredApiLogsManager;
import com.navi.pulse.PulseManager;
import com.navi.pulse.PulseSDKConfig;
import android.database.CursorWindow;
@@ -84,6 +87,12 @@ public class MainApplication extends Application implements ReactApplication {
}
}
public String getDestinationUrl(String buildFlavor) {
return "prod".equals(buildFlavor)
? "https://janus.prod.navi-tech.in/"
: "https://dev-janus.np.navi-tech.in/";
}
@Override
public void onCreate() {
super.onCreate();
@@ -95,7 +104,19 @@ public class MainApplication extends Application implements ReactApplication {
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);
alfredConfig.enablePixelCopy(false);
AlfredManager.INSTANCE.init(alfredConfig, this, 27, "Critical Journey is active");
AlfredApiLogsManager.INSTANCE.init(new AlfredApiLogsProviderImpl());
PulseSDKConfig.Configuration pulseConfig =
new PulseSDKConfig.Configuration.Builder()
.setAppName("collections-agent-app")
.setAppVersion(String.valueOf(BuildConfig.VERSION_CODE))
.setAppVersionName(BuildConfig.VERSION_NAME)
.setDestinationUrl(getDestinationUrl(BuildConfig.BUILD_FLAVOR))
.setEventBatchSize(10)
.setEventInterval(2000)
.build();
PulseManager.INSTANCE.init(pulseConfig, this, null, false);
setupAlfredANRWatchDog(alfredConfig);
setupAlfredCrashReporting(alfredConfig);
@@ -103,7 +124,7 @@ public class MainApplication extends Application implements ReactApplication {
try {
Field field = CursorWindow.class.getDeclaredField("sCursorWindowSize");
field.setAccessible(true);
field.set(null, 20 * 1024 * 1024); // 20MB
field.set(null, 40 * 1024 * 1024); // 40MB
} catch (Exception e) {
if (BuildConfig.DEBUG) {
e.printStackTrace();
@@ -155,8 +176,11 @@ public class MainApplication extends Application implements ReactApplication {
anrEventProperties.put(APP_IN_FOREGROUND, MainActivity.isAppInForeground().toString());
if (isAlfredEnabledFromFirebase && AlfredManager.INSTANCE.isAlfredRecordingEnabled()
&& alfredConfig.getAnrEnableStatus()) {
&& alfredConfig.getAnrEnableStatus() && MainActivity.isAppInForeground()) {
anrEventProperties.put(STACK_TRACE, error.getCause().getStackTrace()[0].toString());
if("release".equals(BuildConfig.BUILD_TYPE)) {
PulseManager.INSTANCE.trackEvent("COSMOS_ANR", anrEventProperties);
}
AlfredManager.INSTANCE.handleAnrEvent(anrEventProperties);
}
}).start();
@@ -179,11 +203,14 @@ public class MainApplication extends Application implements ReactApplication {
crashEventProperties.put(APP_IN_FOREGROUND, MainActivity.isAppInForeground().toString());
if (isAlfredEnabledFromFirebase && AlfredManager.INSTANCE.isAlfredRecordingEnabled()
&& alfredConfig.getCrashEnableStatus()) {
&& alfredConfig.getCrashEnableStatus() && MainActivity.isAppInForeground()) {
StackTraceElement stackTraceElement = exception.getStackTrace()[0];
if (stackTraceElement != null) {
crashEventProperties.put(STACK_TRACE, stackTraceElement.toString());
}
if("release".equals(BuildConfig.BUILD_TYPE)) {
PulseManager.INSTANCE.trackEvent("COSMOS_CRASH", crashEventProperties);
}
AlfredManager.INSTANCE.handleCrashEvent(crashEventProperties);
}
} finally {