Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix friends tab for !profile command #1821

Merged
merged 1 commit into from
Jan 10, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 22 additions & 11 deletions MainModule/Client/UI/Default/Profile.luau
Original file line number Diff line number Diff line change
Expand Up @@ -162,29 +162,40 @@ return function(data, env)
window:Ready()

do --// Friends Tab
local function pagesToTable(pages)
local items = {}
while true do
table.insert(items, pages:GetCurrentPage())
if pages.IsFinished then
break
end
pages:AdvanceToNextPageAsync()
end
return items
end
local function iterPageItems(pages)
local contents = pagesToTable(pages)
local pagenum = 1
local lastpagenum = #contents
return coroutine.wrap(function()
local pagenum = 1
while true do
for _, item in ipairs(pages:GetCurrentPage()) do
while pagenum <= lastpagenum do
for _, item in ipairs(contents[pagenum]) do
coroutine.yield(item, pagenum)
end
if pages.IsFinished then
break
end
pages:AdvanceToNextPageAsync()

pagenum += 1
end
end)
end

local LOCATION_TYPE = {"Mobile Website", "Mobile InGame", "Webpage", "Studio", "InGame", "Xbox", "Team Create"}
local LOCATION_TYPE = {"Mobile Website", "Mobile In-Game", "Webpage", "Studio", "In-Game", "Xbox", "Team Create"}
local ACTIVITY_COLOR_CODES = {
["Mobile Website"] = Color3.fromRGB(50, 140, 231);
["Mobile InGame"] = Color3.fromRGB(55, 200, 55);
["Mobile In-Game"] = Color3.fromRGB(55, 200, 55);
["Webpage"] = Color3.fromRGB(50, 140, 231);
["Studio"] = Color3.fromRGB(231, 112, 0);
["InGame"] = Color3.fromRGB(55, 200, 55);
["In-Game"] = Color3.fromRGB(55, 200, 55);
["Xbox"] = Color3.fromRGB(127, 0, 127);
["Team Create"] = Color3.fromRGB(231, 112, 0);
}
Expand All @@ -210,7 +221,7 @@ return function(data, env)
Routine(function()
for item, pageNo in iterPageItems(friendPages) do
table.insert(sortedFriends, item.Username)
local userId = item.id
local userId = item.Id
local activity = onlineFriends[userId]
friendInfoRef[item.Username] = {
id = userId;
Expand Down Expand Up @@ -467,4 +478,4 @@ return function(data, env)
else
gametab:Disable()
end
end
end
Loading