Skip to content

Commit

Permalink
chore: remove parsing lightning invocies
Browse files Browse the repository at this point in the history
  • Loading branch information
bonomat committed Jan 26, 2024
1 parent 405c8a2 commit 06005a2
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 518 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]

- Chore: Enforce minimum quantity to 500 on dlc channel open
- Chore(app): Remove paying lightning invoices

## [1.8.0] - 2024-01-23

Expand Down
9 changes: 0 additions & 9 deletions mobile/lib/common/routes.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import 'package:get_10101/common/settings/channel_screen.dart';
import 'package:get_10101/common/settings/delete_network_graph.dart';
import 'package:get_10101/common/status_screen.dart';
import 'package:get_10101/features/wallet/domain/destination.dart';
import 'package:get_10101/features/wallet/send/send_lightning_screen.dart';
import 'package:get_10101/features/wallet/send/send_onchain_screen.dart';
import 'package:get_10101/features/welcome/loading_screen.dart';
import 'package:get_10101/common/scaffold_with_nav_bar.dart';
Expand Down Expand Up @@ -165,14 +164,6 @@ GoRouter createRoutes() {
return SendOnChainScreen(destination: state.extra as OnChainAddress);
},
),
GoRoute(
path: SendLightningScreen.subRouteName,
// Use root navigator so the screen overlays the application shell
parentNavigatorKey: rootNavigatorKey,
builder: (BuildContext context, GoRouterState state) {
return SendLightningScreen(destination: state.extra as LightningInvoice);
},
),
GoRoute(
path: OnboardingScreen.subRouteName,
parentNavigatorKey: rootNavigatorKey,
Expand Down
16 changes: 0 additions & 16 deletions mobile/lib/features/wallet/balance_row.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import 'package:flutter/material.dart';
import 'package:get_10101/features/trade/position_change_notifier.dart';
import 'package:get_10101/features/wallet/domain/wallet_type.dart';
import 'package:get_10101/features/wallet/wallet_change_notifier.dart';
import 'package:intl/intl.dart';
import 'package:provider/provider.dart';

class BalanceRow extends StatefulWidget {
Expand All @@ -20,9 +18,6 @@ class _BalanceRowState extends State<BalanceRow> with SingleTickerProviderStateM
Widget build(BuildContext context) {
WalletChangeNotifier walletChangeNotifier = context.watch<WalletChangeNotifier>();

PositionChangeNotifier positionChangeNotifier = context.watch<PositionChangeNotifier>();
final formatter = NumberFormat("#,###,##0.00", "en");

final amountText = switch (widget.walletType) {
WalletType.lightning => Row(
mainAxisAlignment: MainAxisAlignment.center,
Expand All @@ -46,17 +41,6 @@ class _BalanceRowState extends State<BalanceRow> with SingleTickerProviderStateM
style:
TextStyle(fontSize: 14, color: Colors.white, fontWeight: FontWeight.normal))
]),
WalletType.stable => Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(formatter.format(positionChangeNotifier.getStableUSDAmountInFiat()),
style: const TextStyle(
fontSize: 30, color: Colors.white, fontWeight: FontWeight.bold)),
const Text(" \$",
style:
TextStyle(fontSize: 14, color: Colors.white, fontWeight: FontWeight.normal))
]),
};

return Center(child: amountText);
Expand Down
2 changes: 1 addition & 1 deletion mobile/lib/features/wallet/domain/wallet_type.dart
Original file line number Diff line number Diff line change
@@ -1 +1 @@
enum WalletType { lightning, onChain, stable }
enum WalletType { lightning, onChain }
41 changes: 30 additions & 11 deletions mobile/lib/features/wallet/scanner_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:get_10101/common/color.dart';
import 'package:get_10101/features/wallet/domain/destination.dart';
import 'package:get_10101/features/wallet/domain/wallet_type.dart';
import 'package:get_10101/features/wallet/send/send_lightning_screen.dart';
import 'package:get_10101/features/wallet/send/send_onchain_screen.dart';
import 'package:get_10101/features/wallet/wallet_change_notifier.dart';
import 'package:get_10101/features/wallet/wallet_screen.dart';
Expand Down Expand Up @@ -117,14 +116,10 @@ class _ScannerScreenState extends State<ScannerScreen> {
if (_formKey.currentState!.validate()) {
switch (destination!.getWalletType()) {
case WalletType.lightning:
GoRouter.of(context)
.go(SendLightningScreen.route, extra: destination);
_showNoLightningDialog(context);
case WalletType.onChain:
GoRouter.of(context)
.go(SendOnChainScreen.route, extra: destination);
case WalletType.stable:
GoRouter.of(context)
.go(SendLightningScreen.route, extra: destination);
}
}
});
Expand Down Expand Up @@ -195,14 +190,10 @@ class _ScannerScreenState extends State<ScannerScreen> {
if (_formKey.currentState!.validate()) {
switch (destination!.getWalletType()) {
case WalletType.lightning:
GoRouter.of(context)
.go(SendLightningScreen.route, extra: destination);
_showNoLightningDialog(context);
case WalletType.onChain:
GoRouter.of(context)
.go(SendOnChainScreen.route, extra: destination);
case WalletType.stable:
GoRouter.of(context)
.go(SendLightningScreen.route, extra: destination);
}
}
});
Expand Down Expand Up @@ -253,3 +244,31 @@ class _ScannerScreenState extends State<ScannerScreen> {
super.dispose();
}
}

Future<void> _showNoLightningDialog(BuildContext context) async {
return showDialog<void>(
context: context,
barrierDismissible: false,
builder: (BuildContext context) {
return AlertDialog(
title: const Text('Can\'t pay invoice'),
content: const SingleChildScrollView(
child: ListBody(
children: <Widget>[
Text('For the time being we have disabled paying Lightning invoices.'),
Text('Thank you for your understanding.'),
],
),
),
actions: <Widget>[
TextButton(
child: const Text('Ok'),
onPressed: () {
Navigator.of(context).pop();
},
),
],
);
},
);
}
Loading

0 comments on commit 06005a2

Please sign in to comment.