Compare commits

...

3 Commits

Author SHA1 Message Date
Jay 6a2ed2629f fix 2020-05-05 22:47:29 +01:00
Jay 17599a6eaf Scrollview scrollbarwidth 2020-05-05 22:41:39 +01:00
Jay cb36ce065a Show pending apps 2020-05-05 21:40:01 +01:00
3 changed files with 79 additions and 21 deletions

View File

@ -30,20 +30,6 @@ local function createApp(app)
active = false
})
teverse.construct("guiIcon", {
parent = appGui,
size = guiCoord(1, 0, 1, -45),
position = guiCoord(0, 0, 0, 45),
iconMax = 20,
iconColour = colour(1, 1, 1),
iconType = "faSolid",
iconId = "code",
iconAlpha = 0.9,
backgroundAlpha = 1.0,
backgroundColour = colour.rgb(216, 100, 89),
active = false
})
return appGui
end
@ -78,30 +64,100 @@ return {
local subtitle = teverse.construct("guiTextBox", {
parent = page,
size = guiCoord(1.0, -20, 0, 18),
position = guiCoord(0, 10, 0, 58),
position = guiCoord(0, 10, 0, 105),
backgroundAlpha = 0,
text = "Loading Apps",
textSize = 18,
textAlign = "middleLeft"
})
local myApps = teverse.construct("guiFrame", {
parent = page,
size = guiCoord(1.0, -20, 0, 38),
position = guiCoord(0, 10, 0, 62),
backgroundAlpha = 0
})
teverse.http:get("https://teverse.com/api/users/" .. teverse.networking.localClient.id .. "/apps", {
["Authorization"] = "BEARER " .. teverse.userToken
}, function(code, body)
if code == 200 then
local apps = teverse.json:decode(body)
for i,app in pairs(apps) do
local appGui = teverse.construct("guiFrame", {
strokeRadius = 2,
dropShadowAlpha = 0.15,
strokeAlpha = 0.05,
parent = myApps,
position = guiCoord(0, (i-1)*140, 0, 0),
size = guiCoord(0, 130, 1, 0)
})
teverse.guiHelper.hoverColour(appGui, colour.rgb(247, 247, 247))
teverse.construct("guiTextBox", {
parent = appGui,
size = guiCoord(1.0, -20, 0, 16),
position = guiCoord(0, 10, 0, 5),
backgroundAlpha = 0,
text = app.name,
textSize = 18,
textAlign = "middleLeft",
textFont = "tevurl:fonts/openSansSemiBold.ttf",
active = false
})
teverse.construct("guiTextBox", {
parent = appGui,
size = guiCoord(1.0, -20, 0, 14),
position = guiCoord(0, 10, 0, 21),
backgroundAlpha = 0,
text = app.approved and "Approved" or "Pending",
textSize = 14,
textAlign = "middleLeft",
textFont = "tevurl:fonts/openSansBold.ttf",
active = false
})
appGui:on("mouseLeftUp", function()
if not loading.visible then
loading.text = "Working..."
loading.visible = true
teverse.http:get("https://teverse.com/api/apps/" .. app.id .. "/script", {
["Authorization"] = "BEARER " .. teverse.userToken
}, function(code, body)
if code == 200 then
loading.visible = false
teverse.apps:loadString(body)
else
loading.text = "Unable to load app."
sleep(1.5)
loading.visible = false
end
end)
end
end)
end
end
end)
local appsContainer = teverse.construct("guiFrame", {
parent = page,
size = guiCoord(1.0, -20, 1, -100),
position = guiCoord(0, 10, 0, 90),
size = guiCoord(1.0, -20, 1, -140),
position = guiCoord(0, 10, 0, 130),
backgroundAlpha = 0
})
if _DEVICE:sub(0, 6) == "iPhone" then
teverse.guiHelper
.gridConstraint(appsContainer, {
cellSize = guiCoord(0, page.absoluteSize.x - 20, 0, 80),
cellSize = guiCoord(0, page.absoluteSize.x - 20, 0, 50),
cellMargin = guiCoord(0, 15, 0, 25)
})
else
teverse.guiHelper
.gridConstraint(appsContainer, {
cellSize = guiCoord(0, 160, 0, 80),
cellSize = guiCoord(0, 160, 0, 50),
cellMargin = guiCoord(0, 15, 0, 25)
})
end
@ -129,7 +185,7 @@ return {
}, function(code, body)
if code == 200 then
local apps = teverse.json:decode(body)
subtitle.text = "Found " .. #apps .. " public apps."
subtitle.text = "Found " .. #apps .. " public apps:"
for _,app in pairs(apps) do
local appGui = createApp(app)
appGui.parent = appsContainer

View File

@ -162,7 +162,8 @@ return {
size = guiCoord(1, 0, 1, 50),
position = guiCoord(0, 0, 0, -50),
backgroundAlpha = 0,
strokeRadius = 3
strokeRadius = 3,
scrollbarWidth = 4
})
teverse.guiHelper

View File

@ -10,6 +10,7 @@ local container = teverse.construct("guiScrollView", {
position = guiCoord(0, 0, 0, 50),
canvasSize = guiCoord(1, 0, 1, 0),
backgroundAlpha = 0,
scrollbarWidth = 4
})
teverse.construct("guiTextBox", {