Commit 93e19780 authored by wanglei's avatar wanglei

...

parent 67d6402e
...@@ -2,9 +2,7 @@ package com.base.pdfviewerscannerwhite.fcm; ...@@ -2,9 +2,7 @@ package com.base.pdfviewerscannerwhite.fcm;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import com.base.pdfviewerscannerwhite.helper.EventUtils; import com.base.pdfviewerscannerwhite.helper.EventUtils;
import com.base.pdfviewerscannerwhite.utils.LogEx; import com.base.pdfviewerscannerwhite.utils.LogEx;
import com.google.firebase.messaging.FirebaseMessagingService; import com.google.firebase.messaging.FirebaseMessagingService;
...@@ -20,6 +18,9 @@ public class MessagingService extends FirebaseMessagingService { ...@@ -20,6 +18,9 @@ public class MessagingService extends FirebaseMessagingService {
super.onMessageReceived(remoteMessage); super.onMessageReceived(remoteMessage);
LogEx.INSTANCE.logDebug(TAG, "onMessageReceived", false); LogEx.INSTANCE.logDebug(TAG, "onMessageReceived", false);
EventUtils.INSTANCE.event("FCM_Received", null, null, false); EventUtils.INSTANCE.event("FCM_Received", null, null, false);
String action = NotificationUiUtil.INSTANCE.getNextActionId();
NotificationUiUtil.INSTANCE.sendNotification(this, action, PopupConstObject.POPUP_WHERE_FCM);
} }
......
...@@ -17,15 +17,18 @@ import com.base.pdfviewerscannerwhite.bean.ConstObject.NOTIFICATION_ACTION_NEW_I ...@@ -17,15 +17,18 @@ import com.base.pdfviewerscannerwhite.bean.ConstObject.NOTIFICATION_ACTION_NEW_I
import com.base.pdfviewerscannerwhite.bean.ConstObject.NOTIFICATION_ACTION_READ_DOCUMENTS import com.base.pdfviewerscannerwhite.bean.ConstObject.NOTIFICATION_ACTION_READ_DOCUMENTS
import com.base.pdfviewerscannerwhite.bean.ConstObject.NOTIFICATION_ACTION_READ_PDF import com.base.pdfviewerscannerwhite.bean.ConstObject.NOTIFICATION_ACTION_READ_PDF
import com.base.pdfviewerscannerwhite.bean.ConstObject.NOTIFICATION_ACTION_UN_VIEW_FILES import com.base.pdfviewerscannerwhite.bean.ConstObject.NOTIFICATION_ACTION_UN_VIEW_FILES
import com.base.pdfviewerscannerwhite.fcm.PopupConstObject.POPUP_WHERE_FCM
import com.base.pdfviewerscannerwhite.fcm.PopupConstObject.POPUP_WHERE_LOCK import com.base.pdfviewerscannerwhite.fcm.PopupConstObject.POPUP_WHERE_LOCK
import com.base.pdfviewerscannerwhite.fcm.PopupConstObject.POPUP_WHERE_TIMBER import com.base.pdfviewerscannerwhite.fcm.PopupConstObject.POPUP_WHERE_TIMBER
import com.base.pdfviewerscannerwhite.fcm.PopupConstObject.popup_count import com.base.pdfviewerscannerwhite.fcm.PopupConstObject.popup_count
import com.base.pdfviewerscannerwhite.fcm.PopupConstObject.popup_end import com.base.pdfviewerscannerwhite.fcm.PopupConstObject.popup_end
import com.base.pdfviewerscannerwhite.fcm.PopupConstObject.popup_fcm_interval
import com.base.pdfviewerscannerwhite.fcm.PopupConstObject.popup_interval import com.base.pdfviewerscannerwhite.fcm.PopupConstObject.popup_interval
import com.base.pdfviewerscannerwhite.fcm.PopupConstObject.popup_lock_interval import com.base.pdfviewerscannerwhite.fcm.PopupConstObject.popup_lock_interval
import com.base.pdfviewerscannerwhite.fcm.PopupConstObject.popup_start import com.base.pdfviewerscannerwhite.fcm.PopupConstObject.popup_start
import com.base.pdfviewerscannerwhite.fcm.PopupConstObject.popup_status import com.base.pdfviewerscannerwhite.fcm.PopupConstObject.popup_status
import com.base.pdfviewerscannerwhite.fcm.PopupConstObject.popup_timber_interval import com.base.pdfviewerscannerwhite.fcm.PopupConstObject.popup_timber_interval
import com.base.pdfviewerscannerwhite.helper.EventUtils
import com.base.pdfviewerscannerwhite.helper.MyApplication import com.base.pdfviewerscannerwhite.helper.MyApplication
import com.base.pdfviewerscannerwhite.ui.splash.SplashActivity import com.base.pdfviewerscannerwhite.ui.splash.SplashActivity
import com.base.pdfviewerscannerwhite.utils.AppPreferences import com.base.pdfviewerscannerwhite.utils.AppPreferences
...@@ -75,6 +78,7 @@ object NotificationUiUtil { ...@@ -75,6 +78,7 @@ object NotificationUiUtil {
//是否开启推送 //是否开启推送
val status = AppPreferences.getInstance().getString(popup_status, "1").toInt() val status = AppPreferences.getInstance().getString(popup_status, "1").toInt()
if (status == 0) { if (status == 0) {
EventUtils.event("Notification_Error", "status=$status")
LogEx.logDebug("canSendNotification", "status") LogEx.logDebug("canSendNotification", "status")
return false return false
} }
...@@ -82,6 +86,7 @@ object NotificationUiUtil { ...@@ -82,6 +86,7 @@ object NotificationUiUtil {
val count = AppPreferences.getInstance().getString(popup_count, "20").toInt() val count = AppPreferences.getInstance().getString(popup_count, "20").toInt()
if (dayPopupCount > count) { if (dayPopupCount > count) {
LogEx.logDebug("canSendNotification", "count") LogEx.logDebug("canSendNotification", "count")
EventUtils.event("Notification_Error", "dayPopupCount=$dayPopupCount count=$count")
return false return false
} }
//判断是否在时间区域 //判断是否在时间区域
...@@ -91,6 +96,7 @@ object NotificationUiUtil { ...@@ -91,6 +96,7 @@ object NotificationUiUtil {
val currentHour = calendar.get(Calendar.HOUR_OF_DAY) val currentHour = calendar.get(Calendar.HOUR_OF_DAY)
if (currentHour !in start until end) { if (currentHour !in start until end) {
LogEx.logDebug("canSendNotification", "start end") LogEx.logDebug("canSendNotification", "start end")
EventUtils.event("Notification_Error", "start=$start end=$end currentHour=$currentHour")
return false return false
} }
...@@ -102,7 +108,11 @@ object NotificationUiUtil { ...@@ -102,7 +108,11 @@ object NotificationUiUtil {
if (where == POPUP_WHERE_LOCK) { if (where == POPUP_WHERE_LOCK) {
interval = AppPreferences.getInstance().getString(popup_lock_interval, "1").toInt() interval = AppPreferences.getInstance().getString(popup_lock_interval, "1").toInt()
} }
if (where == POPUP_WHERE_FCM) {
interval = AppPreferences.getInstance().getString(popup_fcm_interval, "1").toInt()
}
if (System.currentTimeMillis() - lastPopupTime < interval * 60 * 1000L) { if (System.currentTimeMillis() - lastPopupTime < interval * 60 * 1000L) {
EventUtils.event("Notification_Error", "where=$where interval=$interval")
LogEx.logDebug("canSendNotification", "interval") LogEx.logDebug("canSendNotification", "interval")
return false return false
} }
......
...@@ -4,6 +4,7 @@ object PopupConstObject { ...@@ -4,6 +4,7 @@ object PopupConstObject {
const val POPUP_WHERE_TIMBER = "Timber" const val POPUP_WHERE_TIMBER = "Timber"
const val POPUP_WHERE_LOCK = "Lock" const val POPUP_WHERE_LOCK = "Lock"
const val POPUP_WHERE_FCM = "fcm"
//推送总开关 0 关 1开 //推送总开关 0 关 1开
val popup_status = "popup_status" val popup_status = "popup_status"
...@@ -16,6 +17,7 @@ object PopupConstObject { ...@@ -16,6 +17,7 @@ object PopupConstObject {
val popup_interval = "popup_interval" val popup_interval = "popup_interval"
val popup_timber_interval = "popup_timber_interval" val popup_timber_interval = "popup_timber_interval"
val popup_lock_interval = "popup_lock_interval" val popup_lock_interval = "popup_lock_interval"
val popup_fcm_interval = "popup_fcm_interval"
//推送样式一配置 //推送样式一配置
val popup_style1_start = "popup_style1_start" val popup_style1_start = "popup_style1_start"
......
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