-
Notifications
You must be signed in to change notification settings - Fork 763
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9dbc726
commit c967bff
Showing
38 changed files
with
691 additions
and
599 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 21 additions & 9 deletions
30
android/src/main/java/com/wix/reactnativenotifications/core/JsIOHelper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,38 @@ | ||
package com.wix.reactnativenotifications.core; | ||
|
||
import android.content.Context; | ||
import android.os.Bundle; | ||
|
||
import com.facebook.react.ReactApplication; | ||
import com.facebook.react.bridge.Arguments; | ||
import com.facebook.react.bridge.ReactContext; | ||
import com.facebook.react.bridge.WritableMap; | ||
import com.facebook.react.modules.core.DeviceEventManagerModule; | ||
|
||
public class JsIOHelper { | ||
public boolean sendEventToJS(String eventName, Bundle data, ReactContext reactContext) { | ||
if (reactContext != null) { | ||
sendEventToJS(eventName, Arguments.fromBundle(data), reactContext); | ||
return true; | ||
} | ||
return false; | ||
|
||
private final Context mContext; | ||
|
||
public JsIOHelper(Context context) { | ||
mContext = context; | ||
} | ||
|
||
public boolean sendEventToJS(String eventName, WritableMap data, ReactContext reactContext) { | ||
if (reactContext != null) { | ||
reactContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class).emit(eventName, data); | ||
public boolean sendEventToJS(String eventName, Bundle bundle) { | ||
return sendEventToJS(eventName, Arguments.fromBundle(bundle)); | ||
} | ||
|
||
public boolean sendEventToJS(String eventName, String string) { | ||
return sendEventToJS(eventName, (Object) string); | ||
} | ||
|
||
boolean sendEventToJS(String eventName, Object object) { | ||
final ReactContext reactContext = ((ReactApplication) mContext.getApplicationContext()).getReactNativeHost().getReactInstanceManager().getCurrentReactContext(); | ||
|
||
if (reactContext != null && reactContext.hasActiveCatalystInstance()) { | ||
reactContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class).emit(eventName, object); | ||
return true; | ||
} | ||
|
||
return false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 0 additions & 11 deletions
11
...in/java/com/wix/reactnativenotifications/core/notification/INotificationsApplication.java
This file was deleted.
Oops, something went wrong.
30 changes: 0 additions & 30 deletions
30
...d/src/main/java/com/wix/reactnativenotifications/core/notification/IPushNotification.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.