|
@@ -5,7 +5,7 @@ import {
|
|
|
backTwitterPinLoginCode,
|
|
|
} from "../logic/twitter.js";
|
|
|
|
|
|
-import { setChromeStorage, getChromeCookie, LANDING_PAGE, setChromeCookie, LANDING_PAGE_MIND } from "../uilts/chromeExtension";
|
|
|
+import { setChromeStorage, getChromeCookie, LANDING_PAGE, setChromeCookie, removeChromeCookie, LANDING_PAGE_MIND } from "../uilts/chromeExtension";
|
|
|
import { guid } from '../uilts/help.js'
|
|
|
|
|
|
chrome.runtime.onInstalled.addListener(onInstalledMethod);
|
|
@@ -13,20 +13,24 @@ chrome.runtime.onInstalled.addListener(onInstalledMethod);
|
|
|
chrome.runtime.onMessage.addListener(onMessageMethod);
|
|
|
|
|
|
function onInstalledMethod() {
|
|
|
- getChromeCookie({
|
|
|
- name: 'pickup_info',
|
|
|
- url: 'https://de-net-test.piaoquantv.com'
|
|
|
- }, (res) => {
|
|
|
- if(res) {
|
|
|
- let {postNickName, srcContentId} = res;
|
|
|
- if(postNickName && srcContentId) {
|
|
|
- let url = `https://twitter.com/${postNickName}/status/${srcContentId}`
|
|
|
- chrome.tabs.create({
|
|
|
- url
|
|
|
- });
|
|
|
- }
|
|
|
+ let cookiesParams = {
|
|
|
+ name: "pickup_info",
|
|
|
+ url: "https://de-net-test.piaoquantv.com",
|
|
|
+ };
|
|
|
+ getChromeCookie(cookiesParams, (res) => {
|
|
|
+ let { postNickName, srcContentId } = res;
|
|
|
+ if (res && postNickName && srcContentId) {
|
|
|
+ let url = `https://twitter.com/${postNickName}/status/${srcContentId}`;
|
|
|
+ chrome.tabs.create({
|
|
|
+ url,
|
|
|
+ });
|
|
|
+ removeChromeCookie(cookiesParams);
|
|
|
} else {
|
|
|
- backTwitterPinLoginToken();
|
|
|
+ chrome.tabs.create({
|
|
|
+ url: "https://twitter.com",
|
|
|
+ });
|
|
|
+ let { isOnToolbar } = checkIsPinned();
|
|
|
+ console.log(isOnToolbar);
|
|
|
}
|
|
|
})
|
|
|
getChromeCookie(LANDING_PAGE_MIND, (res_arr) => {
|
|
@@ -43,6 +47,11 @@ function onInstalledMethod() {
|
|
|
})
|
|
|
}
|
|
|
|
|
|
+async function checkIsPinned(){
|
|
|
+ let userSettings = await chrome.action.getUserSettings();
|
|
|
+ console.log('userSettings', userSettings.isOnToolbar)
|
|
|
+}
|
|
|
+
|
|
|
function onMessageMethod(req, sender, sendResponse) {
|
|
|
if (req) {
|
|
|
switch (req.method) {
|