Compare commits
3 Commits
Homocube_E
...
crashanaly
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a25402fc26 | ||
|
|
388af0adf6 | ||
|
|
57a0c2103a |
@@ -52,11 +52,11 @@ android {
|
||||
|
||||
dependencies {
|
||||
|
||||
implementation 'androidx.core:core-ktx:1.10.1'
|
||||
implementation 'androidx.core:core-ktx:1.12.0'
|
||||
implementation 'androidx.appcompat:appcompat:1.6.1'
|
||||
implementation 'com.google.android.material:material:1.9.0'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
||||
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.6.1'
|
||||
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.6.2'
|
||||
|
||||
//firebase
|
||||
implementation platform('com.google.firebase:firebase-bom:32.1.0')
|
||||
@@ -66,7 +66,7 @@ dependencies {
|
||||
implementation 'com.google.firebase:firebase-auth-ktx'
|
||||
implementation 'com.google.firebase:firebase-storage-ktx'
|
||||
implementation 'com.firebaseui:firebase-ui-firestore:8.0.2'
|
||||
implementation 'com.google.android.gms:play-services-auth:20.6.0'
|
||||
implementation 'com.google.android.gms:play-services-auth:20.7.0'
|
||||
implementation 'com.google.android.gms:play-services-location:21.0.1'
|
||||
implementation 'com.google.android.gms:play-services-ads-identifier:18.0.1'
|
||||
implementation 'com.google.android.things:androidthings:1.0'
|
||||
@@ -77,7 +77,7 @@ dependencies {
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
|
||||
|
||||
|
||||
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.1"
|
||||
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.2"
|
||||
implementation 'com.opencsv:opencsv:4.6'
|
||||
implementation 'com.github.mik3y:usb-serial-for-android:3.5.1'
|
||||
|
||||
@@ -102,8 +102,8 @@ dependencies {
|
||||
annotationProcessor 'com.github.bumptech.glide:compiler:4.13.2'
|
||||
|
||||
// Navigation Component
|
||||
implementation "androidx.navigation:navigation-fragment-ktx:2.7.1"
|
||||
implementation "androidx.navigation:navigation-ui-ktx:2.7.1"
|
||||
implementation "androidx.navigation:navigation-fragment-ktx:2.7.2"
|
||||
implementation "androidx.navigation:navigation-ui-ktx:2.7.2"
|
||||
|
||||
//Dagger - Hilt
|
||||
implementation "com.google.dagger:hilt-android:2.46"
|
||||
|
||||
@@ -99,7 +99,7 @@
|
||||
</activity>
|
||||
<activity
|
||||
android:name="com.journeyapps.barcodescanner.CaptureActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:screenOrientation="fullSensor"
|
||||
android:stateNotNeeded="true"
|
||||
tools:replace="android:screenOrientation" />
|
||||
</application>
|
||||
|
||||
@@ -5,6 +5,8 @@ import android.content.Context
|
||||
import androidx.room.Room
|
||||
import com.example.hpostesting.data.dao.MyDatabase
|
||||
import com.google.android.datatransport.runtime.dagger.Provides
|
||||
import com.google.firebase.firestore.FirebaseFirestore
|
||||
import com.google.firebase.firestore.FirebaseFirestoreSettings
|
||||
import dagger.hilt.android.HiltAndroidApp
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
@@ -13,7 +15,14 @@ import javax.inject.Singleton
|
||||
|
||||
@HiltAndroidApp
|
||||
class HPOSTestingApplication: Application() {
|
||||
val applicationScope = CoroutineScope(SupervisorJob() + Dispatchers.IO)
|
||||
|
||||
override fun onCreate() {
|
||||
super.onCreate()
|
||||
val applicationScope = CoroutineScope(SupervisorJob() + Dispatchers.IO)
|
||||
val firestoreSettings = FirebaseFirestoreSettings.Builder()
|
||||
.setPersistenceEnabled(true) // Enable offline persistence if needed
|
||||
.build()
|
||||
|
||||
val firestore = FirebaseFirestore.getInstance()
|
||||
firestore.firestoreSettings = firestoreSettings
|
||||
}
|
||||
}
|
||||
@@ -5,11 +5,14 @@ import android.content.Intent
|
||||
import android.content.SharedPreferences
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import android.view.View
|
||||
import android.widget.Toast
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import com.example.hpostesting.data.DataHolder
|
||||
import com.example.hpostesting.data.constant.Constants
|
||||
import com.example.hpostesting.presentation.dashboard.DashboardActivity
|
||||
import com.google.android.material.snackbar.Snackbar
|
||||
import com.google.firebase.crashlytics.FirebaseCrashlytics
|
||||
import com.journeyapps.barcodescanner.ScanContract
|
||||
import com.journeyapps.barcodescanner.ScanIntentResult
|
||||
import com.journeyapps.barcodescanner.ScanOptions
|
||||
@@ -50,10 +53,35 @@ class KitScanActivity : AppCompatActivity() {
|
||||
moveToNext()
|
||||
}
|
||||
|
||||
// if (checkHemoCubeKitData()) {
|
||||
// DataHolder.selectedTest!!.kitSerial =
|
||||
// sharedPreference.getString(Constants.KIT_NUMBER, "").toString()
|
||||
// moveToNext()
|
||||
// } else {
|
||||
// with(sharedPreference.edit()) {
|
||||
// putString(Constants.KIT_NUMBER, "")
|
||||
// putInt(Constants.KIT_COUNT, 0)
|
||||
// putString(Constants.BUFFER_VALUE_1, "")
|
||||
// putString(Constants.BUFFER_VALUE_2, "")
|
||||
// apply()
|
||||
// }
|
||||
|
||||
|
||||
if (checkHemoCubeKitData()) {
|
||||
DataHolder.selectedTest!!.kitSerial =
|
||||
sharedPreference.getString(Constants.KIT_NUMBER, "").toString()
|
||||
moveToNext()
|
||||
try {
|
||||
DataHolder.selectedTest!!.kitSerial =
|
||||
sharedPreference.getString(Constants.KIT_NUMBER, "").toString()
|
||||
moveToNext()
|
||||
} catch (e: NullPointerException) {
|
||||
// Handle the NullPointerException here
|
||||
e.printStackTrace() // You can log the exception for debugging
|
||||
FirebaseCrashlytics.getInstance().recordException(e)
|
||||
val errorMessage = "An error occurred: ${e.message}"
|
||||
val rootView = findViewById<View>(android.R.id.content)
|
||||
Snackbar.make(rootView, errorMessage, Snackbar.LENGTH_LONG).show()
|
||||
// Optionally, show a user-friendly error message to the user
|
||||
// Toast.makeText(applicationContext, "An error occurred", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
} else {
|
||||
with(sharedPreference.edit()) {
|
||||
putString(Constants.KIT_NUMBER, "")
|
||||
@@ -62,7 +90,9 @@ class KitScanActivity : AppCompatActivity() {
|
||||
putString(Constants.BUFFER_VALUE_2, "")
|
||||
apply()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
binding.nameEditText.setText("SMI/SC/")
|
||||
|
||||
|
||||
@@ -21,6 +21,8 @@ import com.example.hpostesting.data.constant.Constants
|
||||
import com.example.hpostesting.data.model.patient.UserData
|
||||
import com.example.hpostesting.data.model.test.TestType
|
||||
import com.google.android.gms.location.*
|
||||
import com.google.android.material.snackbar.Snackbar
|
||||
import com.google.firebase.crashlytics.FirebaseCrashlytics
|
||||
import com.hoho.android.usbserial.driver.UsbSerialProber
|
||||
import `in`.sminnovations.hpostesting.R
|
||||
import `in`.sminnovations.hpostesting.databinding.ActivityMainBinding
|
||||
@@ -234,18 +236,45 @@ class MainActivity : AppCompatActivity() {
|
||||
return
|
||||
}
|
||||
|
||||
fusedLocationClient.lastLocation.addOnSuccessListener { location: Location? ->
|
||||
location?.let {
|
||||
DataHolder.selectedTest!!.location =
|
||||
UserData.Location(location.latitude, location.longitude)
|
||||
DataHolder.location =
|
||||
UserData.Location(location.latitude, location.longitude)
|
||||
} ?: run {
|
||||
requestLocationUpdates()
|
||||
// fusedLocationClient.lastLocation.addOnSuccessListener { location: Location? ->
|
||||
// location?.let {
|
||||
// DataHolder.selectedTest!!.location =
|
||||
// UserData.Location(location.latitude, location.longitude)
|
||||
// DataHolder.location =
|
||||
// UserData.Location(location.latitude, location.longitude)
|
||||
// } ?: run {
|
||||
// requestLocationUpdates()
|
||||
// }
|
||||
// }.addOnFailureListener { exception: Exception ->
|
||||
// exception.printStackTrace()
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
fusedLocationClient.lastLocation.addOnSuccessListener { location: Location? ->
|
||||
location?.let {
|
||||
DataHolder.selectedTest!!.location =
|
||||
UserData.Location(location.latitude, location.longitude)
|
||||
DataHolder.location =
|
||||
UserData.Location(location.latitude, location.longitude)
|
||||
} ?: run {
|
||||
requestLocationUpdates()
|
||||
}
|
||||
}.addOnFailureListener { exception: Exception ->
|
||||
// Handle the exception here
|
||||
exception.printStackTrace()
|
||||
FirebaseCrashlytics.getInstance().recordException(exception)
|
||||
// Display an error message to the user using a Snackbar
|
||||
val errorMessage = "An error occurred: ${exception.message}"
|
||||
val rootView = findViewById<View>(android.R.id.content)
|
||||
Snackbar.make(rootView, errorMessage, Snackbar.LENGTH_LONG).show()
|
||||
}
|
||||
}.addOnFailureListener { exception: Exception ->
|
||||
exception.printStackTrace()
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
private fun requestLocationUpdates() {
|
||||
|
||||
@@ -39,7 +39,7 @@ class SplashActivity : AppCompatActivity() {
|
||||
binding = ActivitySplashBinding.inflate(layoutInflater)
|
||||
setContentView(binding.root)
|
||||
|
||||
setupFirestoreCache()
|
||||
// setupFirestoreCache()
|
||||
setupStaticConstants()
|
||||
|
||||
requestPermissions()
|
||||
@@ -50,12 +50,12 @@ class SplashActivity : AppCompatActivity() {
|
||||
Settings.Secure.getString(applicationContext.contentResolver, Settings.Secure.ANDROID_ID)
|
||||
}
|
||||
|
||||
private fun setupFirestoreCache() {
|
||||
val settings = FirebaseFirestoreSettings.Builder()
|
||||
.setCacheSizeBytes(FirebaseFirestoreSettings.CACHE_SIZE_UNLIMITED)
|
||||
.build()
|
||||
Firebase.firestore.firestoreSettings = settings
|
||||
}
|
||||
// private fun setupFirestoreCache() {
|
||||
// val settings = FirebaseFirestoreSettings.Builder()
|
||||
// .setCacheSizeBytes(FirebaseFirestoreSettings.CACHE_SIZE_UNLIMITED)
|
||||
// .build()
|
||||
// Firebase.firestore.firestoreSettings = settings
|
||||
// }
|
||||
|
||||
private fun requestPermissions() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
||||
|
||||
@@ -25,7 +25,7 @@ class GalleryFragment : Fragment() {
|
||||
// val galleryViewModel =
|
||||
// ViewModelProvider(this).get(GalleryViewModel::class.java)
|
||||
|
||||
// _binding = FragmentGalleryBinding.inflate(inflater, container, false)
|
||||
_binding = FragmentGalleryBinding.inflate(inflater, container, false)
|
||||
val root: View = binding.root
|
||||
|
||||
// val textView: TextView = binding.textGallery
|
||||
|
||||
@@ -37,8 +37,16 @@ class HomeFragment : Fragment() {
|
||||
private lateinit var sharedPreference: SharedPreferences
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?
|
||||
): View {
|
||||
): View? {
|
||||
_binding = FragmentHomeBinding.inflate(inflater, container, false)
|
||||
|
||||
// Check if _binding is null
|
||||
if (_binding == null) {
|
||||
// Handle the case where binding could not be initialized
|
||||
// You may want to log an error or return a default view in this case
|
||||
return super.onCreateView(inflater, container, savedInstanceState)
|
||||
}
|
||||
|
||||
sharedPreference = requireContext().getSharedPreferences("PREFERENCE_NAME", Context.MODE_PRIVATE)
|
||||
DataHolder.selectedTest = null
|
||||
|
||||
|
||||
Reference in New Issue
Block a user