Skip to content

Commit 36607cb

Browse files
Piggy wallet: fix QR code background, order descending, fix balance updates
1 parent f1ad24a commit 36607cb

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

internal_filesystem/apps/com.lightningpiggy.displaywallet/assets/displaywallet.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,8 @@ def build_main_ui():
205205
receive_qr.set_light_color(lv.color_white())
206206
receive_qr.update("tfar@getalby.com", len("tfar@getalby.com"))
207207
receive_qr.align(lv.ALIGN.TOP_RIGHT,0,0)
208+
receive_qr.set_style_border_color(lv.color_white(), 0)
209+
receive_qr.set_style_border_width(3, 0);
208210
style_line = lv.style_t()
209211
style_line.init()
210212
style_line.set_line_width(2)

internal_filesystem/apps/com.lightningpiggy.displaywallet/assets/wallet.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ def __init__(self):
2424
def add(self, item):
2525
# Check if item already exists (using __eq__)
2626
if item not in self._items:
27-
# Insert item in sorted position (using __lt__)
27+
# Insert item in sorted position for descending order (using __gt__)
2828
for i, existing_item in enumerate(self._items):
29-
if item < existing_item:
29+
if item > existing_item:
3030
self._items.insert(i, item)
3131
return
32-
# If item is larger than all existing items, append it
32+
# If item is smaller than all existing items, append it
3333
self._items.append(item)
3434

3535
def __iter__(self):
@@ -56,9 +56,8 @@ def __eq__(self, other):
5656
return False
5757
return all(p1 == p2 for p1, p2 in zip(self._items, other))
5858

59-
59+
# Payment class remains unchanged
6060
class Payment:
61-
6261
def __init__(self, epoch_time, amount_sats, comment):
6362
self.epoch_time = epoch_time
6463
self.amount_sats = amount_sats
@@ -96,8 +95,6 @@ def __ge__(self, other):
9695
return (self.epoch_time, self.amount_sats, self.comment) >= (other.epoch_time, other.amount_sats, other.comment)
9796

9897

99-
100-
10198
class Wallet:
10299

103100
# These values could be loading from a cache.json file at __init__
@@ -374,7 +371,7 @@ def wallet_manager_thread(self):
374371
elif type != "incoming":
375372
print(f"WARNING: invalid notification type {type}, ignoring.")
376373
continue
377-
new_balance = self.balance + amount
374+
new_balance = self.last_known_balance + amount
378375
self.handle_new_balance(new_balance, False)
379376
epoch_time = transaction["created_at"]
380377
comment = self.getCommentFromTransaction(notification)

0 commit comments

Comments
 (0)