Daniel
12/18/2024, 1:54 PMcoroutineScope.launch(<http://Dispatchers.IO|Dispatchers.IO>) {
val timeTaken = measureTimeMillis {
currentAndroidVersion =
loginViewModel.repo.checkAndroidVersion(lastUpdateDate)
}
println("checkAndroidVersion took $timeTaken ms to execute")
}
this usually prints:
checkAndroidVersion took 1394 ms to execute
checkAndroidVersion took 1028 ms to executeKMM repo:
val functions = Firebase.functions("europe-central2")
suspend fun checkAndroidVersion(version: String): String{
return functions.httpsCallable("checkAndroidVersion").invoke(version).data<String>()
}
cloud function:
exports.checkAndroidVersion =
onCall({region: "europe-central2", minInstances: 1}, (request) => {
<http://logger.info|logger.info>("current user version = "+request.data, {structuredData: true});
const version = request.data;
if (version != "15/10/2024") {
return version;
}
return "updated";
});
Keep in mind that I using Firebase Kotlin SDK since I have a KMM app.