Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
buildscript {
ext.kotlin_version = '2.0.21'
ext.koin_version = '2.1.6'
ext.lifecycle_version = '2.2.0'
ext.lifecycle_version = '2.10.0'
ext.jacoco_core_version = '0.8.14'

repositories {
Expand Down
18 changes: 9 additions & 9 deletions catroid/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@ ext {
manifestAppIcon = '@mipmap/ic_launcher'

projectVersion = "0.9"
gdxVersion = "1.13.0"
gdxVersion = "1.13.1"
mockitoVersion = '5.14.2'
mockkVersion = "1.14.7"
espressoVersion = '3.6.1'
espressoVersion = '3.7.0'
playServicesVersion = '18.1.1'
cameraXVersion = '1.4.0'
room_version = "2.6.1"
room_version = "2.8.4"
coroutines_version = '1.9.0'
work_manager_version = '2.9.1'
}
Expand Down Expand Up @@ -398,7 +398,7 @@ dependencies {
implementation 'com.github.bumptech.glide:glide:4.11.0'

// Lifecycle
implementation "androidx.lifecycle:lifecycle-extensions:$lifecycle_version"
implementation "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle_version"
implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version"

// Room
Expand All @@ -409,18 +409,18 @@ dependencies {
implementation("androidx.room:room-ktx:$room_version")

// Encrypted shared preferences
implementation("androidx.security:security-crypto:1.0.0")
implementation("androidx.security:security-crypto:1.1.0")

// CAST
implementation "com.google.android.gms:play-services-cast:17.0.0"

// Analytics
implementation "com.google.android.gms:play-services-analytics:$playServicesVersion"

implementation 'com.google.guava:guava:28.2-android'
implementation 'com.google.code.gson:gson:2.8.7'
implementation 'com.google.guava:guava:33.5.0-android'
implementation 'com.google.code.gson:gson:2.13.2'

implementation 'com.koushikdutta.async:androidasync:2.2.1'
implementation 'com.koushikdutta.async:androidasync:3.1.0'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'ar.com.hjg:pngj:2.1.0'

Expand All @@ -429,7 +429,7 @@ dependencies {
}

// WebView
implementation "androidx.webkit:webkit:1.2.0"
implementation "androidx.webkit:webkit:1.15.0"

// Pocket Music
implementation 'com.github.pdrogfer:MidiDroid:1.3'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ import org.koin.java.KoinJavaComponent.get

class CameraManager(private val stageActivity: StageActivity) : LifecycleOwner {
private val cameraProvider = ProcessCameraProvider.getInstance(stageActivity).get()
private val lifecycle = LifecycleRegistry(this)
private val lifecycleRegistry = LifecycleRegistry(this)
val previewView = PreviewView(stageActivity).apply {
visibility = View.INVISIBLE
}
Expand Down Expand Up @@ -90,14 +90,14 @@ class CameraManager(private val stageActivity: StageActivity) : LifecycleOwner {
CameraSelector.DEFAULT_BACK_CAMERA
}
currentCameraSelector = defaultCameraSelector
lifecycle.currentState = Lifecycle.State.CREATED
lifecycleRegistry.currentState = Lifecycle.State.CREATED
}

val isCameraFacingFront: Boolean
get() = currentCameraSelector == CameraSelector.DEFAULT_FRONT_CAMERA

val isCameraActive: Boolean
get() = lifecycle.currentState in listOf(Lifecycle.State.STARTED, Lifecycle.State.RESUMED) &&
get() = lifecycleRegistry.currentState in listOf(Lifecycle.State.STARTED, Lifecycle.State.RESUMED) &&
(cameraProvider.isBound(previewUseCase) || cameraProvider.isBound(analysisUseCase))

@Synchronized
Expand All @@ -111,17 +111,17 @@ class CameraManager(private val stageActivity: StageActivity) : LifecycleOwner {

@Synchronized
fun destroy() {
lifecycle.currentState = Lifecycle.State.DESTROYED
lifecycleRegistry.currentState = Lifecycle.State.DESTROYED
}

@Synchronized
fun pause() {
lifecycle.currentState = Lifecycle.State.CREATED
lifecycleRegistry.currentState = Lifecycle.State.CREATED
}

@Synchronized
fun resume() {
lifecycle.currentState = Lifecycle.State.RESUMED
lifecycleRegistry.currentState = Lifecycle.State.RESUMED
currentCamera?.cameraControl?.enableTorch(flashOn)
}

Expand Down Expand Up @@ -255,7 +255,7 @@ class CameraManager(private val stageActivity: StageActivity) : LifecycleOwner {
useCase
)
currentCamera?.cameraControl?.enableTorch(flashOn)
lifecycle.currentState = Lifecycle.State.STARTED
lifecycleRegistry.currentState = Lifecycle.State.STARTED
true
} catch (exception: IllegalStateException) {
Log.e(TAG, "Could not bind use case.", exception)
Expand All @@ -282,5 +282,6 @@ class CameraManager(private val stageActivity: StageActivity) : LifecycleOwner {
destroy()
}

override fun getLifecycle() = lifecycle
override val lifecycle: Lifecycle
get() = lifecycleRegistry
}
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,10 @@
Preconditions.checkState(webSocket == null);
Preconditions.checkState(asyncHttpClient != null);

final WebSocketClient client = this;

Check warning on line 106 in catroid/src/main/java/org/catrobat/catroid/scratchconverter/WebSocketClient.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove this unused "client" local variable.

See more on https://sonarcloud.io/project/issues?id=Catrobat_Catroid&issues=AZ1twAmlMcTl8a-FrsR2&open=AZ1twAmlMcTl8a-FrsR2&pullRequest=5190
asyncHttpClient.websocket(Constants.SCRATCH_CONVERTER_WEB_SOCKET, null, new
//TODO: remove deprecated code for scratch-converter

Check warning on line 107 in catroid/src/main/java/org/catrobat/catroid/scratchconverter/WebSocketClient.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Complete the task associated to this TODO comment.

See more on https://sonarcloud.io/project/issues?id=Catrobat_Catroid&issues=AZ1twAmlMcTl8a-FrsR4&open=AZ1twAmlMcTl8a-FrsR4&pullRequest=5190
/*asyncHttpClient.websocket(Constants.SCRATCH_CONVERTER_WEB_SOCKET, null, new
AsyncHttpClient.WebSocketConnectCallback() {

Check warning on line 109 in catroid/src/main/java/org/catrobat/catroid/scratchconverter/WebSocketClient.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

This block of commented-out lines of code should be removed.

See more on https://sonarcloud.io/project/issues?id=Catrobat_Catroid&issues=AZ1twAmlMcTl8a-FrsR3&open=AZ1twAmlMcTl8a-FrsR3&pullRequest=5190
@Override
public void onCompleted(Exception ex, final WebSocket newWebSocket) {
Preconditions.checkState(state != State.CONNECTED && webSocket == null);
Expand All @@ -124,7 +125,7 @@
webSocket.setClosedCallback(client);
connectCallback.onSuccess();
}
});
});*/
}
Comment on lines 106 to 129

Copilot AI Apr 20, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

connect() no longer initiates a WebSocket connection or invokes connectCallback (the entire asyncHttpClient.websocket(...) call is commented out). As a result, connectAndAuthenticate() can hang in NOT_CONNECTED without ever calling onSuccess()/onFailure(), effectively breaking Scratch Converter connectivity. Please either migrate this call to the non-deprecated androidasync 3.x WebSocket API (and keep the callbacks/state transitions), or remove/feature-gate Scratch Converter so callers aren’t left waiting silently.

Copilot uses AI. Check for mistakes.

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ fun <T> LiveData<T>.getOrAwaitValue(
var data: T? = null
val latch = CountDownLatch(1)
val observer = object : Observer<T> {
override fun onChanged(o: T?) {
data = o
override fun onChanged(value: T) {
data = value
latch.countDown()
this@getOrAwaitValue.removeObserver(this)
}
Expand Down
Loading