<commit_before>Chotify = LCS.class{}

local vsx, vsy

function Chotify:init()
    self.enabled = true
    self.NOTIFICATION_LIMIT = 5
    Spring.Log("Chotify", LOG.NOTICE, "Enabled: " .. tostring(self.enabled))

    self.notifications = {}
    self.totalNotifications = 0
    self._idCounter = 0

    vsx, vsy = Spring.GetViewGeometry()
end

-- this receives the widget:Update callins
function Chotify:_Update()
end

function Chotify:CloseNotification(id)
    local notification = self.notifications[id]
    if notification == nil then
        return
    end
    local window = notification.window
	if not window then
		return
	end
    window:Dispose()
    --[[
    ChiliFX:AddFadeEffect({
        obj = window,
        time = 0.2,
        endValue = 0,
        startValue = 1,
        after = function()
            window:Dispose()
        end,
    })
    ]]
    self.notifications[id] = nil
    self.totalNotifications = self.totalNotifications - 1
    local sorted = self:_SortByStartTimeDesc()
    self:_Realign(sorted)
end

local WINDOW_HEIGHT = 200
local WINDOW_WIDTH = 400

function Chotify:Post(obj)
    if not self.enabled then
        return
    end

    local title = obj.title or ""
    local body = obj.body or ""
    local icon = obj.icon or ""<commit_msg>support simple string-only notifications<commit_after>Chotify = LCS.class{}

local vsx, vsy

function Chotify:init()
    self.enabled = true
    self.NOTIFICATION_LIMIT = 5
    Spring.Log("Chotify", LOG.NOTICE, "Enabled: " .. tostring(self.enabled))

    self.notifications = {}
    self.totalNotifications = 0
    self._idCounter = 0

    vsx, vsy = Spring.GetViewGeometry()
end

-- this receives the widget:Update callins
function Chotify:_Update()
end

function Chotify:CloseNotification(id)
    local notification = self.notifications[id]
    if notification == nil then
        return
    end
    local window = notification.window
	if not window then
		return
	end
    window:Dispose()
    --[[
    ChiliFX:AddFadeEffect({
        obj = window,
        time = 0.2,
        endValue = 0,
        startValue = 1,
        after = function()
            window:Dispose()
        end,
    })
    ]]
    self.notifications[id] = nil
    self.totalNotifications = self.totalNotifications - 1
    local sorted = self:_SortByStartTimeDesc()
    self:_Realign(sorted)
end

local WINDOW_HEIGHT = 200
local WINDOW_WIDTH = 400

function Chotify:Post(obj)
    if not self.enabled then
        return
    end

    if type(obj) == "string" then
        obj = { body = obj }
    end

    local title = obj.title or ""
    local body = obj.body or ""
    local icon = obj.icon or ""
{'fraction_non_alphanumeric': 0.09806891329042029, 'fraction_numerical': 0.010602044680045438, 'mean_word_length': 2.5848032564450474, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '341998', 'n_tokens_mistral': 862, 'n_tokens_neox': 825, 'n_words': 215}