mirror of
https://github.com/cyberarm/w3d_hub_linux_launcher.git
synced 2026-11-05 17:44:16 +00:00
Improve login flow a smidge by showing an error message and re-enabling the sign in button on failure
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,3 +1,4 @@
|
|||||||
|
.*/
|
||||||
pkg/
|
pkg/
|
||||||
*.json
|
*.json
|
||||||
*.xml
|
*.xml
|
||||||
|
|||||||
@@ -68,10 +68,14 @@ module W3DHubLauncher
|
|||||||
# FIXME: Retry? Show error? ???
|
# FIXME: Retry? Show error? ???
|
||||||
pp settings_result
|
pp settings_result
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
dialog(
|
||||||
|
Dialog::Alert,
|
||||||
|
title: "Failed to sign in",
|
||||||
|
message: "If you have failed 3 or more times in a row, wait about 15 minutes and try again."
|
||||||
|
)
|
||||||
|
btn.enabled = true
|
||||||
end
|
end
|
||||||
|
|
||||||
# FIXME: Show error message!
|
|
||||||
pp result
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
29
lib/dialogs/alert.rb
Normal file
29
lib/dialogs/alert.rb
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
module W3DHubLauncher
|
||||||
|
class Dialog
|
||||||
|
class Alert < W3DHubLauncher::Dialog
|
||||||
|
def setup
|
||||||
|
super
|
||||||
|
|
||||||
|
stack(width: 1.0, max_width: 800, height: 1.0, max_height: 480, style_class: [:dialog]) do
|
||||||
|
flow(width: 1.0, background_nine_slice: NINE_SLICE_ROUNDED_TOP, background_nine_slice_from_edge: NINE_SLICE_EDGE, background_nine_slice_color: 0) do
|
||||||
|
banner @options[:title] || "", width: 1.0, text_align: :center
|
||||||
|
end
|
||||||
|
|
||||||
|
stack(style_class: [:dialog_container]) do
|
||||||
|
tagline @options[:message] || ""
|
||||||
|
end
|
||||||
|
|
||||||
|
flow(width: 1.0, padding: PADDING, background_nine_slice: NINE_SLICE_ROUNDED_BOTTOM, background_nine_slice_from_edge: NINE_SLICE_EDGE, background_nine_slice_color: 0) do
|
||||||
|
flow(fill: true)
|
||||||
|
|
||||||
|
button "Close", **CTA_BUTTON_THEME do
|
||||||
|
pop_state
|
||||||
|
end
|
||||||
|
|
||||||
|
flow(fill: true)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -44,6 +44,12 @@ module W3DHubLauncher
|
|||||||
MemCache[:servers].delete(game_server) if game_server
|
MemCache[:servers].delete(game_server) if game_server
|
||||||
end
|
end
|
||||||
|
|
||||||
|
CyberarmEngine::EventBus.subscribe("application_changed") do |payload|
|
||||||
|
# pp payload
|
||||||
|
# SDL 3.6 required
|
||||||
|
# SDL.ShowNotification(NAME, "Application Changed Event", nil, nil, 0) #(payload["application"]["name"], payload["state"])
|
||||||
|
end
|
||||||
|
|
||||||
push_state(States::Boot)
|
push_state(States::Boot)
|
||||||
# push_state(States::Interface)
|
# push_state(States::Interface)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -106,6 +106,11 @@ module W3DHubLauncher
|
|||||||
if response.okay?
|
if response.okay?
|
||||||
hash = JSON.parse(response.data)
|
hash = JSON.parse(response.data)
|
||||||
|
|
||||||
|
if hash["error"]
|
||||||
|
result.error = hash["error"]
|
||||||
|
return result
|
||||||
|
end
|
||||||
|
|
||||||
user_details_result = fetch_user_details(Integer(hash["userid"]))
|
user_details_result = fetch_user_details(Integer(hash["userid"]))
|
||||||
user_details_hash = user_details_result.okay? ? JSON.parse(user_details_result.data) : {}
|
user_details_hash = user_details_result.okay? ? JSON.parse(user_details_result.data) : {}
|
||||||
|
|
||||||
@@ -134,6 +139,11 @@ module W3DHubLauncher
|
|||||||
if response.okay?
|
if response.okay?
|
||||||
hash = JSON.parse(response.data)
|
hash = JSON.parse(response.data)
|
||||||
|
|
||||||
|
if hash["error"]
|
||||||
|
result.error = hash["error"]
|
||||||
|
return result
|
||||||
|
end
|
||||||
|
|
||||||
user_details_result = fetch_user_details(Integer(hash["userid"]))
|
user_details_result = fetch_user_details(Integer(hash["userid"]))
|
||||||
user_details_hash = user_details_result.okay? ? JSON.parse(user_details_result.data) : {}
|
user_details_hash = user_details_result.okay? ? JSON.parse(user_details_result.data) : {}
|
||||||
|
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ require_relative "lib/pages/server_browser"
|
|||||||
require_relative "lib/pages/boot/terms"
|
require_relative "lib/pages/boot/terms"
|
||||||
require_relative "lib/pages/boot/initial_setup"
|
require_relative "lib/pages/boot/initial_setup"
|
||||||
require_relative "lib/pages/boot/start_up"
|
require_relative "lib/pages/boot/start_up"
|
||||||
|
require_relative "lib/dialogs/alert"
|
||||||
require_relative "lib/dialogs/about"
|
require_relative "lib/dialogs/about"
|
||||||
require_relative "lib/dialogs/downloads"
|
require_relative "lib/dialogs/downloads"
|
||||||
require_relative "lib/dialogs/server"
|
require_relative "lib/dialogs/server"
|
||||||
|
|||||||
Reference in New Issue
Block a user