Skip to content

Commit

Permalink
TSPR on testnet, priority fee and rbf
Browse files Browse the repository at this point in the history
* `TSPR` on testnet
* replace by fee and fee estimate rpc
* support for priority fee and rbf (fallback values `0.001`, `0.01`, `0.1` are used only when rpc fails)
* adjust default max decimals (8 decimals max)
* revert to flutter_vibrate (solution: livekit/client-sdk-flutter#569 (comment) in `android\build.gradle`)
* downgrade decimal dep for better compatibility
* bump version `v0.3.20`
  • Loading branch information
x100111010 committed Nov 1, 2024
1 parent 0265986 commit 6cdb768
Show file tree
Hide file tree
Showing 52 changed files with 2,825 additions and 658 deletions.
13 changes: 13 additions & 0 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,19 @@ rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}

subprojects {
afterEvaluate { project ->
if (project.plugins.hasPlugin("com.android.application") ||
project.plugins.hasPlugin("com.android.library")) {
project.android {
compileSdkVersion 34
buildToolsVersion "34.0.0"
}
}
}
}

subprojects {
project.evaluationDependsOn(':app')
}
Expand Down
306 changes: 151 additions & 155 deletions lib/contacts/contact_add_sheet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import '../widgets/address_widgets.dart';
import '../widgets/app_text_field.dart';
import '../widgets/buttons.dart';
import '../widgets/sheet_widget.dart';
import '../widgets/tap_outside_unfocus.dart';
import 'contact.dart';

class ContactAddSheet extends ConsumerStatefulWidget {
Expand Down Expand Up @@ -89,129 +88,106 @@ class _ContactAddSheetState extends ConsumerState<ContactAddSheet> {

final addressPrefix = ref.watch(addressPrefixProvider);

return TapOutsideUnfocus(
child: SheetWidget(
title: l10n.addContact,
mainWidget: Column(
children: [
// Enter Name Container
AppTextField(
topMargin: MediaQuery.of(context).size.height * 0.14,
padding: const EdgeInsets.symmetric(horizontal: 30),
focusNode: _nameFocusNode,
controller: _nameController,
textInputAction: widget.address != null
? TextInputAction.done
: TextInputAction.next,
hintText: _showNameHint ? l10n.contactNameHint : "",
keyboardType: TextInputType.text,
style: styles.textStyleAppTextFieldSimple,
inputFormatters: [
LengthLimitingTextInputFormatter(20),
ContactFormatter()
],
onSubmitted: (text) {
final scope = FocusScope.of(context);
if (widget.address == null) {
final address = _addressController.text;
final prefix = ref.read(addressPrefixProvider);
if (!Address.isValid(address, prefix)) {
scope.requestFocus(_addressFocusNode);
} else {
scope.unfocus();
}
return SheetWidget(
title: l10n.addContact,
mainWidget: Column(
children: [
// Enter Name Container
AppTextField(
topMargin: MediaQuery.of(context).size.height * 0.14,
padding: const EdgeInsets.symmetric(horizontal: 30),
focusNode: _nameFocusNode,
controller: _nameController,
textInputAction: widget.address != null
? TextInputAction.done
: TextInputAction.next,
hintText: _showNameHint ? l10n.contactNameHint : "",
keyboardType: TextInputType.text,
style: styles.textStyleAppTextFieldSimple,
inputFormatters: [
LengthLimitingTextInputFormatter(20),
ContactFormatter()
],
onSubmitted: (text) {
final scope = FocusScope.of(context);
if (widget.address == null) {
final address = _addressController.text;
final prefix = ref.read(addressPrefixProvider);
if (!Address.isValid(address, prefix)) {
scope.requestFocus(_addressFocusNode);
} else {
scope.unfocus();
}
},
),
// Enter Name Error Container
Container(
margin: const EdgeInsets.only(top: 5, bottom: 5),
child: Text(
_nameValidationText,
style: styles.textStyleParagraphThinPrimary,
),
} else {
scope.unfocus();
}
},
),
// Enter Name Error Container
Container(
margin: const EdgeInsets.only(top: 5, bottom: 5),
child: Text(
_nameValidationText,
style: styles.textStyleParagraphThinPrimary,
),
// Enter Address container
AppTextField(
padding: !_shouldShowTextField()
? EdgeInsets.symmetric(horizontal: 25, vertical: 15)
: EdgeInsets.zero,
focusNode: _addressFocusNode,
controller: _addressController,
style: _addressValid
? styles.textStyleAddressText90
: styles.textStyleAddressText60,
inputFormatters: [
LengthLimitingTextInputFormatter(74),
],
textInputAction: TextInputAction.done,
maxLines: null,
autocorrect: false,
hintText: _showAddressHint ? l10n.addressHint : '',
prefixButton: TextFieldButton(
icon: AppIcons.scan,
onPressed: () async {
final scanResult = await UserDataUtil.scanQrCode(context);
final data = scanResult?.code;
if (data == null) {
UIUtil.showSnackbar(l10n.qrInvalidAddress, context);
} else {
final address = Address.tryParse(
data,
expectedPrefix: addressPrefix,
);
if (mounted && address != null) {
setState(() {
_addressController.text = address.toString();
_addressValidationText = "";
_addressValid = true;
_addressValidAndUnfocused = true;
});
_addressFocusNode.unfocus();
}
}
},
),
fadePrefixOnCondition: true,
prefixShowFirstCondition: _showPasteButton,
suffixButton: TextFieldButton(
icon: AppIcons.paste,
onPressed: () async {
if (!_showPasteButton) {
return;
}
String? data =
await UserDataUtil.getClipboardText(DataType.ADDRESS);
if (data != null) {
),
// Enter Address container
AppTextField(
padding: !_shouldShowTextField()
? EdgeInsets.symmetric(horizontal: 25, vertical: 15)
: EdgeInsets.zero,
focusNode: _addressFocusNode,
controller: _addressController,
style: _addressValid
? styles.textStyleAddressText90
: styles.textStyleAddressText60,
inputFormatters: [
LengthLimitingTextInputFormatter(74),
],
textInputAction: TextInputAction.done,
maxLines: null,
autocorrect: false,
hintText: _showAddressHint ? l10n.addressHint : '',
prefixButton: TextFieldButton(
icon: AppIcons.scan,
onPressed: () async {
final scanResult = await UserDataUtil.scanQrCode(context);
final data = scanResult?.code;
if (data == null) {
UIUtil.showSnackbar(l10n.qrInvalidAddress, context);
} else {
final address = Address.tryParse(
data,
expectedPrefix: addressPrefix,
);
if (mounted && address != null) {
setState(() {
_addressController.text = address.toString();
_addressValidationText = "";
_addressValid = true;
_showPasteButton = false;
_addressController.text = data;
_addressValidAndUnfocused = true;
});
_addressFocusNode.unfocus();
} else {
setState(() {
_showPasteButton = true;
_addressValid = false;
});
}
},
),
fadeSuffixOnCondition: true,
suffixShowFirstCondition: _showPasteButton,
onChanged: (text) {
final address = Address.tryParse(
text,
expectedPrefix: addressPrefix,
);
if (address != null) {
}
},
),
fadePrefixOnCondition: true,
prefixShowFirstCondition: _showPasteButton,
suffixButton: TextFieldButton(
icon: AppIcons.paste,
onPressed: () async {
if (!_showPasteButton) {
return;
}
String? data =
await UserDataUtil.getClipboardText(DataType.ADDRESS);
if (data != null) {
setState(() {
_addressValid = true;
_showPasteButton = false;
_addressController.text = address.toString();
_addressController.text = data;
_addressValidAndUnfocused = true;
});
_addressFocusNode.unfocus();
} else {
Expand All @@ -221,53 +197,73 @@ class _ContactAddSheetState extends ConsumerState<ContactAddSheet> {
});
}
},
overrideTextFieldWidget: !_shouldShowTextField()
? GestureDetector(
onTap: () {
if (widget.address != null) {
return;
}
setState(() {
_addressValidAndUnfocused = false;
});
Future.delayed(Duration(milliseconds: 50), () {
FocusScope.of(context)
.requestFocus(_addressFocusNode);
});
},
child: AddressThreeLineText(
address: widget.address != null
? widget.address!
: _addressController.text,
),
)
: null,
),
// Enter Address Error Container
Container(
margin: const EdgeInsets.only(top: 5, bottom: 5),
child: Text(
_addressValidationText,
style: styles.textStyleParagraphThinPrimary,
),
fadeSuffixOnCondition: true,
suffixShowFirstCondition: _showPasteButton,
onChanged: (text) {
final address = Address.tryParse(
text,
expectedPrefix: addressPrefix,
);
if (address != null) {
setState(() {
_addressValid = true;
_showPasteButton = false;
_addressController.text = address.toString();
});
_addressFocusNode.unfocus();
} else {
setState(() {
_showPasteButton = true;
_addressValid = false;
});
}
},
overrideTextFieldWidget: !_shouldShowTextField()
? GestureDetector(
onTap: () {
if (widget.address != null) {
return;
}
setState(() {
_addressValidAndUnfocused = false;
});
Future.delayed(Duration(milliseconds: 50), () {
FocusScope.of(context).requestFocus(_addressFocusNode);
});
},
child: AddressThreeLineText(
address: widget.address != null
? widget.address!
: _addressController.text,
),
)
: null,
),
// Enter Address Error Container
Container(
margin: const EdgeInsets.only(top: 5, bottom: 5),
child: Text(
_addressValidationText,
style: styles.textStyleParagraphThinPrimary,
),
],
),
bottomWidget: Padding(
padding: const EdgeInsets.symmetric(horizontal: 28),
child: Column(
children: [
PrimaryButton(
title: l10n.addContact,
onPressed: _addContact,
),
const SizedBox(height: 16),
PrimaryOutlineButton(
title: l10n.close,
onPressed: () => appRouter.pop(context),
),
],
),
],
),
bottomWidget: Padding(
padding: const EdgeInsets.symmetric(horizontal: 28),
child: Column(
children: [
PrimaryButton(
title: l10n.addContact,
onPressed: _addContact,
),
const SizedBox(height: 16),
PrimaryOutlineButton(
title: l10n.close,
onPressed: () => appRouter.pop(context),
),
],
),
),
);
Expand Down
15 changes: 9 additions & 6 deletions lib/contacts/contact_details.dart
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,16 @@ class ContactDetails extends HookConsumerWidget {
);
}

void showSendSheet() {
Future<void> showSendSheet() async {
appRouter.pop(context);
Sheets.showAppHeightNineSheet(
context: context,
theme: theme,
widget: SendSheet(contact: contact),
);
final (:cont, :rbf) = await UIUtil.checkForPendingTx(context, ref: ref);
if (cont) {
Sheets.showAppHeightNineSheet(
context: context,
theme: theme,
widget: SendSheet(contact: contact, rbf: rbf),
);
}
}

return SafeArea(
Expand Down
Loading

0 comments on commit 6cdb768

Please sign in to comment.