[fix] ReaderZooming: Deal with some more zoom_mode shenanigans (#7780)

Migrate *global* zoom_mode settings to genus/type, too.

Nothing can actually set this as a global anymore, but we still honored
it nonetheless.

Fix #7778
This commit is contained in:
NiLuJe
2021-06-01 12:08:12 +02:00
committed by GitHub
parent 8d37d49d70
commit 0b58abada5
3 changed files with 78 additions and 48 deletions

View File

@@ -7,7 +7,7 @@ local lfs = require("libs/libkoreader-lfs")
local logger = require("logger")
-- Date at which the last migration snippet was added
local CURRENT_MIGRATION_DATE = 20210521
local CURRENT_MIGRATION_DATE = 20210531
-- Retrieve the date of the previous migration, if any
local last_migration_date = G_reader_settings:readSetting("last_migration_date", 0)
@@ -247,5 +247,20 @@ if last_migration_date < 20210521 then
end
end
-- 20210531, ReaderZooming, deprecate zoom_mode in global settings, https://github.com/koreader/koreader/pull/7780
if last_migration_date < 20210531 then
logger.info("Performing one-time migration for 20210531")
if G_reader_settings:has("zoom_mode") then
local ReaderZooming = require("apps/reader/modules/readerzooming")
-- NOTE: For simplicity's sake, this will overwrite potentially existing genus/type globals,
-- as they were ignored in this specific case anyway...
local zoom_mode_genus, zoom_mode_type = ReaderZooming:mode_to_combo(G_reader_settings:readSetting("zoom_mode"))
G_reader_settings:saveSetting("kopt_zoom_mode_genus", zoom_mode_genus)
G_reader_settings:saveSetting("kopt_zoom_mode_type", zoom_mode_type)
G_reader_settings:delSetting("zoom_mode")
end
end
-- We're done, store the current migration date
G_reader_settings:saveSetting("last_migration_date", CURRENT_MIGRATION_DATE)