@Test public void getContactKey() { ShadowMarketingCloudSdk.isReady(true); when(registrationManager.getContactKey()).thenReturn("test@salesforce.com"); reactModule.getContactKey(promise); verify(registrationManager).getContactKey(); verify(promise).resolve("test@salesforce.com"); }
@ReactMethod public void getContactKey(final Promise promise) { handleAction(new PromiseAction(promise) { @Override void execute(MarketingCloudSdk sdk, @NonNull Promise promise) { promise.resolve(sdk.getRegistrationManager().getContactKey()); } }); }
RNMarketingCloudSdkModule extends ReactContextBaseJavaModule { @ReactMethod public void getContactKey(final Promise promise) { handleAction(new PromiseAction(promise) { @Override void execute(MarketingCloudSdk sdk, @NonNull Promise promise) { promise.resolve(sdk.getRegistrationManager().getContactKey()); } }); } }
RNMarketingCloudSdkModule extends ReactContextBaseJavaModule { @ReactMethod public void getContactKey(final Promise promise) { handleAction(new PromiseAction(promise) { @Override void execute(MarketingCloudSdk sdk, @NonNull Promise promise) { promise.resolve(sdk.getRegistrationManager().getContactKey()); } }); } RNMarketingCloudSdkModule(ReactApplicationContext reactContext); }
RNMarketingCloudSdkModule extends ReactContextBaseJavaModule { @ReactMethod public void getContactKey(final Promise promise) { handleAction(new PromiseAction(promise) { @Override void execute(MarketingCloudSdk sdk, @NonNull Promise promise) { promise.resolve(sdk.getRegistrationManager().getContactKey()); } }); } 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 getContactKey(final Promise promise) { handleAction(new PromiseAction(promise) { @Override void execute(MarketingCloudSdk sdk, @NonNull Promise promise) { promise.resolve(sdk.getRegistrationManager().getContactKey()); } }); } 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();  }