Skip to content

Commit

Permalink
Merge branch 'acra-crashes' into 'master'
Browse files Browse the repository at this point in the history
Fix ACRA crashes for 1.16-alpha0

Closes acra-crash-reports#131, acra-crash-reports#128, and acra-crash-reports#127

See merge request fdroid/fdroidclient!1167
  • Loading branch information
eighthave committed Dec 20, 2022
2 parents b6ad769 + 226ac16 commit 4156c13
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
Expand Up @@ -14,8 +14,10 @@
import android.text.TextUtils;
import android.util.Log;

import org.fdroid.database.Repository;
import org.fdroid.fdroid.FDroidApp;
import org.fdroid.fdroid.Preferences;
import org.fdroid.fdroid.R;
import org.fdroid.fdroid.Utils;
import org.fdroid.fdroid.nearby.peers.BonjourPeer;

Expand Down Expand Up @@ -178,6 +180,10 @@ public void handleMessage(Message msg) {
}

private void handleVisible(String localRepoName, boolean useHttps) {
if (FDroidApp.repo == null) {
sendBroadcast(STATUS_ERROR, context.getString(R.string.swap_no_wifi_network));
return;
}
HashMap<String, String> values = new HashMap<>();
values.put(BonjourPeer.PATH, "/fdroid/repo");
values.put(BonjourPeer.NAME, localRepoName);
Expand Down
Expand Up @@ -29,7 +29,7 @@ public class BonjourPeer extends WifiPeer {
public static BonjourPeer getInstance(ServiceInfo serviceInfo) {
String type = serviceInfo.getPropertyString(TYPE);
String fingerprint = serviceInfo.getPropertyString(FINGERPRINT);
if (type == null || !type.startsWith("fdroidrepo")
if (type == null || !type.startsWith("fdroidrepo") || FDroidApp.repo == null
|| TextUtils.equals(FDroidApp.repo.getFingerprint(), fingerprint)) {
return null;
}
Expand Down
Expand Up @@ -14,6 +14,7 @@
import org.fdroid.database.UpdatableApp;
import org.fdroid.database.DbUpdateChecker;
import org.fdroid.fdroid.AppUpdateStatusManager;
import org.fdroid.fdroid.Utils;
import org.fdroid.fdroid.data.Apk;
import org.fdroid.fdroid.data.App;
import org.fdroid.fdroid.data.DBHelper;
Expand All @@ -35,10 +36,7 @@
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import androidx.recyclerview.widget.RecyclerView;

import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
import io.reactivex.rxjava3.core.Single;
import io.reactivex.rxjava3.disposables.Disposable;
import io.reactivex.rxjava3.schedulers.Schedulers;

/**
* Manages the following types of information:
Expand Down Expand Up @@ -101,10 +99,8 @@ public UpdatesAdapter(AppCompatActivity activity) {
private void loadUpdatableApps() {
List<String> releaseChannels = Preferences.get().getBackendReleaseChannels();
if (disposable != null) disposable.dispose();
disposable = Single.fromCallable(() -> updateChecker.getUpdatableApps(releaseChannels))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(this::onCanUpdateLoadFinished);
disposable = Utils.runOffUiThread(() -> updateChecker.getUpdatableApps(releaseChannels),
this::onCanUpdateLoadFinished);
}

public boolean canViewAllUpdateableApps() {
Expand Down
Expand Up @@ -121,7 +121,8 @@ public data class FileV1(
) : IndexFile {
public companion object {
@JvmStatic
public fun deserialize(string: String): FileV1 {
public fun deserialize(string: String?): FileV1? {
if (string == null) return null
return IndexParser.json.decodeFromString(string)
}
}
Expand Down

0 comments on commit 4156c13

Please sign in to comment.