From 5a1bb685c967b669ffaba5b411f98ed3c01bbb1e Mon Sep 17 00:00:00 2001 From: Brooke Rhodes Date: Fri, 15 May 2026 12:36:18 -0700 Subject: [PATCH 1/2] copy auth url on click --- .../AddAccountFlow/StartPage/BrowserFlow.luau | 22 +++++++++++++++++-- .../Notification/NotificationsContainer.luau | 2 +- rokit.toml | 2 +- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/plugin/src/AddAccountFlow/StartPage/BrowserFlow.luau b/plugin/src/AddAccountFlow/StartPage/BrowserFlow.luau index 530252a..4c09ad5 100644 --- a/plugin/src/AddAccountFlow/StartPage/BrowserFlow.luau +++ b/plugin/src/AddAccountFlow/StartPage/BrowserFlow.luau @@ -1,3 +1,5 @@ +local UserInputService = game:GetService("UserInputService") + local Plugin = script:FindFirstAncestor("StudioActivity") local Packages = Plugin.Packages @@ -6,6 +8,7 @@ local React = require(Packages.React) local ReactCharm = require(Packages.ReactCharm) local AuthContext = require(script.Parent.Parent.AuthContext) +local NotificationStore = require(Plugin.Source.Notification.NotificationStore) local Steps = require(script.Parent.Steps) local TextInput = Foundation.TextInput @@ -18,6 +21,16 @@ local useState = React.useState local useEffect = React.useEffect local useCallback = React.useCallback +local function sendCopyKeycode() + local virtualInput: VirtualInput = UserInputService:CreateVirtualInput() :: any + + virtualInput:SendKey(true, Enum.KeyCode.LeftControl) + virtualInput:SendKey(true, Enum.KeyCode.C) + + virtualInput:SendKey(false, Enum.KeyCode.LeftControl) + virtualInput:SendKey(false, Enum.KeyCode.C) +end + local function BrowserFlow() local auth = AuthContext.useAuth() @@ -47,7 +60,12 @@ local function BrowserFlow() if textbox then textbox.TextEditable = false - local focusConnection = textbox.Focused:Connect(selectAll) + local focusConnection = textbox.Focused:Connect(function() + selectAll() + + sendCopyKeycode() + NotificationStore.get().push("info", "Copied URL to clipboard") + end) -- Re-select all if the user clicks to move the cursor while focused. -- CursorPosition changes when the user clicks within the box or @@ -94,7 +112,7 @@ local function BrowserFlow() steps = { { id = "step-1", - text = "Select and copy this link", + text = "Select to copy this link", content = e(TextInput, { onReturnPressed = function() end, text = startUrl, diff --git a/plugin/src/Notification/NotificationsContainer.luau b/plugin/src/Notification/NotificationsContainer.luau index 3deb43d..fb2a298 100644 --- a/plugin/src/Notification/NotificationsContainer.luau +++ b/plugin/src/Notification/NotificationsContainer.luau @@ -25,7 +25,7 @@ local function NotificationsContainer() return e(View, { tag = "size-full", - ZIndex = 10, + ZIndex = 300, }, active and e(Notification, { key = tostring(active.id), type = active.type, diff --git a/rokit.toml b/rokit.toml index ed192b2..b37e57b 100644 --- a/rokit.toml +++ b/rokit.toml @@ -4,7 +4,7 @@ wally = "UpliftGames/wally@0.3.2" wally-package-types = "JohnnyMorganz/wally-package-types@1.6.2" selene = "Kampfkarren/selene@0.30.1" stylua = "johnnymorganz/stylua@2.4.0" -luau-lsp = "JohnnyMorganz/luau-lsp@1.66.0" +luau-lsp = "JohnnyMorganz/luau-lsp@1.67.0" lune = "lune-org/lune@0.10.4" roblox-packages = "flipbook-labs/roblox-packages@0.5.0" lute = "luau-lang/lute@1.0.0" From 12bb5e324263e7e117008516464f8e8ac048fb9e Mon Sep 17 00:00:00 2001 From: Brooke Rhodes Date: Mon, 18 May 2026 21:34:18 -0400 Subject: [PATCH 2/2] harden --- plugin/src/AddAccountFlow/StartPage/BrowserFlow.luau | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/plugin/src/AddAccountFlow/StartPage/BrowserFlow.luau b/plugin/src/AddAccountFlow/StartPage/BrowserFlow.luau index 4c09ad5..73d998d 100644 --- a/plugin/src/AddAccountFlow/StartPage/BrowserFlow.luau +++ b/plugin/src/AddAccountFlow/StartPage/BrowserFlow.luau @@ -21,6 +21,10 @@ local useState = React.useState local useEffect = React.useEffect local useCallback = React.useCallback +-- This is a horrible hack that allows us to copy the contents of a TextBox +-- to the clipboard, by sending a virtual ctrl + c keycode sequence. +-- +-- Not sure if this will work long-term. Only one way to find out! local function sendCopyKeycode() local virtualInput: VirtualInput = UserInputService:CreateVirtualInput() :: any @@ -63,8 +67,12 @@ local function BrowserFlow() local focusConnection = textbox.Focused:Connect(function() selectAll() - sendCopyKeycode() - NotificationStore.get().push("info", "Copied URL to clipboard") + -- This hack might start to error in the future, so we wrap it + -- in a pcall just in case. + local success = pcall(sendCopyKeycode) + if success then + NotificationStore.get().push("info", "Copied URL to clipboard") + end end) -- Re-select all if the user clicks to move the cursor while focused.