Files
hpos/app/src/main/java/com/example/hpostesting/HPOSTestingApplication.kt

42 lines
1.7 KiB
Kotlin
Raw Normal View History

2024-03-18 13:16:11 +05:30
/*
* // Copyright (c) 2024 ShanMukha Innovations Pvt. Ltd. All rights reserved.
* // Notice: All information contained herein is, and remains
* // the property of ShanMukha Innovations Pvt. Ltd. and its suppliers,
* // if any. The intellectual and technical concepts contained
* // herein are proprietary to ShanMukha Innovations Pvt. Ltd.
* // and its suppliers and may be covered by Indian and Foreign Patents,
* // patents in process, and are protected by trade secret or copyright law.
* // Dissemination of this information or reproduction of this material
* // is strictly forbidden unless prior written permission is obtained
* // from ShanMukha Innovations Pvt. Ltd.
*/
2023-06-28 12:41:18 +05:30
package com.example.hpostesting
import android.app.Application
import com.example.hpostesting.firebase.FirebaseManager
2023-09-16 05:43:27 +00:00
import com.google.firebase.firestore.FirebaseFirestore
import com.google.firebase.firestore.FirebaseFirestoreSettings
2023-06-28 12:41:18 +05:30
import dagger.hilt.android.HiltAndroidApp
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.SupervisorJob
import javax.inject.Inject
2023-06-28 12:41:18 +05:30
@HiltAndroidApp
2024-02-14 12:47:39 +05:30
class HPOSTestingApplication : Application() {
@Inject
lateinit var firebaseManager: FirebaseManager
2023-09-16 05:43:27 +00:00
override fun onCreate() {
super.onCreate()
val applicationScope = CoroutineScope(SupervisorJob() + Dispatchers.IO)
// You can now use firebaseManager here after Hilt injects it
2023-09-16 05:43:27 +00:00
val firestoreSettings = FirebaseFirestoreSettings.Builder()
.setPersistenceEnabled(true) // Enable offline persistence if needed
.build()
2023-07-25 11:40:10 +05:30
val firestore = firebaseManager.getCurrentFirestore()
2023-09-16 05:43:27 +00:00
firestore.firestoreSettings = firestoreSettings
}
2023-06-28 12:41:18 +05:30
}