Skip to content
Open
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
5 changes: 2 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ android {
}
repositories {
maven {
url 'https://gitlab.com/api/v4/projects/8817162/packages/maven'
url 'https://jitpack.io'
}
mavenCentral()
jcenter()
Expand All @@ -116,8 +116,7 @@ dependencies {
implementation 'com.mikhaellopez:circularprogressbar:3.0.3'
implementation 'org.jsoup:jsoup:1.14.1'
// https://gitlab.com/eyeo/distpartners/libadblockplus-android/-/tags
implementation 'org.adblockplus:adblock-android-webview:5.0.1'

Choose a reason for hiding this comment

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

What's the need to downgrade?

Copy link
Author

Choose a reason for hiding this comment

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

Given version was not resolving properly (I tried to investigate it but with no result). That version builds fine

Choose a reason for hiding this comment

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

This caused issues with AdBlock feature or functioning of the app overall?

Copy link
Author

Choose a reason for hiding this comment

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

Gradle couldn't find this version and download it

Choose a reason for hiding this comment

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

Android Studio suggessted me to update to 7.3.1 along with other libraries

Copy link
Author

Choose a reason for hiding this comment

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

Does it build successfully for you with 5.0.1?

Copy link

@pixincreate pixincreate Dec 25, 2022

Choose a reason for hiding this comment

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

Understandable. The app uses many old libraries and functionalities that easily breaks upon upgrading. I got to know about these by the logs in CI/CD.
Yes, I was able to build it directly. I did even upgrade the things. I cherry picked your commit yesterday to my repo and they'll eventually got downgraded. Haven't checked it yet due to lack of time.

Copy link
Author

Choose a reason for hiding this comment

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

Copy link

@pixincreate pixincreate Dec 25, 2022

Choose a reason for hiding this comment

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

I just tried to build and yes, yes it failed now. I wonder why and how did that failed as I was able to build it yesterday as well as day before yesterday.

maybe it's due to repo havingt only 4.4.0 listed

This IMO might be one of the possible reason. I still personally prefer uBlock over adblock tho.

Copy link
Author

Choose a reason for hiding this comment

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

Me too. But I just wanted to hot fix stuff in order to build the repo. There was no reasoning behind decisions I made apart from successful build. You can change it however you like, though.

implementation 'com.github.ihimanshurawat:Hasher:1.2'
implementation 'org.adblockplus:adblock-android-webview:4.4.0'
implementation 'androidx.navigation:navigation-fragment:2.5.2'
implementation 'androidx.navigation:navigation-ui:2.5.2'
implementation 'com.google.code.gson:gson:2.8.9'
Expand Down
20 changes: 14 additions & 6 deletions app/src/main/java/com/cylonid/nativealpha/model/DataManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,16 @@
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.reflect.TypeToken;
import com.himanshurawat.hasher.HashType;
import com.himanshurawat.hasher.Hasher;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Map;
import java.util.TreeMap;

Expand Down Expand Up @@ -275,7 +276,11 @@ public boolean saveSharedPreferencesToFile(Uri uri) {
appdata = App.getAppContext().getSharedPreferences(SHARED_PREF_KEY, MODE_PRIVATE);
TreeMap<String, ?> shared_pref_map = new TreeMap<>(appdata.getAll());

oos.writeObject(Hasher.Companion.hash(shared_pref_map.toString(), HashType.SHA_256));
MessageDigest digest = MessageDigest.getInstance("SHA-256");
byte[] encodedhash = digest.digest(
shared_pref_map.toString().getBytes(StandardCharsets.UTF_8));
String hashString = Arrays.toString(encodedhash);
oos.writeObject(hashString);
oos.writeObject(shared_pref_map);

result = true;
Expand All @@ -296,7 +301,10 @@ public boolean loadSharedPreferencesFromFile(Uri uri){
prefEdit.clear();
String checksum = (String) ois.readObject();
TreeMap<String, ?> shared_pref_map = ((TreeMap<String, ?>) ois.readObject());
String new_checksum = Hasher.Companion.hash(shared_pref_map.toString(), HashType.SHA_256);
MessageDigest digest = MessageDigest.getInstance("SHA-256");
byte[] encodedhash = digest.digest(
shared_pref_map.toString().getBytes(StandardCharsets.UTF_8));
String new_checksum = Arrays.toString(encodedhash);

if (!checksum.equals(new_checksum))
throw new InvalidChecksumException("Checksums between backup and restored settings do not match.");
Expand All @@ -318,7 +326,7 @@ else if (v instanceof String)
prefEdit.apply();
result = true;

} catch (InvalidChecksumException | IOException | ClassNotFoundException e) {
} catch (InvalidChecksumException | IOException | ClassNotFoundException | NoSuchAlgorithmException e) {
e.printStackTrace();
}

Expand Down
2 changes: 2 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ buildscript {
maven {
url "https://plugins.gradle.org/m2/"
}
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.2.2'
Expand All @@ -27,6 +28,7 @@ allprojects {
google()
jcenter()
maven { url 'https://jitpack.io' }
mavenCentral()
}
}

Expand Down