Skip to content

Commit

Permalink
hot-fix: Only shows update message once per session
Browse files Browse the repository at this point in the history
  • Loading branch information
drewbaumann committed Oct 25, 2024
1 parent e77efeb commit 4b30395
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,25 @@ local AskGPT = InputContainer:new {
is_doc_only = true,
}

-- Flag to ensure the update message is shown only once per session
local updateMessageShown = false

function AskGPT:init()
self.ui.highlight:addToHighlightDialog("askgpt_ChatGPT", function(_reader_highlight_instance)
return {
text = _("Ask ChatGPT"),
enabled = Device:hasClipboard(),
callback = function()
NetworkMgr:runWhenOnline(function()
UpdateChecker.checkForUpdates()
if not updateMessageShown then
UpdateChecker.checkForUpdates()
updateMessageShown = true -- Set flag to true so it won't show again
end
showChatGPTDialog(self.ui, _reader_highlight_instance.selected_text.text)
end)
end,
}
end)
end

return AskGPT
return AskGPT

0 comments on commit 4b30395

Please sign in to comment.