-
Notifications
You must be signed in to change notification settings - Fork 4
Drop support of the old arch #27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -39,7 +39,7 @@ public class RNBatchEventDispatcher implements BatchEventDispatcher { | |
|
|
||
| /** | ||
| * Event Queue | ||
| * | ||
| * <p> | ||
| * We need to queue events because Batch SDK is started before | ||
| * we have react context catalyst instance ready. | ||
| */ | ||
|
|
@@ -57,10 +57,10 @@ public class RNBatchEventDispatcher implements BatchEventDispatcher { | |
| * @param event dispatched event | ||
| */ | ||
| private void sendEvent(@NonNull RNBatchEvent event) { | ||
| if (reactContext == null || !reactContext.hasActiveCatalystInstance()) { | ||
| Log.d(RNBatchModuleImpl.LOGGER_TAG, | ||
| if (reactContext == null || !reactContext.hasActiveReactInstance()) { | ||
| Log.d(RNBatchModule.LOGGER_TAG, | ||
| "Trying to send an event while react context is null" + | ||
| " or has no active catalyst instance. Aborting."); | ||
| " or has no active react instance. Aborting."); | ||
| return; | ||
| } | ||
| reactContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class) | ||
|
|
@@ -106,15 +106,15 @@ public void dispatchEvent(@NonNull Batch.EventDispatcher.Type type, | |
| JSONObject customPayloadJSON = new JSONObject(customPayload); | ||
| params.putMap("messagingCustomPayload", RNUtils.convertJSONObjectToWritableMap(customPayloadJSON)); | ||
| } catch (JSONException e) { | ||
| Log.d(RNBatchModuleImpl.LOGGER_TAG,"Failed to parse messaging custom payload"); | ||
| Log.d(RNBatchModule.LOGGER_TAG,"Failed to parse messaging custom payload"); | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| RNBatchEvent event = new RNBatchEvent(eventName, params); | ||
| if (!isModuleReady() || !hasListener) { | ||
| Log.d(RNBatchModuleImpl.LOGGER_TAG, | ||
| Log.d(RNBatchModule.LOGGER_TAG, | ||
| "Module is not ready or no listener registered yet. Queuing event: ".concat(eventName)); | ||
| queueEvent(event); | ||
| return; | ||
|
|
@@ -131,7 +131,7 @@ private void dequeueEvents() { | |
| if (events.isEmpty()) { | ||
| return; | ||
| } | ||
| while(events.size() != 0) { | ||
| while(!events.isEmpty()) { | ||
| sendEvent(events.pop()); | ||
| } | ||
| } | ||
|
|
@@ -164,7 +164,7 @@ public void setReactContext(@NonNull ReactApplicationContext reactContext) { | |
| * @return true if ready | ||
| */ | ||
| private boolean isModuleReady() { | ||
| return reactContext != null && reactContext.hasActiveCatalystInstance(); | ||
| return reactContext != null && reactContext.hasReactInstance(); | ||
|
Comment on lines
164
to
+167
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Event dispatching now relies on Useful? React with 👍 / 👎.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. let's bump to 0.77, older react native version still maintained (hasReactInstance has been introduced in 0.75) |
||
| } | ||
|
|
||
| /** | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doupt
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ca marche les tags html en javadoc