fix: SMS permission should be asked when enabling the provider

master
Dominique Merle 4 years ago
parent d14e3e3b75
commit b5d4965f36

@ -1,14 +1,31 @@
extends Control 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") onready var NewPollButton : Button = find_node("NewPollButton")
func _ready(): func _ready():
NewPollButton.grab_focus() NewPollButton.grab_focus()
var window_size = Vector2( var window_size = Vector2(
Config.get_parameter("video.window.width"), # Hmmm. Perhaps rename the Config properties like ProjectSettings'?
Config.get_parameter("video.window.height") 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 OS.window_size = window_size

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

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

@ -52,7 +52,7 @@ __meta__ = {
} }
[node name="NoProvidersHelpLabel" type="RichTextLabel" parent="CenterContainer/VBoxContainer/TabContainer/Providers/VBoxContainer"] [node name="NoProvidersHelpLabel" type="RichTextLabel" parent="CenterContainer/VBoxContainer/TabContainer/Providers/VBoxContainer"]
margin_right = 585.0 margin_right = 579.0
margin_bottom = 100.0 margin_bottom = 100.0
rect_min_size = Vector2( 0, 100 ) rect_min_size = Vector2( 0, 100 )
bbcode_enabled = true 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"] [node name="DemoContainer" type="HBoxContainer" parent="CenterContainer/VBoxContainer/TabContainer/Providers/VBoxContainer"]
margin_top = 108.0 margin_top = 108.0
margin_right = 585.0 margin_right = 579.0
margin_bottom = 188.0 margin_bottom = 188.0
__meta__ = { __meta__ = {
"_edit_use_anchors_": false "_edit_use_anchors_": false
@ -75,14 +75,14 @@ text = "Demo Provider"
[node name="DemoHelpLabel" type="Label" parent="CenterContainer/VBoxContainer/TabContainer/Providers/VBoxContainer/DemoContainer"] [node name="DemoHelpLabel" type="Label" parent="CenterContainer/VBoxContainer/TabContainer/Providers/VBoxContainer/DemoContainer"]
margin_left = 332.0 margin_left = 332.0
margin_top = 12.0 margin_top = 12.0
margin_right = 585.0 margin_right = 579.0
margin_bottom = 68.0 margin_bottom = 68.0
text = "Enable this to simulate text = "Enable this to simulate
votes for a quick demo" votes for a quick demo"
[node name="TwitchContainer" type="HBoxContainer" parent="CenterContainer/VBoxContainer/TabContainer/Providers/VBoxContainer"] [node name="TwitchContainer" type="HBoxContainer" parent="CenterContainer/VBoxContainer/TabContainer/Providers/VBoxContainer"]
margin_top = 196.0 margin_top = 196.0
margin_right = 585.0 margin_right = 579.0
margin_bottom = 276.0 margin_bottom = 276.0
__meta__ = { __meta__ = {
"_edit_use_anchors_": false "_edit_use_anchors_": false
@ -101,7 +101,7 @@ text = "Configure"
[node name="SmsContainer" type="HBoxContainer" parent="CenterContainer/VBoxContainer/TabContainer/Providers/VBoxContainer"] [node name="SmsContainer" type="HBoxContainer" parent="CenterContainer/VBoxContainer/TabContainer/Providers/VBoxContainer"]
margin_top = 284.0 margin_top = 284.0
margin_right = 585.0 margin_right = 579.0
margin_bottom = 364.0 margin_bottom = 364.0
__meta__ = { __meta__ = {
"_edit_use_anchors_": false "_edit_use_anchors_": false
@ -228,8 +228,11 @@ margin_bottom = 52.0
theme = ExtResource( 4 ) theme = ExtResource( 4 )
text = "DONE" text = "DONE"
[node name="NoTwitchSettingsPopup" parent="." instance=ExtResource( 3 )] [node name="NoTwitchSettingsPopup" parent="CenterContainer" instance=ExtResource( 3 )]
visible = false 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/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="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"] [connection signal="pressed" from="CenterContainer/VBoxContainer/TabContainer/Providers/VBoxContainer/TwitchContainer/TwitchConfigureButton" to="." method="_on_TwitchConfigureButton_pressed"]

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

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

Loading…
Cancel
Save