Skip to content

Commit

Permalink
Update naming
Browse files Browse the repository at this point in the history
  • Loading branch information
buenaflor committed Apr 24, 2024
1 parent b401ed0 commit c06973c
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ class SentryFlutterPlugin : FlutterPlugin, MethodCallHandler, ActivityAware {

private var activity: WeakReference<Activity>? = null
private var framesTracker: ActivityFramesTracker? = null
private var engineEndTime: Long? = null
private var engineReadyEndtime: Long? = null

override fun onAttachedToEngine(flutterPluginBinding: FlutterPlugin.FlutterPluginBinding) {
engineEndTime = System.currentTimeMillis()
engineReadyEndtime = System.currentTimeMillis()

context = flutterPluginBinding.applicationContext
channel = MethodChannel(flutterPluginBinding.binaryMessenger, "sentry_flutter")
Expand Down Expand Up @@ -149,7 +149,7 @@ class SentryFlutterPlugin : FlutterPlugin, MethodCallHandler, ActivityAware {
}

private fun fetchEngineReadyEndtime(result: Result) {
result.success(engineEndTime)
result.success(engineReadyEndtime)
}

private fun beginNativeFrames(result: Result) {
Expand Down
6 changes: 3 additions & 3 deletions flutter/ios/Classes/SentryFlutterPluginApple.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ public class SentryFlutterPluginApple: NSObject, FlutterPlugin {
#endif
}

private static var engineEndtime: Int64 = 0
private static var engineReadyEndtime: Int64 = 0

public static func register(with registrar: FlutterPluginRegistrar) {
let currentDate = Date()
let timeInterval = currentDate.timeIntervalSince1970
engineEndtime = Int64(timeInterval * 1000)
engineReadyEndtime = Int64(timeInterval * 1000)

#if os(iOS)
let channel = FlutterMethodChannel(name: "sentry_flutter", binaryMessenger: registrar.messenger())
Expand Down Expand Up @@ -86,7 +86,7 @@ public class SentryFlutterPluginApple: NSObject, FlutterPlugin {
}

private func fetchEngineReadyEndtime(result: @escaping FlutterResult) {
result(SentryFlutterPluginApple.engineEndtime)
result(SentryFlutterPluginApple.engineReadyEndtime)
}

// swiftlint:disable:next cyclomatic_complexity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,20 +71,20 @@ class NativeAppStartIntegration extends Integration<SentryFlutterOptions> {
_native.appStartEnd ??= options.clock();
final appStartEnd = _native.appStartEnd;
final nativeAppStart = await _native.fetchNativeAppStart();
final engineEndtime = await _native.fetchEngineReadyEndtime();
final engineReadyEndtime = await _native.fetchEngineReadyEndtime();
final dartLoadingEnd = SentryFlutter.dartLoadingEnd;

if (nativeAppStart == null ||
appStartEnd == null ||
engineEndtime == null) {
engineReadyEndtime == null) {
return;
}

final appStartDateTime = DateTime.fromMillisecondsSinceEpoch(
nativeAppStart.appStartTime.toInt());
final duration = appStartEnd.difference(appStartDateTime);
final engineEndDatetime =
DateTime.fromMillisecondsSinceEpoch(engineEndtime);
DateTime.fromMillisecondsSinceEpoch(engineReadyEndtime);

// We filter out app start more than 60s.
// This could be due to many different reasons.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,10 +195,10 @@ void main() {
});

test('have correct endTimestamp', () async {
final engineEndtime = await fixture.native.fetchEngineReadyEndtime();
final engineReadyEndtime = await fixture.native.fetchEngineReadyEndtime();
expect(coldStartSpan?.endTimestamp, fixture.native.appStartEnd?.toUtc());
expect(engineReadySpan?.endTimestamp,
DateTime.fromMillisecondsSinceEpoch(engineEndtime!).toUtc());
DateTime.fromMillisecondsSinceEpoch(engineReadyEndtime!).toUtc());
expect(dartIsolateLoadingSpan?.endTimestamp,
SentryFlutter.dartLoadingEnd.toUtc());
expect(firstFrameRenderSpan?.endTimestamp, coldStartSpan?.endTimestamp);
Expand Down

0 comments on commit c06973c

Please sign in to comment.