Skip to content

Commit b75331c

Browse files
miscellaneous changes
1 parent 477c64e commit b75331c

File tree

2 files changed

+21
-8
lines changed

2 files changed

+21
-8
lines changed

demo/scenes/realtime_db.gd

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ extends Control
33
@onready var path = $MarginContainer/VBoxContainer/HBoxContainer/path
44
@onready var pair_container = $ManageDataPanel/VBoxContainer/ScrollContainer/key_value_pair_container
55

6+
func _notification(what: int) -> void:
7+
if what == NOTIFICATION_WM_GO_BACK_REQUEST:
8+
get_tree().change_scene_to_packed(load("res://main.tscn"))
9+
10+
611
func _ready() -> void:
712
Firebase.realtimeDB.write_task_completed.connect(print_output.bind("write_task_completed"))
813
Firebase.realtimeDB.get_task_completed.connect(print_output.bind("get_task_completed"))

firebase/export_scripts_template/export_plugin.gd

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
@tool
2-
class_name FirebaseEditorPlugin extends EditorPlugin
2+
extends EditorPlugin
33

44
var export_plugin : AndroidExportPlugin
55

@@ -30,11 +30,11 @@ func _disable_plugin() -> void:
3030
remove_autoload_singleton("Firebase")
3131
_cleanup_gradle_files()
3232

33-
static func _cleanup_gradle_files() -> void:
33+
func _cleanup_gradle_files() -> void:
3434
_clean_line_from_file("res://android/build/build.gradle", BUILD_GRADLE_PLUGIN_LINE)
3535
_clean_line_from_file("res://android/build/settings.gradle", SETTINGS_GRADLE_PLUGIN_LINE)
3636

37-
static func _clean_line_from_file(file_path: String, line_to_remove: String) -> void:
37+
func _clean_line_from_file(file_path: String, line_to_remove: String) -> void:
3838
if FileAccess.file_exists(file_path):
3939
var text := FileAccess.open(file_path, FileAccess.READ).get_as_text()
4040
text = text.replace(line_to_remove, "")
@@ -51,12 +51,12 @@ class AndroidExportPlugin extends EditorExportPlugin:
5151
return
5252

5353
if (not get_option("gradle_build/use_gradle_build")) or (not FileAccess.file_exists("res://android/build/google-services.json")):
54-
FirebaseEditorPlugin._cleanup_gradle_files()
54+
_clean_line_from_file("res://android/build/build.gradle", BUILD_GRADLE_PLUGIN_LINE)
55+
_clean_line_from_file("res://android/build/settings.gradle", SETTINGS_GRADLE_PLUGIN_LINE)
5556
return
5657

57-
# Modify build.gradle
58+
# Modify build.gradle and settings.gradle
5859
_insert_line_if_missing("res://android/build/build.gradle", "id 'org.jetbrains.kotlin.android'", BUILD_GRADLE_PLUGIN_LINE)
59-
# Modify settings.gradle
6060
_insert_line_if_missing("res://android/build/settings.gradle", "id 'org.jetbrains.kotlin.android' version versions.kotlinVersion", SETTINGS_GRADLE_PLUGIN_LINE)
6161

6262
func _insert_line_if_missing(file_path: String, after_line: String, insert_line: String) -> void:
@@ -67,7 +67,7 @@ class AndroidExportPlugin extends EditorExportPlugin:
6767
var lines := text.split("\n")
6868
var result := PackedStringArray()
6969
var inserted := false
70-
70+
7171
for line in lines:
7272
result.append(line)
7373
if not inserted and line.strip_edges() == after_line.strip_edges():
@@ -79,11 +79,19 @@ class AndroidExportPlugin extends EditorExportPlugin:
7979
break
8080
result.append(indent + insert_line)
8181
inserted = true
82-
82+
8383
var file := FileAccess.open(file_path, FileAccess.WRITE)
8484
file.store_string("\n".join(result))
8585
file.close()
8686

87+
func _clean_line_from_file(file_path: String, line_to_remove: String) -> void:
88+
if FileAccess.file_exists(file_path):
89+
var text := FileAccess.open(file_path, FileAccess.READ).get_as_text()
90+
text = text.replace(line_to_remove, "")
91+
var file := FileAccess.open(file_path, FileAccess.WRITE)
92+
file.store_string(text)
93+
file.close()
94+
8795
func _supports_platform(platform):
8896
if platform is EditorExportPlatformAndroid:
8997
return true

0 commit comments

Comments
 (0)