Browse Source

fix: SMS permission should be asked when enabling the provider

master
Dominique Merle 2 years ago
parent
commit
b5d4965f36
  1. 21
      gui/MainMenu.gd
  2. 8
      gui/forms/NewPollForm.tscn
  3. 8
      gui/forms/SettingsForm.gd
  4. 17
      gui/forms/SettingsForm.tscn
  5. 6
      gui/popups/NoTwitchSettingsPopup.gd
  6. 4
      gui/popups/NoTwitchSettingsPopup.tscn

21
gui/MainMenu.gd

@ -1,14 +1,31 @@
extends Control
# Welcome!
#
# You are in the MAIN MENU.
# There's not much going around in here…
#
# The goal of this application is to provide Majority Judgment utilities.
# Most of the modular/reusable code about MJ is in an addon.
# Check `addons/majority_judgment/`. (it will move to its own repo someday)
onready var NewPollButton : Button = find_node("NewPollButton")
func _ready():
NewPollButton.grab_focus()
var window_size = Vector2(
Config.get_parameter("video.window.width"),
Config.get_parameter("video.window.height")
# Hmmm. Perhaps rename the Config properties like ProjectSettings'?
Config.get_parameter(
"video.window.width",
ProjectSettings.get_setting("display/window/size/width")
),
Config.get_parameter(
"video.window.height",
ProjectSettings.get_setting("display/window/size/height")
)
)
OS.window_size = window_size

8
gui/forms/NewPollForm.tscn

@ -27,9 +27,9 @@ __meta__ = {
}
[node name="VBoxContainer" type="VBoxContainer" parent="CenterContainer"]
margin_left = 80.0
margin_left = 74.0
margin_top = 170.0
margin_right = 532.0
margin_right = 526.0
margin_bottom = 628.0
__meta__ = {
"_edit_use_anchors_": false
@ -129,9 +129,9 @@ size_flags_horizontal = 3
text = "CREATE"
[node name="NoProviderPopup" parent="CenterContainer" instance=ExtResource( 4 )]
margin_left = 26.0
margin_left = 20.0
margin_top = 99.0
margin_right = 586.0
margin_right = 580.0
margin_bottom = 699.0
dialog_text = "No vote provider is enabled.
No-one will be able to vote!

8
gui/forms/SettingsForm.gd

@ -9,6 +9,8 @@ onready var WindowSizeHeightLineEdit = find_node("WindowSizeHeightLineEdit", tr
var initializing = true
func _ready():
DemoProviderCheckButton.pressed = Config.get_parameter(
"provider_MajorityJudgmentDemoProvider_enabled",
@ -69,9 +71,9 @@ func _on_SmsCheckButton_toggled(button_pressed):
)
if App.can_have_sms_provider():
if button_pressed and not initializing:
var asr = App.get_android_sms_reader()
assert(asr, "AndroidSmsReader must be available.")
if not asr.can_read():
var AndroidSmsReceiver = Engine.get_singleton('AndroidSmsReceiver')
assert(AndroidSmsReceiver, "AndroidSmsReceiver must be available.")
if not AndroidSmsReceiver.can_receive():
SmsCheckButton.pressed = false

17
gui/forms/SettingsForm.tscn

@ -52,7 +52,7 @@ __meta__ = {
}
[node name="NoProvidersHelpLabel" type="RichTextLabel" parent="CenterContainer/VBoxContainer/TabContainer/Providers/VBoxContainer"]
margin_right = 585.0
margin_right = 579.0
margin_bottom = 100.0
rect_min_size = Vector2( 0, 100 )
bbcode_enabled = true
@ -61,7 +61,7 @@ text = "Your community votes by sending commands such as \"A4 B2\" in the chat.
[node name="DemoContainer" type="HBoxContainer" parent="CenterContainer/VBoxContainer/TabContainer/Providers/VBoxContainer"]
margin_top = 108.0
margin_right = 585.0
margin_right = 579.0
margin_bottom = 188.0
__meta__ = {
"_edit_use_anchors_": false
@ -75,14 +75,14 @@ text = "Demo Provider"
[node name="DemoHelpLabel" type="Label" parent="CenterContainer/VBoxContainer/TabContainer/Providers/VBoxContainer/DemoContainer"]
margin_left = 332.0
margin_top = 12.0
margin_right = 585.0
margin_right = 579.0
margin_bottom = 68.0
text = "Enable this to simulate
votes for a quick demo"
[node name="TwitchContainer" type="HBoxContainer" parent="CenterContainer/VBoxContainer/TabContainer/Providers/VBoxContainer"]
margin_top = 196.0
margin_right = 585.0
margin_right = 579.0
margin_bottom = 276.0
__meta__ = {
"_edit_use_anchors_": false
@ -101,7 +101,7 @@ text = "Configure"
[node name="SmsContainer" type="HBoxContainer" parent="CenterContainer/VBoxContainer/TabContainer/Providers/VBoxContainer"]
margin_top = 284.0
margin_right = 585.0
margin_right = 579.0
margin_bottom = 364.0
__meta__ = {
"_edit_use_anchors_": false
@ -228,8 +228,11 @@ margin_bottom = 52.0
theme = ExtResource( 4 )
text = "DONE"
[node name="NoTwitchSettingsPopup" parent="." instance=ExtResource( 3 )]
visible = false
[node name="NoTwitchSettingsPopup" parent="CenterContainer" instance=ExtResource( 3 )]
margin_left = 26.0
margin_top = 174.0
margin_right = 573.0
margin_bottom = 625.0
[connection signal="toggled" from="CenterContainer/VBoxContainer/TabContainer/Providers/VBoxContainer/DemoContainer/DemoProviderCheckButton" to="." method="_on_DemoProviderCheckButton_toggled"]
[connection signal="toggled" from="CenterContainer/VBoxContainer/TabContainer/Providers/VBoxContainer/TwitchContainer/TwitchCheckButton" to="." method="_on_TwitchCheckButton_toggled"]
[connection signal="pressed" from="CenterContainer/VBoxContainer/TabContainer/Providers/VBoxContainer/TwitchContainer/TwitchConfigureButton" to="." method="_on_TwitchConfigureButton_pressed"]

6
gui/popups/NoTwitchSettingsPopup.gd

@ -5,7 +5,11 @@ func show_if_should():
for provider in App.get_providers():
if provider is MajorityJudgmentTwitchChatProvider:
var config = provider.get_oauth_config()
if not config["channel"]:
if (
(not "channel" in config)
or
(not config["channel"])
):
popup_centered()

4
gui/popups/NoTwitchSettingsPopup.tscn

@ -3,7 +3,6 @@
[ext_resource path="res://gui/popups/NoTwitchSettingsPopup.gd" type="Script" id=1]
[node name="NoTwitchSettingsPopup" type="AcceptDialog"]
visible = true
margin_right = 83.0
margin_bottom = 58.0
popup_exclusive = true
@ -20,4 +19,7 @@ Let's review together what's needed!
-- The Popup Paintress"
script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}
[connection signal="confirmed" from="." to="." method="_on_NoTwitchSettingsPopup_confirmed"]
Loading…
Cancel
Save