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

fix kIsWeb / platform bug in receive tab #244

Merged
merged 5 commits into from
Mar 24, 2024
Merged
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
428 changes: 245 additions & 183 deletions CHANGELOG.md

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
buildscript {
ext.kotlin_version = '1.7.21'
ext {
compileSdkVersion = 33
targetSdkVersion = 33
compileSdkVersion = 34
targetSdkVersion = 34
appCompatVersion = "1.1.0"
}

Expand Down
4 changes: 2 additions & 2 deletions lib/models/available_coins.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class AvailableCoins {
letterCode: 'PPC',
iconPath: 'assets/icon/ppc-icon-48.png',
iconPathTransparent: 'assets/icon/ppc-icon-white-48.png',
networkType: NetworkParams.mainnet,
networkType: Network.mainnet,
opreturnSize: 256,
fractions: 6,
minimumTxValue: 10000,
Expand All @@ -39,7 +39,7 @@ class AvailableCoins {
letterCode: 'tPPC',
iconPath: 'assets/icon/ppc-icon-48-grey.png',
iconPathTransparent: 'assets/icon/ppc-icon-48-grey.png',
networkType: NetworkParams.testnet,
networkType: Network.testnet,
opreturnSize: 256,
fixedFee: true,
fractions: 6,
Expand Down
2 changes: 1 addition & 1 deletion lib/models/coin.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class Coin {
final String iconPath;
final String iconPathTransparent;
final String uriCode;
final NetworkParams networkType;
final Network networkType;
final int fractions;
final int minimumTxValue;
final double fixedFeePerKb;
Expand Down
2 changes: 1 addition & 1 deletion lib/screens/changelog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class ChangeLogScreen extends StatelessWidget {
styleSheet:
MarkdownStyleSheet.fromTheme(Theme.of(context))
.copyWith(
textScaleFactor: 1.1,
textScaler: const TextScaler.linear(1.1),
),
),
],
Expand Down
2 changes: 1 addition & 1 deletion lib/screens/setup/setup_import_seed.dart
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class _SetupImportSeedState extends State<SetupImportSeedScreen> {
'createWallet',
e.toString(),
);
if (mounted) {
if (context.mounted) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(
Expand Down
2 changes: 1 addition & 1 deletion lib/screens/wallet/import_wif.dart
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ class _ImportWifScreenState extends State<ImportWifScreen> {
),
);
} else {
if (mounted) {
if (context.mounted) {
await showDialog(
context: ctx,
builder: (BuildContext context) {
Expand Down
2 changes: 1 addition & 1 deletion lib/screens/wallet/transaction_confirmation.dart
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ class _TransactionConfirmationScreenState
'showTransactionConfirmation',
e.toString(),
);
if (mounted) {
if (context.mounted) {
ScaffoldMessenger.of(context)
.showSnackBar(
SnackBar(
Expand Down
2 changes: 1 addition & 1 deletion lib/screens/wallet/wallet_home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ class _WalletHomeState extends State<WalletHomeScreen>
newState: false,
);

if (mounted) {
if (context.mounted) {
context.loaderOverlay.hide();
Navigator.of(context).pop(); // pops modal bottom sheet
}
Expand Down
2 changes: 1 addition & 1 deletion lib/tools/validators.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'package:coinlib_flutter/coinlib_flutter.dart';

/// Returns true if the address is valid for the given network.
bool validateAddress(String address, NetworkParams network) {
bool validateAddress(String address, Network network) {
try {
Address.fromString(address, network);
return true;
Expand Down
71 changes: 37 additions & 34 deletions lib/widgets/wallet/receive_tab.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'dart:io';

import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:provider/provider.dart';
Expand Down Expand Up @@ -163,41 +164,43 @@ class _ReceiveTabState extends State<ReceiveTab> {
),
),
);
} else if (widget.wallet.letterCode == 'PPC' && Platform.isIOS == false) {
return Align(
child: PeerContainer(
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
PeerServiceTitle(
title: AppLocalizations.instance.translate('buy_peercoin'),
),
const SizedBox(height: 20),
Text(
AppLocalizations.instance
.translate('receive_website_description'),
textAlign: TextAlign.center,
),
const SizedBox(height: 20),
PeerButton(
text: AppLocalizations.instance
.translate('receive_website_credit'),
action: () {
launchURL('https://ppc.lol/buy');
},
),
const SizedBox(height: 20),
PeerButton(
text: AppLocalizations.instance
.translate('receive_website_exchandes'),
action: () {
launchURL('https://ppc.lol/exchanges');
},
),
],
} else if (!kIsWeb) {
if (widget.wallet.letterCode == 'PPC' && Platform.isIOS == false) {
return Align(
child: PeerContainer(
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
PeerServiceTitle(
title: AppLocalizations.instance.translate('buy_peercoin'),
),
const SizedBox(height: 20),
Text(
AppLocalizations.instance
.translate('receive_website_description'),
textAlign: TextAlign.center,
),
const SizedBox(height: 20),
PeerButton(
text: AppLocalizations.instance
.translate('receive_website_credit'),
action: () {
launchURL('https://ppc.lol/buy');
},
),
const SizedBox(height: 20),
PeerButton(
text: AppLocalizations.instance
.translate('receive_website_exchandes'),
action: () {
launchURL('https://ppc.lol/exchanges');
},
),
],
),
),
),
);
);
}
}
return const SizedBox();
}
Expand Down
9 changes: 4 additions & 5 deletions lib/widgets/wallet/send_tab.dart
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,10 @@ class _SendTabState extends State<SendTab> {
currentIndex: _currentAddressIndex + 1,
numberOfRecipients: _numberOfRecipients,
raiseNewindex: (int newIndex) => setState(
() => {
if (triggerFormValidation())
{
_currentAddressIndex = newIndex - 1,
},
() {
if (triggerFormValidation()) {
_currentAddressIndex = newIndex - 1;
}
},
),
)
Expand Down
Loading
Loading