🐛 (shelf): 微信书架待导入快照只弹一次导入页,普通刷新不再重复弹窗

Co-authored-by: Copilot <[email protected]>
This commit is contained in:
GarfieldandCopilot committed 2026-12-03 14:55:00 +08:00
1 parent d77606c6f8
commit b4ff3791f1
4 files changed
+22 -1

No files matched your search

@@ -138,6 +138,7 @@ function Client:shelfSyncAsync(cb, spill, open_import)
local ok, werr = ShelfImport.stash(data.body)
Awake.hold("wechat_shelf", false)
if ok and open_import then
ShelfImport.prompted = true
require("utils.extension").call("web.open_page", ShelfImport.PAGE, _("微信书架导入"), ShelfImport.TOO_LARGE)
end
cb(nil, ok and ShelfImport.TOO_LARGE or werr)
@@ -55,7 +55,11 @@ function ShelfImport.size()
return size
end
--- 当前待导入快照是否已弹过导入页(进程内);快照没了就清零。
ShelfImport.prompted = false
function ShelfImport.discard()
ShelfImport.prompted = false
os.remove(ShelfImport.path())
end
@@ -512,7 +512,7 @@ function Source:syncBooksAsync(opts, cb)
local client = self._client
local remote = {
shelfSyncAsync = function(_, done)
return client:shelfSyncAsync(done, true, opts.force == true)
return client:shelfSyncAsync(done, true, opts.force == true or opts.manual == true)
end,
addToShelfAsync = function(_, id, done) return client:addToShelfAsync(id, done) end,
removeFromShelfAsync = function(_, id, done) return client:removeFromShelfAsync(id, done) end,
@@ -536,6 +536,11 @@ function Source:syncBooksAsync(opts, cb)
if opts.force then return fullPull() end
local pending_import = require("moonsource_weread.shelf_import")
if pending_import.size() then
-- 后台先存盘的快照用户没见过导入页:普通手动刷新补弹一次,之后不再打扰。
if opts.manual and not pending_import.prompted then
pending_import.prompted = true
require("utils.extension").call("web.open_page", pending_import.PAGE, _("微信书架导入"), pending_import.TOO_LARGE)
end
return SourceBase.defer(cb, {
pulled = 0, pushed = 0, hidden = 0, conflicts = 0,
skipped = true, reason = "pending_import",