Skip to content

Commit

Permalink
Merge pull request #7 from Foundation-Devices/dev-v1.0.4
Browse files Browse the repository at this point in the history
v1.0.4 changes
  • Loading branch information
FoundationKen authored Jun 25, 2021
2 parents cad967d + 89585ce commit 414b479
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 19 deletions.
6 changes: 2 additions & 4 deletions ports/stm32/boards/Passport/modules/accounts.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,6 @@ async def show(self):
self.goto(self.ENTER_ACCOUNT_NAME)

elif self.state == self.ENTER_ACCOUNT_NAME:
# Default the name to the label as a starting point for the user
self.account_name = ''

name = await ux_enter_text(
'Account Name',
label='New Account Name',
Expand All @@ -82,9 +79,10 @@ async def show(self):
# See if an account with this name already exists
if account_exists(name):
result = await ux_show_story('An account with the name "{}" already exists. Please choose a different name.'.format(name),
title='Duplicate', center=True, center_vertically=True, right_btn='RENAME')
title='Duplicate', center=True, center_vertically=True, right_btn='EDIT')
if result == 'x':
self.goto_prev()
continue
else:
self.account_name = name # Start off with the name the user entered
continue
Expand Down
33 changes: 18 additions & 15 deletions ports/stm32/boards/Passport/modules/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,28 +121,27 @@ async def regulatory_info():
# font=FontTiny)

async def rename_account(menu, label, item):
from export import auto_backup
from utils import account_exists, do_rename_account
from constants import MAX_ACCOUNT_NAME_LEN

account = common.active_account

original_name = account.get('name')
new_name = original_name

while True:
new_name = await ux_enter_text('Rename', label="Enter account name", initial_text=account.get('name'),
new_name = await ux_enter_text('Rename', label="Enter account name", initial_text=new_name,
right_btn='RENAME', max_length=MAX_ACCOUNT_NAME_LEN)

if new_name == None:
# User selected BACK
if new_name == None or new_name == original_name:
# User selected BACK or selected RENAME with the same exact name
return

# See if an account with this name already exists
if account_exists(new_name):
result = await ux_show_story('An account with the name "{}" already exists. Please choose a different name.'.format(new_name),
title='Duplicate', center=True, center_vertically=True, right_btn='RENAME')
if result == 'x':
self.goto_prev()
else:
continue
await ux_show_story('An account with the name "{}" already exists. Please choose a different name.'.format(new_name),
title='Duplicate', center=True, center_vertically=True, right_btn='EDIT')
continue

# Get the accounts and replace the name and save it
await do_rename_account(account.get('acct_num'), new_name)
Expand Down Expand Up @@ -640,9 +639,9 @@ async def restore_wallet_from_seed(menu, label, item):
if result == 'x':
return

fake_it = True
fake_it = False
if fake_it:
mnemonic = 'fabric humor guess asset day palace wealth spare trend seek focus empower hair advance myself defy grain inhale market noodle right need joke scatter'
pass
else:
from seed_entry_ux import SeedEntryUX
seed_phrase_entry = SeedEntryUX(seed_len=item.arg)
Expand Down Expand Up @@ -1296,21 +1295,25 @@ async def import_multisig_from_qr(*a):
system.turbo(False);

if data != None:
# TOnly need to decode this for QR codes...from SD card it's already in bytes
data = data.decode('utf-8')
await handle_import_multisig_config(data)

async def handle_import_multisig_config(data):
from auth import maybe_enroll_xpub
from export import offer_backup
from utils import show_top_menu

# Coming from a UR code we need to decode from bytes
if isinstance(data, (bytes, bytearray)):
data = data.decode('utf-8')

try:
common.is_new_wallet_a_duplicate = False
possible_name = "ms"
maybe_enroll_xpub(config=data, name=possible_name)
await show_top_menu() # wait for interaction with the enroll

await offer_backup()
if not common.is_new_wallet_a_duplicate:
await offer_backup()
except Exception as e:
await ux_show_story('Unable to import multisig configuration.\n\n'+str(e), title='Error')

Expand Down

0 comments on commit 414b479

Please sign in to comment.