Skip to content

Commit e690423

Browse files
committed
update notes import and export file type to jsonl
Changes the file type of notes exports to .jsonl (JSON Lines), which is a more common format used by compatible wallets as specified in BIP-329. For example, exporting labels with Sparrow Wallet creates a .jsonl, which would previously have to be renamed manually in order to allow importing it in the BitBoxApp. The supported import file types are updated accordingly, still allowing .txt imports for exports created prior to this change.
1 parent fa03491 commit e690423

File tree

4 files changed

+6
-9
lines changed

4 files changed

+6
-9
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
- Introduce full screen selector for mobile in place of dropdown
99
- Fix wrong estimated confirmation time for ERC20 tokens.
1010
- Enable unlock test wallet in testnet
11+
- Change notes export file type to JSON Lines
1112

1213
# v4.47.2
1314
- Linux: fix compatiblity with some versions of Mesa that are incompatible with the bundled wayland libraries

backend/notes.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ func (backend *Backend) ExportNotes() error {
158158
if err != nil {
159159
return err
160160
}
161-
name := fmt.Sprintf("%s-notes.txt", time.Now().Format("2006-01-02-at-15-04-05"))
161+
name := fmt.Sprintf("%s-notes.jsonl", time.Now().Format("2006-01-02-at-15-04-05"))
162162
suggestedPath := filepath.Join(exportsDir, name)
163163
path := backend.Environment().GetSaveFilename(suggestedPath)
164164
if path == "" {

frontends/android/BitBoxApp/app/src/main/java/ch/shiftcrypto/bitboxapp/MainActivity.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
import java.io.IOException;
5252
import java.io.InputStream;
5353
import java.io.InputStreamReader;
54+
import java.util.Arrays;
5455
import java.util.ArrayList;
5556
import java.util.HashMap;
5657
import java.util.Iterator;
@@ -352,13 +353,8 @@ public boolean onShowFileChooser(WebView webView, ValueCallback<Uri[]> filePathC
352353
MainActivity.this.filePathCallback = filePathCallback;
353354
String[] mimeTypes = fileChooserParams.getAcceptTypes();
354355
String fileType = "*/*";
355-
if (mimeTypes.length == 1) {
356-
// import notes form uses .txt file type, but is not supported here.
357-
if (".txt".equals(mimeTypes[0])) {
358-
fileType = "text/plain";
359-
} else if (MimeTypeMap.getSingleton().hasMimeType(mimeTypes[0])) {
360-
fileType = mimeTypes[0];
361-
}
356+
if (mimeTypes.length == 1 && MimeTypeMap.getSingleton().hasMimeType(mimeTypes[0])) {
357+
fileType = mimeTypes[0];
362358
}
363359
mGetContent.launch(fileType);
364360
return true;

frontends/web/src/routes/settings/components/appearance/notesImport.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export const NotesImport = () => {
3232
type="file"
3333
className={style.fileInput}
3434
ref={fileInputRef}
35-
accept=".txt"
35+
accept=".jsonl,.txt"
3636
onChange={async (e: React.ChangeEvent<HTMLInputElement>) => {
3737
setImportDisabled(e.target.files === null || e.target.files.length === 0);
3838
if (fileInputRef.current === null) {

0 commit comments

Comments
 (0)