Skip to content

Commit 176292c

Browse files
committed
Refactor registerPushNotificationHandlers
The function is now part of the Talk object. This helps make it clear which package the function belongs to.
1 parent eef0b3c commit 176292c

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

examples/push_notifications/lib/main.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Future<void> main() async {
99
options: DefaultFirebaseOptions.currentPlatform,
1010
);
1111

12-
await registerPushNotificationHandlers(
12+
await Talk.registerPushNotificationHandlers(
1313
androidChannel: const AndroidChannel(
1414
channelId: 'com.talkjs.flutter_push_example.messages',
1515
channelName: 'Messages',

lib/talkjs_flutter.dart

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,14 @@ class Talk {
3232
final hash = digest.toString().toLowerCase();
3333
return hash.substring(0, 20);
3434
}
35-
}
3635

37-
Future<void> registerPushNotificationHandlers({AndroidChannel? androidChannel, IOSPermissions? iosPermissions}) async {
38-
if ((Platform.isAndroid) && (androidChannel != null)) {
39-
await registerAndroidPushNotificationHandlers(androidChannel);
40-
}
36+
static Future<void> registerPushNotificationHandlers({AndroidChannel? androidChannel, IOSPermissions? iosPermissions}) async {
37+
if ((Platform.isAndroid) && (androidChannel != null)) {
38+
await registerAndroidPushNotificationHandlers(androidChannel);
39+
}
4140

42-
if ((Platform.isIOS) && (iosPermissions != null)) {
43-
await registerIOSPushNotificationHandlers(iosPermissions);
41+
if ((Platform.isIOS) && (iosPermissions != null)) {
42+
await registerIOSPushNotificationHandlers(iosPermissions);
43+
}
4444
}
4545
}

0 commit comments

Comments
 (0)