@@ -2,6 +2,7 @@ package com.invertedx.sentinelx
22
33import android.app.NotificationChannel
44import android.app.NotificationManager
5+ import android.content.Intent
56import android.os.Build
67import android.os.Bundle
78import com.invertedx.sentinelx.channel.ApiChannel
@@ -24,6 +25,7 @@ class MainActivity : FlutterActivity() {
2425 private lateinit var networkChannel: NetworkChannel
2526 private lateinit var onPermissionResultCallback: OnPermissionResult
2627 private lateinit var apiChannel: ApiChannel ;
28+ private lateinit var systemChannel: SystemChannel ;
2729
2830 override fun onCreate (savedInstanceState : Bundle ? ) {
2931 super .onCreate(savedInstanceState)
@@ -33,8 +35,9 @@ class MainActivity : FlutterActivity() {
3335 createNotificationChannels()
3436 networkChannel = NetworkChannel (applicationContext, this );
3537 apiChannel = ApiChannel (applicationContext);
36-
37- MethodChannel (flutterView, " system.channel" ).setMethodCallHandler(SystemChannel (applicationContext, this ))
38+ systemChannel = SystemChannel (applicationContext, this );
39+
40+ MethodChannel (flutterView, " system.channel" ).setMethodCallHandler(systemChannel)
3841 MethodChannel (flutterView, " crypto.channel" ).setMethodCallHandler(CryptoChannel (applicationContext))
3942 MethodChannel (flutterView, " api.channel" ).setMethodCallHandler(apiChannel)
4043 MethodChannel (flutterView, " network.channel" ).setMethodCallHandler(networkChannel)
@@ -77,6 +80,19 @@ class MainActivity : FlutterActivity() {
7780 )
7881 serviceChannel.setSound(null , null )
7982 getSystemService(NotificationManager ::class .java)?.createNotificationChannel(serviceChannel)
83+
84+ val updateChannel = NotificationChannel (
85+ " UPDATE_CHANNEL" ,
86+ " Update Notifications" ,
87+ NotificationManager .IMPORTANCE_DEFAULT
88+ )
89+ getSystemService(NotificationManager ::class .java)?.createNotificationChannel(updateChannel)
90+
8091 }
8192 }
93+
94+ override fun onNewIntent (intent : Intent ? ) {
95+ intent?.let { systemChannel.onNotificationIntent(it) }
96+ super .onNewIntent(intent)
97+ }
8298}
0 commit comments