-
Notifications
You must be signed in to change notification settings - Fork 169
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #140 from AoEiuV020/p1
修复没有谷歌配置文件无法运行的问题
- Loading branch information
Showing
5 changed files
with
53 additions
and
20 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
32 changes: 32 additions & 0 deletions
32
app/src/main/kotlin/dev/aaa1115910/bv/util/FirebaseUtil.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,32 @@ | ||
package dev.aaa1115910.bv.util | ||
|
||
import android.content.Context | ||
import com.google.firebase.FirebaseApp | ||
import com.google.firebase.analytics.ktx.analytics | ||
import com.google.firebase.crashlytics.ktx.crashlytics | ||
import com.google.firebase.ktx.Firebase | ||
|
||
object FirebaseUtil { | ||
private var initialized = false | ||
|
||
fun init(context: Context) { | ||
initialized = FirebaseApp.initializeApp(context) != null | ||
} | ||
|
||
fun log(msg: String) { | ||
if (!initialized) return | ||
Firebase.crashlytics.log(msg) | ||
} | ||
|
||
fun recordException(throwable: Throwable) { | ||
if (!initialized) return | ||
Firebase.crashlytics.recordException(throwable) | ||
} | ||
|
||
fun setCrashlyticsCollectionEnabled(enable: Boolean) { | ||
if (!initialized) return | ||
Firebase.crashlytics.setCrashlyticsCollectionEnabled(enable) | ||
Firebase.analytics.setAnalyticsCollectionEnabled(enable) | ||
} | ||
|
||
} |
18 changes: 10 additions & 8 deletions
18
app/src/main/kotlin/dev/aaa1115910/bv/util/KLoggerExtends.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