Commit 053abc89 authored by Your Name's avatar Your Name

Merge remote-tracking branch 'origin/master'

parents 8b79581b 841b13a2
Pipeline #1391 canceled with stages
...@@ -118,12 +118,22 @@ object NotificationUtils { ...@@ -118,12 +118,22 @@ object NotificationUtils {
} }
private var lastNotificationTime = 0L
fun sendNotification(context: Context, where: String) { fun sendNotification(context: Context, where: String) {
if (isDeviceLocked || isAppInForeground || !isScreenOn) { if (isDeviceLocked || isAppInForeground || !isScreenOn) {
return return
} }
val actionId = nextNotificationId val actionId = nextNotificationId
val intervalTime = System.currentTimeMillis() - lastNotificationTime
val spInterval = SpUtils.getInstance().getInt("NotificationInterval", 1)
val oneMinute = 1 * 60 * 1000L
Log.e("sendNotification", "where=$where actionId=$actionId intervalTime=$intervalTime spInterval=$spInterval")
if (lastNotificationTime != 0L && intervalTime < spInterval * oneMinute) {
return
}
val bigRemoteViews = RemoteViews(context.packageName, R.layout.notification_common) val bigRemoteViews = RemoteViews(context.packageName, R.layout.notification_common)
val smallRemoteViews = RemoteViews(context.packageName, R.layout.notification_common_small) val smallRemoteViews = RemoteViews(context.packageName, R.layout.notification_common_small)
var intentAction = "" var intentAction = ""
...@@ -227,6 +237,7 @@ object NotificationUtils { ...@@ -227,6 +237,7 @@ object NotificationUtils {
bigRemoteViews, bigRemoteViews,
smallRemoteViews, smallRemoteViews,
) )
lastNotificationTime = System.currentTimeMillis()
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment