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
1 change: 1 addition & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
Bangle.js2: Menus now buzz when back button pressed or icon tapped (fix #2642)
JIT: When referencing a built-in member function of a built-in (Math.*, E.*, PIN_NAME.*, etc) include address rather than looking up (#2398)
nRF52 Central: Lower min connection interval from 20->7.5ms, max 200->1000ms (allows some extra devices to be connected to)
Bangle.js2: Add optional long press button actions to `showPrompt` (#2656)

2v27 : nRF5x: Ensure Bluetooth notifications work correctly when two separate connections use the same handle for their characteristics
nRF5x: Remove handlers from our handlers array when a device is disconnected
Expand Down
3 changes: 2 additions & 1 deletion libs/banglejs/jswrap_bangle.c
Original file line number Diff line number Diff line change
Expand Up @@ -6073,7 +6073,7 @@ E.showMessage("Lots of text will wrap automatically",{
"return" : ["JsVar","A promise that is resolved when 'Ok' is pressed"],
"ifdef" : "BANGLEJS",
"typescript" : [
"showPrompt<T = boolean>(message: string, options?: { title?: string, buttons?: { [key: string]: T }, buttonHeight?: number, image?: string, remove?: () => void }): Promise<T>;",
"showPrompt<T = boolean>(message: string, options?: { title?: string, buttons?: { [key: string]: T }, buttonsLong?: { [key: string]: T }, buttonHeight?: number, image?: string, remove?: () => void }): Promise<T>;",
"showPrompt(): void;"
]
}
Expand Down Expand Up @@ -6113,6 +6113,7 @@ The second `options` argument can contain:
{
title: "Hello", // optional Title
buttons : {"Ok":true,"Cancel":false}, // optional list of button text & return value
buttonsLong : {"Ok":2,"Cancel":"Cancel"}, // Bangle.js2: optional subset of buttons that should also have a specific long press action
img: "image_string" // optional image string to draw
remove: function() { } // Bangle.js: optional function to be called when the prompt is removed#
buttonHeight : 30, // Bangle.js2: optional height to force the buttons to be
Expand Down
7 changes: 5 additions & 2 deletions libs/js/banglejs/E_showPrompt_Q3.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,10 @@
draw(i); // highlighted button
g.flip(); // write to screen
E.showPrompt(); // remove
resolve(options.buttons[btns[i]]);
if (e.type===2 /*long press*/ && options.buttonsLong && btns[i] in options.buttonsLong)
resolve(options.buttonsLong[btns[i]]);
else
resolve(options.buttons[btns[i]]);
}
});
}};
Expand All @@ -76,4 +79,4 @@
};
Bangle.setUI(ui);
});
})
})
4 changes: 2 additions & 2 deletions libs/js/banglejs/E_showPrompt_Q3.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading