makes app production ready

This commit is contained in:
Raphael Maenle 2022-01-11 14:02:38 +01:00
parent c213e51cdd
commit 6df001ed4c
7 changed files with 17 additions and 15 deletions

1
.gitignore vendored
View File

@ -28,3 +28,4 @@ google-services.json
# Android Profiling # Android Profiling
*.hprof *.hprof
*.aab

View File

@ -1,7 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
package="com.maenle.bump"> package="com.maenle.bump"
android:versionName="initial">
<uses-feature android:name="android.hardware.camera.any" /> <uses-feature android:name="android.hardware.camera.any" />
<uses-permission android:name="android.permission.CAMERA" /> <uses-permission android:name="android.permission.CAMERA" />

View File

@ -19,18 +19,18 @@ class MyFirebaseMessagingService : FirebaseMessagingService() {
// [START receive_message] // [START receive_message]
override fun onMessageReceived(remoteMessage: RemoteMessage) { override fun onMessageReceived(remoteMessage: RemoteMessage) {
// Not getting messages here? See why this may be: https://goo.gl/39bRNJ // Not getting messages here? See why this may be: https://goo.gl/39bRNJ
Log.d(TAG, "From: ${remoteMessage.from}") // Log.d(TAG, "From: ${remoteMessage.from}")
// TODO Step 3.5 check messages for data // TODO Step 3.5 check messages for data
// Check if message contains a data payload. // Check if message contains a data payload.
remoteMessage.data.let { remoteMessage.data.let {
Log.d(TAG, "Message data payload: " + remoteMessage.data) // Log.d(TAG, "Message data payload: " + remoteMessage.data)
} }
// TODO Step 3.6 check messages for notification and call sendNotification // TODO Step 3.6 check messages for notification and call sendNotification
// Check if message contains a notification payload. // Check if message contains a notification payload.
remoteMessage.notification?.let { remoteMessage.notification?.let {
Log.d(TAG, "Message Notification Body: ${it.body}") // Log.d(TAG, "Message Notification Body: ${it.body}")
sendNotification(it.body!!) sendNotification(it.body!!)
} }
} }

View File

@ -110,9 +110,9 @@ class CameraFragment: Fragment() {
previewUseCase previewUseCase
) )
} catch (illegalStateException: IllegalStateException) { } catch (illegalStateException: IllegalStateException) {
Log.e(TAG, illegalStateException.message ?: "IllegalStateException") // Log.e(TAG, illegalStateException.message ?: "IllegalStateException")
} catch (illegalArgumentException: IllegalArgumentException) { } catch (illegalArgumentException: IllegalArgumentException) {
Log.e(TAG, illegalArgumentException.message ?: "IllegalArgumentException") // Log.e(TAG, illegalArgumentException.message ?: "IllegalArgumentException")
} }
} }
@ -153,9 +153,9 @@ class CameraFragment: Fragment() {
analysisUseCase analysisUseCase
) )
} catch (illegalStateException: IllegalStateException) { } catch (illegalStateException: IllegalStateException) {
Log.e(TAG, illegalStateException.message ?: "IllegalStateException") // Log.e(TAG, illegalStateException.message ?: "IllegalStateException")
} catch (illegalArgumentException: IllegalArgumentException) { } catch (illegalArgumentException: IllegalArgumentException) {
Log.e(TAG, illegalArgumentException.message ?: "IllegalArgumentException") // Log.e(TAG, illegalArgumentException.message ?: "IllegalArgumentException")
} }
} }
@ -189,7 +189,7 @@ class CameraFragment: Fragment() {
blockingScanned = false blockingScanned = false
} }
.addOnFailureListener { .addOnFailureListener {
Log.e(TAG, it.message ?: it.toString()) // Log.e(TAG, it.message ?: it.toString())
}.addOnCompleteListener { }.addOnCompleteListener {
// When the image is from CameraX analysis use case, must call image.close() on received // When the image is from CameraX analysis use case, must call image.close() on received
// images when finished using them. Otherwise, new images may not be received or the camera // images when finished using them. Otherwise, new images may not be received or the camera
@ -207,7 +207,7 @@ class CameraFragment: Fragment() {
if (isCameraPermissionGranted()) { if (isCameraPermissionGranted()) {
bindCameraUseCases() bindCameraUseCases()
} else { } else {
Log.e(TAG, "no camera permission") // Log.e(TAG, "no camera permission")
} }
} }
super.onRequestPermissionsResult(requestCode, permissions, grantResults) super.onRequestPermissionsResult(requestCode, permissions, grantResults)

View File

@ -125,7 +125,7 @@ class FirstFragment : Fragment() {
try { try {
bitmap = qrgEncoder.encodeAsBitmap() bitmap = qrgEncoder.encodeAsBitmap()
} catch (e: WriterException) { } catch (e: WriterException) {
Log.d("Tag", e.toString()) // Log.d("Tag", e.toString())
} }
if(nightModeFlags == Configuration.UI_MODE_NIGHT_YES) { if(nightModeFlags == Configuration.UI_MODE_NIGHT_YES) {
@ -160,7 +160,7 @@ class FirstFragment : Fragment() {
if (!task.isSuccessful) { if (!task.isSuccessful) {
curmessage = getString(R.string.message_subscribe_failed) curmessage = getString(R.string.message_subscribe_failed)
} }
Log.d(TAG, curmessage.toString()) // Log.d(TAG, curmessage.toString())
} }
// [END subscribe_topics] // [END subscribe_topics]
} }

View File

@ -29,9 +29,9 @@ class CameraXViewModel(application: Application) : AndroidViewModel(application)
cameraProviderLiveData!!.setValue(cameraProviderFuture.get()) cameraProviderLiveData!!.setValue(cameraProviderFuture.get())
} catch (e: ExecutionException) { } catch (e: ExecutionException) {
// Handle any errors (including cancellation) here. // Handle any errors (including cancellation) here.
Log.e(TAG, "Unhandled exception", e) // Log.e(TAG, "Unhandled exception", e)
} catch (e: InterruptedException) { } catch (e: InterruptedException) {
Log.e(TAG, "Unhandled exception", e) // Log.e(TAG, "Unhandled exception", e)
} }
}, },
ContextCompat.getMainExecutor(getApplication()) ContextCompat.getMainExecutor(getApplication())

View File

@ -26,7 +26,7 @@ class RestSingleton constructor(context: Context){
} }
private val TAG = MainActivity::class.java.simpleName private val TAG = MainActivity::class.java.simpleName
private const val URL = "http://192.168.68.127:4000/api/" private const val URL = "https://bump.maenle.net/api/"
} }
fun list(sender: String, callback: (JSONArray) -> Unit){ fun list(sender: String, callback: (JSONArray) -> Unit){