Skip to content

Commit 35a0c5a

Browse files
chore: fix ci failed jobs
1 parent 21cc57b commit 35a0c5a

File tree

8 files changed

+21
-24
lines changed

8 files changed

+21
-24
lines changed

example/lib/src/components/animated_box.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class _AnimatedBoxState extends State<AnimatedBox>
1616
void initState() {
1717
super.initState();
1818
_controller = AnimationController(
19-
duration: const Duration(minutes: 1 , seconds: 40),
19+
duration: const Duration(minutes: 1, seconds: 40),
2020
vsync: this,
2121
);
2222
_animation = Tween<double>(begin: 0, end: 100).animate(_controller)

example/lib/src/components/ui_traces_content.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ class _UITracesContentState extends State<UITracesContent> {
4949
),
5050
],
5151
),
52-
5352
],
5453
);
5554
}

lib/src/models/InstabugFrameData.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class InstabugFrameData {
88
String toString() => "start time: $startTimeTimestamp, duration: $duration";
99

1010
@override
11-
bool operator == (covariant InstabugFrameData other) {
11+
bool operator ==(covariant InstabugFrameData other) {
1212
if (identical(this, other)) return true;
1313
return startTimeTimestamp == other.startTimeTimestamp &&
1414
duration == other.duration;

lib/src/models/InstabugScreenRenderData.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,4 @@ class InstabugScreenRenderData {
3939
frozenFramesTotalDuration == other.frozenFramesTotalDuration &&
4040
listEquals(frameData, other.frameData);
4141
}
42-
43-
4442
}

lib/src/modules/apm.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,8 @@ class APM {
195195
(_) async {
196196
// Start screen render collector for custom ui trace if enabled.
197197
if (await FlagsConfig.screenRendering.isEnabled()) {
198-
InstabugScreenRenderManager.I.startScreenRenderCollectorForTraceId(0 ,UiTraceType.custom);
198+
InstabugScreenRenderManager.I
199+
.startScreenRenderCollectorForTraceId(0, UiTraceType.custom);
199200
}
200201
},
201202
);
@@ -377,7 +378,7 @@ class APM {
377378
/// Returns:
378379
/// A Future<double> that represent the refresh rate.
379380
@internal
380-
static Future<double> getDeviceRefreshRate(){
381+
static Future<double> getDeviceRefreshRate() {
381382
return _host.deviceRefreshRate();
382383
}
383384
}

lib/src/utils/screen_rendering/instabug_screen_render_manager.dart

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,11 @@ class InstabugScreenRenderManager {
5555

5656
/// setup function for [InstabugScreenRenderManager]
5757
@internal
58-
void init(WidgetsBinding widgetBinding, [double? refreshRate]) {
58+
Future<void> init(WidgetsBinding widgetBinding) async {
5959
if (!_isTimingsListenerAttached) {
6060
_widgetsBinding = widgetBinding;
6161
_addWidgetBindingObserver();
62-
_initStaticValues(refreshRate);
62+
await _initStaticValues();
6363
_initFrameTimings();
6464
screenRenderEnabled = true;
6565
}
@@ -145,8 +145,8 @@ class InstabugScreenRenderManager {
145145
/// On iOS, it will only contains the main display on the phone or tablet.
146146
/// On Desktop, it will contain only a main display with a valid refresh rate but invalid size and device pixel ratio values.
147147
//todo: will be compared with value from native side after it's implemented.
148-
double get _getDeviceRefreshRate =>
149-
_widgetsBinding.platformDispatcher.displays.first.refreshRate;
148+
// double get _getDeviceRefreshRate =>
149+
// _widgetsBinding.platformDispatcher.displays.first.refreshRate;
150150

151151
/// Get device refresh rate from native side.
152152
//todo: will be compared with value from native side after it's implemented.
@@ -155,13 +155,13 @@ class InstabugScreenRenderManager {
155155
APM.getDeviceRefreshRate();
156156

157157
/// Initialize the static variables
158-
void _initStaticValues(double? refreshRate) {
158+
Future<void> _initStaticValues() async {
159159
_timingsCallback = (timings) {
160160
for (final frameTiming in timings) {
161161
analyzeFrameTiming(frameTiming);
162162
}
163163
};
164-
_deviceRefreshRate = refreshRate ?? _getDeviceRefreshRate;
164+
_deviceRefreshRate = await _getDeviceRefreshRateFromNative;
165165
_slowFrameThresholdMs = _targetMsPerFrame(_deviceRefreshRate);
166166
_screenRenderForAutoUiTrace = InstabugScreenRenderData(frameData: []);
167167
_screenRenderForCustomUiTrace = InstabugScreenRenderData(frameData: []);

lib/src/utils/screen_rendering/instabug_widget_binding_observer.dart

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,15 @@ class InstabugWidgetsBindingObserver extends WidgetsBindingObserver {
6060
case AppLifecycleState.detached:
6161
_handleDetachedState();
6262
break;
63-
case AppLifecycleState.inactive:
64-
// TODO: Handle this case.
65-
break;
66-
case AppLifecycleState.hidden:
67-
// TODO: Handle this case.
68-
break;
63+
default:
64+
_handleDefaultState();
6965
}
7066
}
67+
68+
void _handleDefaultState() {
69+
//todo: will be removed
70+
debugPrint("default");
71+
}
7172
}
7273

7374
@internal

test/utils/screen_render/instabug_screen_render_manager_test.dart

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,14 @@ void main() {
1919
late InstabugScreenRenderManager manager;
2020
late MockApmHostApi mApmHost;
2121
late MockWidgetsBinding mWidgetBinding;
22-
const mRefreshRate = 60.0;
2322

2423
setUp(() async {
2524
mApmHost = MockApmHostApi();
2625
mWidgetBinding = MockWidgetsBinding();
2726
manager = InstabugScreenRenderManager.init(); // test-only constructor
2827
APM.$setHostApi(mApmHost);
29-
30-
manager.init(mWidgetBinding, mRefreshRate);
28+
when(mApmHost.deviceRefreshRate()).thenAnswer((_) async => 60);
29+
manager.init(mWidgetBinding);
3130
});
3231

3332
tearDown(() {
@@ -44,10 +43,9 @@ void main() {
4443
});
4544

4645
test('calling init more that one time should do nothing', () async {
47-
manager.init(mWidgetBinding, mRefreshRate);
46+
manager.init(mWidgetBinding);
4847
manager.init(
4948
mWidgetBinding,
50-
mRefreshRate,
5149
); // second call should be ignored
5250

5351
verify(mWidgetBinding.addObserver(any)).called(1);

0 commit comments

Comments
 (0)