Skip to content

Commit 089e5ce

Browse files
author
Ali Abdelfattah
authored
Merge pull request #207 from Instabug/feature/end-app-launch
[MOB-6472] Add APM.endAppLaunch API
2 parents 32346ce + d693f8a commit 089e5ce

File tree

6 files changed

+44
-0
lines changed

6 files changed

+44
-0
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
2+
## master
3+
4+
* Adds APM.endAppLaunch API
5+
16
## v10.9.1 (2021-10-13)
27

38
* Bumps Instabug Android SDK to v10.9.1

android/src/main/java/com/instabug/instabugflutter/InstabugFlutterPlugin.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1131,6 +1131,22 @@ public void run() {
11311131
});
11321132
}
11331133

1134+
/**
1135+
* Ends app launch
1136+
*/
1137+
public void endAppLaunch() {
1138+
new Handler(Looper.getMainLooper()).post(new Runnable() {
1139+
@Override
1140+
public void run() {
1141+
try {
1142+
APM.endAppLaunch();
1143+
} catch (Exception e) {
1144+
e.printStackTrace();
1145+
}
1146+
}
1147+
});
1148+
}
1149+
11341150
public void apmNetworkLogByReflection(HashMap<String, Object> jsonObject) throws JSONException {
11351151
APMNetworkLogger apmNetworkLogger = new APMNetworkLogger();
11361152
final String requestUrl = (String) jsonObject.get("url");

ios/Classes/InstabugFlutterPlugin.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -493,4 +493,10 @@
493493
*/
494494
+ (void)endUITrace;
495495

496+
/**
497+
* Ends the current session’s App Launch. Calling this API is optional, App Launches will still be captured and ended automatically by the SDK;
498+
* this API just allows you to change when an App Launch actually ends.
499+
*/
500+
+ (void)endAppLaunch;
501+
496502
@end

ios/Classes/InstabugFlutterPlugin.m

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -934,6 +934,13 @@ + (void)endUITrace {
934934
[IBGAPM endUITrace];
935935
}
936936

937+
/**
938+
* Ends app launch.
939+
*/
940+
+ (void)endAppLaunch {
941+
[IBGAPM endAppLaunch];
942+
}
943+
937944
/** Reports that the screen has been changed (Repro Steps) the screen sent to this method will be the 'current view' on the dashboard
938945
*
939946
* @param screenName string containing the screen name

lib/APM.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,10 @@ class APM {
113113
static void endUITrace() async {
114114
await _channel.invokeMethod<Object>('endUITrace');
115115
}
116+
/// Ends UI trace.
117+
static void endAppLaunch() async {
118+
await _channel.invokeMethod<Object>('endAppLaunch');
119+
}
116120

117121
static Future<bool?> networkLogAndroid(NetworkData data) async {
118122
if (Platform.isAndroid) {

test/instabug_flutter_test.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1102,4 +1102,10 @@ void main() {
11021102
APM.endUITrace();
11031103
expect(log, <Matcher>[isMethodCall('endUITrace', arguments: null)]);
11041104
});
1105+
1106+
test('endAppLaunch: Test', () async {
1107+
final List<dynamic> args = <dynamic>[null];
1108+
APM.endAppLaunch();
1109+
expect(log, <Matcher>[isMethodCall('endAppLaunch', arguments: null)]);
1110+
});
11051111
}

0 commit comments

Comments
 (0)