[UX] Add Device:openLink() stub for Linux SDL (#4822)

References #4821.
pull/4824/head
Frans de Jonge 5 years ago committed by GitHub
parent 728bb187fa
commit b1ed2838c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -614,6 +614,11 @@ function ReaderLink:onGotoLink(link, neglect_current_location, allow_footnote_po
return true
end
-- try opening link in native browser
if Device:openLink(link_url) then
return true
end
-- Not supported
UIManager:show(InfoMessage:new{
text = T(_("Invalid or external link:\n%1"), link_url),

@ -64,6 +64,8 @@ local Device = {
-- set to yes on devices that support over-the-air incremental updates.
hasOTAUpdates = no,
openLink = no,
}
function Device:new(o)

@ -17,6 +17,10 @@ local Device = Generic:new{
needsScreenRefreshAfterResume = no,
hasColorScreen = yes,
hasEinkScreen = no,
openLink = function(self, link)
if not link or type(link) ~= "string" then return end
return os.execute("xdg-open '"..link.."'") == 0
end,
}
local AppImage = Device:new{

@ -236,7 +236,7 @@ function OTAManager:fetchAndProcessUpdate()
android.notification(T(_("Downloading %1"), ota_package))
end
elseif Device:isSDL() then
os.execute("xdg-open '"..link.."'")
Device:openLink(link)
end
end
})

Loading…
Cancel
Save