Skip to content

Commit b6eb9ca

Browse files
authored
Merge pull request #1226 from Foundation-Devices/ENV-2930-tag-last-coin
[2.2.14] fix: pop to coin list when last untagged coins are tagged
2 parents 6830295 + 09a1945 commit b6eb9ca

2 files changed

Lines changed: 16 additions & 2 deletions

File tree

‎lib/ui/home/cards/accounts/detail/coins/create_coin_tag_dialog.dart‎

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,7 @@ class _CreateCoinTagState extends ConsumerState<CreateCoinTag> {
263263
if (!context.mounted) return;
264264

265265
bool isUntagged = false;
266+
bool isLastUntaggedCoins = false;
266267
try {
267268
final selectedAccount = ref.read(selectedAccountProvider);
268269
if (selectedAccount == null) {
@@ -278,6 +279,19 @@ class _CreateCoinTagState extends ConsumerState<CreateCoinTag> {
278279
tag = "";
279280
isUntagged = true;
280281
}
282+
283+
// Check if these coins are the last untagged coins before tagging them
284+
if (!isUntagged) {
285+
final allTags = ref.read(tagsProvider(widget.accountId));
286+
final untaggedList = allTags.where((t) => t.untagged).toList();
287+
if (untaggedList.isNotEmpty) {
288+
final untaggedIds =
289+
untaggedList.first.utxo.map((u) => u.getId()).toSet();
290+
final coinIds = widget.coins.map((c) => c.getId()).toSet();
291+
isLastUntaggedCoins = untaggedIds.every((id) => coinIds.contains(id));
292+
}
293+
}
294+
281295
setState(() {
282296
_isLoading = true;
283297
});
@@ -290,7 +304,7 @@ class _CreateCoinTagState extends ConsumerState<CreateCoinTag> {
290304
});
291305
if (context.mounted) {
292306
Navigator.of(context).pop();
293-
if (isUntagged) {
307+
if (isUntagged || isLastUntaggedCoins) {
294308
Navigator.of(context).pop();
295309
}
296310
}

‎pubspec.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev
1919
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
2020
# Read more about iOS versioning at
2121
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
22-
version: 2.2.14+11
22+
version: 2.2.14+12
2323

2424
environment:
2525
sdk: ">=3.5.0 <4.0.0"

0 commit comments

Comments
 (0)