Skip to content

Commit

Permalink
android notif [nfc]: Rename file to NotificationUiManager
Browse files Browse the repository at this point in the history
This makes a much more on-point name for what this file actually does.
It doesn't have anything particularly to do with FCM at all; that's
the job of some other code (and not very much of it.)  Rather its job
is to maintain the set of notifications as they appear in the UI.

The reason it was named this is just that that's what it had always
been; converted from FCMPushNotifications.java in 5654221, and
before that renamed from GCMPushNotifications.java in f180171,
both early 2019.

And that in turn dates to when the first version of this code was
written in 2017, where it was entangled with a pretty chaotic
third-party library from the RN universe.  (See e.g. 30e4d8e,
and the rest of the changes leading up to d048dba.)
  • Loading branch information
gnprice committed Nov 10, 2021
1 parent 202c8df commit f27a5ee
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import org.unimodules.core.interfaces.SingletonModule;

import com.zulipmobile.generated.BasePackageList;
import com.zulipmobile.notifications.FCMPushNotifications;
import com.zulipmobile.notifications.NotificationUiManager;
import com.zulipmobile.notifications.NotificationsPackage;
import com.zulipmobile.sharing.SharingPackage;

Expand Down Expand Up @@ -69,7 +69,7 @@ public ReactNativeHost getReactNativeHost() {
@Override
public void onCreate() {
super.onCreate();
FCMPushNotifications.createNotificationChannel(this);
NotificationUiManager.createNotificationChannel(this);
SoLoader.init(this, /* native exopackage */ false);
initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public void onMessageReceived(RemoteMessage message) {
if (!(applicationContext instanceof MainApplication)) {
return;
}
FCMPushNotifications.onReceived(this, message.getData());
NotificationUiManager.onReceived(this, message.getData());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
import com.zulipmobile.MainApplication;

import static android.content.Intent.ACTION_VIEW;
import static com.zulipmobile.notifications.FCMPushNotifications.ACTION_CLEAR;
import static com.zulipmobile.notifications.FCMPushNotifications.EXTRA_NOTIFICATION_DATA;
import static com.zulipmobile.notifications.NotificationUiManager.ACTION_CLEAR;
import static com.zulipmobile.notifications.NotificationUiManager.EXTRA_NOTIFICATION_DATA;

public class NotificationIntentService extends IntentService {
public NotificationIntentService() {
Expand All @@ -25,7 +25,7 @@ protected void onHandleIntent(Intent intent) {
}
if (ACTION_VIEW.equals(intent.getAction())) {
final Bundle data = intent.getBundleExtra(EXTRA_NOTIFICATION_DATA);
FCMPushNotifications.onOpened((ReactApplication) getApplication(), data);
NotificationUiManager.onOpened((ReactApplication) getApplication(), data);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@file:JvmName("FCMPushNotifications")
@file:JvmName("NotificationUiManager")

package com.zulipmobile.notifications

Expand Down
4 changes: 2 additions & 2 deletions docs/architecture/notifications.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ iOS we haven't implemented all the same notification features.)

For the implementation of our UI notifications, see:

* on Android, our [`FCMPushNotifications.kt`][FCMPushNotifications.kt]
* on Android, our [`NotificationUiManager.kt`][NotificationUiManager.kt]

* on iOS, the server code in
[`push_notifications.py`][push_notifications.py] that generates the
Expand All @@ -52,7 +52,7 @@ For the implementation of our UI notifications, see:
notification, without involving any client-side code of our own.

[FcmMessage.kt]: ../../android/app/src/main/java/com/zulipmobile/notifications/FcmMessage.kt
[FCMPushNotifications.kt]: ../../android/app/src/main/java/com/zulipmobile/notifications/FCMPushNotifications.kt
[NotificationUiManager.kt]: ../../android/app/src/main/java/com/zulipmobile/notifications/NotificationUiManager.kt
[push_notifications.py]: https://github.com/zulip/zulip/blob/main/zerver/lib/push_notifications.py
[apns-payload]: https://developer.apple.com/documentation/usernotifications/setting_up_a_remote_notification_server/generating_a_remote_notification

Expand Down

0 comments on commit f27a5ee

Please sign in to comment.