-
Notifications
You must be signed in to change notification settings - Fork 29
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
Major codebase cleanup #415
Changes from all commits
9edf8ba
eed8f3f
c03421b
36804d2
057aae6
1b24bbd
ca32965
2c34342
1696b64
48cc1fe
42f814d
08a8978
567d3cf
8d44e72
87fdb76
3f5df40
f8be66f
118fde6
0589659
26bd7d7
fcbcf65
dee040b
94ca64a
cf46efa
ea2303a
96a0fd4
2323997
5a1b0ed
01ff02b
5d0c4ba
d018d34
01b186f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
description: This file stores settings for Dart & Flutter DevTools. | ||
documentation: https://docs.flutter.dev/tools/devtools/extensions#configure-extension-enablement-states | ||
extensions: | ||
- provider: true |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -63,6 +63,7 @@ class Wallet with _$Wallet { | |
@Default(0) int subKeyIndex, | ||
// List<String>? labelTags, | ||
// List<Bip329Label>? bip329Labels, | ||
Address? firstAddress, | ||
}) = _Wallet; | ||
const Wallet._(); | ||
|
||
|
@@ -515,6 +516,10 @@ class Wallet with _$Wallet { | |
List<SwapTx> swapsToProcess() { | ||
return swaps.where((swap) => swap.proceesTx() && !swap.failed()).toList(); | ||
} | ||
|
||
int balanceSats() => balance ?? 0; | ||
|
||
String balanceStr() => ((balance ?? 0) / 100000000).toStringAsFixed(8); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
} | ||
|
||
@freezed | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,8 +3,9 @@ import 'dart:async'; | |
import 'package:bb_mobile/_model/wallet.dart'; | ||
import 'package:bb_mobile/_pkg/error.dart'; | ||
import 'package:bb_mobile/_pkg/wallet/bip21.dart'; | ||
import 'package:bb_mobile/home/bloc/home_cubit.dart'; | ||
import 'package:bb_mobile/network/bloc/network_cubit.dart'; | ||
import 'package:bb_mobile/home/bloc/home_bloc.dart'; | ||
import 'package:bb_mobile/network/bloc/event.dart'; | ||
import 'package:bb_mobile/network/bloc/network_bloc.dart'; | ||
import 'package:flutter/material.dart'; | ||
// import 'package:uni_links/uni_links.dart'; | ||
|
||
|
@@ -39,8 +40,8 @@ class DeepLink { | |
Future<Err?> handleUri({ | ||
required String link, | ||
// required SettingsCubit settingsCubit, | ||
required HomeCubit homeCubit, | ||
required NetworkCubit networkCubit, | ||
required HomeBloc homeCubit, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
required NetworkBloc networkCubit, | ||
required BuildContext context, | ||
}) async { | ||
try { | ||
|
@@ -50,8 +51,8 @@ class DeepLink { | |
final address = bip21Obj.address; | ||
final isTestnet = isTestnetAddress(address); | ||
if (isTestnet == null) return Err('Invalid address'); | ||
final currentIsTestnet = networkCubit.state.testnet; | ||
if (currentIsTestnet != isTestnet) networkCubit.toggleTestnet(); | ||
final currentIsTestnet = networkCubit.state.networkData.testnet; | ||
if (currentIsTestnet != isTestnet) networkCubit.add(ToggleTestnet()); | ||
await Future.delayed(const Duration(milliseconds: 200)); | ||
final wallet = homeCubit.state.getFirstWithSpendableAndBalance( | ||
isTestnet ? BBNetwork.Testnet : BBNetwork.Mainnet, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,7 @@ class StorageKeys { | |
static const wallets = 'wallets'; | ||
static const settings = 'settings'; | ||
static const network = 'network'; | ||
static const networkReposity = 'networkReposity'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not clear why a repository itself should have a key to be stored itself...? |
||
static const networkFees = 'networkFees'; | ||
static const currency = 'currency'; | ||
static const lighting = 'lighting'; | ||
|
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not change the balance field/parameter to balanceSats directly with a default value of 0 instead of having balance which is unclear if it is in sats or btc or fiat and then having a function for balanceSats which just returns balance or 0… I think this can be clearer by just replacing the balance field for balanceSats directly with a default 0 value.