@@ -10,138 +10,138 @@ import org.godotengine.godot.plugin.SignalInfo
10
10
import org.godotengine.godot.plugin.UsedByGodot
11
11
12
12
class FirebasePlugin (godot : Godot ) : GodotPlugin(godot) {
13
- override fun getPluginName (): String = " GodotFirebaseAndroid"
13
+ override fun getPluginName (): String = " GodotFirebaseAndroid"
14
14
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 )
19
19
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
+ }
24
24
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
+ }
28
28
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
+ }
37
37
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
+ }
45
45
46
- /* *
47
- * Authentication
48
- */
49
- @UsedByGodot
50
- fun signInAnonymously () = auth.signInAnonymously()
46
+ /* *
47
+ * Authentication
48
+ */
49
+ @UsedByGodot
50
+ fun signInAnonymously () = auth.signInAnonymously()
51
51
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)
54
54
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)
57
57
58
- @UsedByGodot
59
- fun sendEmailVerification () = auth.sendEmailVerification()
58
+ @UsedByGodot
59
+ fun sendEmailVerification () = auth.sendEmailVerification()
60
60
61
- @UsedByGodot
62
- fun sendPasswordResetEmail (email : String ) = auth.sendPasswordResetEmail(email)
61
+ @UsedByGodot
62
+ fun sendPasswordResetEmail (email : String ) = auth.sendPasswordResetEmail(email)
63
63
64
- @UsedByGodot
65
- fun signInWithGoogle () = auth.signInWithGoogle()
64
+ @UsedByGodot
65
+ fun signInWithGoogle () = auth.signInWithGoogle()
66
66
67
- @UsedByGodot
68
- fun getCurrentUser () = auth.getCurrentUser()
67
+ @UsedByGodot
68
+ fun getCurrentUser () = auth.getCurrentUser()
69
69
70
- @UsedByGodot
71
- fun isSignedIn () = auth.isSignedIn()
70
+ @UsedByGodot
71
+ fun isSignedIn () = auth.isSignedIn()
72
72
73
- @UsedByGodot
74
- fun signOut () = auth.signOut()
73
+ @UsedByGodot
74
+ fun signOut () = auth.signOut()
75
75
76
- @UsedByGodot
77
- fun deleteUser () = auth.deleteUser()
76
+ @UsedByGodot
77
+ fun deleteUser () = auth.deleteUser()
78
78
79
- /* *
80
- * Firestore
81
- */
79
+ /* *
80
+ * Firestore
81
+ */
82
82
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)
85
85
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)
88
88
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)
91
91
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)
94
94
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)
97
97
98
- @UsedByGodot
99
- fun firestoreGetDocumentsInCollection (collection : String ) = firestore.getDocumentsInCollection(collection)
98
+ @UsedByGodot
99
+ fun firestoreGetDocumentsInCollection (collection : String ) = firestore.getDocumentsInCollection(collection)
100
100
101
- @UsedByGodot
102
- fun firestoreListenToDocument (documentPath : String ) = firestore.listenToDocument(documentPath)
101
+ @UsedByGodot
102
+ fun firestoreListenToDocument (documentPath : String ) = firestore.listenToDocument(documentPath)
103
103
104
- @UsedByGodot
105
- fun firestoreStopListeningToDocument (documentPath : String ) = firestore.stopListeningToDocument(documentPath)
104
+ @UsedByGodot
105
+ fun firestoreStopListeningToDocument (documentPath : String ) = firestore.stopListeningToDocument(documentPath)
106
106
107
- /* *
108
- * Cloud Storage
109
- */
107
+ /* *
108
+ * Cloud Storage
109
+ */
110
110
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)
113
113
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)
116
116
117
- @UsedByGodot
118
- fun storageGetMetadata (path : String ) = storage.getMetadata(path)
117
+ @UsedByGodot
118
+ fun storageGetMetadata (path : String ) = storage.getMetadata(path)
119
119
120
- @UsedByGodot
121
- fun storageDeleteFile (path : String ) = storage.deleteFile(path)
120
+ @UsedByGodot
121
+ fun storageDeleteFile (path : String ) = storage.deleteFile(path)
122
122
123
- @UsedByGodot
124
- fun storageListFiles (path : String ) = storage.listFiles(path)
123
+ @UsedByGodot
124
+ fun storageListFiles (path : String ) = storage.listFiles(path)
125
125
126
- /* *
127
- * Realtime Database
128
- */
126
+ /* *
127
+ * Realtime Database
128
+ */
129
129
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)
132
132
133
- @UsedByGodot
134
- fun rtdbGetValue (path : String ) = realtimeDatabase.getValue(path)
133
+ @UsedByGodot
134
+ fun rtdbGetValue (path : String ) = realtimeDatabase.getValue(path)
135
135
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)
138
138
139
- @UsedByGodot
140
- fun rtdbDeleteValue (path : String ) = realtimeDatabase.deleteValue(path)
139
+ @UsedByGodot
140
+ fun rtdbDeleteValue (path : String ) = realtimeDatabase.deleteValue(path)
141
141
142
- @UsedByGodot
143
- fun rtdbListenToPath (path : String ) = realtimeDatabase.listenToPath(path)
142
+ @UsedByGodot
143
+ fun rtdbListenToPath (path : String ) = realtimeDatabase.listenToPath(path)
144
144
145
- @UsedByGodot
146
- fun rtdbStopListening (path : String ) = realtimeDatabase.stopListening(path)
145
+ @UsedByGodot
146
+ fun rtdbStopListening (path : String ) = realtimeDatabase.stopListening(path)
147
147
}
0 commit comments