-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(viewmodel): avoid crash with firebase instance when config changes.
- Loading branch information
1 parent
dbe65c5
commit 09b9acf
Showing
10 changed files
with
78 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 3 additions & 4 deletions
7
...edback/android/sources/FirebaseFactory.kt → ...ack/android/viewmodels/FirebaseFactory.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
...-viewmodel/src/main/java/io/openfeedback/android/viewmodels/OpenFeedbackFirebaseConfig.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package io.openfeedback.android.viewmodels | ||
|
||
import android.content.Context | ||
import androidx.compose.runtime.Immutable | ||
|
||
@Immutable | ||
data class OpenFeedbackFirebaseConfig( | ||
val context: Context, | ||
val projectId: String, | ||
val applicationId: String, | ||
val apiKey: String, | ||
val databaseUrl: String, | ||
val appName: String = "openfeedback" | ||
) { | ||
val firebaseApp = FirebaseFactory.create(context, this, appName) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 0 additions & 8 deletions
8
openfeedback/src/main/java/io/openfeedback/android/FirebaseConfig.kt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
sample-app/src/main/java/io/openfeedback/android/sample/MainApplication.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package io.openfeedback.android.sample | ||
|
||
import android.app.Application | ||
import io.openfeedback.android.viewmodels.OpenFeedbackFirebaseConfig | ||
|
||
class MainApplication: Application() { | ||
lateinit var openFeedbackFirebaseConfig: OpenFeedbackFirebaseConfig | ||
|
||
override fun onCreate() { | ||
super.onCreate() | ||
openFeedbackFirebaseConfig = OpenFeedbackFirebaseConfig( | ||
context = this, | ||
projectId = "openfeedback-b7ab9", | ||
applicationId = "1:765209934800:android:a6bb09f3deabc2277297d5", | ||
apiKey = "AIzaSyC_cfbh8xKwF8UPxCeasGcsHyK4s5yZFeA", | ||
databaseUrl = "https://openfeedback-b7ab9.firebaseio.com" | ||
) | ||
} | ||
} |