From f5a152c7dec7f28849c9e3a1ee545fd06832f772 Mon Sep 17 00:00:00 2001 From: Jenny Jingjing Li Date: Sat, 6 Mar 2021 16:18:22 +1100 Subject: [PATCH] Gas warnings (#1753) Co-authored-by: jinkjonks --- .../app/ui/GasSettingsActivity.java | 131 ++++++++++++-- .../ui/widget/entity/GasWarningLayout.java | 38 ++++ .../ui/widget/entity/VisibilityCallback.java | 6 + .../app/widget/AmountDisplayWidget.java | 20 +++ .../alphawallet/app/widget/GasSliderView.java | 39 +++- .../com/alphawallet/app/widget/GasWidget.java | 86 ++++++++- .../drawable/background_text_edit_error.xml | 8 + .../drawable/background_warning_salmon.xml | 7 + .../main/res/layout/activity_gas_settings.xml | 166 +++++++++++++++--- .../main/res/layout/dialog_action_sheet.xml | 1 + app/src/main/res/layout/item_gas_settings.xml | 32 +++- app/src/main/res/layout/item_gas_slider.xml | 2 +- app/src/main/res/layout/item_gas_speed.xml | 11 -- app/src/main/res/values-es/strings.xml | 7 + app/src/main/res/values-zh/strings.xml | 7 + app/src/main/res/values/strings.xml | 7 + build.gradle | 28 ++- gradle.properties | 2 +- 18 files changed, 512 insertions(+), 86 deletions(-) create mode 100644 app/src/main/java/com/alphawallet/app/ui/widget/entity/GasWarningLayout.java create mode 100644 app/src/main/java/com/alphawallet/app/ui/widget/entity/VisibilityCallback.java create mode 100644 app/src/main/java/com/alphawallet/app/widget/AmountDisplayWidget.java create mode 100644 app/src/main/res/drawable/background_text_edit_error.xml create mode 100644 app/src/main/res/drawable/background_warning_salmon.xml diff --git a/app/src/main/java/com/alphawallet/app/ui/GasSettingsActivity.java b/app/src/main/java/com/alphawallet/app/ui/GasSettingsActivity.java index a33b3c2a3..1939d62d1 100644 --- a/app/src/main/java/com/alphawallet/app/ui/GasSettingsActivity.java +++ b/app/src/main/java/com/alphawallet/app/ui/GasSettingsActivity.java @@ -4,17 +4,22 @@ package com.alphawallet.app.ui; import android.content.Context; import android.content.Intent; import android.os.Bundle; +import android.os.Handler; import android.text.format.DateUtils; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; +import android.widget.EditText; +import android.widget.FrameLayout; import android.widget.ImageView; import android.widget.LinearLayout; +import android.widget.ScrollView; import android.widget.TextView; import androidx.annotation.Nullable; +import androidx.core.content.ContextCompat; import androidx.lifecycle.ViewModelProvider; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; @@ -30,6 +35,7 @@ import com.alphawallet.app.service.TickerService; import com.alphawallet.app.ui.widget.divider.ListDivider; import com.alphawallet.app.ui.widget.entity.GasSettingsCallback; import com.alphawallet.app.ui.widget.entity.GasSpeed; +import com.alphawallet.app.ui.widget.entity.GasWarningLayout; import com.alphawallet.app.util.BalanceUtils; import com.alphawallet.app.util.Utils; import com.alphawallet.app.viewmodel.GasSettingsViewModel; @@ -71,7 +77,10 @@ public class GasSettingsActivity extends BaseActivity implements GasSettingsCall private BigDecimal availableBalance; private BigDecimal sendAmount; private BigInteger customGasPriceFromWidget; - private final BigInteger minGas = BigInteger.valueOf(C.GAS_PRICE_MIN); + private GasWarningLayout gasWarning; + private GasWarningLayout insufficientWarning; + private ScrollView scroll; + private final Handler handler = new Handler(); private int customIndex = -1; @@ -86,6 +95,9 @@ public class GasSettingsActivity extends BaseActivity implements GasSettingsCall gasSliderView = findViewById(R.id.gasSliderView); recyclerView = findViewById(R.id.list); + gasWarning = findViewById(R.id.gas_warning_bubble); + insufficientWarning = findViewById(R.id.insufficient_bubble); + scroll = findViewById(R.id.setting_scroll); recyclerView.setLayoutManager(new LinearLayoutManager(this)); viewModel = new ViewModelProvider(this, viewModelFactory) @@ -127,6 +139,7 @@ public class GasSettingsActivity extends BaseActivity implements GasSettingsCall { GasPriceSpread gs = ((RealmGasSpread) realmToken).getGasPrice(); initGasSpeeds(gs); + gasSettingsUpdate(gasSpeeds.get(customIndex).gasPrice, customGasLimit.toBigInteger()); } }); } @@ -231,7 +244,6 @@ public class GasSettingsActivity extends BaseActivity implements GasSettingsCall final TextView speedCostEth; final TextView speedCostFiat; final TextView speedTime; - final LinearLayout blankOverlay; final View itemLayout; CustomViewHolder(View view) @@ -244,7 +256,6 @@ public class GasSettingsActivity extends BaseActivity implements GasSettingsCall speedTime = view.findViewById(R.id.text_speed_time); itemLayout = view.findViewById(R.id.layout_list_item); speedGwei = view.findViewById(R.id.text_gwei); - blankOverlay = view.findViewById(R.id.layout_overlay); } } @@ -264,12 +275,16 @@ public class GasSettingsActivity extends BaseActivity implements GasSettingsCall holder.itemLayout.setOnClickListener(v -> { if (position == customIndex && currentGasSpeedIndex != customIndex) { - if (holder.blankOverlay.getVisibility() == View.VISIBLE) { return; } //don't allow selection of invalid amount gasSliderView.initGasLimit(customGasLimit.toBigInteger()); gasSliderView.reportPosition(); } + else if (position != customIndex && currentGasSpeedIndex == customIndex) + { + hideGasWarning(); + } currentGasSpeedIndex = position; notifyDataSetChanged(); + }); String speedGwei = BalanceUtils.weiToGweiBI(gs.gasPrice).toBigInteger().toString(); @@ -291,6 +306,7 @@ public class GasSettingsActivity extends BaseActivity implements GasSettingsCall } } + BigDecimal gasFee = new BigDecimal(gs.gasPrice).multiply(useGasLimit); String gasAmountInBase = BalanceUtils.getScaledValueScientific(gasFee, baseCurrency.tokenInfo.decimals, GAS_PRECISION); @@ -318,15 +334,7 @@ public class GasSettingsActivity extends BaseActivity implements GasSettingsCall //determine if this amount can be used BigDecimal txCost = gasFee.add(sendAmount); - if (txCost.compareTo(availableBalance) >= 0) - { - //cannot be used - holder.blankOverlay.setVisibility(View.VISIBLE); - } - else - { - holder.blankOverlay.setVisibility(View.GONE); - } + checkInsufficientGas(txCost); } private void blankCustomHolder(CustomViewHolder holder) @@ -378,8 +386,10 @@ public class GasSettingsActivity extends BaseActivity implements GasSettingsCall gasSliderView.initGasPriceMax(gs.gasPrice); notice.setVisibility(View.VISIBLE); gasSliderView.setVisibility(View.GONE); + hideGasWarning(); } } + } @Override @@ -410,23 +420,39 @@ public class GasSettingsActivity extends BaseActivity implements GasSettingsCall expectedTime = (long) ((double) lg.seconds - extrapolateFactor * timeDiff); break; } - else if (lg.speed.equals(getString(R.string.speed_slow)) && dGasPrice < lowerBound) - { + else if (lg.speed.equals(getString(R.string.speed_slow))) { //final entry //danger zone - transaction may not complete double dangerAmount = lowerBound / 2.0; long dangerTime = 12 * DateUtils.HOUR_IN_MILLIS / 1000; - if (dGasPrice < dangerAmount) + if (dGasPrice < (lowerBound*0.95)) //only show gas warning if less than 95% of slow { + showGasWarning(false); + } + + if (dGasPrice < dangerAmount) { expectedTime = -1; //never + } else { + expectedTime = extrapolateTime(dangerTime, lg.seconds, dGasPrice, dangerAmount, lowerBound); + } + + return expectedTime; + } + else if (ug.speed.equals(getString(R.string.speed_rapid)) && dGasPrice >= upperBound) + { + if (dGasPrice > 1.4 * upperBound) + { + showGasWarning(true); //only show gas warning if greater than 140% of max needed gas } else { - expectedTime = extrapolateTime(dangerTime, lg.seconds, dGasPrice, dangerAmount, lowerBound); + hideGasWarning(); } - break; + return expectedTime; //exit here so we don't hit the speed_slow catcher } } + + hideGasWarning(); // Didn't need a gas warning: custom gas is within bounds } return expectedTime; @@ -441,7 +467,10 @@ public class GasSettingsActivity extends BaseActivity implements GasSettingsCall private void updateCustomElement(BigInteger gasPrice, BigInteger gasLimit) { - if (customIndex < 0) return; + if (customIndex < 0) + { + return; + } GasSpeed gs = gasSpeeds.get(customIndex); //new settings from the slider widget gs = new GasSpeed(gs.speed, getExpectedTransactionTime(gasPrice), gasPrice, true); @@ -450,4 +479,68 @@ public class GasSettingsActivity extends BaseActivity implements GasSettingsCall this.customGasLimit = new BigDecimal(gasLimit); } + + private void showGasWarning(boolean high) + { + if (currentGasSpeedIndex != customIndex) + { + return; + } + + displayGasWarning(); //if gas warning already showing, no need to take focus from user input + + TextView heading = findViewById(R.id.bubble_title); + TextView body = findViewById(R.id.bubble_body); + if (high) + { + heading.setText(getString(R.string.high_gas_setting)); + body.setText(getString(R.string.body_high_gas)); + } + else + { + heading.setText(getString(R.string.low_gas_setting)); + body.setText(getString(R.string.body_low_gas)); + } + } + + private void displayGasWarning() + { + if (gasWarning.getVisibility() != View.VISIBLE) //no need to re-apply + { + handler.postDelayed(() -> scroll.fullScroll(View.FOCUS_DOWN), 100); + + gasWarning.setVisibility(View.VISIBLE); + + EditText gas_price_entry = findViewById(R.id.gas_price_entry); + gas_price_entry.setTextColor(getColor(R.color.danger)); + gas_price_entry.setBackground(ContextCompat.getDrawable(this, R.drawable.background_text_edit_error)); + } + } + + private void hideGasWarning() + { + gasWarning.setVisibility(View.GONE); + + EditText gas_price_entry = findViewById(R.id.gas_price_entry); + gas_price_entry.setTextColor(getColor(R.color.dove)); + gas_price_entry.setBackground(getDrawable(R.drawable.background_password_entry)); + } + + private void checkInsufficientGas(BigDecimal txCost) + { + if (txCost.compareTo(availableBalance) > 0) + { + insufficientWarning.setVisibility(View.VISIBLE); + } + else + { + insufficientWarning.setVisibility(View.GONE); + } + + if (insufficientWarning.getVisibility() == View.VISIBLE && gasWarning.getVisibility() == View.VISIBLE) + { + gasWarning.setVisibility(View.GONE); + } + } + } diff --git a/app/src/main/java/com/alphawallet/app/ui/widget/entity/GasWarningLayout.java b/app/src/main/java/com/alphawallet/app/ui/widget/entity/GasWarningLayout.java new file mode 100644 index 000000000..6f021b89a --- /dev/null +++ b/app/src/main/java/com/alphawallet/app/ui/widget/entity/GasWarningLayout.java @@ -0,0 +1,38 @@ +package com.alphawallet.app.ui.widget.entity; + +import android.content.Context; +import android.util.AttributeSet; +import android.view.View; +import android.widget.FrameLayout; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + +public class GasWarningLayout extends FrameLayout +{ + private VisibilityCallback visibilityCallback; + + public GasWarningLayout(@NonNull Context context) + { + super(context); + } + + public GasWarningLayout(@NonNull Context context, @Nullable AttributeSet attrs) + { + super(context, attrs); + } + + @Override + public void onVisibilityChanged(View changedView, int visibility) + { + super.onVisibilityChanged(changedView, visibility); + if (visibilityCallback != null) + { + visibilityCallback.onVisibilityChanged(visibility == View.VISIBLE); + } + } + public void setVisibilityCallback(VisibilityCallback vs) + { + visibilityCallback = vs; + } +} diff --git a/app/src/main/java/com/alphawallet/app/ui/widget/entity/VisibilityCallback.java b/app/src/main/java/com/alphawallet/app/ui/widget/entity/VisibilityCallback.java new file mode 100644 index 000000000..1a5be0a69 --- /dev/null +++ b/app/src/main/java/com/alphawallet/app/ui/widget/entity/VisibilityCallback.java @@ -0,0 +1,6 @@ +package com.alphawallet.app.ui.widget.entity; + +public interface VisibilityCallback +{ + public void onVisibilityChanged(boolean visible); +} diff --git a/app/src/main/java/com/alphawallet/app/widget/AmountDisplayWidget.java b/app/src/main/java/com/alphawallet/app/widget/AmountDisplayWidget.java new file mode 100644 index 000000000..b8293fe90 --- /dev/null +++ b/app/src/main/java/com/alphawallet/app/widget/AmountDisplayWidget.java @@ -0,0 +1,20 @@ +package com.alphawallet.app.widget; + +import android.content.Context; +import android.util.AttributeSet; +import android.widget.LinearLayout; + +import androidx.annotation.Nullable; + +public class AmountDisplayWidget extends LinearLayout +{ + public AmountDisplayWidget(Context context) + { + super(context); + } + + public AmountDisplayWidget(Context context, @Nullable AttributeSet attrs) + { + super(context, attrs); + } +} diff --git a/app/src/main/java/com/alphawallet/app/widget/GasSliderView.java b/app/src/main/java/com/alphawallet/app/widget/GasSliderView.java index 0cb6c768a..228fcc150 100644 --- a/app/src/main/java/com/alphawallet/app/widget/GasSliderView.java +++ b/app/src/main/java/com/alphawallet/app/widget/GasSliderView.java @@ -2,6 +2,7 @@ package com.alphawallet.app.widget; import android.annotation.SuppressLint; import android.content.Context; +import android.os.Handler; import android.text.Editable; import android.text.TextUtils; import android.text.TextWatcher; @@ -39,6 +40,7 @@ public class GasSliderView extends RelativeLayout private final float minimumPrice = BalanceUtils.weiToGweiBI(BigInteger.valueOf(C.GAS_PRICE_MIN)).multiply(BigDecimal.TEN).floatValue(); //minimum for slider private float gasLimitScaleFactor; private boolean limitInit = false; + private final Handler handler = new Handler(); private GasSettingsCallback gasCallback; @@ -136,7 +138,14 @@ public class GasSliderView extends RelativeLayout if (gasLimitValue.hasFocus() || gasPriceValue.hasFocus()) { limitInit = true; - updateGasControl(); + handler.removeCallbacks(null); + handler.postDelayed(new Runnable() { + @Override + public void run() { + updateSliderSettingsFromText(); //ensure sliders reflect new values + updateGasControl(); + } + },2000); } } }; @@ -164,6 +173,34 @@ public class GasSliderView extends RelativeLayout } } + //After user updates the gas settings, reflect the new values in the sliders + private void updateSliderSettingsFromText() + { + String gasPriceStr = gasPriceValue.getText().toString(); + String gasLimitStr = gasLimitValue.getText().toString(); + + try + { + BigDecimal gweiPrice = new BigDecimal(gasPriceStr); + setPriceSlider(gweiPrice); + } + catch (Exception e) + { + // - user typed a number that couldn't be converted + } + + try + { + BigDecimal gasLimitGwei = new BigDecimal(gasLimitStr); + int progress = (int)((float)(gasLimitGwei.longValue() - C.GAS_LIMIT_MIN)/gasLimitScaleFactor); + gasLimitSlider.setProgress(progress); + } + catch (Exception e) + { + // - no need to act + } + } + @SuppressLint("SetTextI18n") public void initGasPrice(BigInteger price) { diff --git a/app/src/main/java/com/alphawallet/app/widget/GasWidget.java b/app/src/main/java/com/alphawallet/app/widget/GasWidget.java index 97dce38e4..871ec4708 100644 --- a/app/src/main/java/com/alphawallet/app/widget/GasWidget.java +++ b/app/src/main/java/com/alphawallet/app/widget/GasWidget.java @@ -4,8 +4,10 @@ import android.app.Activity; import android.content.Context; import android.content.Intent; import android.os.Handler; +import android.text.format.DateUtils; import android.util.AttributeSet; import android.view.View; +import android.widget.FrameLayout; import android.widget.LinearLayout; import android.widget.TextView; @@ -22,9 +24,11 @@ import com.alphawallet.app.service.TickerService; import com.alphawallet.app.service.TokensService; import com.alphawallet.app.ui.GasSettingsActivity; import com.alphawallet.app.ui.widget.entity.GasSpeed; +import com.alphawallet.app.ui.widget.entity.GasWarningLayout; import com.alphawallet.app.util.BalanceUtils; import com.alphawallet.app.util.Utils; import com.alphawallet.app.web3.entity.Web3Transaction; +import com.google.api.Distribution; import java.math.BigDecimal; import java.math.BigInteger; @@ -64,6 +68,7 @@ public class GasWidget extends LinearLayout implements Runnable private final TextView speedText; private final TextView timeEstimate; private final LinearLayout gasWarning; + private LinearLayout speedWarning; private final Context context; private final List gasSpeeds; @@ -82,6 +87,7 @@ public class GasWidget extends LinearLayout implements Runnable speedText = findViewById(R.id.text_speed); timeEstimate = findViewById(R.id.text_time_estimate); gasWarning = findViewById(R.id.layout_gas_warning); + speedWarning = findViewById(R.id.layout_speed_warning); gasSpeeds = new ArrayList<>(); @@ -167,7 +173,6 @@ public class GasWidget extends LinearLayout implements Runnable { customSpeedTitle = getContext().getString(R.string.speed_custom); } - return new GasSpeed(customSpeedTitle, expectedTxTime, newGasPrice, true); } @@ -190,6 +195,7 @@ public class GasWidget extends LinearLayout implements Runnable currentGasSpeedIndex = gasSelectionIndex; customNonce = nonce; handleCustomGas(customGasPrice, customGasLimit, expectedTxTime); + handler.post(this); } @@ -207,6 +213,7 @@ public class GasWidget extends LinearLayout implements Runnable gasSpeeds.remove(currentGasSpeedIndex); gasSpeeds.add(gs); customGasLimit = custGasLimit.toBigInteger(); + } adjustedValue = calculateSendAllValue(); @@ -237,12 +244,10 @@ public class GasWidget extends LinearLayout implements Runnable if (!sufficientGas) { gasWarning.setVisibility(View.VISIBLE); - speedText.setVisibility(View.GONE); } else { gasWarning.setVisibility(View.GONE); - speedText.setVisibility(View.VISIBLE); } return sufficientGas; @@ -362,7 +367,6 @@ public class GasWidget extends LinearLayout implements Runnable { // } - timeEstimate.setText(displayStr); speedText.setText(gs.speed); adjustedValue = calculateSendAllValue(); @@ -372,7 +376,12 @@ public class GasWidget extends LinearLayout implements Runnable functionInterface.updateAmount(); } + if (currentGasSpeedIndex == customGasSpeedIndex) + { + checkCustomGasPrice(gasSpeeds.get(customGasSpeedIndex).gasPrice); + } checkSufficientGas(); + manageWarnings(); } public BigInteger getGasPrice(BigInteger defaultPrice) @@ -400,6 +409,75 @@ public class GasWidget extends LinearLayout implements Runnable } } + private void checkCustomGasPrice(BigInteger customGasPrice) + { + if (currentGasSpeedIndex != customGasSpeedIndex) + { + return; + } + if (gasSpeeds.size() <= 2) + { + return; + } + + double dGasPrice = customGasPrice.doubleValue(); + + GasSpeed ug = gasSpeeds.get(0); //rapid + GasSpeed lg = gasSpeeds.get(gasSpeeds.size() - 2); //slow + + double lowerBound = lg.gasPrice.doubleValue(); + double upperBound = ug.gasPrice.doubleValue(); + + if (dGasPrice < lowerBound) + { + showCustomSpeedWarning(false); + } + else if (dGasPrice > 1.5 * upperBound) + { + showCustomSpeedWarning(true); + } + else + { + speedWarning.setVisibility(View.GONE); + } + } + + private void showCustomSpeedWarning(boolean high) + { + if (currentGasSpeedIndex != customGasSpeedIndex) + { + return; + } + + TextView warningText = findViewById(R.id.text_speed_warning); + + if (high) + { + warningText.setText(getResources().getString(R.string.speed_high_gas)); + } + else + { + warningText.setText(getResources().getString(R.string.speed_too_low)); + } + speedWarning.setVisibility(View.VISIBLE); + } + + private void manageWarnings() + { + if (gasWarning.getVisibility() == VISIBLE || speedWarning.getVisibility() == VISIBLE) + { + speedText.setVisibility(View.GONE); + if (gasWarning.getVisibility() == VISIBLE && speedWarning.getVisibility() == VISIBLE) + { + speedWarning.setVisibility(View.GONE); + } + } + else + { + speedText.setVisibility(View.VISIBLE); + } + } + public BigInteger getGasLimit() { return getUseGasLimit(); diff --git a/app/src/main/res/drawable/background_text_edit_error.xml b/app/src/main/res/drawable/background_text_edit_error.xml new file mode 100644 index 000000000..93f791d6f --- /dev/null +++ b/app/src/main/res/drawable/background_text_edit_error.xml @@ -0,0 +1,8 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/background_warning_salmon.xml b/app/src/main/res/drawable/background_warning_salmon.xml new file mode 100644 index 000000000..24644e588 --- /dev/null +++ b/app/src/main/res/drawable/background_warning_salmon.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_gas_settings.xml b/app/src/main/res/layout/activity_gas_settings.xml index 054226d41..9c442c18c 100644 --- a/app/src/main/res/layout/activity_gas_settings.xml +++ b/app/src/main/res/layout/activity_gas_settings.xml @@ -1,36 +1,144 @@ - + android:layout_height="match_parent"> + - + - + - - - + + + + + + + + + + + + + + + + + + - + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/dialog_action_sheet.xml b/app/src/main/res/layout/dialog_action_sheet.xml index 3ced42682..5a76359d5 100644 --- a/app/src/main/res/layout/dialog_action_sheet.xml +++ b/app/src/main/res/layout/dialog_action_sheet.xml @@ -143,6 +143,7 @@ + + android:textSize="@dimen/sp17"/> + + + + + + + android:textSize="@dimen/sp17"/> diff --git a/app/src/main/res/layout/item_gas_speed.xml b/app/src/main/res/layout/item_gas_speed.xml index cd90639cb..6044be92e 100644 --- a/app/src/main/res/layout/item_gas_speed.xml +++ b/app/src/main/res/layout/item_gas_speed.xml @@ -6,17 +6,6 @@ android:layout_height="wrap_content" android:background="@color/white"> - - Intercambio de tokens Withdraw Deposit + Gas price is set below the \'slow\' speed. + Gas Fee Might Be Too Low + You have set a really high gas fee. Please make sure this is not a mistake. AlphaWallet uses gasnow.org live oracle and updates the gas price every 15 sec. + High Fee Warning! + Too Low + High Fee + Your balance has insufficient funds for the transaction value plus transaction fee. Convert to xDAI Crypto Buy %1$s diff --git a/app/src/main/res/values-zh/strings.xml b/app/src/main/res/values-zh/strings.xml index 7265febc3..454427097 100644 --- a/app/src/main/res/values-zh/strings.xml +++ b/app/src/main/res/values-zh/strings.xml @@ -713,6 +713,13 @@ 通证交换 Withdraw Deposit + Gas price is set below the \'slow\' speed. + Gas Fee Might Be Too Low + You have set a really high gas fee. Please make sure this is not a mistake. AlphaWallet uses gasnow.org live oracle and updates the gas price every 15 sec. + High Fee Warning! + Too Low + 高价 + Your balance has insufficient funds for the transaction value plus transaction fee. Convert to xDAI Crypto Buy %1$s diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 1b6265803..17d9e4ed6 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -716,6 +716,8 @@ Fast Slow Custom + Too Low + High Fee Dapp Settings (New: %1$s %2$s) Set Speed @@ -739,6 +741,11 @@ Token Swap Withdraw Deposit + Gas price is set below the \'slow\' speed.\nYour transaction may take a long time to be written or may never be written. + Gas Fee Might Be Too Low + You have set a really high gas fee. Please make sure this is not a mistake. AlphaWallet uses gasnow.org live oracle and updates the gas price every 15 sec. + High Fee Warning! + Your balance has insufficient funds for the transaction value plus transaction fee. Convert to xDAI Crypto Buy %1$s diff --git a/build.gradle b/build.gradle index 848e269b6..decbdb114 100644 --- a/build.gradle +++ b/build.gradle @@ -1,24 +1,22 @@ -// Top-level build file where you can add configuration options common to all sub-projects/modules. - buildscript { - ext.kotlin_version = '1.4.21' + ext.kotlin_version = '1.4.10' repositories { // don't add anything here until you read to the bottom of this bracket google() jcenter() mavenCentral() maven { url 'https://jitpack.io' } - // WARNING WARNING WARNING - // you are about to add here a repository which provides some library for the Android app - // don't do that. add that repository to app/build.gradle + // WARNING WARNING WARNING + // you are about to add here a repository which provides some library for the Android app + // don't do that. add that repository to app/build.gradle } dependencies { classpath 'com.android.tools.build:gradle:3.5.4' //NB - there is an issue with newer versions of gradle. The APK balloons out, so far haven't diagnosed why. - //If you want to try upgrading gradle plugin past 3.5.4 you will need to also diagnose the APK ballooning issue. + //If you want to try upgrading gradle plugin past 3.5.4 you will need to also diagnose the APK ballooning issue. classpath "io.realm:realm-gradle-plugin:7.0.8" - // WARNING WARNING WARNING - // you are about to add here a dependency to be used in the Android app - // don't do that. add that dependency to app/build.gradle + // WARNING WARNING WARNING + // you are about to add here a dependency to be used in the Android app + // don't do that. add that dependency to app/build.gradle classpath 'com.google.gms:google-services:4.3.4' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath 'com.google.firebase:firebase-crashlytics-gradle:2.4.1' @@ -31,9 +29,9 @@ allprojects { jcenter() mavenCentral() maven { url 'https://jitpack.io' } - // WARNING WARNING WARNING - // you are about to add here a repository which provides some library for the Android app - // don't do that. add that repository to app/build.gradle + // WARNING WARNING WARNING + // you are about to add here a repository which provides some library for the Android app + // don't do that. add that repository to app/build.gradle } configurations.all { @@ -46,7 +44,3 @@ allprojects { task clean(type: Delete) { delete rootProject.buildDir } - -// WARNING WARNING WARNING -// you are about to add here a plugin that is only related to the Android app -// don't do that. add that repository to app/build.gradle diff --git a/gradle.properties b/gradle.properties index 2cad4db39..856427192 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,4 +7,4 @@ android.enableJetifier=true android.useAndroidX=true android.enableR8=true -org.gradle.jvmargs=-Xms2048m -Xmx8192m \ No newline at end of file +org.gradle.jvmargs=-Xms2048m -Xmx4096m \ No newline at end of file