Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ 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.UiThreadUtil

import com.expensify.chat.MainActivity

Expand All @@ -25,4 +26,14 @@ class AppStateTrackerModule(reactContext: ReactApplicationContext) : ReactContex
promise.resolve(false)
}
}

/**
* Tells Android that NewDot finished its first screen, which records time to full display for this launch.
*/
@ReactMethod
fun reportFullyDrawn() {
UiThreadUtil.runOnUiThread {
reactApplicationContext.getCurrentActivity()?.reportFullyDrawn()
}
}
}
2 changes: 2 additions & 0 deletions src/Expensify.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import PushNotification from './libs/Notification/PushNotification';
import {endSpan, getSpan, startSpan} from './libs/telemetry/activeSpans';
import {startBootsplashMonitor} from './libs/telemetry/bootsplashTelemetry';
import {scheduleInitialDatabaseSizeMeasurement} from './libs/telemetry/databaseSizeTracker';
import reportFullyDrawn from './libs/telemetry/reportFullyDrawn';
import {cleanupTelemetryTrackers, initializeTelemetryTrackers} from './libs/telemetry/TelemetrySynchronizer';
import Visibility from './libs/Visibility';
import ONYXKEYS from './ONYXKEYS';
Expand Down Expand Up @@ -209,6 +210,7 @@ function Expensify() {
setSplashScreenState(CONST.BOOT_SPLASH_STATE.HIDDEN);
endSpan(CONST.TELEMETRY.SPAN_OD_ND_TRANSITION);
endSpan(CONST.TELEMETRY.SPAN_APP_STARTUP);
reportFullyDrawn();
endSpan(CONST.TELEMETRY.SPAN_BOOTSPLASH.ROOT);
endSpan(CONST.TELEMETRY.SPAN_BOOTSPLASH.SPLASH_HIDER);
scheduleInitialDatabaseSizeMeasurement();
Expand Down
9 changes: 9 additions & 0 deletions src/libs/telemetry/reportFullyDrawn/index.android.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import {NativeModules} from 'react-native';

import type ReportFullyDrawn from './types';

const reportFullyDrawn: ReportFullyDrawn = () => {
NativeModules.AppStateTracker.reportFullyDrawn?.();
};

export default reportFullyDrawn;
6 changes: 6 additions & 0 deletions src/libs/telemetry/reportFullyDrawn/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import type ReportFullyDrawn from './types';

// Time to full display is an Android startup metric, so the other platforms have nothing to report.
const reportFullyDrawn: ReportFullyDrawn = () => {};

export default reportFullyDrawn;
3 changes: 3 additions & 0 deletions src/libs/telemetry/reportFullyDrawn/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
type ReportFullyDrawn = () => void;

export default ReportFullyDrawn;
2 changes: 2 additions & 0 deletions src/types/modules/react-native.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import type {TargetedEvent} from 'react-native';

type AppStateTrackerModule = {
getWasAppRelaunchedFromIcon: () => Promise<boolean>;
// Missing on binaries built before this method was added.
reportFullyDrawn?: () => void;
};

type RNTextInputResetModule = {
Expand Down
Loading