finish up in-app updater

fixes #170

once androidacy impl is finished, will switch to androidacy API over GitHub for stability and accessibility reasons

Signed-off-by: androidacy-user <opensource@androidacy.com>
pull/284/head
androidacy-user 1 year ago
parent df41a04c15
commit 68bf2636c3

@ -1,6 +1,6 @@
plugins { plugins {
// Gradle doesn't allow conditionally enabling/disabling plugins // Gradle doesn't allow conditionally enabling/disabling plugins
id "io.sentry.android.gradle" version "3.4.0" id "io.sentry.android.gradle" version "3.4.1"
id 'com.android.application' id 'com.android.application'
id 'com.mikepenz.aboutlibraries.plugin' id 'com.mikepenz.aboutlibraries.plugin'
id 'org.jetbrains.kotlin.android' id 'org.jetbrains.kotlin.android'
@ -270,7 +270,7 @@ sentry {
// Enable auto-installation of Sentry components (sentry-android SDK and okhttp, timber and fragment integrations). // Enable auto-installation of Sentry components (sentry-android SDK and okhttp, timber and fragment integrations).
autoInstallation { autoInstallation {
sentryVersion = '6.12.1' sentryVersion = sentry_version
} }
// temp fix for gradle bug // temp fix for gradle bug
@ -318,6 +318,8 @@ dependencies {
implementation "io.sentry:sentry-android-timber:$sentry_version" implementation "io.sentry:sentry-android-timber:$sentry_version"
implementation "io.sentry:sentry-android-fragment:$sentry_version" implementation "io.sentry:sentry-android-fragment:$sentry_version"
implementation "io.sentry:sentry-android-okhttp:$sentry_version" implementation "io.sentry:sentry-android-okhttp:$sentry_version"
implementation "io.sentry:sentry-kotlin-extensions:$sentry_version"
implementation "io.sentry:sentry-android-ndk:$sentry_version"
// Markdown // Markdown
implementation "io.noties.markwon:core:4.6.2" implementation "io.noties.markwon:core:4.6.2"
@ -332,7 +334,6 @@ dependencies {
implementation 'androidx.core:core-ktx:1.9.0' implementation 'androidx.core:core-ktx:1.9.0'
implementation "io.sentry:sentry-kotlin-extensions:$sentry_version"
// timber // timber
implementation 'com.jakewharton.timber:timber:5.0.1' implementation 'com.jakewharton.timber:timber:5.0.1'
@ -377,11 +378,11 @@ android {
kotlin { kotlin {
jvmToolchain { jvmToolchain {
languageVersion.set(JavaLanguageVersion.of(11)) // "8" languageVersion.set(JavaLanguageVersion.of(11))
} }
} }
// Safeguard (Do not remove) // Safeguard (Do not remove. Or do, i'm just a comment not a cop)
final File res = new File(projectDir, "src/main/res") final File res = new File(projectDir, "src/main/res")
for (String name : res.list()) { for (String name : res.list()) {
// Character.isDigit is required to make sure // Character.isDigit is required to make sure

@ -3,9 +3,11 @@ package com.fox2code.mmm;
import static com.fox2code.mmm.utils.IntentHelper.getActivity; import static com.fox2code.mmm.utils.IntentHelper.getActivity;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.content.ComponentName;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.content.res.Resources; import android.content.res.Resources;
import android.os.Bundle; import android.os.Bundle;
import android.view.View; import android.view.View;
@ -61,6 +63,8 @@ public class SetupActivity extends FoxActivity implements LanguageActivity {
} }
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION, 0); this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION, 0);
createRealmDatabase(); createRealmDatabase();
createFiles();
disableUpdateActivityForFdroidFlavor();
// Set theme // Set theme
SharedPreferences prefs = MainApplication.getSharedPreferences(); SharedPreferences prefs = MainApplication.getSharedPreferences();
switch (prefs.getString("theme", "system")) { switch (prefs.getString("theme", "system")) {
@ -337,6 +341,9 @@ public class SetupActivity extends FoxActivity implements LanguageActivity {
} }
} }
}); });
}
public void createFiles() {
try { try {
String cookieFileName = "cookies"; String cookieFileName = "cookies";
// initial set of cookies, only really used to create the keypair and encrypted file // initial set of cookies, only really used to create the keypair and encrypted file
@ -372,7 +379,7 @@ public class SetupActivity extends FoxActivity implements LanguageActivity {
outputStream.flush(); outputStream.flush();
} }
} catch (GeneralSecurityException | } catch (GeneralSecurityException |
IOException e) { IOException e) {
Timber.e(e); Timber.e(e);
} }
// we literally only use these to create the http cache folders // we literally only use these to create the http cache folders
@ -389,4 +396,15 @@ public class SetupActivity extends FoxActivity implements LanguageActivity {
} }
} }
} }
@SuppressWarnings("ConstantConditions")
public void disableUpdateActivityForFdroidFlavor() {
if (BuildConfig.FLAVOR.equals("fdroid")) {
Timber.d("Disabling update activity for fdroid flavor");
// disable update activity through package manager
PackageManager pm = getPackageManager();
ComponentName componentName = new ComponentName(this, UpdateActivity.class);
pm.setComponentEnabledSetting(componentName, PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP);
}
}
} }

@ -43,14 +43,6 @@ public class UpdateActivity extends FoxActivity {
MaterialTextView statusTextView = findViewById(R.id.update_progress_text); MaterialTextView statusTextView = findViewById(R.id.update_progress_text);
// set status text to please wait // set status text to please wait
statusTextView.setText(R.string.please_wait); statusTextView.setText(R.string.please_wait);
// for debug builds, set update_debug_warning to visible and return
/**if (BuildConfig.DEBUG) {
findViewById(R.id.update_debug_warning).setVisibility(MaterialTextView.VISIBLE);
progressIndicator.setIndeterminate(false);
progressIndicator.setProgressCompat(0, false);
statusTextView.setVisibility(MaterialTextView.INVISIBLE);
return;
}*/
Thread updateThread = new Thread() { Thread updateThread = new Thread() {
public void run() { public void run() {
// Now, parse the intent // Now, parse the intent

@ -19,7 +19,7 @@ buildscript {
flavorAware: true flavorAware: true
] ]
project.ext.kotlin_version = "1.8.0" project.ext.kotlin_version = "1.8.0"
project.ext.sentry_version = "6.12.1" project.ext.sentry_version = "6.13.0"
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:7.4.0' classpath 'com.android.tools.build:gradle:7.4.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

Loading…
Cancel
Save