Skip to content
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

fix notification bug during incoming data call #1

Merged
merged 1 commit into from
Feb 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,13 @@ protected PushNotification(Context context, Bundle bundle, AppLifecycleFacade ap
}

@Override
public void onReceived() throws InvalidNotificationException {
if (!mAppLifecycleFacade.isAppVisible()) {
public void onReceived() {
ReactContext reactContext = mAppLifecycleFacade.getRunningReactContext();
boolean hasActiveCatalystInstance = reactContext != null && reactContext.hasActiveCatalystInstance();
if (!mAppLifecycleFacade.isAppVisible() || !hasActiveCatalystInstance) {
postNotification(null);
notifyReceivedBackgroundToJS();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we still need to call notifyReceivedBackgroundToJS()? Omitting this may be why you cannot start a call from the iOS native contact app (as you mentioned on the status meeting this morning).

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keeping notifyReceivedBackgroundToJS() does not solve the outgoing call issue from the native call app. In fact, I've installed old builds, and it seems that this issue is not new.

So I'm trying to figure out, wether it is caused by a change we've made earlier, or it is caused by an Android/Samsung update..

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the app still receive registerNotificationReceivedBackground events (in phon-push-notifications/attachEvents.android.js) without this?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

idk, I only end-to-end tested and incoming data call worked from dead state.. But I try to check log and and find out..

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I comment out the registerNotificationReceivedBackground handler, phone still receives incoming data calls, but with no sound 🤷🏽‍♂️

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I guess we can live without background notifications. AFAICT we do not consume push/RECEIVED_BACKGROUND anywhere. But I don't think this change is suitable for an upstream PR.

} else {
}
if (hasActiveCatalystInstance) {
notifyReceivedToJS();
}
}
Expand Down Expand Up @@ -130,17 +132,13 @@ protected void dispatchImmediately() {
}

protected void dispatchUponVisibility() {
mAppLifecycleFacade.addVisibilityListener(getIntermediateAppVisibilityListener());
mAppLifecycleFacade.addVisibilityListener(mAppVisibilityListener);

// Make the app visible so that we'll dispatch the notification opening when visibility changes to 'true' (see
// above listener registration).
launchOrResumeApp();
}

protected AppVisibilityListener getIntermediateAppVisibilityListener() {
return mAppVisibilityListener;
}

protected Notification buildNotification(PendingIntent intent) {
return getNotificationBuilder(intent).build();
}
Expand Down