Skip to content

Commit 7b85bf4

Browse files
committed
Remove error code on login and fix hanging item slot controls in tradequery
1 parent 79f70d9 commit 7b85bf4

1 file changed

Lines changed: 12 additions & 13 deletions

File tree

src/Classes/TradeQuery.lua

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -484,6 +484,8 @@ Highest Weight - Displays the order retrieved from trade]]
484484
main.lastRefreshToken = main.api.refreshToken
485485
main.tokenExpiry = main.api.tokenExpiry
486486
main:SaveSettings()
487+
488+
TradeQueryClass:SetNotice(self.controls.pbNotice, "")
487489
else
488490
self.charImportStatus = colorCodes.WARNING.."Not authenticated"
489491
end
@@ -531,6 +533,16 @@ Highest Weight - Displays the order retrieved from trade]]
531533
self.controls["name"..row_count].shown = function()
532534
return hideRowFunc(self, row_count)
533535
end
536+
537+
-- fix case where the row count is reduced from the last time the popup was
538+
-- opened, which would leave extra row controls in the menu
539+
for k, v in pairs(self.controls) do
540+
local number = k:match("(%d+)")
541+
if number and tonumber(number) > row_count then
542+
self.controls[k] = nil
543+
end
544+
end
545+
534546
row_count = row_count + 2
535547

536548
local effective_row_count = row_count - ((scrollBarShown and #slotTables >= 19) and #slotTables-19 or 0) + 2 + 2 -- Two top menu rows, two bottom rows, slots after #19 overlap the other controls at the bottom of the pane
@@ -541,22 +553,9 @@ Highest Weight - Displays the order retrieved from trade]]
541553
self.controls.scrollBar = new("ScrollBarControl", {"TOPRIGHT", self.controls["StatWeightMultipliersButton"],"TOPRIGHT"}, {0, 25, 18, 0}, 50, "VERTICAL", false)
542554
self.controls.scrollBar.shown = function() return scrollBarShown end
543555

544-
local function wipeItemControls()
545-
for index, _ in pairs(self.controls) do
546-
if index:match("%d") then
547-
self.controls[index] = nil
548-
end
549-
end
550-
end
551556
self.controls.fullPrice = new("LabelControl", {"BOTTOM", nil, "BOTTOM"}, {0, -row_height - pane_margins_vertical - row_vertical_padding, pane_width - 2 * pane_margins_horizontal, row_height}, "")
552557
self.controls.close = new("ButtonControl", {"BOTTOM", nil, "BOTTOM"}, {0, -pane_margins_vertical, 90, row_height}, "Done", function()
553558
main:ClosePopup()
554-
-- there's a case where if you have a socket(s) allocated, open TradeQuery, close it, dealloc, then open TradeQuery again
555-
-- the deallocated socket controls were still showing, so this will remove all dynamically created controls from items
556-
557-
-- later note: this is disabled because it causes the trader to crash if
558-
-- it's closed mid-search
559-
-- wipeItemControls()
560559
end)
561560

562561
self.controls.updateCurrencyConversion = new("ButtonControl", {"BOTTOMLEFT", nil, "BOTTOMLEFT"}, {pane_margins_horizontal, -pane_margins_vertical, 240, row_height}, "Get Currency Conversion Rates", function()

0 commit comments

Comments
 (0)