Skip to content

Commit 892f0a0

Browse files
committed
Fix startup crash by removing FirebaseInitProvider and adding exception boundaries
1 parent df5d4aa commit 892f0a0

2 files changed

Lines changed: 12 additions & 21 deletions

File tree

app/src/main/AndroidManifest.xml

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -46,19 +46,6 @@
4646
android:resource="@xml/provider_paths" />
4747
</provider>
4848

49-
<!-- Disable Firebase auto-init to prevent crash on startup -->
50-
<provider
51-
android:name="com.google.firebase.provider.FirebaseInitProvider"
52-
android:authorities="${applicationId}.firebaseinitprovider"
53-
android:exported="false"
54-
android:initOrder="100"
55-
tools:replace="android:initOrder"
56-
tools:node="replace" />
57-
58-
<meta-data
59-
android:name="firebase_data_collection_default_enabled"
60-
android:value="false" />
61-
6249
</application>
6350

6451
</manifest>

app/src/main/java/com/example/AuthViewModel.kt

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,21 @@ class AuthViewModel : ViewModel() {
2626
init {
2727
// Collect supabase session updates
2828
viewModelScope.launch {
29-
supabase.auth.sessionStatus.collect { status ->
30-
when (status) {
31-
is io.github.jan.supabase.auth.status.SessionStatus.Authenticated -> {
32-
_currentUser.value = status.session.user
33-
}
34-
else -> {
35-
if (_currentUser.value != "Guest") {
36-
_currentUser.value = null
29+
try {
30+
supabase.auth.sessionStatus.collect { status ->
31+
when (status) {
32+
is io.github.jan.supabase.auth.status.SessionStatus.Authenticated -> {
33+
_currentUser.value = status.session.user
34+
}
35+
else -> {
36+
if (_currentUser.value != "Guest") {
37+
_currentUser.value = null
38+
}
3739
}
3840
}
3941
}
42+
} catch (e: Throwable) {
43+
android.util.Log.e("AuthViewModel", "Session status collect error: ${e.message}")
4044
}
4145
}
4246
}

0 commit comments

Comments
 (0)