Merge branch 'acra-fixes' into 'master'

Four fixes for acra issues

Closes acra-crash-reports#749, acra-crash-reports#748, acra-crash-reports#741, and acra-crash-reports#740

See merge request fdroid/fdroidclient!1423
This commit is contained in:
Hans-Christoph Steiner
2024-09-13 08:35:49 +00:00
5 changed files with 31 additions and 3 deletions

View File

@@ -492,7 +492,13 @@ public class SwapWorkflowActivity extends AppCompatActivity {
if (Build.VERSION.SDK_INT <= 28) {
wifiManager.setWifiEnabled(false);
}
if (wifiApControl.enable()) {
boolean wifiEnabled = false;
try {
wifiEnabled = wifiApControl.enable();
} catch (Exception e) {
Log.e(TAG, "Error enabling WiFi: ", e);
}
if (wifiEnabled) {
Toast.makeText(this, R.string.swap_toast_hotspot_enabled, Toast.LENGTH_SHORT).show();
SwapService.putHotspotActivatedUserPreference(true);
} else {

View File

@@ -1,6 +1,8 @@
package org.fdroid.fdroid
import android.content.Context
import android.os.Handler
import android.os.Looper
import android.util.Log
import android.widget.Toast
import android.widget.Toast.LENGTH_LONG
@@ -149,7 +151,10 @@ class RepoUpdateManager @JvmOverloads constructor(
msgBuilder.append("$repoName: ${e.localizedMessage} ${cause.localizedMessage}")
}
}
Toast.makeText(context, msgBuilder.toString(), LENGTH_LONG).show()
// can't show Toast from background thread, so we need to move this to UiThread
Handler(Looper.getMainLooper()).post {
Toast.makeText(context, msgBuilder.toString(), LENGTH_LONG).show()
}
}
override fun onDownloadProgress(repo: Repository, bytesRead: Long, totalBytes: Long) {

View File

@@ -150,6 +150,11 @@ public class RepoDetailsActivity extends AppCompatActivity {
repoId = getIntent().getLongExtra(ARG_REPO_ID, 0);
model.initRepo(repoId);
repo = FDroidApp.getRepoManager(this).getRepository(repoId);
if (repo == null) {
// repo must have been deleted just now (maybe slow UI?)
finish();
return;
}
TextView inputUrl = findViewById(R.id.input_repo_url);
inputUrl.setText(repo.getAddress());

View File

@@ -16,7 +16,7 @@ internal object RepoUriGetter {
it.buildUpon().scheme("http").build()
}
it.host == "fdroid.link" -> getFdroidLinkUri(it)
it.host == "fdroid.link" && it.encodedFragment != null -> getFdroidLinkUri(it)
it.scheme.isNullOrBlank() -> {
// assume https:// when no scheme given

View File

@@ -90,6 +90,18 @@ internal class RepoUriGetterTest {
val uri3 = RepoUriGetter.getUri("https://fdroid.link/#http://f-droid.org/repo")
assertEquals("http://f-droid.org/repo", uri3.uri.toString())
assertNull(uri3.fingerprint)
val uri4 = RepoUriGetter.getUri("https://fdroid.link/")
// we don't care what it is as long as it doesn't crash
assertNull(uri4.fingerprint)
val uri5 = RepoUriGetter.getUri("https://fdroid.link/#foo")
// we don't care what it is as long as it doesn't crash
assertNull(uri5.fingerprint)
val uri6 = RepoUriGetter.getUri("https://fdroid.link/#invalid://foo.bar")
// we don't care what it is as long as it doesn't crash
assertNull(uri6.fingerprint)
}
@Test