Pārlūkot izejas kodu

Merge branch 'dev_1.1.2' of https://git.yishihui.com/DeNet/de-net into dev_1.1.2

zhangwei 2 gadi atpakaļ
vecāks
revīzija
949708e0dd
2 mainītis faili ar 19 papildinājumiem un 21 dzēšanām
  1. 18 20
      src/logic/content/twitter.js
  2. 1 1
      src/view/popup/setting/index.vue

+ 18 - 20
src/logic/content/twitter.js

@@ -1411,15 +1411,25 @@ export function publishNFTTweetEvent({ groupId, postId, srcContent }, callback)
                     groupFontWeight: '500',
                     lineDisplay: 'none'
                 });
-                chrome.runtime.sendMessage({
-                    actionType: "SWITCH_GROUP_BANNER_STATUS",
-                    data: { type: 'arrow' }
-                }, () => { });
+                sendMessageToGroupBanner({ type: 'arrow' })
             }, 2000);
         });
     }, 800)
 }
 
+const sendMessageToGroupBanner = (params) => {
+    chrome.runtime.sendMessage({
+        actionType: "SWITCH_GROUP_BANNER_STATUS",
+        data: params
+    }, (res) => {
+        if (!res) {
+            Report.reportLog({
+                objectType: Report.objectType.chrome_extension_sendmessage_error
+            })
+        }
+    });
+}
+
 export const publishNFTTweetPost = ({ postId, srcContent, groupId }) => {
     let inputEle = document.querySelector('div[contenteditable="true"]');
     let textContent = inputEle.innerText
@@ -1845,10 +1855,7 @@ const groupBtnStyleChange = () => {
         if (line) {
             let { display } = line.style;
             if (display != 'none') {
-                chrome.runtime.sendMessage({
-                    actionType: "SWITCH_GROUP_BANNER_STATUS",
-                    data: { type: 'btn' }
-                }, () => { });
+                sendMessageToGroupBanner({ type: 'btn' })
             }
         }
     }
@@ -1986,10 +1993,7 @@ const addGroupTabEventListener = () => {
 
         let tipsDom = document.querySelector('#denet_group_banner');
         if (tipsDom) {
-            chrome.runtime.sendMessage({
-                actionType: "SWITCH_GROUP_BANNER_STATUS",
-                data: { type: 'btn' }
-            }, () => { });
+            sendMessageToGroupBanner({ type: 'btn' })
         } else {
             onShowGroupBanner();
         }
@@ -2000,10 +2004,7 @@ const onShowGroupBanner = () => {
     chrome.runtime.onMessage.addListener((req, sender, sendResponse) => {
         switch (req.actionType) {
             case 'IFRAME_SHOW_GROUP_TIP':
-                chrome.runtime.sendMessage({
-                    actionType: "SWITCH_GROUP_BANNER_STATUS",
-                    data: { type: 'btn' }
-                }, () => { });
+                sendMessageToGroupBanner({ type: 'btn' })
                 if (!getGroupTabNode()) {
                     addGroupTab();
                 }
@@ -2080,10 +2081,7 @@ const TweetTabEventHandler = () => {
         display: 'block'
     });
 
-    chrome.runtime.sendMessage({
-        actionType: "SWITCH_GROUP_BANNER_STATUS",
-        data: { type: 'arrow' }
-    }, () => { });
+    sendMessageToGroupBanner({ type: 'arrow' })
 };
 
 

+ 1 - 1
src/view/popup/setting/index.vue

@@ -6,7 +6,7 @@
                 class="icon-arrow"
                 @click="back"
             />
-            <span>SET</span>
+            <span>Settings</span>
         </div>
 
         <div class="item">