Skip to content

Commit

Permalink
41
Browse files Browse the repository at this point in the history
  • Loading branch information
luozhiya committed Jan 27, 2025
1 parent b25a9dd commit 75cc5f1
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions lua/fittencode/client/notify_login.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
local Config = require('fittencode.config')
local Translate = require('fittencode.translate')

local M = {}

local note_login_dismissed = false
local last_note_login_time = 0
local note_login_interval = 1e3 * 60 * 5

function M.notify_login()
if not note_login_dismissed and ((vim.uv.hrtime() - last_note_login_time) / 1e6) < note_login_interval then
last_note_login_time = vim.uv.hrtime()
vim.ui.select({ 'Login', 'Dismiss' }, {
prompt = Translate('[Fitten Code] Please login first.'),
}, function(choice)
if choice == 'Login' then
vim.schedule(function()
vim.cmd('FittenCode login')
end)
elseif choice == 'Dismiss' then
note_login_dismissed = true
end
end)
end
end

function M.register_service()
end

return M

0 comments on commit 75cc5f1

Please sign in to comment.