feat(settings): split import into separate key + viewing-key buttons
Backup & Data now has two distinct import actions instead of one auto-detecting dialog: - "Import Key" imports a spending key (transparent WIF or shielded z-spending key) with the strong "grants access to funds" warning. - "Import Viewing Key" imports a watch-only shielded viewing key (zxviews…) with a milder eye/watch-only note and an optional "scan from block height" field — z_importviewingkey accepts a start height, so watching a recent address needn't rescan the whole chain. The shared Material dialog (renderImportKeyDialog) branches on import_view_mode_: title, warning tone, field label, the live type indicator, and the recognition guard. A key valid for the *other* button (e.g. a spending key pasted into the viewing-key dialog) now shows a redirect hint rather than a generic "unrecognized" error. importPrivateKey gains a startHeight arg, appended to the shielded import RPCs (z_importviewingkey / z_importkey) and ignored for transparent WIF (importprivkey has no start-height param). The scan-height buffer is wiped on open/close alongside the key buffer. i18n: 9 new keys (button label + tooltip, viewing title/note/field, scan label/hint, two wrong-type redirect hints) with translations for all 8 languages; CJK subset rebuilt (+1 glyph). A modal-import-viewkey sweep surface is added for the viewing-mode dialog. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1349,12 +1349,14 @@ void RenderSettingsPage(App* app) {
|
||||
float naturalW = 0;
|
||||
for (int i = 0; i < 5; i++)
|
||||
naturalW += ImGui::CalcTextSize(r1[i]).x + btnPadX;
|
||||
float impViewW = ImGui::CalcTextSize(TR("settings_import_viewkey")).x + btnPadX;
|
||||
naturalW += impViewW; // the extra "Import viewing key" button (rendered after Import key)
|
||||
float wizW = showFullNodeLifecycleActions ? ImGui::CalcTextSize(wizLabel).x + btnPadX : 0.0f;
|
||||
float bsW = showFullNodeLifecycleActions ? ImGui::CalcTextSize(bsLabel).x + btnPadX : 0.0f;
|
||||
// Full-node-only "Seed phrase" + "Migrate to seed" buttons trail the Backup button.
|
||||
float seedW = showFullNodeLifecycleActions ? ImGui::CalcTextSize(TR("seed_backup_button")).x + btnPadX : 0.0f;
|
||||
float migrateW = showFullNodeLifecycleActions ? ImGui::CalcTextSize(TR("seed_migrate_button")).x + btnPadX : 0.0f;
|
||||
float totalW = naturalW + sp * 5;
|
||||
float totalW = naturalW + sp * 6; // 6 base buttons (incl. Import viewing key)
|
||||
if (showFullNodeLifecycleActions) totalW += wizW + bsW + seedW + migrateW + sp * 4;
|
||||
|
||||
float scale = (totalW > contentW) ? contentW / totalW : 1.0f;
|
||||
@@ -1364,6 +1366,11 @@ void RenderSettingsPage(App* app) {
|
||||
if (TactileButton(r1[0], ImVec2(0, 0), btnFont))
|
||||
app->showImportKeyDialog();
|
||||
if (ImGui::IsItemHovered()) material::Tooltip("%s", t1[0]);
|
||||
// Watch-only shielded viewing-key import (separate button — different key type + scan-height).
|
||||
ImGui::SameLine(0, scaledSp);
|
||||
if (TactileButton(TR("settings_import_viewkey"), ImVec2(0, 0), btnFont))
|
||||
app->showImportViewingKeyDialog();
|
||||
if (ImGui::IsItemHovered()) material::Tooltip("%s", TR("tt_import_viewkey"));
|
||||
ImGui::SameLine(0, scaledSp);
|
||||
if (TactileButton(r1[1], ImVec2(0, 0), btnFont))
|
||||
app->showExportKeyDialog();
|
||||
|
||||
Reference in New Issue
Block a user