cicy-desktop 2.1.230 → 2.1.231
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -28,10 +28,12 @@ let homeTabWc = null; // the homepage's resident-tab webContents (primary path
|
|
|
28
28
|
// browser window (homepage = profile 0 的起始页). Clicking a team there
|
|
29
29
|
// opens the team as another tab in the same window. Falls back to a standalone
|
|
30
30
|
// window only if the tab engine throws, so the homepage is never unreachable.
|
|
31
|
-
async function openHomepage() {
|
|
31
|
+
async function openHomepage(opts = {}) {
|
|
32
32
|
try {
|
|
33
33
|
const tabBrowser = require("../tools/tab-browser-tools");
|
|
34
|
-
|
|
34
|
+
// opts.activate=false(deeplink / second-instance 顺带调用)→ 不抢用户当前 tab,只保证
|
|
35
|
+
// 首页存在 + 窗口在前台;不传(tray「打开首页」/ 启动)→ 默认切到首页 tab。
|
|
36
|
+
const { win, wc } = tabBrowser.openHomeWindow(0, pickHomepageURL(), opts);
|
|
35
37
|
if (wc) {
|
|
36
38
|
homeTabWc = wc;
|
|
37
39
|
try { wc.once("destroyed", () => { if (homeTabWc === wc) homeTabWc = null; }); } catch {}
|
package/src/main.js
CHANGED
|
@@ -248,7 +248,7 @@ async function handleDeepLink(url) {
|
|
|
248
248
|
if (electronApp.isReady()) {
|
|
249
249
|
try {
|
|
250
250
|
const { openHomepage } = require("./backends/homepage-window");
|
|
251
|
-
openHomepage();
|
|
251
|
+
openHomepage({ activate: false }); // deeplink 顺带唤起,不抢用户当前 tab(团队列表已由 broadcast 刷新)
|
|
252
252
|
} catch {}
|
|
253
253
|
}
|
|
254
254
|
}
|
|
@@ -276,7 +276,7 @@ electronApp.on("second-instance", (_e, argv) => {
|
|
|
276
276
|
|
|
277
277
|
try {
|
|
278
278
|
const { openHomepage } = require("./backends/homepage-window");
|
|
279
|
-
openHomepage();
|
|
279
|
+
openHomepage({ activate: false }); // 再次启动 exe 只把窗口带到前台,不抢走用户正在看的团队 tab
|
|
280
280
|
} catch {}
|
|
281
281
|
const { BrowserWindow } = require("electron");
|
|
282
282
|
for (const w of BrowserWindow.getAllWindows()) {
|
|
@@ -389,11 +389,18 @@ async function openTab(accountIdx, url, opts = {}) {
|
|
|
389
389
|
// { win, wc } so the homepage module can track the tab's webContents for the
|
|
390
390
|
// main→renderer pushes (auth:complete, update-state) that used to target the
|
|
391
391
|
// standalone homepage window.
|
|
392
|
-
function openHomeWindow(accountIdx, homeUrl) {
|
|
392
|
+
function openHomeWindow(accountIdx, homeUrl, opts = {}) {
|
|
393
393
|
const m = ensureManager(accountIdx);
|
|
394
394
|
let tab = m.tabs.find((t) => t.home);
|
|
395
|
-
if (tab) {
|
|
396
|
-
|
|
395
|
+
if (tab) {
|
|
396
|
+
// 只在明确要求(用户点「打开首页」/ 启动)时才切到首页 tab。deeplink / second-instance 等
|
|
397
|
+
// **顺带**触发 openHomepage 的路径传 activate:false —— 绝不抢走用户正在看的团队 tab,否则
|
|
398
|
+
// 对话着对话着窗口就莫名切到「我的团队」(用户报的 bug)。当前本来就是首页 tab、或还没有任何
|
|
399
|
+
// active tab 时,activate 无副作用,照常执行。
|
|
400
|
+
if (opts.activate !== false || m.activeId == null || m.activeId === tab.id) m.activate(tab.id);
|
|
401
|
+
} else {
|
|
402
|
+
const id = m.addTab(homeUrl, { home: true }); tab = m.tabs.find((t) => t.id === id);
|
|
403
|
+
}
|
|
397
404
|
try { m.win.show(); m.win.focus(); } catch (e) {}
|
|
398
405
|
let wc = null; try { wc = tab ? tab.view.webContents : null; } catch (e) {}
|
|
399
406
|
return { win: m.win, wc };
|