|
@@ -473,42 +473,74 @@ function createAlarm() {
|
|
|
}
|
|
|
|
|
|
export function getMessageInfo() {
|
|
|
- fetchAllMessageInfo().then(res => {
|
|
|
- if (res.code == 0) {
|
|
|
- let { unReadCountTotal = 0 } = res.data;
|
|
|
- if (unReadCountTotal > 0) {
|
|
|
- let text = unReadCountTotal > 99 ? '99+' : unReadCountTotal + '';
|
|
|
- setBadgeInfo({ data: { text } });
|
|
|
- } else {
|
|
|
- hideBadge();
|
|
|
+ try {
|
|
|
+ fetchAllMessageInfo().then(res => {
|
|
|
+ if (res.code == 0) {
|
|
|
+ let { unReadCountTotal = 0 } = res.data;
|
|
|
+ if (unReadCountTotal > 0) {
|
|
|
+ let text = unReadCountTotal > 99 ? '99+' : unReadCountTotal + '';
|
|
|
+ setBadgeInfo({ data: { text } });
|
|
|
+ } else {
|
|
|
+ hideBadge();
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- })
|
|
|
+ })
|
|
|
+ } catch (error) {
|
|
|
+ Report.reportLog({
|
|
|
+ objectType: Report.objectType.background_function_catch,
|
|
|
+ funcName: 'getMessageInfo',
|
|
|
+ errMsg: error.message
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
export function readTaskAllMsg({ msgType }, cb) {
|
|
|
- fetchReadTaskAllMsg({
|
|
|
- msgType // 1:任务红包 2:钱包明细
|
|
|
- }).then(res => {
|
|
|
- if (res.code == 0) {
|
|
|
- cb && cb();
|
|
|
- }
|
|
|
- });
|
|
|
+ try{
|
|
|
+ fetchReadTaskAllMsg({
|
|
|
+ msgType // 1:任务红包 2:钱包明细
|
|
|
+ }).then(res => {
|
|
|
+ if (res.code == 0) {
|
|
|
+ cb && cb();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } catch (error) {
|
|
|
+ Report.reportLog({
|
|
|
+ objectType: Report.objectType.background_function_catch,
|
|
|
+ funcName: 'readTaskAllMsg',
|
|
|
+ errMsg: error.message
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
export const onDisconnectHandler = (port) => {
|
|
|
- if (port.name === "popup" || port.name === "popup_transactions") {
|
|
|
- let msgType = port.name === "popup" ? 1 : 2;
|
|
|
- readTaskAllMsg({ msgType }, () => {
|
|
|
- getMessageInfo();
|
|
|
+ try{
|
|
|
+ if (port.name === "popup" || port.name === "popup_transactions") {
|
|
|
+ let msgType = port.name === "popup" ? 1 : 2;
|
|
|
+ readTaskAllMsg({ msgType }, () => {
|
|
|
+ getMessageInfo();
|
|
|
+ })
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ Report.reportLog({
|
|
|
+ objectType: Report.objectType.background_function_catch,
|
|
|
+ funcName: 'onDisconnectHandler',
|
|
|
+ errMsg: error.message
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
|
|
|
export const injectExtensionPopup = (tab) => {
|
|
|
- sendActivetabMessage({
|
|
|
- actionType: 'BG_INJECT_EXTENSION_POPUP'
|
|
|
- });
|
|
|
+ try{
|
|
|
+ sendActivetabMessage({
|
|
|
+ actionType: 'BG_INJECT_EXTENSION_POPUP'
|
|
|
+ });
|
|
|
+ } catch (error) {
|
|
|
+ Report.reportLog({
|
|
|
+ objectType: Report.objectType.background_function_catch,
|
|
|
+ funcName: 'injectExtensionPopup',
|
|
|
+ errMsg: error.message
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
export const setPopupConfig = (activeInfo) => {
|