Skip to content

Commit 5a73179

Browse files
committed
Implement update notification method channel
1 parent be4bf1c commit 5a73179

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

android/app/src/main/kotlin/com/invertedx/sentinelx/MainActivity.kt

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package com.invertedx.sentinelx
22

33
import android.app.NotificationChannel
44
import android.app.NotificationManager
5+
import android.content.Intent
56
import android.os.Build
67
import android.os.Bundle
78
import 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

Comments
 (0)