fail fast with no internet

trying to refresh is useless if we don't have a connection

also, updates sentry to the latest

TODO: remove Prism4j and it's dependants, it hasn't been updated since 2019

Signed-off-by: androidacy-user <opensource@androidacy.com>
pull/27/head
androidacy-user 4 years ago
parent 609a6c6b19
commit c8529ee12b

@ -1,6 +1,6 @@
plugins {
// Gradle doesn't allow conditionally enabling/disabling plugins
id "io.sentry.android.gradle" version "3.3.0"
id "io.sentry.android.gradle" version "3.4.0"
id 'com.android.application'
id 'com.mikepenz.aboutlibraries.plugin'
}
@ -238,7 +238,7 @@ sentry {
// Enable auto-installation of Sentry components (sentry-android SDK and okhttp, timber and fragment integrations).
autoInstallation {
sentryVersion = '6.10.0'
sentryVersion = '6.11.0'
}
}
@ -277,7 +277,7 @@ dependencies {
implementation 'com.github.topjohnwu.libsu:io:5.0.1'
implementation 'com.github.Fox2Code:RosettaX:1.0.9'
implementation 'com.github.Fox2Code:AndroidANSI:1.0.1'
implementation 'io.sentry:sentry-android:6.10.0'
implementation 'io.sentry:sentry-android:6.11.0'
// Markdown
implementation "io.noties.markwon:core:4.6.2"

@ -41,14 +41,14 @@ public class RepoUpdater {
return 0;
}
this.indexRaw = Http.doHttpGet(this.repoData.getUrl(), false);
this.toUpdate = this.repoData.populate(new JSONObject(
new String(this.indexRaw, StandardCharsets.UTF_8)));
this.toUpdate = this.repoData.populate(new JSONObject(new String(this.indexRaw, StandardCharsets.UTF_8)));
// Since we reuse instances this should work
this.toApply = new HashSet<>(this.repoData.moduleHashMap.values());
this.toApply.removeAll(this.toUpdate);
// Return repo to update
return this.toUpdate.size();
} catch (Exception e) {
} catch (
Exception e) {
Log.e(TAG, "Failed to get manifest of " + this.repoData.id, e);
this.indexRaw = null;
this.toUpdate = Collections.emptyList();
@ -74,9 +74,11 @@ public class RepoUpdater {
if (this.indexRaw != null) {
try {
Files.write(this.repoData.metaDataCache, this.indexRaw);
if (BuildConfig.DEBUG) { Log.d(TAG, "Wrote index of " + this.repoData.id);
if (BuildConfig.DEBUG) {
Log.d(TAG, "Wrote index of " + this.repoData.id);
}
} catch (IOException e) {
} catch (
IOException e) {
e.printStackTrace();
}
this.indexRaw = null;

@ -3,6 +3,8 @@ package com.fox2code.mmm.utils;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.fox2code.mmm.repo.RepoManager;
/**
* Manager that want both to be thread safe and not to worry about thread safety
* {@link #scan()} and {@link #update(UpdateListener)} can be called from multiple
@ -27,6 +29,10 @@ public abstract class SyncManager {
// MultiThread friendly method
public final void update(@Nullable UpdateListener updateListener) {
// fail fast on no internet
if (!RepoManager.getINSTANCE().hasConnectivity()) {
return;
}
if (updateListener == null) updateListener = NO_OP;
if (!this.syncing) {
// Do scan
@ -60,10 +66,6 @@ public abstract class SyncManager {
}
}
public final boolean isRepoUpdating() {
return this.syncing;
}
public final void afterUpdate() {
if (this.syncing) synchronized (this.syncLock) { Thread.yield(); }
}

Loading…
Cancel
Save