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 8 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
9 changes: 6 additions & 3 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 203
versionName "3.59"

applicationId "io.stormbird.wallet"
minSdkVersion 23
Expand Down Expand Up @@ -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
Binary file modified app/libs/core-4.8.8-android.jar
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ public interface PreferenceRepositoryType {
void setHasSetNetworkFilters();
boolean hasSetNetworkFilters();
void blankHasSetNetworkFilters();
void cancelAPI23Notification();
boolean hasCancelledAPI23Notification();

void commit();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public class SharedPreferenceRepository implements PreferenceRepositoryType {
private static final String RATE_APP_SHOWN = "rate_us_shown";
private static final String LAUNCH_COUNT = "launch_count";
private static final String NEW_WALLET = "new_wallet_";
private static final String API23_NOTIFICATION = "api23_notification";

private final SharedPreferences pref;

Expand Down Expand Up @@ -243,6 +244,18 @@ public void blankHasSetNetworkFilters()
pref.edit().putBoolean(SET_NETWORK_FILTERS, false).apply();
}

@Override
public void cancelAPI23Notification()
{
pref.edit().putBoolean(API23_NOTIFICATION, true).apply();
}

@Override
public boolean hasCancelledAPI23Notification()
{
return pref.getBoolean(API23_NOTIFICATION, false);
}

//Ensure settings are committed
@SuppressLint("ApplySharedPref")
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,15 +175,15 @@ public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup c
private void initNotificationView(View view)
{
notificationView = view.findViewById(R.id.notification);
if (android.os.Build.VERSION.SDK_INT <= Build.VERSION_CODES.M)
if (android.os.Build.VERSION.SDK_INT <= Build.VERSION_CODES.M && !viewModel.hasShownAPI23Notification())
{
notificationView.setTitle(getContext().getString(R.string.title_version_support_warning));
notificationView.setMessage(getContext().getString(R.string.message_version_support_warning));
notificationView.setPrimaryButtonText(getContext().getString(R.string.hide_notification));
notificationView.setPrimaryButtonListener(() ->
{
notificationView.setVisibility(View.GONE);
viewModel.setMarshMallowWarning(true);
viewModel.cancelAPI23Notification();
});
}
else
Expand Down
11 changes: 5 additions & 6 deletions app/src/main/java/com/alphawallet/app/ui/WalletFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -757,7 +757,7 @@ public boolean onMenuItemClick(MenuItem menuItem)
{
if (menuItem.getItemId() == R.id.action_my_wallet)
{
viewModel.showMyAddress(getContext());
viewModel.showMyAddress(requireContext());
}
if (menuItem.getItemId() == R.id.action_scan)
{
Expand All @@ -769,13 +769,12 @@ public boolean onMenuItemClick(MenuItem menuItem)
private void initNotificationView(View view)
{
NotificationView notificationView = view.findViewById(R.id.notification);
boolean hasShownWarning = viewModel.isMarshMallowWarningShown();

if (!hasShownWarning && android.os.Build.VERSION.SDK_INT <= Build.VERSION_CODES.M)
if (!viewModel.isMarshMallowWarningShown() && android.os.Build.VERSION.SDK_INT <= Build.VERSION_CODES.M)
{
notificationView.setTitle(getContext().getString(R.string.title_version_support_warning));
notificationView.setMessage(getContext().getString(R.string.message_version_support_warning));
notificationView.setPrimaryButtonText(getContext().getString(R.string.hide_notification));
notificationView.setTitle(requireContext().getString(R.string.title_version_support_warning));
notificationView.setMessage(requireContext().getString(R.string.message_version_support_warning));
notificationView.setPrimaryButtonText(requireContext().getString(R.string.hide_notification));
notificationView.setPrimaryButtonListener(() ->
{
notificationView.setVisibility(View.GONE);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package com.alphawallet.app.viewmodel;


import android.content.Context;

import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
import android.content.Context;

import com.alphawallet.app.entity.CurrencyItem;
import com.alphawallet.app.entity.LocaleItem;
Expand Down Expand Up @@ -147,7 +148,13 @@ public void setIsDismissed(String walletAddr, boolean isDismissed)
genericWalletInteract.setIsDismissed(walletAddr, isDismissed);
}

public void setMarshMallowWarning(boolean shown) {
preferenceRepository.setMarshMallowWarning(shown);
public boolean hasShownAPI23Notification()
{
return preferenceRepository.hasCancelledAPI23Notification();
}

public void cancelAPI23Notification()
{
preferenceRepository.cancelAPI23Notification();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ private void storeTx(EthTransaction rawTx, Wallet wallet, long chainId, Web3j we
return;
}

org.web3j.protocol.core.methods.response.Transaction ethTx = rawTx.getTransaction().get();
org.web3j.protocol.core.methods.response.Transaction ethTx = rawTx.getTransaction(); // no Optional<> in API23
disposable = EventUtils.getBlockDetails(ethTx.getBlockHash(), web3j)
.map(ethBlock -> new Transaction(ethTx, chainId, true, ethBlock.getBlock().getTimestamp().longValue()))
.map(tx -> writeTransaction(wallet, tx))
Expand Down
44 changes: 36 additions & 8 deletions app/src/main/java/com/alphawallet/app/web3/Web3View.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
package com.alphawallet.app.web3;

import static androidx.webkit.WebSettingsCompat.FORCE_DARK_OFF;
import static androidx.webkit.WebSettingsCompat.FORCE_DARK_ON;

import android.annotation.SuppressLint;
import android.content.Context;
import android.content.res.Configuration;
import android.graphics.Bitmap;
import android.os.Build;
import android.util.AttributeSet;
Expand All @@ -19,8 +15,6 @@
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.webkit.WebSettingsCompat;
import androidx.webkit.WebViewFeature;

import com.alphawallet.app.BuildConfig;
import com.alphawallet.app.entity.URLLoadInterface;
Expand All @@ -35,6 +29,8 @@
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;

import java.net.MalformedURLException;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;

Expand Down Expand Up @@ -380,7 +376,7 @@ else if (!loadingError && loadInterface != null)
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url)
{
redirect = true;
redirect = isRedirect(view, url);

return externalClient.shouldOverrideUrlLoading(view, url)
|| internalClient.shouldOverrideUrlLoading(view, url);
Expand All @@ -398,10 +394,42 @@ public void onReceivedError(WebView view, WebResourceRequest request, WebResourc
@Override
public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request)
{
redirect = true;
redirect = isRedirect(view, request);

return externalClient.shouldOverrideUrlLoading(view, request)
|| internalClient.shouldOverrideUrlLoading(view, request);
}

private boolean isRedirect(WebView view, String url)
{
try
{
return isRedirect(new URL(view.getUrl()), new URL(url));
}
catch (MalformedURLException e)
{
return true;
}
}

private boolean isRedirect(WebView view, WebResourceRequest request)
{
try
{
return isRedirect(new URL(view.getUrl()), new URL(request.toString()));
}
catch (MalformedURLException e)
{
return true;
}
}

private boolean isRedirect(URL urlSource, URL urlDestination)
{
String sourceBase = urlSource.getHost();
String destinationBase = urlDestination.getHost();

return !sourceBase.equals(destinationBase) || urlSource.toString().equals(urlDestination.toString());
}
}
}
33 changes: 25 additions & 8 deletions app/src/main/java/com/alphawallet/app/widget/InputAmount.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package com.alphawallet.app.widget;

import static com.alphawallet.app.C.GAS_LIMIT_MIN;
import static com.alphawallet.app.repository.TokensRealmSource.databaseKey;

import android.content.Context;
import android.content.res.TypedArray;
import android.os.Handler;
Expand Down Expand Up @@ -36,14 +39,14 @@
import java.math.RoundingMode;
import java.text.DecimalFormat;

import io.reactivex.Completable;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;
import io.realm.Case;
import io.realm.Realm;
import io.realm.RealmQuery;
import timber.log.Timber;

import static com.alphawallet.app.C.GAS_LIMIT_MIN;
import static com.alphawallet.app.repository.TokensRealmSource.databaseKey;

/**
* Created by JB on 10/11/2020.
*/
Expand Down Expand Up @@ -384,8 +387,8 @@ private void setupAllFunds()
if (token.isEthereum() && token.hasPositiveBalance())
{
RealmGasSpread gasSpread = tokensService.getTickerRealmInstance().where(RealmGasSpread.class)
.equalTo("chainId", token.tokenInfo.chainId)
.findFirst();
.equalTo("chainId", token.tokenInfo.chainId)
.findFirst();

if (gasSpread != null && gasSpread.getGasPrice().compareTo(BigInteger.ZERO) > 0)
{
Expand All @@ -396,9 +399,23 @@ private void setupAllFunds()
{
gasFetch.setVisibility(View.VISIBLE);
Web3j web3j = TokenRepository.getWeb3jService(token.tokenInfo.chainId);
web3j.ethGasPrice().sendAsync()
.thenAccept(ethGasPrice -> onLatestGasPrice(ethGasPrice.getGasPrice()))
.exceptionally(this::onGasFetchError);
Completable.fromRunnable(() ->
{
try
{
onLatestGasPrice(web3j.ethGasPrice().sendAsync().get().getGasPrice());
}
catch (Exception e)
{
e.printStackTrace();
onGasFetchError(e);
}
}
)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(() -> {}, this::onGasFetchError)
.isDisposed();
}
}
else
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values-es/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@
<string name="your_wallets">Tus monederos</string>
<string name="action_copy">Copiar</string>
<string name="title_version_support_warning">Actualización importante</string>
<string name="message_version_support_warning">A partir de la versión 3.0, AlphaWallet ya no será compatible con dispositivos que ejecuten Android 6.0 o inferior.</string>
<string name="message_version_support_warning">Esta es la versión final de los dispositivos compatibles con AlphaWallet que se ejecutan en Android 6.</string>
<string name="hide_notification">Ocultar notificación</string>
<string name="card_view_not_found_error">%1$s no encontrado</string>
<string name="tokenscript_management">Gestión de TokenScript</string>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values-fr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@
<string name="your_wallets">Vos Portefeuilles</string>
<string name="action_copy">Copier</string>
<string name="title_version_support_warning">Mise à jour importante</string>
<string name="message_version_support_warning">À partir de la version 3.0, AlphaWallet ne prendra plus en charge les appareils fonctionnant sous Android 6.0 et versions antérieures.</string>
<string name="message_version_support_warning">Il s\'agit de la version finale d\'AlphaWallet prenant en charge les appareils fonctionnant sous Android 6.</string>
<string name="hide_notification">Cacher Notification</string>
<string name="card_view_not_found_error">%1$s pas trouvé</string>
<string name="tokenscript_management">Gestion TokenScript</string>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values-id/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,7 @@
<string name="your_wallets">Dompet Anda</string>
<string name="action_copy">Salin</string>
<string name="title_version_support_warning">Pembaruan Penting</string>
<string name="message_version_support_warning">Mulai Versi 3.0, AlphaWallet tidak mendukung perangkat yang berjalan di Android 6.0 dan di bawahnya.</string>
<string name="message_version_support_warning">Ini adalah build terakhir dari perangkat pendukung AlphaWallet yang berjalan di Android 6.</string>
<string name="hide_notification">Sembunyikan Pemberitahuan</string>
<string name="card_view_not_found_error">%1$s tidak ditemukan</string>
<string name="tokenscript_management">Pengelolaan TokenScript</string>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values-my/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,7 @@
<string name="your_wallets">သင်၏ ဝေါလက်များ</string>
<string name="action_copy">ကူးယူမည်</string>
<string name="title_version_support_warning">အရေးကြီးသောအသစ်ပြုပြင်မွမ်းမံမှုများ</string>
<string name="message_version_support_warning">Alphawalletဗားရှင်း 3.0မှစ၍ Wallet သည် Android ဗားရှင်း 6.0ထက်နိမ့်သောစက်များတွင်အသုံးမပြုနိုင်တော့ပါ။</string>
<string name="message_version_support_warning">၎င်းသည် Android 6 ပေါ်တွင် အသုံးပြုနေသည့် AlphaWallet ပံ့ပိုးပေးသည့် စက်ပစ္စည်းများ၏ နောက်ဆုံးတည်ဆောက်မှုဖြစ်သည်။</string>
<string name="hide_notification">အသိပေးကြေငြာချက်များကိုပုန်းကွယ်မည်</string>
<string name="card_view_not_found_error">%1$s ကိုရှာမတွေ့ပါ</string>
<string name="tokenscript_management">TokenScriptကို စီမံခန့်ခွဲခြင်း</string>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values-vi/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,7 @@
<string name="your_wallets">Ví của bạn</string>
<string name="action_copy">Sao chép</string>
<string name="title_version_support_warning">Important Update</string>
<string name="message_version_support_warning">Bắt đầu từ Phiên bản 3.0, AlphaWallet sẽ không còn hỗ trợ các thiết bị chạy trên Android 6.0 trở xuống.</string>
<string name="message_version_support_warning">Đây là bản dựng cuối cùng của AlphaWallet hỗ trợ các thiết bị chạy trên Android 6.</string>
<string name="hide_notification">Tắt thông báo</string>
<string name="card_view_not_found_error">%1$s not found</string>
<string name="tokenscript_management">TokenScript Management</string>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values-zh/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@
<string name="your_wallets">您的钱包</string>
<string name="action_copy">复制</string>
<string name="title_version_support_warning">重要更新</string>
<string name="message_version_support_warning">从版本 3.0 开始,AlphaWallet 将不再支持在 Android 6.0 及以下设备上运行。</string>
<string name="message_version_support_warning">这是 AlphaWallet 的最终版本,支持在 Android 6 上运行的设备。</string>
<string name="hide_notification">隐藏通知</string>
<string name="card_view_not_found_error">未找到%1$s</string>
<string name="tokenscript_management">TokenScript 管理</string>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@
<string name="your_wallets">Your Wallets</string>
<string name="action_copy">Copy</string>
<string name="title_version_support_warning">Important Update</string>
<string name="message_version_support_warning">Starting Version 3.0, AlphaWallet will no longer support devices running on Android 6.0 and below.</string>
<string name="message_version_support_warning">This is the final build of AlphaWallet supporting devices running on Android 6.</string>
<string name="hide_notification">Hide Notification</string>
<string name="card_view_not_found_error">%1$s not found</string>
<string name="tokenscript_management">TokenScript Management</string>
Expand Down