mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
[fix, UX] Update kosync login/logout text (#5278)
As a side effect of <https://github.com/koreader/koreader/pull/4189> some menus have to manually trigger updates. I'm not overly enthused with this solution but I couldn't think of anything better right now. Fixes <https://github.com/koreader/koreader/issues/5224>.
This commit is contained in:
@@ -96,9 +96,17 @@ function KOSync:addToMainMenu(menu_items)
|
||||
end,
|
||||
keep_menu_open = true,
|
||||
callback_func = function()
|
||||
return self.kosync_userkey and
|
||||
function() self:logout() end or
|
||||
function() self:login() end
|
||||
if self.kosync_userkey then
|
||||
return function(menu)
|
||||
self._menu_to_update = menu
|
||||
self:logout()
|
||||
end
|
||||
else
|
||||
return function(menu)
|
||||
self._menu_to_update = menu
|
||||
self:login()
|
||||
end
|
||||
end
|
||||
end,
|
||||
},
|
||||
{
|
||||
@@ -328,6 +336,7 @@ function KOSync:doRegister(username, password)
|
||||
elseif status then
|
||||
self.kosync_username = username
|
||||
self.kosync_userkey = userkey
|
||||
self._menu_to_update:updateItems()
|
||||
UIManager:show(InfoMessage:new{
|
||||
text = _("Registered to KOReader server."),
|
||||
})
|
||||
@@ -363,6 +372,7 @@ function KOSync:doLogin(username, password)
|
||||
elseif status then
|
||||
self.kosync_username = username
|
||||
self.kosync_userkey = userkey
|
||||
self._menu_to_update:updateItems()
|
||||
UIManager:show(InfoMessage:new{
|
||||
text = _("Logged in to KOReader server."),
|
||||
})
|
||||
@@ -378,6 +388,7 @@ end
|
||||
function KOSync:logout()
|
||||
self.kosync_userkey = nil
|
||||
self.kosync_auto_sync = true
|
||||
self._menu_to_update:updateItems()
|
||||
self:saveSettings()
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user