[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>.
pull/5280/head
Frans de Jonge 5 years ago committed by GitHub
parent dd4bfb0a45
commit 6979e080f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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

Loading…
Cancel
Save