@Test public void getTags() { ShadowMarketingCloudSdk.isReady(true); Set<String> tags = Collections.singleton("Testing"); when(registrationManager.getTags()).thenReturn(tags); reactModule.getTags(promise); verify(registrationManager).getTags(); ArgumentCaptor<ShadowArguments.TestWritableArray> arrCaptor = ArgumentCaptor.forClass(ShadowArguments.TestWritableArray.class); verify(promise).resolve(arrCaptor.capture()); ShadowArguments.TestWritableArray arr = arrCaptor.getValue(); assertEquals(1, arr.size()); assertEquals("Testing", arr.getString(0)); }
@ReactMethod public void getTags(Promise promise) { handleAction(new PromiseAction(promise) { @Override void execute(MarketingCloudSdk sdk, @NonNull Promise promise) { Set<String> tags = sdk.getRegistrationManager().getTags(); WritableArray array = Arguments.createArray(); if (!tags.isEmpty()) { for (String tag : tags) { array.pushString(tag); } } promise.resolve(array); } }); }
RNMarketingCloudSdkModule extends ReactContextBaseJavaModule { @ReactMethod public void getTags(Promise promise) { handleAction(new PromiseAction(promise) { @Override void execute(MarketingCloudSdk sdk, @NonNull Promise promise) { Set<String> tags = sdk.getRegistrationManager().getTags(); WritableArray array = Arguments.createArray(); if (!tags.isEmpty()) { for (String tag : tags) { array.pushString(tag); } } promise.resolve(array); } }); } }
RNMarketingCloudSdkModule extends ReactContextBaseJavaModule { @ReactMethod public void getTags(Promise promise) { handleAction(new PromiseAction(promise) { @Override void execute(MarketingCloudSdk sdk, @NonNull Promise promise) { Set<String> tags = sdk.getRegistrationManager().getTags(); WritableArray array = Arguments.createArray(); if (!tags.isEmpty()) { for (String tag : tags) { array.pushString(tag); } } promise.resolve(array); } }); } RNMarketingCloudSdkModule(ReactApplicationContext reactContext); }
RNMarketingCloudSdkModule extends ReactContextBaseJavaModule { @ReactMethod public void getTags(Promise promise) { handleAction(new PromiseAction(promise) { @Override void execute(MarketingCloudSdk sdk, @NonNull Promise promise) { Set<String> tags = sdk.getRegistrationManager().getTags(); WritableArray array = Arguments.createArray(); if (!tags.isEmpty()) { for (String tag : tags) { array.pushString(tag); } } promise.resolve(array); } }); } RNMarketingCloudSdkModule(ReactApplicationContext reactContext); @Override String getName(); @ReactMethod void isPushEnabled(Promise promise); @ReactMethod void enablePush(); @ReactMethod void disablePush(); @ReactMethod void getSystemToken(Promise promise); @ReactMethod void getAttributes(Promise promise); @ReactMethod void setAttribute(final String key, final String value); @ReactMethod void clearAttribute(final String key); @ReactMethod void addTag(final String tag); @ReactMethod void removeTag(final String tag); @ReactMethod void getTags(Promise promise); @ReactMethod void setContactKey(final String contactKey); @ReactMethod void getContactKey(final Promise promise); @ReactMethod void enableVerboseLogging(); @ReactMethod void disableVerboseLogging(); @ReactMethod void logSdkState(); }
RNMarketingCloudSdkModule extends ReactContextBaseJavaModule { @ReactMethod public void getTags(Promise promise) { handleAction(new PromiseAction(promise) { @Override void execute(MarketingCloudSdk sdk, @NonNull Promise promise) { Set<String> tags = sdk.getRegistrationManager().getTags(); WritableArray array = Arguments.createArray(); if (!tags.isEmpty()) { for (String tag : tags) { array.pushString(tag); } } promise.resolve(array); } }); } RNMarketingCloudSdkModule(ReactApplicationContext reactContext); @Override String getName(); @ReactMethod void isPushEnabled(Promise promise); @ReactMethod void enablePush(); @ReactMethod void disablePush(); @ReactMethod void getSystemToken(Promise promise); @ReactMethod void getAttributes(Promise promise); @ReactMethod void setAttribute(final String key, final String value); @ReactMethod void clearAttribute(final String key); @ReactMethod void addTag(final String tag); @ReactMethod void removeTag(final String tag); @ReactMethod void getTags(Promise promise); @ReactMethod void setContactKey(final String contactKey); @ReactMethod void getContactKey(final Promise promise); @ReactMethod void enableVerboseLogging(); @ReactMethod void disableVerboseLogging(); @ReactMethod void logSdkState();  }