@@ -1131,42 +1131,74 @@ public void run() {
1131
1131
});
1132
1132
}
1133
1133
1134
- public void apmNetworkLogByReflection (HashMap <String , Object > jsonObject ) throws JSONException {
1135
- APMNetworkLogger apmNetworkLogger = new APMNetworkLogger ();
1136
- final String requestUrl = (String ) jsonObject .get ("url" );
1137
- final String requestBody = (String ) jsonObject .get ("requestBody" );
1138
- final String responseBody = (String ) jsonObject .get ("responseBody" );
1139
- final String requestMethod = (String ) jsonObject .get ("method" );
1140
- //--------------------------------------------
1141
- final String requestContentType = (String ) jsonObject .get ("contentType" );
1142
- final String responseContentType = (String ) jsonObject .get ("responseContentType" );
1143
- //--------------------------------------------
1144
- final String errorDomain = (String ) jsonObject .get ("errorDomain" );
1145
- final Integer statusCode = (Integer ) jsonObject .get ("responseCode" );
1146
- final long requestDuration = ((Number ) jsonObject .get ("duration" )).longValue () / 1000 ;
1147
- final long requestStartTime = ((Number ) jsonObject .get ("startTime" )).longValue () * 1000 ;
1148
- final String requestHeaders = (new JSONObject ((HashMap <String , String >) jsonObject .get ("requestHeaders" ))).toString (4 );
1149
- final String responseHeaders = (new JSONObject ((HashMap <String , String >) jsonObject .get ("responseHeaders" ))).toString (4 );
1150
- final String errorMessage ;
1151
-
1152
- if (errorDomain .equals ("" )) {
1153
- errorMessage = null ;
1154
- } else {
1155
- errorMessage = errorDomain ;
1156
- }
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
+ }
1157
1149
1150
+ public void apmNetworkLogByReflection (HashMap <String , Object > jsonObject ) throws JSONException {
1158
1151
try {
1159
- Method method = getMethod (Class .forName ("com.instabug.apm.networking.APMNetworkLogger" ), "log" , long .class , long .class , String .class , String .class , String .class , String .class , String .class , String .class , String .class , int .class , String .class , String .class );
1160
- if (method != null ) {
1161
- method .invoke (apmNetworkLogger , requestStartTime , requestDuration , requestHeaders , requestBody , requestMethod , requestUrl , requestContentType , responseHeaders , responseBody , statusCode , responseContentType , errorMessage );
1152
+ APMNetworkLogger apmNetworkLogger = new APMNetworkLogger ();
1153
+ final String requestUrl = (String ) jsonObject .get ("url" );
1154
+ final String requestBody = (String ) jsonObject .get ("requestBody" );
1155
+ final String responseBody = (String ) jsonObject .get ("responseBody" );
1156
+ final String requestMethod = (String ) jsonObject .get ("method" );
1157
+ //--------------------------------------------
1158
+ final String requestContentType = (String ) jsonObject .get ("requestContentType" );
1159
+ final String responseContentType = (String ) jsonObject .get ("responseContentType" );
1160
+ //--------------------------------------------
1161
+ final long requestBodySize = ((Number ) jsonObject .get ("requestBodySize" )).longValue ();
1162
+ final long responseBodySize = ((Number ) jsonObject .get ("responseBodySize" )).longValue ();
1163
+ //--------------------------------------------
1164
+ final String errorDomain = (String ) jsonObject .get ("errorDomain" );
1165
+ final Integer statusCode = (Integer ) jsonObject .get ("responseCode" );
1166
+ final long requestDuration = ((Number ) jsonObject .get ("duration" )).longValue () / 1000 ;
1167
+ final long requestStartTime = ((Number ) jsonObject .get ("startTime" )).longValue () * 1000 ;
1168
+ final String requestHeaders = (new JSONObject ((HashMap <String , String >) jsonObject .get ("requestHeaders" ))).toString (4 );
1169
+ final String responseHeaders = (new JSONObject ((HashMap <String , String >) jsonObject .get ("responseHeaders" ))).toString (4 );
1170
+ final String errorMessage ;
1171
+
1172
+ if (errorDomain .equals ("" )) {
1173
+ errorMessage = null ;
1162
1174
} else {
1163
- Log . e ( "IB-CP-Bridge" , "apmNetworkLogByReflection was not found by reflection" ) ;
1175
+ errorMessage = errorDomain ;
1164
1176
}
1165
- } catch (ClassNotFoundException e ) {
1166
- e .printStackTrace ();
1167
- } catch (IllegalAccessException e ) {
1168
- e .printStackTrace ();
1169
- } catch (InvocationTargetException e ) {
1177
+ //--------------------------------------------------
1178
+ String gqlQueryName = null ;
1179
+ if (jsonObject .containsKey ("gqlQueryName" )){
1180
+ gqlQueryName = (String ) jsonObject .get ("gqlQueryName" );
1181
+ }
1182
+ String serverErrorMessage = "" ;
1183
+ if (jsonObject .containsKey ("serverErrorMessage" )){
1184
+ serverErrorMessage = (String ) jsonObject .get ("serverErrorMessage" );
1185
+ }
1186
+
1187
+ try {
1188
+ Method method = getMethod (Class .forName ("com.instabug.apm.networking.APMNetworkLogger" ), "log" , long .class , long .class , String .class , String .class , long .class , String .class , String .class , String .class , String .class , String .class , long .class , int .class , String .class , String .class , String .class , String .class );
1189
+ if (method != null ) {
1190
+ method .invoke (apmNetworkLogger , requestStartTime , requestDuration , requestHeaders , requestBody , requestBodySize , requestMethod , requestUrl , requestContentType , responseHeaders , responseBody , responseBodySize , statusCode , responseContentType , errorMessage , gqlQueryName , serverErrorMessage );
1191
+ } else {
1192
+ Log .e ("IB-CP-Bridge" , "apmNetworkLogByReflection was not found by reflection" );
1193
+ }
1194
+ } catch (ClassNotFoundException e ) {
1195
+ e .printStackTrace ();
1196
+ } catch (IllegalAccessException e ) {
1197
+ e .printStackTrace ();
1198
+ } catch (InvocationTargetException e ) {
1199
+ e .printStackTrace ();
1200
+ }
1201
+ } catch (Exception e ) {
1170
1202
e .printStackTrace ();
1171
1203
}
1172
1204
0 commit comments