Compare commits
3
Commits
v0.4.0
...
c9ecc00861
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c9ecc00861 | ||
|
|
b4ff3791f1 | ||
|
|
d77606c6f8 |
No files matched your search
@@ -1,5 +1,9 @@
|
|||||||
# 更新日志
|
# 更新日志
|
||||||
|
|
||||||
|
## 0.4.1
|
||||||
|
|
||||||
|
- :bug: (shelf): 微信书架待导入快照只弹一次导入页,普通刷新不再重复弹窗
|
||||||
|
|
||||||
## 0.4.0
|
## 0.4.0
|
||||||
|
|
||||||
- :lock: (notes): 新想法默认私有,设置里可改可见范围
|
- :lock: (notes): 新想法默认私有,设置里可改可见范围
|
||||||
|
|||||||
@@ -138,6 +138,7 @@ function Client:shelfSyncAsync(cb, spill, open_import)
|
|||||||
local ok, werr = ShelfImport.stash(data.body)
|
local ok, werr = ShelfImport.stash(data.body)
|
||||||
Awake.hold("wechat_shelf", false)
|
Awake.hold("wechat_shelf", false)
|
||||||
if ok and open_import then
|
if ok and open_import then
|
||||||
|
ShelfImport.prompted = true
|
||||||
require("utils.extension").call("web.open_page", ShelfImport.PAGE, _("微信书架导入"), ShelfImport.TOO_LARGE)
|
require("utils.extension").call("web.open_page", ShelfImport.PAGE, _("微信书架导入"), ShelfImport.TOO_LARGE)
|
||||||
end
|
end
|
||||||
cb(nil, ok and ShelfImport.TOO_LARGE or werr)
|
cb(nil, ok and ShelfImport.TOO_LARGE or werr)
|
||||||
|
|||||||
@@ -55,7 +55,11 @@ function ShelfImport.size()
|
|||||||
return size
|
return size
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- 当前待导入快照是否已弹过导入页(进程内);快照没了就清零。
|
||||||
|
ShelfImport.prompted = false
|
||||||
|
|
||||||
function ShelfImport.discard()
|
function ShelfImport.discard()
|
||||||
|
ShelfImport.prompted = false
|
||||||
os.remove(ShelfImport.path())
|
os.remove(ShelfImport.path())
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -512,7 +512,7 @@ function Source:syncBooksAsync(opts, cb)
|
|||||||
local client = self._client
|
local client = self._client
|
||||||
local remote = {
|
local remote = {
|
||||||
shelfSyncAsync = function(_, done)
|
shelfSyncAsync = function(_, done)
|
||||||
return client:shelfSyncAsync(done, true, opts.force == true)
|
return client:shelfSyncAsync(done, true, opts.force == true or opts.manual == true)
|
||||||
end,
|
end,
|
||||||
addToShelfAsync = function(_, id, done) return client:addToShelfAsync(id, done) end,
|
addToShelfAsync = function(_, id, done) return client:addToShelfAsync(id, done) end,
|
||||||
removeFromShelfAsync = function(_, id, done) return client:removeFromShelfAsync(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
|
if opts.force then return fullPull() end
|
||||||
local pending_import = require("moonsource_weread.shelf_import")
|
local pending_import = require("moonsource_weread.shelf_import")
|
||||||
if pending_import.size() then
|
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, {
|
return SourceBase.defer(cb, {
|
||||||
pulled = 0, pushed = 0, hidden = 0, conflicts = 0,
|
pulled = 0, pushed = 0, hidden = 0, conflicts = 0,
|
||||||
skipped = true, reason = "pending_import",
|
skipped = true, reason = "pending_import",
|
||||||
|
|||||||
@@ -47,7 +47,9 @@ live.doc_settings = {
|
|||||||
}
|
}
|
||||||
package.loaded["apps/reader/readerui"] = { instance = live }
|
package.loaded["apps/reader/readerui"] = { instance = live }
|
||||||
package.loaded["reader.session"] = {
|
package.loaded["reader.session"] = {
|
||||||
_snapshot = { identity = { source_id = "local", stable_id = "open-book", chapter_idx = 2 } },
|
current = function()
|
||||||
|
return { identity = { source_id = "local", stable_id = "open-book", chapter_idx = 2 } }
|
||||||
|
end,
|
||||||
}
|
}
|
||||||
|
|
||||||
local wechat_notes = require("moonsource_weread.notes")
|
local wechat_notes = require("moonsource_weread.notes")
|
||||||
|
|||||||
@@ -438,10 +438,6 @@ do
|
|||||||
source_id = "authoritative", stable_id = "book.epub", chapter_idx = 3,
|
source_id = "authoritative", stable_id = "book.epub", chapter_idx = 3,
|
||||||
source = authoritative,
|
source = authoritative,
|
||||||
}), 0)
|
}), 0)
|
||||||
Assert.eq(SessionNote.applyLocal({ doc_settings = ui3.doc_settings }, {
|
|
||||||
source_id = "authoritative", stable_id = "book.epub", chapter_idx = 2,
|
|
||||||
source = authoritative,
|
|
||||||
}), 0, "没有打开文档时不应用")
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 上传窗口内用户又划了线:不能用上传时那份快照 + 旧修订号覆盖回去。
|
-- 上传窗口内用户又划了线:不能用上传时那份快照 + 旧修订号覆盖回去。
|
||||||
|
|||||||
@@ -1569,6 +1569,17 @@ do
|
|||||||
Assert.is_true(reopen_pending, "手动强制刷新重新打开已有导入页")
|
Assert.is_true(reopen_pending, "手动强制刷新重新打开已有导入页")
|
||||||
Assert.eq(err, "pending import")
|
Assert.eq(err, "pending import")
|
||||||
|
|
||||||
|
-- 后台同步先把快照存盘,之后普通手动刷新(非长按强刷)也必须弹出导入页
|
||||||
|
local opened = 0
|
||||||
|
require("utils.extension").add("web.open_page", function() opened = opened + 1 end)
|
||||||
|
src:syncBooksAsync({ manual = true }, function(r, e) result, err = r, e end)
|
||||||
|
require("support.stubs").flush()
|
||||||
|
Assert.eq(opened, 1, "普通手动刷新遇到没弹过的待导入快照要弹一次")
|
||||||
|
Assert.is_true(result.skipped)
|
||||||
|
src:syncBooksAsync({ manual = true }, function(r, e) result, err = r, e end)
|
||||||
|
require("support.stubs").flush()
|
||||||
|
Assert.eq(opened, 1, "同一份快照只弹一次,之后的普通刷新不再弹")
|
||||||
|
|
||||||
fake_client.shelfSyncIdsAsync, fake_client.shelfSyncAsync = nil, nil
|
fake_client.shelfSyncIdsAsync, fake_client.shelfSyncAsync = nil, nil
|
||||||
package.loaded["moonsource_weread.shelf_import"] = saved_import
|
package.loaded["moonsource_weread.shelf_import"] = saved_import
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in new issue
Block a user