Skip to content

Commit 295ee8a

Browse files
committed
Move notificationChannelToWrapper to UnityNotificationManager
1 parent 36e4101 commit 295ee8a

File tree

2 files changed

+19
-17
lines changed

2 files changed

+19
-17
lines changed

com.unity.mobile.notifications/Runtime/Android/Plugins/com/unity/androidnotifications/UnityNotificationManager.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,25 @@ protected static NotificationChannelWrapper getNotificationChannel(Context conte
232232
return channel;
233233
}
234234

235+
protected static NotificationChannelWrapper notificationChannelToWrapper(NotificationChannel channel) {
236+
assert Build.VERSION.SDK_INT >= Build.VERSION_CODES.O;
237+
238+
NotificationChannelWrapper wrapper = new NotificationChannelWrapper();
239+
240+
wrapper.id = channel.getId();
241+
wrapper.name = channel.getName().toString();
242+
wrapper.importance = channel.getImportance();
243+
wrapper.description = channel.getDescription();
244+
wrapper.enableLights = channel.shouldShowLights();
245+
wrapper.enableVibration = channel.shouldVibrate();
246+
wrapper.canBypassDnd = channel.canBypassDnd();
247+
wrapper.canShowBadge = channel.canShowBadge();
248+
wrapper.vibrationPattern = channel.getVibrationPattern();
249+
wrapper.lockscreenVisibility = channel.getLockscreenVisibility();
250+
251+
return wrapper;
252+
}
253+
235254
// Get a notification channel by id.
236255
// This function will only be called for devices which are low than Android O.
237256
protected NotificationChannelWrapper getNotificationChannel(String id) {

com.unity.mobile.notifications/Runtime/Android/Plugins/com/unity/androidnotifications/UnityNotificationManagerOreo.java

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -25,23 +25,6 @@ protected static NotificationChannelWrapper getOreoNotificationChannel(Context c
2525
return null;
2626
}
2727

28-
protected static NotificationChannelWrapper notificationChannelToWrapper(NotificationChannel channel) {
29-
NotificationChannelWrapper wrapper = new NotificationChannelWrapper();
30-
31-
wrapper.id = channel.getId();
32-
wrapper.name = channel.getName().toString();
33-
wrapper.importance = channel.getImportance();
34-
wrapper.description = channel.getDescription();
35-
wrapper.enableLights = channel.shouldShowLights();
36-
wrapper.enableVibration = channel.shouldVibrate();
37-
wrapper.canBypassDnd = channel.canBypassDnd();
38-
wrapper.canShowBadge = channel.canShowBadge();
39-
wrapper.vibrationPattern = channel.getVibrationPattern();
40-
wrapper.lockscreenVisibility = channel.getLockscreenVisibility();
41-
42-
return wrapper;
43-
}
44-
4528
@Override
4629
public void deleteNotificationChannel(String id) {
4730
assert Build.VERSION.SDK_INT >= Build.VERSION_CODES.O;

0 commit comments

Comments
 (0)