@@ -10,138 +10,138 @@ import org.godotengine.godot.plugin.SignalInfo
1010import org.godotengine.godot.plugin.UsedByGodot
1111
1212class FirebasePlugin (godot : Godot ) : GodotPlugin(godot) {
13- override fun getPluginName (): String = " GodotFirebaseAndroid"
13+ override fun getPluginName (): String = " GodotFirebaseAndroid"
1414
15- private val auth = Authentication (this )
16- private val firestore = Firestore (this )
17- private val storage = CloudStorage (this )
18- private val realtimeDatabase = RealtimeDatabase (this )
15+ private val auth = Authentication (this )
16+ private val firestore = Firestore (this )
17+ private val storage = CloudStorage (this )
18+ private val realtimeDatabase = RealtimeDatabase (this )
1919
20- override fun onMainCreate (activity : Activity ? ): View ? {
21- activity?.let { auth.init (it) }
22- return super .onMainCreate(activity)
23- }
20+ override fun onMainCreate (activity : Activity ? ): View ? {
21+ activity?.let { auth.init (it) }
22+ return super .onMainCreate(activity)
23+ }
2424
25- override fun onMainActivityResult (requestCode : Int , resultCode : Int , data : Intent ? ) {
26- auth.handleActivityResult(requestCode, resultCode, data)
27- }
25+ override fun onMainActivityResult (requestCode : Int , resultCode : Int , data : Intent ? ) {
26+ auth.handleActivityResult(requestCode, resultCode, data)
27+ }
2828
29- override fun getPluginSignals (): MutableSet <SignalInfo > {
30- val signals: MutableSet <SignalInfo > = mutableSetOf ()
31- signals.addAll(auth.authSignals())
32- signals.addAll(firestore.firestoreSignals())
33- signals.addAll(realtimeDatabase.realtimeDbSignals())
34- signals.addAll(storage.storageSignals())
35- return signals
36- }
29+ override fun getPluginSignals (): MutableSet <SignalInfo > {
30+ val signals: MutableSet <SignalInfo > = mutableSetOf ()
31+ signals.addAll(auth.authSignals())
32+ signals.addAll(firestore.firestoreSignals())
33+ signals.addAll(realtimeDatabase.realtimeDbSignals())
34+ signals.addAll(storage.storageSignals())
35+ return signals
36+ }
3737
38- fun emitGodotSignal (signalName : String , arg1 : Any? , arg2 : Any? = null) {
39- if (arg2 != null ) {
40- emitSignal(signalName, arg1, arg2)
41- } else {
42- emitSignal(signalName, arg1)
43- }
44- }
38+ fun emitGodotSignal (signalName : String , arg1 : Any? , arg2 : Any? = null) {
39+ if (arg2 != null ) {
40+ emitSignal(signalName, arg1, arg2)
41+ } else {
42+ emitSignal(signalName, arg1)
43+ }
44+ }
4545
46- /* *
47- * Authentication
48- */
49- @UsedByGodot
50- fun signInAnonymously () = auth.signInAnonymously()
46+ /* *
47+ * Authentication
48+ */
49+ @UsedByGodot
50+ fun signInAnonymously () = auth.signInAnonymously()
5151
52- @UsedByGodot
53- fun createUserWithEmailPassword (email : String , password : String ) = auth.createUserWithEmailPassword(email, password)
52+ @UsedByGodot
53+ fun createUserWithEmailPassword (email : String , password : String ) = auth.createUserWithEmailPassword(email, password)
5454
55- @UsedByGodot
56- fun signInWithEmailPassword (email : String , password : String ) = auth.signInWithEmailPassword(email, password)
55+ @UsedByGodot
56+ fun signInWithEmailPassword (email : String , password : String ) = auth.signInWithEmailPassword(email, password)
5757
58- @UsedByGodot
59- fun sendEmailVerification () = auth.sendEmailVerification()
58+ @UsedByGodot
59+ fun sendEmailVerification () = auth.sendEmailVerification()
6060
61- @UsedByGodot
62- fun sendPasswordResetEmail (email : String ) = auth.sendPasswordResetEmail(email)
61+ @UsedByGodot
62+ fun sendPasswordResetEmail (email : String ) = auth.sendPasswordResetEmail(email)
6363
64- @UsedByGodot
65- fun signInWithGoogle () = auth.signInWithGoogle()
64+ @UsedByGodot
65+ fun signInWithGoogle () = auth.signInWithGoogle()
6666
67- @UsedByGodot
68- fun getCurrentUser () = auth.getCurrentUser()
67+ @UsedByGodot
68+ fun getCurrentUser () = auth.getCurrentUser()
6969
70- @UsedByGodot
71- fun isSignedIn () = auth.isSignedIn()
70+ @UsedByGodot
71+ fun isSignedIn () = auth.isSignedIn()
7272
73- @UsedByGodot
74- fun signOut () = auth.signOut()
73+ @UsedByGodot
74+ fun signOut () = auth.signOut()
7575
76- @UsedByGodot
77- fun deleteUser () = auth.deleteUser()
76+ @UsedByGodot
77+ fun deleteUser () = auth.deleteUser()
7878
79- /* *
80- * Firestore
81- */
79+ /* *
80+ * Firestore
81+ */
8282
83- @UsedByGodot
84- fun firestoreAddDocument (collection : String , data : Dictionary ) = firestore.addDocument(collection, data)
83+ @UsedByGodot
84+ fun firestoreAddDocument (collection : String , data : Dictionary ) = firestore.addDocument(collection, data)
8585
86- @UsedByGodot
87- fun firestoreSetDocument (collection : String , documentId : String , data : Dictionary , merge : Boolean = false) = firestore.setDocument(collection, documentId, data, merge)
86+ @UsedByGodot
87+ fun firestoreSetDocument (collection : String , documentId : String , data : Dictionary , merge : Boolean = false) = firestore.setDocument(collection, documentId, data, merge)
8888
89- @UsedByGodot
90- fun firestoreGetDocument (collection : String , documentId : String ) = firestore.getDocument(collection, documentId)
89+ @UsedByGodot
90+ fun firestoreGetDocument (collection : String , documentId : String ) = firestore.getDocument(collection, documentId)
9191
92- @UsedByGodot
93- fun firestoreUpdateDocument (collection : String , documentId : String , data : Dictionary ) = firestore.updateDocument(collection, documentId, data)
92+ @UsedByGodot
93+ fun firestoreUpdateDocument (collection : String , documentId : String , data : Dictionary ) = firestore.updateDocument(collection, documentId, data)
9494
95- @UsedByGodot
96- fun firestoreDeleteDocument (collection : String , documentId : String ) = firestore.deleteDocument(collection, documentId)
95+ @UsedByGodot
96+ fun firestoreDeleteDocument (collection : String , documentId : String ) = firestore.deleteDocument(collection, documentId)
9797
98- @UsedByGodot
99- fun firestoreGetDocumentsInCollection (collection : String ) = firestore.getDocumentsInCollection(collection)
98+ @UsedByGodot
99+ fun firestoreGetDocumentsInCollection (collection : String ) = firestore.getDocumentsInCollection(collection)
100100
101- @UsedByGodot
102- fun firestoreListenToDocument (documentPath : String ) = firestore.listenToDocument(documentPath)
101+ @UsedByGodot
102+ fun firestoreListenToDocument (documentPath : String ) = firestore.listenToDocument(documentPath)
103103
104- @UsedByGodot
105- fun firestoreStopListeningToDocument (documentPath : String ) = firestore.stopListeningToDocument(documentPath)
104+ @UsedByGodot
105+ fun firestoreStopListeningToDocument (documentPath : String ) = firestore.stopListeningToDocument(documentPath)
106106
107- /* *
108- * Cloud Storage
109- */
107+ /* *
108+ * Cloud Storage
109+ */
110110
111- @UsedByGodot
112- fun storageUploadFile (path : String , localFilePath : String ) = storage.uploadFile(path, localFilePath)
111+ @UsedByGodot
112+ fun storageUploadFile (path : String , localFilePath : String ) = storage.uploadFile(path, localFilePath)
113113
114- @UsedByGodot
115- fun storageDownloadFile (path : String , destinationPath : String ) = storage.downloadFile(path, destinationPath)
114+ @UsedByGodot
115+ fun storageDownloadFile (path : String , destinationPath : String ) = storage.downloadFile(path, destinationPath)
116116
117- @UsedByGodot
118- fun storageGetMetadata (path : String ) = storage.getMetadata(path)
117+ @UsedByGodot
118+ fun storageGetMetadata (path : String ) = storage.getMetadata(path)
119119
120- @UsedByGodot
121- fun storageDeleteFile (path : String ) = storage.deleteFile(path)
120+ @UsedByGodot
121+ fun storageDeleteFile (path : String ) = storage.deleteFile(path)
122122
123- @UsedByGodot
124- fun storageListFiles (path : String ) = storage.listFiles(path)
123+ @UsedByGodot
124+ fun storageListFiles (path : String ) = storage.listFiles(path)
125125
126- /* *
127- * Realtime Database
128- */
126+ /* *
127+ * Realtime Database
128+ */
129129
130- @UsedByGodot
131- fun rtdbSetValue (path : String , data : Dictionary ) = realtimeDatabase.setValue(path, data)
130+ @UsedByGodot
131+ fun rtdbSetValue (path : String , data : Dictionary ) = realtimeDatabase.setValue(path, data)
132132
133- @UsedByGodot
134- fun rtdbGetValue (path : String ) = realtimeDatabase.getValue(path)
133+ @UsedByGodot
134+ fun rtdbGetValue (path : String ) = realtimeDatabase.getValue(path)
135135
136- @UsedByGodot
137- fun rtdbUpdateValue (path : String , data : Dictionary ) = realtimeDatabase.updateValue(path, data)
136+ @UsedByGodot
137+ fun rtdbUpdateValue (path : String , data : Dictionary ) = realtimeDatabase.updateValue(path, data)
138138
139- @UsedByGodot
140- fun rtdbDeleteValue (path : String ) = realtimeDatabase.deleteValue(path)
139+ @UsedByGodot
140+ fun rtdbDeleteValue (path : String ) = realtimeDatabase.deleteValue(path)
141141
142- @UsedByGodot
143- fun rtdbListenToPath (path : String ) = realtimeDatabase.listenToPath(path)
142+ @UsedByGodot
143+ fun rtdbListenToPath (path : String ) = realtimeDatabase.listenToPath(path)
144144
145- @UsedByGodot
146- fun rtdbStopListening (path : String ) = realtimeDatabase.stopListening(path)
145+ @UsedByGodot
146+ fun rtdbStopListening (path : String ) = realtimeDatabase.stopListening(path)
147147}
0 commit comments