Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Final API23 (Android 6) Support Release #2699

Open
wants to merge 36 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
a8fc438
Enable desugar
asif-finimble Jun 15, 2022
70d52f0
Fixed API23 crashes and compatibility using modded web3j-3.3.1-android
asif-finimble Jul 4, 2022
cfe5863
Update core web3j for ENS feature
JamesSmartCell Sep 20, 2022
00118c1
fix formatting
JamesSmartCell Sep 20, 2022
e09aac9
Update final version message and library
JamesSmartCell Sep 20, 2022
136a009
update API23 notice
JamesSmartCell Sep 21, 2022
6d33440
Fix Inject for websites in same domain
JamesSmartCell Sep 21, 2022
b22f8c5
bump gradle
JamesSmartCell Sep 21, 2022
f6ad872
Update to current master for re-release
JamesSmartCell Oct 30, 2022
d1109d2
Add RPC validation fix, swap providers and bump gradle
JamesSmartCell Nov 3, 2022
ff528b7
test release
JamesSmartCell Nov 4, 2022
256b2d2
Remove play library to push release through
JamesSmartCell Nov 9, 2022
1762e06
Remove anayltics
JamesSmartCell Nov 9, 2022
c728fff
Update gradle
JamesSmartCell Nov 11, 2022
f4ce0b4
Fix for Android deeplink issues
JamesSmartCell Nov 14, 2022
ec3aa09
Fix most of the crashes (#2956)
seabornlee Nov 18, 2022
70d0d4d
fix NPEs
JamesSmartCell Nov 18, 2022
341ff5e
Fix for video not looping (#2941)
JamesSmartCell Nov 15, 2022
072a99b
Add IPFS connection point (#2920)
JamesSmartCell Nov 8, 2022
d515e86
Remove PHI network (#2952)
justindg Nov 17, 2022
39f2dc9
Bump gradle to 3.60.
JamesSmartCell Nov 19, 2022
d982e4d
Fix crashbug and update gradle for release update.
JamesSmartCell Nov 20, 2022
b9df7e9
Add tertiary key for Infura to test usage
JamesSmartCell Nov 28, 2022
267fb3e
Fix swap tests
JamesSmartCell Nov 28, 2022
6d68fe3
Add caching for ENS resolve.
JamesSmartCell Nov 28, 2022
2537d6a
Restrict calls on update ticker
JamesSmartCell Nov 29, 2022
c3b8656
Fix for empty ticker returns
JamesSmartCell Nov 29, 2022
409624e
Bump gradle build number
JamesSmartCell Nov 29, 2022
e396fdf
Ensure all usages of primary URL include the required secret and repl…
JamesSmartCell Dec 7, 2022
0036736
Updates
JamesSmartCell Dec 7, 2022
7042ad3
Ensure all usages of primary URL include the required secret and repl…
JamesSmartCell Dec 7, 2022
bd08254
update
JamesSmartCell Dec 7, 2022
cda91d3
Cherry pick fixes
JamesSmartCell Dec 7, 2022
6068cf5
Further update fixes to reduce overhead with balance updates
JamesSmartCell Dec 8, 2022
83063c8
Fix various ERC721 handling bugs
JamesSmartCell Dec 9, 2022
dcbc9ae
Bump gradle
JamesSmartCell Dec 9, 2022
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
27 changes: 27 additions & 0 deletions .github/workflows/codestyle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Check code format
on:
pull_request:
jobs:
lint:
name: Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup NodeJS
uses: actions/setup-node@v3
with:
node-version: 16
- name: Install dependencies
run: npm install
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v34
- name: Check all changed files
run: |
for file in ${{ steps.changed-files.outputs.all_changed_files }}; do
npx ec "$file"
done

22 changes: 13 additions & 9 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ android {
}
}
defaultConfig {
versionCode 202
versionName "3.58.3"
versionCode 224
versionName "3.60.8"

applicationId "io.stormbird.wallet"
minSdkVersion 23
Expand Down Expand Up @@ -132,7 +132,7 @@ android {
Below code is used to include analytics only when Flavor is "No Analytics"
This is due to China release where Google services should not be included
*/
apply plugin: 'com.google.gms.google-services'
//apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'
}
noAnalytics {
Expand Down Expand Up @@ -164,7 +164,7 @@ android {
signingConfig signingConfigs.release
}
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
packagingOptions {
exclude 'META-INF/NOTICE' // will not include NOTICE file
Expand All @@ -184,6 +184,8 @@ android {
abortOnError false
}
compileOptions {
// Flag to enable support for the new language APIs
coreLibraryDesugaringEnabled true
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_1_8
}
Expand Down Expand Up @@ -273,8 +275,9 @@ dependencies {
implementation 'com.github.apl-devs:appintro:v4.2.2'
implementation 'com.github.romandanylyk:PageIndicatorView:v1.0.0'

//coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.0.5'
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
Copy link

Choose a reason for hiding this comment

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

Warning ⚠️  
📚 A newer version of com.android.tools:desugar_jdk_libs than 1.1.5 is available: 1.2.0
🛠️ GradleDependency

by Android Lint 🤖

Copy link

Choose a reason for hiding this comment

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

Warning ⚠️  
📚 A newer version of com.android.tools:desugar_jdk_libs than 1.1.5 is available: 1.2.0
🛠️ GradleDependency

by Android Lint 🤖


implementation 'io.reactivex:rxjava:1.2.4'
// ReactiveX
implementation 'io.reactivex.rxjava2:rxjava:2.2.21'
implementation "io.reactivex.rxjava2:rxandroid:2.1.1"
Expand Down Expand Up @@ -348,11 +351,12 @@ dependencies {

implementation 'androidx.work:work-runtime:2.7.1'

//Analytics
analyticsImplementation 'com.google.android.play:core:1.10.3'
analyticsImplementation 'com.google.firebase:firebase-analytics:21.1.1'
analyticsImplementation platform('com.google.firebase:firebase-bom:28.1.0')
//analyticsImplementation 'com.google.firebase:firebase-analytics'
analyticsImplementation 'com.google.firebase:firebase-crashlytics'
//analyticsImplementation 'com.google.firebase:firebase-analytics:21.1.1'
analyticsImplementation 'com.mixpanel.android:mixpanel-android:5.8.4'
analyticsImplementation 'com.google.firebase:firebase-crashlytics:18.2.13'
//analyticsImplementation 'com.google.firebase:firebase-crashlytics:18.2.13'
}

// WARNING WARNING WARNING
Expand Down
Binary file modified app/libs/core-4.8.8-android.jar
Binary file not shown.
20 changes: 20 additions & 0 deletions app/proguard-android-optimize.txt
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,23 @@

# These classes are duplicated between android.jar and core-lambda-stubs.jar.
-dontnote java.lang.invoke.**

-keepclasseswithmembernames,includedescriptorclasses class * {
native <methods>;
}

#trust wallet
-keep class wallet.core.jni.** { *; }
-keep class wallet.core.jni.proto.** { *; }
-keep class org.web3j.** { *; }

#entities, jsInterface & listeners
-keep class com.alphawallet.token.** { *; }
-keep class com.alphawallet.app.walletconnect.** { *; }
-keep class com.alphawallet.app.web3.** { *; }
-keep class com.alphawallet.app.web3j.** { *; }
-keep class com.alphawallet.app.entity.** { *; }

-repackageclasses
#-dontobfuscate
#-printconfiguration ../full-r8-config.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,22 @@
import com.alphawallet.app.C;
import com.alphawallet.app.entity.AnalyticsProperties;
import com.alphawallet.app.entity.ServiceErrorException;
import com.alphawallet.app.repository.KeyProvider;
import com.alphawallet.app.repository.KeyProviderFactory;
import com.google.firebase.analytics.FirebaseAnalytics;
import com.google.firebase.crashlytics.FirebaseCrashlytics;
import com.google.firebase.iid.FirebaseInstanceId;
import com.mixpanel.android.mpmetrics.MixpanelAPI;

import org.json.JSONException;
import org.json.JSONObject;

import java.util.Objects;

public class AnalyticsService<T> implements AnalyticsServiceType<T> {

private final MixpanelAPI mixpanelAPI;
private final FirebaseAnalytics firebaseAnalytics;
//private final FirebaseAnalytics firebaseAnalytics;

public AnalyticsService(Context context)
{
mixpanelAPI = MixpanelAPI.getInstance(context, KeyProviderFactory.get().getAnalyticsKey());
firebaseAnalytics = FirebaseAnalytics.getInstance(context);
//firebaseAnalytics = FirebaseAnalytics.getInstance(context);
}

@Override
Expand Down Expand Up @@ -62,7 +57,7 @@ private void trackFirebase(AnalyticsProperties analyticsProperties, String event

props.putString(C.APP_NAME, BuildConfig.APPLICATION_ID);

firebaseAnalytics.logEvent(eventName, props);
//firebaseAnalytics.logEvent(eventName, props);
}

private void trackMixpanel(AnalyticsProperties analyticsProperties, String eventName)
Expand Down Expand Up @@ -92,17 +87,17 @@ private void trackMixpanel(AnalyticsProperties analyticsProperties, String event
@Override
public void identify(String uuid)
{
firebaseAnalytics.setUserId(uuid);
//firebaseAnalytics.setUserId(uuid);
mixpanelAPI.identify(uuid);
mixpanelAPI.getPeople().identify(uuid);
FirebaseInstanceId.getInstance().getInstanceId()
/*FirebaseInstanceId.getInstance().getInstanceId()
.addOnCompleteListener(task -> {
if (task.isSuccessful())
{
String token = Objects.requireNonNull(task.getResult()).getToken();
mixpanelAPI.getPeople().setPushRegistrationId(token);
}
});
});*/
}

@Override
Expand Down
28 changes: 9 additions & 19 deletions app/src/analytics/java/com/alphawallet/app/util/RateApp.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.alphawallet.app.util;

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.RatingBar;
Expand All @@ -10,10 +12,6 @@
import com.alphawallet.app.R;
import com.alphawallet.app.repository.PreferenceRepositoryType;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import com.google.android.play.core.review.ReviewInfo;
import com.google.android.play.core.review.ReviewManager;
import com.google.android.play.core.review.ReviewManagerFactory;
import com.google.android.play.core.tasks.Task;

public class RateApp {
// should be shown on 5th run or after the first transaction (afterTransaction == true)
Expand All @@ -38,9 +36,7 @@ static public void showRateTheApp(Activity context, PreferenceRepositoryType pre
preferenceRepository.setRateAppShown();
}
})
.setNegativeButton(R.string.rate_no_thanks, (dialogInterface, i) -> {
preferenceRepository.setRateAppShown();
});
.setNegativeButton(R.string.rate_no_thanks, (dialogInterface, i) -> preferenceRepository.setRateAppShown());

AlertDialog dialog = builder.show();
ratingBar.setOnRatingBarChangeListener((rb, rating, fromUser) -> {
Expand All @@ -53,18 +49,12 @@ static public void showRateTheApp(Activity context, PreferenceRepositoryType pre
}
}

private static void startRateFlow(Activity context, PreferenceRepositoryType preferenceRepository) {
ReviewManager manager = ReviewManagerFactory.create(context);
Task<ReviewInfo> request = manager.requestReviewFlow();
request.addOnCompleteListener(task -> {
if (task.isSuccessful()) {
ReviewInfo reviewInfo = task.getResult();
Task<Void> flow = manager.launchReviewFlow(context, reviewInfo);
flow.addOnCompleteListener(flowTask -> {

});
}
});
private static void startRateFlow(Activity activity, PreferenceRepositoryType preferenceRepository) {
//simply take them to play store for now, until the current situation with play store libraries not being allowed is resolved
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("https://play.google.com/store/apps/details?id=" + activity.getPackageName()));
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NO_ANIMATION);
activity.startActivity(intent);
// save rate ui shown
preferenceRepository.setRateAppShown();
}
Expand Down
26 changes: 14 additions & 12 deletions app/src/analytics/java/com/alphawallet/app/util/UpdateUtils.java
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
package com.alphawallet.app.util;

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;

import com.alphawallet.app.entity.FragmentMessenger;
import com.google.android.play.core.appupdate.AppUpdateInfo;
import com.google.android.play.core.appupdate.AppUpdateManager;
import com.google.android.play.core.appupdate.AppUpdateManagerFactory;
import com.google.android.play.core.appupdate.AppUpdateOptions;
import com.google.android.play.core.install.model.AppUpdateType;
import com.google.android.play.core.install.model.UpdateAvailability;
import com.google.android.play.core.tasks.Task;

public class UpdateUtils {
//Pull update check for now
public static void checkForUpdates(Activity context, FragmentMessenger messenger) {
AppUpdateManager appUpdateManager = AppUpdateManagerFactory.create(context);
/*AppUpdateManager appUpdateManager = AppUpdateManagerFactory.create(context);

Task<AppUpdateInfo> appUpdateInfoTask = appUpdateManager.getAppUpdateInfo();

Expand All @@ -22,12 +18,18 @@ public static void checkForUpdates(Activity context, FragmentMessenger messenger
{
messenger.updateReady(appUpdateInfo.availableVersionCode());
}
});
});*/
}

public static void pushUpdateDialog(Activity context)
public static void pushUpdateDialog(Activity activity)
{
AppUpdateManager appUpdateManager = AppUpdateManagerFactory.create(context);
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("https://play.google.com/store/apps/details?id=" + activity.getPackageName()));
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NO_ANIMATION);

activity.startActivity(intent);

/*AppUpdateManager appUpdateManager = AppUpdateManagerFactory.create(context);

Task<AppUpdateInfo> appUpdateInfoTask = appUpdateManager.getAppUpdateInfo();

Expand All @@ -36,6 +38,6 @@ public static void pushUpdateDialog(Activity context)
{
appUpdateManager.startUpdateFlow(appUpdateInfo, context, AppUpdateOptions.newBuilder(AppUpdateType.FLEXIBLE).build());
}
});
});*/
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,12 @@
*/
public class TokenScriptCertificateTest extends BaseE2ETest
{
private final String doorContractAddress;
private String doorContractAddress;
private final String contractOwnerPk = "0x69c22d654be7fe75e31fbe26cb56c93ec91144fab67cb71529c8081971635069";
private final Web3j web3j;

private final boolean useMumbai = false; //for local testing

private static final Map<String, String[]> WALLETS_ON_GANACHE = new HashMap<String, String[]>()
{{
put("24", new String[]{"0x644022aef70ad515ee186345fd74b005d759f41be8157c2835de3597d943146d", "0xE494323823fdF1A1Ab6ca79d2538C7182690D52a"});
Expand Down Expand Up @@ -81,6 +83,12 @@ public TokenScriptCertificateTest()

//Always use zero nonce for determining the contract address
doorContractAddress = EthUtils.calculateContractAddress(deployCredentials.getAddress(), 0L);

if (useMumbai)
{
//If using Mumbai for this test:
doorContractAddress = "0xA0343dfd68FcD7F18153b8AB87936c5A9C1Da20e";
}
}

@Test
Expand All @@ -100,8 +108,8 @@ public void should_view_signature_details()

assertThat(getWalletAddress(), equalTo(ownerAddress));

addNewNetwork("Ganache");
selectTestNet("Ganache");
addNewNetwork("Ganache", GANACHE_URL);
selectTestNet(useMumbai ? "Mumbai" : "Ganache");

//Ensure we're on the wallet page
switchToWallet(ownerAddress);
Expand All @@ -117,7 +125,7 @@ public void should_view_signature_details()

onView(allOf(withId(R.id.edit_text))).perform(replaceText(doorContractAddress));

onView(isRoot()).perform(waitUntil(withId(R.id.select_token), 30));
onView(isRoot()).perform(waitUntil(withId(R.id.select_token), 300));

click(withId(R.id.select_token));

Expand All @@ -142,6 +150,8 @@ public void should_view_signature_details()

shouldSee("Smart Token Labs");
shouldSee("ECDSA");
shouldSee("Contract Owner"); // Note this may fail once we pull owner() from contract, test will need to be changed to contract owner, which for this test is: 0xA20efc4B9537d27acfD052003e311f762620642D
shouldSee("Contract Owner"); // Note this may fail once we pull owner() from contract,
// test will need to be changed to contract owner,
// which for this test is: 0xA20efc4B9537d27acfD052003e311f762620642D
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import static com.alphawallet.app.steps.Steps.selectTestNet;
import static com.alphawallet.app.steps.Steps.sendBalanceTo;
import static com.alphawallet.app.steps.Steps.switchToWallet;
import static com.alphawallet.app.util.EthUtils.GANACHE_URL;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.fail;
Expand Down Expand Up @@ -46,7 +47,7 @@ public void should_transfer_from_an_account_to_another() {
importWalletFromSettingsPage(privateKey);
assertThat(getWalletAddress(), equalTo(existedWalletAddress));

addNewNetwork("Ganache");
addNewNetwork("Ganache", GANACHE_URL);
selectTestNet("Ganache");
sendBalanceTo(newWalletAddress, "0.001");
ensureTransactionConfirmed();
Expand Down
10 changes: 5 additions & 5 deletions app/src/androidTest/java/com/alphawallet/app/steps/Steps.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import static androidx.test.espresso.matcher.ViewMatchers.withText;
import static com.alphawallet.app.assertions.Should.shouldNotSee;
import static com.alphawallet.app.assertions.Should.shouldSee;
import static com.alphawallet.app.util.EthUtils.GANACHE_URL;
import static com.alphawallet.app.util.Helper.click;
import static com.alphawallet.app.util.Helper.waitUntil;
import static com.alphawallet.app.util.RootUtil.isDeviceRooted;
Expand Down Expand Up @@ -204,16 +203,17 @@ public static void toggleSwitch(int id) {
onView(allOf(withId(R.id.switch_material), isDescendantOfA(withId(id)))).perform(ViewActions.click());
}

public static void addNewNetwork(String name)
public static void addNewNetwork(String name, String url)
{
gotoSettingsPage();
selectMenu("Select Active Networks");
click(withId(R.id.action_add));
input(R.id.input_network_name, name);
input(R.id.input_network_rpc_url, GANACHE_URL);
input(R.id.input_network_rpc_url, url);
input(R.id.input_network_chain_id, "2");
input(R.id.input_network_symbol, "ETH");
input(R.id.input_network_explorer_api, GANACHE_URL);
input(R.id.input_network_block_explorer_url, GANACHE_URL);
input(R.id.input_network_explorer_api, url);
input(R.id.input_network_block_explorer_url, url);
onView(withId(R.id.network_input_scroll)).perform(swipeUp());
Helper.wait(1);
click(withId(R.id.checkbox_testnet));
Expand Down
Loading