Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions core/src/apps/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ def get_vendor():
return "trezor.io" if storage.device.is_trezor_compatible() else "onekey.so"


FW_VENDOR_BTC_ONLY = "OneKey Bitcoin-only"


def busy_expiry_ms() -> int:
"""
Returns the time left until the busy state expires or 0 if the device is not in the busy state.
Expand Down Expand Up @@ -101,6 +104,7 @@ def get_features() -> Features:
Capability.Shamir,
Capability.ShamirGroups,
]
f.fw_vendor = FW_VENDOR_BTC_ONLY
else:
f.capabilities = [
Capability.Bitcoin,
Expand Down
7 changes: 6 additions & 1 deletion core/src/apps/common/seed.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from typing import TYPE_CHECKING

from storage import cache, device
import storage.cache as cache
import storage.device as device
from trezor import utils, wire
from trezor.crypto import bip32, hmac

Expand Down Expand Up @@ -85,6 +86,10 @@ async def derive_and_store_roots(ctx: wire.Context) -> None:

if not state[0] & 0x80:
passphrase = await get_passphrase(ctx)
from trezor.ui.layouts import show_popup
from trezor.lvglui.i18n import gettext as _, keys as i18n_keys

await show_popup(_(i18n_keys.TITLE__PLEASE_WAIT), None, timeout_ms=1000)
mnemonic.get_seed(passphrase, progress_bar=False)

if cache.SESSION_DIRIVE_CARDANO:
Expand Down
4 changes: 2 additions & 2 deletions core/src/trezor/lvglui/i18n/keys.py
Original file line number Diff line number Diff line change
Expand Up @@ -2234,6 +2234,6 @@
TITLE_REQUEST_CONFIRMATION = 1015
# Abort Recovery Phrase Creation?
TITLE__ABORT_RECOVERY_PHRASE_CREATION = 1016
# Write down the following {num} words in order for Share {num1} of {num2}.
TITLE__WRITE_DOWN_THE_FOLLOWING_20_WORDS_IN_ORDER_FOR_SHARE_STR_OF_STR = 1017
# This is Share {num1} of {num2}.
SUBTITLE__THIS_IS_SHARE_STR_OF_STR = 1017
# fmt: on
2 changes: 1 addition & 1 deletion core/src/trezor/lvglui/i18n/locales/de.py
Original file line number Diff line number Diff line change
Expand Up @@ -1017,6 +1017,6 @@
"Aktualisieren Sie auf die neueste Version, um „An PIN anheften“ zu verwenden.",
"Anfragebestätigung",
"Wiederherstellungsphrase-Erstellung abbrechen?",
"Schreiben Sie die folgenden {num} Wörter der Reihe nach für Anteil {num1} von {num2} auf.",
"Dies ist Anteil {num1} von {num2}.",
]
# fmt: on
2 changes: 1 addition & 1 deletion core/src/trezor/lvglui/i18n/locales/en.py
Original file line number Diff line number Diff line change
Expand Up @@ -1017,6 +1017,6 @@
"Update to the latest version to use “Attach to PIN”.",
"Request Confirmation",
"Abort Recovery Phrase Creation?",
"Write down the following {num} words in order for Share {num1} of {num2}.",
"This is Share {num1} of {num2}.",
]
# fmt: on
2 changes: 1 addition & 1 deletion core/src/trezor/lvglui/i18n/locales/es.py
Original file line number Diff line number Diff line change
Expand Up @@ -1017,6 +1017,6 @@
"Actualiza a la última versión para usar \"Adjuntar al PIN\".",
"Confirmación de solicitud",
"¿Abortar la creación de la frase de recuperación?",
"Escribe las siguientes {num} palabras en orden para la Parte {num1} de {num2}.",
"Esta es la parte {num1} de {num2}.",
]
# fmt: on
2 changes: 1 addition & 1 deletion core/src/trezor/lvglui/i18n/locales/fr.py
Original file line number Diff line number Diff line change
Expand Up @@ -1017,6 +1017,6 @@
"Mettez à jour vers la dernière version pour utiliser « Épingler ».",
"Demande de confirmation",
"Abandonner la création de la phrase de récupération ?",
"Écrivez les {num} mots suivants dans l'ordre pour la Part {num1} sur {num2}.",
"Ceci est la part {num1} sur {num2}.",
]
# fmt: on
2 changes: 1 addition & 1 deletion core/src/trezor/lvglui/i18n/locales/it.py
Original file line number Diff line number Diff line change
Expand Up @@ -1017,6 +1017,6 @@
"Aggiorna all'ultima versione per utilizzare \"Allega al PIN\".",
"Conferma richiesta",
"Annullare la creazione della frase di recupero?",
"Scrivi le seguenti {num} parole in ordine per la Parte {num1} di {num2}.",
"Questa è la quota {num1} di {num2}.",
]
# fmt: on
6 changes: 3 additions & 3 deletions core/src/trezor/lvglui/i18n/locales/ja.py
Original file line number Diff line number Diff line change
Expand Up @@ -894,7 +894,7 @@
"進む",
"PINに添付",
"PINを使用して隠されたウォレットを解除する",
"隠しウォレットのPINを設定",
"隠しPINを設定",
"フィンガープリントアップグレード",
"今すぐセットアップ",
"電源ボタンに指を置き、その後持ち上げてください。光の点に従って指を動かし、このステップを繰り返します。",
Expand Down Expand Up @@ -944,7 +944,7 @@
"OP_RETURN",
"この取引にはゼロ以外のOP_RETURN値が含まれています。一度承認されると、あなたの資金は永久にロックされます。",
"標準ウォレットのPIN",
"隠しウォレットのPINを入力してください",
"隠しウォレットのPINを入力",
"標準ウォレット",
"隠しウォレット",
"タップして送信",
Expand Down Expand Up @@ -1017,6 +1017,6 @@
"「PINに添付」機能を利用するには、最新バージョンにアップデートしてください。",
"リクエストの確認",
"リカバリーフレーズの作成を中止しますか?",
"次の{num}語を順番に書き留めてください。「{num2}のうち{num1}」の共有用です。",
"これは {num2} のうちの {num1} つ目の共有です。",
]
# fmt: on
2 changes: 1 addition & 1 deletion core/src/trezor/lvglui/i18n/locales/ko.py
Original file line number Diff line number Diff line change
Expand Up @@ -1017,6 +1017,6 @@
"“PIN에 첨부” 기능을 사용하려면 최신 버전으로 업데이트하세요.",
"요청 확인",
"복구 구문 생성을 중단하시겠습니까?",
"다음 {num}개의 단어를 순서대로 적으세요 (공유 {num2} 중 {num1}).",
"이것은 {num2} 중 {num1}번째 공유입니다.",
]
# fmt: on
2 changes: 1 addition & 1 deletion core/src/trezor/lvglui/i18n/locales/pt_br.py
Original file line number Diff line number Diff line change
Expand Up @@ -1017,6 +1017,6 @@
"Atualize para a versão mais recente para usar o recurso “Vincular ao PIN”.",
"Solicitar Confirmação",
"Cancelar a criação da frase de recuperação?",
"Anote as seguintes {num} palavras em ordem para a Frase {num1} de {num2}.",
"Esta é a Ação {num1} de {num2}.",
]
# fmt: on
2 changes: 1 addition & 1 deletion core/src/trezor/lvglui/i18n/locales/ru.py
Original file line number Diff line number Diff line change
Expand Up @@ -1017,6 +1017,6 @@
"Обновите приложение до последней версии, чтобы использовать функцию «Прикрепить к PIN-коду».",
"Подтверждение запроса",
"Прервать создание фразы восстановления?",
"Запишите следующие {num} слова по порядку для Доли {num1} из {num2}.",
"Это доля {num1} из {num2}.",
]
# fmt: on
2 changes: 1 addition & 1 deletion core/src/trezor/lvglui/i18n/locales/zh_cn.py
Original file line number Diff line number Diff line change
Expand Up @@ -1017,6 +1017,6 @@
"更新到最新版本后,再使用\"Passphrase 绑定 PIN 码\"功能。",
"确认请求",
"终止创建助记词?",
"请按顺序写下以下 {num} 个助记词(第 {num1} 份,共 {num2} 份。",
"这是第 {num1} 份,共 {num2} 份。",
]
# fmt: on
2 changes: 1 addition & 1 deletion core/src/trezor/lvglui/i18n/locales/zh_hk.py
Original file line number Diff line number Diff line change
Expand Up @@ -1017,6 +1017,6 @@
"更新到最新版本後,再使用\"Passphrase 綁定 PIN 碼\"功能。",
"確認請求",
"終止創建助記詞?",
"請按順序寫下以下 {num} 個助記詞(第 {num1} 份,共 {num2} 份。",
"這是第 {num1} 份,共 {num2} 份。",
]
# fmt: on
6 changes: 4 additions & 2 deletions core/src/trezor/lvglui/scrs/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,8 @@ def add_nav_back(self):
when you need to handle the back event specifically.
"""
self.nav_back = Navigation(self)
self.content_area.set_style_max_height(574, 0)
if any([hasattr(self, "btn_no"), hasattr(self, "btn_yes")]):
self.content_area.set_style_max_height(574, 0)
self.content_area.align_to(self.nav_back, lv.ALIGN.OUT_BOTTOM_LEFT, 0, 0)

def add_nav_back_right(self):
Expand All @@ -554,7 +555,8 @@ def add_nav_back_right(self):
nav_btn_align=lv.ALIGN.RIGHT_MID,
align=lv.ALIGN.TOP_RIGHT,
)
self.content_area.set_style_max_height(574, 0)
if any([hasattr(self, "btn_no"), hasattr(self, "btn_yes")]):
self.content_area.set_style_max_height(574, 0)
self.content_area.align_to(self.nav_back, lv.ALIGN.OUT_BOTTOM_RIGHT, 0, 0)

def eventhandler(self, event_obj):
Expand Down
37 changes: 21 additions & 16 deletions core/src/trezor/lvglui/scrs/homescreen.py
Original file line number Diff line number Diff line change
Expand Up @@ -549,29 +549,30 @@ async def list_credential(self):
from .app_passkeys import PasskeysListItemBtn

BATCH_SIZE = 5
stored_credentials = []
# pyright: off
stored_credentials = [None] * self.count
for i, credential in enumerate(self.credentials):
stored_credentials.append(
(
credential.app_name(),
credential.account_name(),
credential.index,
credential.creation_time,
)
stored_credentials[i] = (
credential.app_name(),
credential.account_name(),
credential.index,
credential.creation_time,
)
self.overlay.set_value(i + 1)
if (i < BATCH_SIZE) or ((i + 1) % BATCH_SIZE == 0):
gc.collect()
await loop.sleep(10)
stored_credentials.sort(key=lambda x: x[3])
for i, credential in enumerate(stored_credentials):
self.listed_credentials.append(
PasskeysListItemBtn(
self.container,
credential[0],
credential[1] or "",
credential[2],
)
self.listed_credentials[i] = PasskeysListItemBtn(
self.container,
credential[0],
credential[1] or "",
credential[2],
)
if (i < BATCH_SIZE) or ((i + 1) % BATCH_SIZE == 0):
gc.collect()
# pyright: on
self.container.refresh_self_size()
del stored_credentials
self.overlay.del_delayed(10)
Expand All @@ -588,7 +589,7 @@ def fresh_show(self):
else:
self.count = get_registered_credentials_count()
self.credentials = get_registered_credentials()
self.listed_credentials = []
self.listed_credentials = [None] * self.count

fido_enabled = storage_device.is_fido_enabled()
if not hasattr(self, "banner") and not fido_enabled:
Expand Down Expand Up @@ -634,12 +635,14 @@ def auto_adjust_scroll(self, item_height):
)

async def on_remove(self, i):
# pyright: off
credential = self.listed_credentials.pop(i)
from .app_passkeys import delete_credential

delete_credential(credential.credential_index)
item_height = credential.get_height()
credential.delete()
# pyright: on
self.fresh_show()
self.auto_adjust_scroll(item_height)

Expand All @@ -656,13 +659,15 @@ def on_click_event(self, event_obj):
elif target in self.listed_credentials:
for i, credential in enumerate(self.listed_credentials):
if target == credential:
# pyright: off
workflow.spawn(
app_passkeys.request_credential_details(
credential.app_name,
credential.account_name,
on_remove=lambda index=i: self.on_remove(index),
)
)
# pyright: on
elif hasattr(self, "rti_btn") and target == self.rti_btn:
FidoKeysSetting(self)

Expand Down
10 changes: 5 additions & 5 deletions core/src/trezor/lvglui/scrs/lockscreen.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from storage import device
import storage.device as storage_device
from trezor import ui, utils
from trezor.lvglui.i18n import gettext as _, keys as i18n_keys

Expand All @@ -23,7 +23,7 @@ def retrieval(cls) -> tuple[bool, "LockScreen" | None]:
return False, None

def __init__(self, device_name, ble_name="", dev_state=None):
lockscreen = device.get_homescreen()
lockscreen = storage_device.get_homescreen()
self.double_click = DoubleClickDetector(click_timeout=800, click_dist=50)
if not hasattr(self, "_init"):
self._init = True
Expand Down Expand Up @@ -141,14 +141,14 @@ def anim_set_x(self, x):
pass

def _show_fingerprint_prompt_if_necessary(self):
if device.has_prompted_fingerprint():
if storage_device.has_prompted_fingerprint():
if hasattr(self, "fingerprint_prompt"):
self.fingerprint_prompt.delete()
return
self.fingerprint_prompt = lv.img(self.content_area)
self.fingerprint_prompt.set_src("A:/res/fingerprint-prompt.png")
self.fingerprint_prompt.set_pos(424, 28)
device.set_fingerprint_prompted()
storage_device.set_fingerprint_prompted()

def eventhandler(self, event_obj: lv.event_t):
code = event_obj.code
Expand All @@ -157,7 +157,7 @@ def eventhandler(self, event_obj: lv.event_t):
self.channel.publish("clicked")
else:
if not ui.display.backlight():
if not device.is_tap_awake_enabled():
if not storage_device.is_tap_awake_enabled():
return
else:
indev = lv.indev_get_act()
Expand Down
1 change: 1 addition & 0 deletions core/src/trezor/lvglui/scrs/reset_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ def __init__(
_(i18n_keys.BUTTON__CONTINUE),
anim_dir=0,
)
self.subtitle.set_recolor(True)
if indicator_text:
self.add_indicator(indicator_text)
else:
Expand Down
16 changes: 8 additions & 8 deletions core/src/trezor/lvglui/scrs/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -1024,7 +1024,7 @@ def __init__(
to_address: str,
to_address_safe: str,
value_safe: str,
opeartion: int,
operation: int,
safe_tx_gas: str,
base_gas: str,
gas_price_safe: str,
Expand Down Expand Up @@ -1054,7 +1054,7 @@ def __init__(
from .components.listitem import RawDataOverviewWithTitle

self.primary_color = primary_color
is_delegate_call = opeartion == 1
is_delegate_call = operation == 1
if is_delegate_call:
self.warning_banner = Banner(
self.content_area,
Expand Down Expand Up @@ -1088,7 +1088,7 @@ def __init__(
self.item_group_body_operation = DisplayItem(
self.group_safe_tx,
"Operation",
f'#FF1100 {opeartion} {"(CALL)" if opeartion == 0 else "(DELEGATECALL)"}#',
f'#FF1100 {operation} {"(CALL)" if operation == 0 else "(DELEGATECALL)"}#',
)
if call_method and isinstance(call_data, dict):
from .components.listitem import DisplayItemWithFlexColPanel
Expand Down Expand Up @@ -3433,14 +3433,14 @@ def __init__(
confirm_text: str = "",
cancel_text: str = "",
icon_path: str | None = None,
anim_dir: int = 1,
anim_dir: int = 0,
):
super().__init__(
title, subtitle, confirm_text, cancel_text, icon_path, anim_dir=anim_dir
)

def show_unload_anim(self):
self.destroy(200)
self.destroy(300)


class AlgoCommon(FullSizeWindow):
Expand Down Expand Up @@ -5459,7 +5459,7 @@ def __init__(
to_address: str,
value: str,
call_data: bytes | None,
opeartion: int,
operation: int,
safe_tx_gas: int,
base_gas: int,
gas_price: str,
Expand All @@ -5482,7 +5482,7 @@ def __init__(
primary_color=primary_color,
)
self.primary_color = primary_color
is_delegate_call = opeartion == 1
is_delegate_call = operation == 1
if is_delegate_call:
self.warning_banner = Banner(
self.content_area,
Expand Down Expand Up @@ -5529,7 +5529,7 @@ def __init__(
self.item_group_operation = DisplayItem(
self.group_more,
_(i18n_keys.GLOBAL_OPERATION),
f'#FF1100 {opeartion} {"(CALL)" if opeartion == 0 else "(DELEGATECALL)"}#',
f'#FF1100 {operation} {"(CALL)" if operation == 0 else "(DELEGATECALL)"}#',
)
self.item_group_nonce = DisplayItem(
self.group_more,
Expand Down
Loading
Loading