Skip to content

Commit

Permalink
no longer store custom categories to disk
Browse files Browse the repository at this point in the history
still read it though to clean up
  • Loading branch information
DJSchaffner committed Apr 9, 2024
1 parent d2d03ee commit f47ab00
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ local L = addonBetterBags:GetModule('Localization')
local debug = false
local frame = CreateFrame("Frame", nil)

local customCategories = {}

-------------------------------------------------------

local function printChat(message)
Expand All @@ -28,14 +30,14 @@ end

local function updateCategories()
-- Wipe custom categories since we can't retrieve deleted set from itemRack (Except maybe store duplicate of sets and check last version of it)
for category, _ in pairs(CustomCategories) do
for category, _ in pairs(customCategories) do
-- @TODO use temporary categories when the feature is added in BetterBags
categories:DeleteCategory(L:G(category))
printChat("Deleted category '" .. L:G(category) .. "'")
end

-- Reset list of in-use categories
CustomCategories = {}
customCategories = {}

-- Keep track of all used items and their associated sets
local usedItems = {}
Expand Down Expand Up @@ -76,7 +78,7 @@ local function updateCategories()
label = "Sets: ".. table.concat(sets, ", ")
end

CustomCategories[L:G(label)] = true
customCategories[L:G(label)] = true
categories:AddItemToCategory(item, L:G(label))
-- printChat("Added item '" .. id .. "' to '" .. label .. "' category")
end
Expand All @@ -87,11 +89,12 @@ end

local function initCategories()
-- Prepare stored variable
if CustomCategories == nil then
printChat("Saved variable initialized..")
CustomCategories = {}
else
if CustomCategories ~= nil then
customCategories = CustomCategories
printChat("Saved variable restored..")

-- Reset saved variable (will be deprecated next update)
CustomCategories = {}
end

printChat("Initializing Categories..")
Expand Down

0 comments on commit f47ab00

Please sign in to comment.