@imatis/react-native-notifications 4.3.1-imatis.24 → 4.3.1-imatis.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/android/app/src/main/AndroidManifest.xml +1 -0
- package/lib/android/app/src/main/java/com/wix/reactnativenotifications/core/JsIOHelper.java +4 -0
- package/lib/android/app/src/main/java/com/wix/reactnativenotifications/core/notification/PushNotification.java +16 -2
- package/lib/android/app/src/main/java/com/wix/reactnativenotifications/core/notification/PushNotificationProps.java +8 -0
- package/lib/android/app/src/test/java/com/wix/reactnativenotifications/core/AppLaunchHelperTest.java +117 -0
- package/lib/android/app/src/test/java/com/wix/reactnativenotifications/core/InitialNotificationHolderTest.java +59 -0
- package/lib/android/app/src/test/java/com/wix/reactnativenotifications/core/JsIOHelperTest.java +60 -0
- package/lib/android/app/src/test/java/com/wix/reactnativenotifications/core/notification/PushNotificationTest.java +381 -0
- package/lib/android/app/src/test/java/com/wix/reactnativenotifications/core/notificationdrawer/PushNotificationsDrawerTest.java +96 -0
- package/lib/android/app/src/test/resources/robolectric.properties +1 -0
- package/package.json +2 -2
- package/android/app/src/reactNative59/reactNative59.iml +0 -11
- package/android/app/src/reactNative60/reactNative60.iml +0 -11
- package/lib/android/.gradle/6.1.1/executionHistory/executionHistory.lock +0 -0
- package/lib/android/.gradle/6.1.1/fileChanges/last-build.bin +0 -0
- package/lib/android/.gradle/6.1.1/fileHashes/fileHashes.bin +0 -0
- package/lib/android/.gradle/6.1.1/fileHashes/fileHashes.lock +0 -0
- package/lib/android/.gradle/6.1.1/gc.properties +0 -0
- package/lib/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/lib/android/.gradle/buildOutputCleanup/cache.properties +0 -2
- package/lib/android/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
- package/lib/android/.gradle/checksums/checksums.lock +0 -0
- package/lib/android/.gradle/checksums/md5-checksums.bin +0 -0
- package/lib/android/.gradle/checksums/sha1-checksums.bin +0 -0
- package/lib/android/.gradle/vcs-1/gc.properties +0 -0
- package/lib/android/local.properties +0 -8
- package/lib/dist/DTO/Notification.d.ts +0 -11
- package/lib/dist/DTO/Notification.js +0 -28
- package/lib/dist/DTO/Notification.test.d.ts +0 -1
- package/lib/dist/DTO/Notification.test.js +0 -52
- package/lib/dist/DTO/NotificationAndroid.d.ts +0 -7
- package/lib/dist/DTO/NotificationAndroid.js +0 -20
- package/lib/dist/DTO/NotificationAndroid.test.d.ts +0 -1
- package/lib/dist/DTO/NotificationAndroid.test.js +0 -25
- package/lib/dist/DTO/NotificationFactory.d.ts +0 -4
- package/lib/dist/DTO/NotificationFactory.js +0 -18
- package/lib/dist/DTO/NotificationIOS.d.ts +0 -12
- package/lib/dist/DTO/NotificationIOS.js +0 -40
- package/lib/dist/DTO/NotificationIOS.test.d.ts +0 -1
- package/lib/dist/DTO/NotificationIOS.test.js +0 -58
- package/lib/dist/Notifications.d.ts +0 -65
- package/lib/dist/Notifications.js +0 -98
- package/lib/dist/NotificationsAndroid.d.ts +0 -14
- package/lib/dist/NotificationsAndroid.js +0 -32
- package/lib/dist/NotificationsIOS.d.ts +0 -51
- package/lib/dist/NotificationsIOS.js +0 -83
- package/lib/dist/adapters/CompletionCallbackWrapper.d.ts +0 -11
- package/lib/dist/adapters/CompletionCallbackWrapper.js +0 -44
- package/lib/dist/adapters/NativeCommandsSender.d.ts +0 -31
- package/lib/dist/adapters/NativeCommandsSender.js +0 -73
- package/lib/dist/adapters/NativeCommandsSender.mock.d.ts +0 -1
- package/lib/dist/adapters/NativeCommandsSender.mock.js +0 -4
- package/lib/dist/adapters/NativeEventsReceiver.d.ts +0 -19
- package/lib/dist/adapters/NativeEventsReceiver.js +0 -46
- package/lib/dist/adapters/NativeEventsReceiver.mock.d.ts +0 -1
- package/lib/dist/adapters/NativeEventsReceiver.mock.js +0 -4
- package/lib/dist/adapters/UniqueIdProvider.d.ts +0 -3
- package/lib/dist/adapters/UniqueIdProvider.js +0 -10
- package/lib/dist/commands/Commands.d.ts +0 -32
- package/lib/dist/commands/Commands.js +0 -79
- package/lib/dist/commands/Commands.test.d.ts +0 -1
- package/lib/dist/commands/Commands.test.js +0 -201
- package/lib/dist/events/EventsRegistry.d.ts +0 -18
- package/lib/dist/events/EventsRegistry.js +0 -28
- package/lib/dist/events/EventsRegistry.test.d.ts +0 -1
- package/lib/dist/events/EventsRegistry.test.js +0 -182
- package/lib/dist/events/EventsRegistryIOS.d.ts +0 -12
- package/lib/dist/events/EventsRegistryIOS.js +0 -19
- package/lib/dist/events/EventsRegistryIOS.test.d.ts +0 -1
- package/lib/dist/events/EventsRegistryIOS.test.js +0 -51
- package/lib/dist/index.d.ts +0 -7
- package/lib/dist/index.js +0 -12
- package/lib/dist/interfaces/EventSubscription.d.ts +0 -3
- package/lib/dist/interfaces/EventSubscription.js +0 -2
- package/lib/dist/interfaces/NotificationActionResponse.d.ts +0 -5
- package/lib/dist/interfaces/NotificationActionResponse.js +0 -10
- package/lib/dist/interfaces/NotificationCategory.d.ts +0 -18
- package/lib/dist/interfaces/NotificationCategory.js +0 -20
- package/lib/dist/interfaces/NotificationChannel.d.ts +0 -14
- package/lib/dist/interfaces/NotificationChannel.js +0 -2
- package/lib/dist/interfaces/NotificationCompletion.d.ts +0 -10
- package/lib/dist/interfaces/NotificationCompletion.js +0 -9
- package/lib/dist/interfaces/NotificationEvents.d.ts +0 -18
- package/lib/dist/interfaces/NotificationEvents.js +0 -2
- package/lib/dist/interfaces/NotificationPermissions.d.ts +0 -14
- package/lib/dist/interfaces/NotificationPermissions.js +0 -2
- package/lib/ios/RNNotifications.xcodeproj/project.xcworkspace/xcuserdata/troy.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/package-lock.json +0 -13507
|
@@ -17,6 +17,10 @@ public class JsIOHelper {
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
public boolean sendEventToJS(String eventName, WritableMap data, ReactContext reactContext) {
|
|
20
|
+
if(!reactContext.hasActiveCatalystInstance()) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
|
|
20
24
|
if (reactContext != null) {
|
|
21
25
|
reactContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class).emit(eventName, data);
|
|
22
26
|
return true;
|
|
@@ -15,6 +15,8 @@ import android.net.Uri;
|
|
|
15
15
|
import android.os.Build;
|
|
16
16
|
import android.os.Bundle;
|
|
17
17
|
import android.os.PowerManager;
|
|
18
|
+
import android.os.VibrationEffect;
|
|
19
|
+
import android.os.Vibrator;
|
|
18
20
|
import android.util.Log;
|
|
19
21
|
|
|
20
22
|
import com.facebook.react.bridge.ReactContext;
|
|
@@ -214,7 +216,7 @@ public class PushNotification implements IPushNotification {
|
|
|
214
216
|
Log.d(LOGTAG, e.getMessage());
|
|
215
217
|
}
|
|
216
218
|
|
|
217
|
-
if(mNotificationProps.getCriticalAlert()){
|
|
219
|
+
if(mNotificationProps.getCriticalAlert() || mNotificationProps.getOverridemute()){
|
|
218
220
|
try {
|
|
219
221
|
MediaPlayer mMediaPlayer = new MediaPlayer();
|
|
220
222
|
mMediaPlayer.setDataSource(mContext.getApplicationContext(), soundUri);
|
|
@@ -227,6 +229,18 @@ public class PushNotification implements IPushNotification {
|
|
|
227
229
|
mMediaPlayer.start();
|
|
228
230
|
}
|
|
229
231
|
});
|
|
232
|
+
|
|
233
|
+
Vibrator v = (Vibrator) mContext.getSystemService(Context.VIBRATOR_SERVICE);
|
|
234
|
+
// Vibrate with wave form
|
|
235
|
+
long[] timings = new long[] { 50, 50, 50, 50, 50, 100, 350, 25, 25, 25, 25, 200 };
|
|
236
|
+
int[] amplitudes = new int[] { 33, 51, 75, 113, 170, 255, 0, 38, 62, 100, 160, 255 };
|
|
237
|
+
int repeatIndex = -1; // Do not repeat.
|
|
238
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
|
239
|
+
v.vibrate(VibrationEffect.createWaveform(timings, amplitudes, repeatIndex));
|
|
240
|
+
} else {
|
|
241
|
+
//deprecated in API 26
|
|
242
|
+
v.vibrate(3000);
|
|
243
|
+
}
|
|
230
244
|
} catch (Exception e) {
|
|
231
245
|
Log.d(LOGTAG, e.getMessage());
|
|
232
246
|
}
|
|
@@ -248,7 +262,7 @@ public class PushNotification implements IPushNotification {
|
|
|
248
262
|
|
|
249
263
|
private void setUpIconColor(Notification.Builder notification) {
|
|
250
264
|
int colorResID = getAppResourceId("colorAccent", "color");
|
|
251
|
-
if (colorResID != 0
|
|
265
|
+
if (colorResID != 0) {
|
|
252
266
|
int color = mContext.getResources().getColor(colorResID);
|
|
253
267
|
notification.setColor(color);
|
|
254
268
|
}
|
|
@@ -58,6 +58,14 @@ public class PushNotificationProps {
|
|
|
58
58
|
return 0.0;
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
+
public Boolean getOverridemute() {
|
|
62
|
+
String val = mBundle.getString("overridemute");
|
|
63
|
+
if(val != null && !val.isEmpty()){
|
|
64
|
+
return val.toLowerCase().equals("true");
|
|
65
|
+
}
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
|
|
61
69
|
public Boolean getOngoing() {
|
|
62
70
|
return mBundle.getBoolean("ongoing");
|
|
63
71
|
}
|
package/lib/android/app/src/test/java/com/wix/reactnativenotifications/core/AppLaunchHelperTest.java
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
package com.wix.reactnativenotifications.core;
|
|
2
|
+
|
|
3
|
+
import android.app.Activity;
|
|
4
|
+
import android.content.ComponentName;
|
|
5
|
+
import android.content.Context;
|
|
6
|
+
import android.content.Intent;
|
|
7
|
+
import android.content.pm.PackageManager;
|
|
8
|
+
|
|
9
|
+
import org.junit.Before;
|
|
10
|
+
import org.junit.Test;
|
|
11
|
+
import org.junit.runner.RunWith;
|
|
12
|
+
import org.mockito.Mock;
|
|
13
|
+
import org.mockito.MockitoAnnotations;
|
|
14
|
+
import org.robolectric.RobolectricTestRunner;
|
|
15
|
+
|
|
16
|
+
import static org.junit.Assert.assertEquals;
|
|
17
|
+
import static org.junit.Assert.assertFalse;
|
|
18
|
+
import static org.junit.Assert.assertNotNull;
|
|
19
|
+
import static org.junit.Assert.assertTrue;
|
|
20
|
+
import static org.mockito.ArgumentMatchers.eq;
|
|
21
|
+
import static org.mockito.Mockito.mock;
|
|
22
|
+
import static org.mockito.Mockito.when;
|
|
23
|
+
|
|
24
|
+
@RunWith(RobolectricTestRunner.class)
|
|
25
|
+
public class AppLaunchHelperTest {
|
|
26
|
+
|
|
27
|
+
private static final String LAUNCHED_FROM_NOTIF_BOOLEAN_EXTRA_NAME = "launchedFromNotification";
|
|
28
|
+
|
|
29
|
+
static class ActivityMock extends Activity {
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
private final String APP_PACKAGE_NAME = "the.package";
|
|
33
|
+
private final String APP_MAIN_ACTIVITY_NAME = ActivityMock.class.getName();
|
|
34
|
+
|
|
35
|
+
@Mock private Context mContext;
|
|
36
|
+
@Mock private PackageManager mPackageManager;
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
@Before
|
|
40
|
+
public void setup() throws Exception {
|
|
41
|
+
MockitoAnnotations.initMocks(this);
|
|
42
|
+
when(mContext.getApplicationContext()).thenReturn(mContext);
|
|
43
|
+
when(mContext.getPackageManager()).thenReturn(mPackageManager);
|
|
44
|
+
when(mContext.getPackageName()).thenReturn(APP_PACKAGE_NAME);
|
|
45
|
+
|
|
46
|
+
// Set-up the intent (mock) returned by the SDK for getLaunchIntentForPackage()
|
|
47
|
+
Intent intent = mock(Intent.class);
|
|
48
|
+
when(intent.getComponent()).thenReturn(new ComponentName(APP_PACKAGE_NAME, APP_MAIN_ACTIVITY_NAME));
|
|
49
|
+
when(mPackageManager.getLaunchIntentForPackage(eq(APP_PACKAGE_NAME))).thenReturn(intent);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
@Test
|
|
53
|
+
public void getLaunchIntent__returnsCustomIntentWithNotifFlagExtra() throws Exception {
|
|
54
|
+
final AppLaunchHelper uut = getUUT();
|
|
55
|
+
Intent intent = uut.getLaunchIntent(mContext);
|
|
56
|
+
|
|
57
|
+
assertNotNull(intent);
|
|
58
|
+
assertEquals(APP_PACKAGE_NAME, intent.getComponent().getPackageName());
|
|
59
|
+
assertEquals(APP_MAIN_ACTIVITY_NAME, intent.getComponent().getClassName());
|
|
60
|
+
assertEquals(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED, intent.getFlags());
|
|
61
|
+
assertTrue(intent.getBooleanExtra(LAUNCHED_FROM_NOTIF_BOOLEAN_EXTRA_NAME, false));
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
@Test
|
|
65
|
+
public void isLaunchIntentsActivity_activityIsMainLauncherActivity_returnTrue() throws Exception {
|
|
66
|
+
Activity activity = getActivityMock(APP_MAIN_ACTIVITY_NAME);
|
|
67
|
+
|
|
68
|
+
final AppLaunchHelper uut = getUUT();
|
|
69
|
+
boolean result = uut.isLaunchIntentsActivity(activity);
|
|
70
|
+
|
|
71
|
+
assertTrue(result);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
@Test
|
|
75
|
+
public void isLaunchIntentsActivity_activityIsNotMainActivity_returnFalse() throws Exception {
|
|
76
|
+
Activity activity = getActivityMock("other.activity");
|
|
77
|
+
|
|
78
|
+
final AppLaunchHelper uut = getUUT();
|
|
79
|
+
boolean result = uut.isLaunchIntentsActivity(activity);
|
|
80
|
+
|
|
81
|
+
assertFalse(result);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
@Test
|
|
85
|
+
public void isLaunchIntentOfNotification_hasFlagInBundle_returnTrue() throws Exception {
|
|
86
|
+
Intent intent = mock(Intent.class);
|
|
87
|
+
when(intent.getBooleanExtra(eq(LAUNCHED_FROM_NOTIF_BOOLEAN_EXTRA_NAME), eq(false))).thenReturn(true);
|
|
88
|
+
|
|
89
|
+
final AppLaunchHelper uut = getUUT();
|
|
90
|
+
boolean result = uut.isLaunchIntentOfNotification(intent);
|
|
91
|
+
|
|
92
|
+
assertTrue(result);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
@Test
|
|
96
|
+
public void isLaunchIntentOfNotification_noFlagInBundle_returnFalse() throws Exception {
|
|
97
|
+
Intent intent = mock(Intent.class);
|
|
98
|
+
|
|
99
|
+
final AppLaunchHelper uut = getUUT();
|
|
100
|
+
boolean result = uut.isLaunchIntentOfNotification(intent);
|
|
101
|
+
|
|
102
|
+
assertFalse(result);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
protected Activity getActivityMock(String activityClassName) {
|
|
106
|
+
Activity activity = mock(Activity.class);
|
|
107
|
+
when(activity.getPackageManager()).thenReturn(mPackageManager);
|
|
108
|
+
when(activity.getPackageName()).thenReturn(APP_PACKAGE_NAME);
|
|
109
|
+
when(activity.getComponentName()).thenReturn(new ComponentName(APP_PACKAGE_NAME, activityClassName));
|
|
110
|
+
when(activity.getLocalClassName()).thenReturn(activityClassName);
|
|
111
|
+
return activity;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
private AppLaunchHelper getUUT() {
|
|
115
|
+
return new AppLaunchHelper();
|
|
116
|
+
}
|
|
117
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
package com.wix.reactnativenotifications.core;
|
|
2
|
+
|
|
3
|
+
import com.wix.reactnativenotifications.core.notification.PushNotificationProps;
|
|
4
|
+
|
|
5
|
+
import org.junit.Test;
|
|
6
|
+
import org.junit.runner.RunWith;
|
|
7
|
+
import org.mockito.junit.MockitoJUnitRunner;
|
|
8
|
+
|
|
9
|
+
import static org.junit.Assert.*;
|
|
10
|
+
import static org.mockito.Mockito.mock;
|
|
11
|
+
|
|
12
|
+
@RunWith(MockitoJUnitRunner.class)
|
|
13
|
+
public class InitialNotificationHolderTest {
|
|
14
|
+
|
|
15
|
+
@Test
|
|
16
|
+
public void initialState() throws Exception {
|
|
17
|
+
final InitialNotificationHolder uut = createUUT();
|
|
18
|
+
assertNull(uut.get());
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
@Test
|
|
22
|
+
public void setsInitialNotification() throws Exception {
|
|
23
|
+
PushNotificationProps props = mock(PushNotificationProps.class);
|
|
24
|
+
final InitialNotificationHolder uut = createUUT();
|
|
25
|
+
uut.set(props);
|
|
26
|
+
assertEquals(props, uut.get());
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
@Test
|
|
30
|
+
public void clearsInitialNotification() throws Exception {
|
|
31
|
+
PushNotificationProps props = mock(PushNotificationProps.class);
|
|
32
|
+
final InitialNotificationHolder uut = createUUT();
|
|
33
|
+
uut.set(props);
|
|
34
|
+
uut.clear();
|
|
35
|
+
assertNull(uut.get());
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
@Test
|
|
39
|
+
public void replacesInitialNotification() throws Exception {
|
|
40
|
+
PushNotificationProps props1 = mock(PushNotificationProps.class);
|
|
41
|
+
PushNotificationProps props2 = mock(PushNotificationProps.class);
|
|
42
|
+
final InitialNotificationHolder uut = createUUT();
|
|
43
|
+
uut.set(props1);
|
|
44
|
+
uut.set(props2);
|
|
45
|
+
assertNotEquals(props1, props2);
|
|
46
|
+
assertEquals(props2, uut.get());
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
@Test
|
|
50
|
+
public void isALazySingleton() throws Exception {
|
|
51
|
+
final InitialNotificationHolder instance = InitialNotificationHolder.getInstance();
|
|
52
|
+
assertNotNull(instance);
|
|
53
|
+
assertEquals(instance, InitialNotificationHolder.getInstance());
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
private InitialNotificationHolder createUUT() {
|
|
57
|
+
return new InitialNotificationHolder();
|
|
58
|
+
}
|
|
59
|
+
}
|
package/lib/android/app/src/test/java/com/wix/reactnativenotifications/core/JsIOHelperTest.java
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
package com.wix.reactnativenotifications.core;
|
|
2
|
+
|
|
3
|
+
import android.os.Bundle;
|
|
4
|
+
|
|
5
|
+
import com.facebook.react.bridge.ReactContext;
|
|
6
|
+
import com.facebook.react.bridge.WritableMap;
|
|
7
|
+
import com.facebook.react.modules.core.DeviceEventManagerModule;
|
|
8
|
+
|
|
9
|
+
import org.junit.Before;
|
|
10
|
+
import org.junit.Test;
|
|
11
|
+
import org.junit.runner.RunWith;
|
|
12
|
+
import org.mockito.Mock;
|
|
13
|
+
import org.mockito.junit.MockitoJUnitRunner;
|
|
14
|
+
|
|
15
|
+
import static org.junit.Assert.assertFalse;
|
|
16
|
+
import static org.junit.Assert.assertTrue;
|
|
17
|
+
import static org.mockito.ArgumentMatchers.any;
|
|
18
|
+
import static org.mockito.ArgumentMatchers.anyString;
|
|
19
|
+
import static org.mockito.Mockito.mock;
|
|
20
|
+
import static org.mockito.Mockito.never;
|
|
21
|
+
import static org.mockito.Mockito.verify;
|
|
22
|
+
import static org.mockito.Mockito.when;
|
|
23
|
+
|
|
24
|
+
@RunWith(MockitoJUnitRunner.class)
|
|
25
|
+
public class JsIOHelperTest {
|
|
26
|
+
|
|
27
|
+
@Mock DeviceEventManagerModule.RCTDeviceEventEmitter mRCTDeviceEventEmitter;
|
|
28
|
+
@Mock ReactContext mReactContext;
|
|
29
|
+
|
|
30
|
+
@Before
|
|
31
|
+
public void setup() throws Exception {
|
|
32
|
+
when(mReactContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)).thenReturn(mRCTDeviceEventEmitter);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
@Test
|
|
36
|
+
public void sendEventToJS_hasReactContext_emitsEventToJs() throws Exception {
|
|
37
|
+
WritableMap data = mock(WritableMap.class);
|
|
38
|
+
|
|
39
|
+
final JsIOHelper uut = createUUT();
|
|
40
|
+
boolean result = uut.sendEventToJS("my-event", data, mReactContext);
|
|
41
|
+
|
|
42
|
+
assertTrue(result);
|
|
43
|
+
verify(mRCTDeviceEventEmitter).emit("my-event", data);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
@Test
|
|
47
|
+
public void sendEventToJS_noReactContext_returnsFalse() throws Exception {
|
|
48
|
+
WritableMap data = mock(WritableMap.class);
|
|
49
|
+
|
|
50
|
+
final JsIOHelper uut = createUUT();
|
|
51
|
+
boolean result = uut.sendEventToJS("my-event", data, null);
|
|
52
|
+
|
|
53
|
+
assertFalse(result);
|
|
54
|
+
verify(mRCTDeviceEventEmitter, never()).emit(anyString(), any(WritableMap.class));
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
private JsIOHelper createUUT() {
|
|
58
|
+
return new JsIOHelper();
|
|
59
|
+
}
|
|
60
|
+
}
|