Skip to content

Commit bbe4e19

Browse files
Add ibgSleep for Android
1 parent 1e4a03f commit bbe4e19

File tree

3 files changed

+38
-0
lines changed

3 files changed

+38
-0
lines changed

android/src/main/java/com/instabug/reactlibrary/RNInstabugAPMModule.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
import android.os.Handler;
55
import android.os.Looper;
6+
import android.os.SystemClock;
67

78
import com.facebook.react.bridge.Callback;
89
import com.facebook.react.bridge.ReactApplicationContext;
@@ -33,6 +34,21 @@ public String getName() {
3334
return "IBGAPM";
3435
}
3536

37+
/**
38+
* Sets the printed logs priority. Filter to one of the following levels.
39+
*
40+
* @param logLevel the priority level.
41+
*/
42+
@ReactMethod
43+
public void ibgSleep() {
44+
MainThreadHandler.runOnMainThread(new Runnable() {
45+
@Override
46+
public void run() {
47+
SystemClock.sleep(3000);
48+
}
49+
});
50+
}
51+
3652
/**
3753
* Sets the printed logs priority. Filter to one of the following levels.
3854
*

ios/RNInstabug/InstabugAPMBridge.m

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,21 @@ - (id) init
3535
return self;
3636
}
3737

38+
RCT_EXPORT_METHOD(ibgSleep) {
39+
[NSThread sleepForTimeInterval:3.0f];
40+
// for (int i = 1; i <= 1000000; i++)
41+
// {
42+
// double value = sqrt(i);
43+
44+
// printf("%@", [NSNumber numberWithDouble:value]);
45+
// }
46+
// [NSThread sleepForTimeInterval:3.0f];
47+
}
48+
49+
RCT_EXPORT_METHOD(setLogLevel:(IBGLogLevel)_logLevel) {
50+
IBGAPM.logLevel = _logLevel;
51+
}
52+
3853
RCT_EXPORT_METHOD(setEnabled:(BOOL)isEnabled) {
3954
IBGAPM.enabled = isEnabled;
4055
}

modules/APM.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,4 +100,11 @@ export default {
100100
endUITrace() {
101101
IBGAPM.endUITrace();
102102
},
103+
104+
/**
105+
* Used for internal testing.
106+
*/
107+
_ibgSleep() {
108+
IBGAPM.ibgSleep();
109+
}
103110
};

0 commit comments

Comments
 (0)