mirror of
https://github.com/status-im/status-react.git
synced 2025-01-27 19:26:05 +00:00
239a0cbfe6
bots dir slurp-bot macro split commands.js into browse, mailman and wallet bot-url & loading of default bots command schema command-parameter schema global-command in default_commands @browse command in all chats load global command from jail optimize applications startup Conflicts: bots/wallet/translations.js resources/console.js resources/dapp.js resources/default_contacts.json resources/status.js resources/wallet.js src/status_im/accounts/screen.cljs src/status_im/chat/constants.cljs src/status_im/chat/handlers.cljs src/status_im/chat/handlers/commands.cljs src/status_im/chat/handlers/send_message.cljs src/status_im/chat/subs.cljs src/status_im/chat/suggestions.cljs src/status_im/chat/views/command.cljs src/status_im/chat/views/suggestions.cljs src/status_im/commands/handlers/jail.cljs src/status_im/commands/handlers/loading.cljs src/status_im/contacts/handlers.cljs src/status_im/data_store/realm/schemas/account/core.cljs src/status_im/data_store/realm/schemas/account/v5/core.cljs src/status_im/models/commands.cljs src/status_im/utils/js_resources.cljs
37 lines
818 B
JavaScript
37 lines
818 B
JavaScript
function browseSuggestions(params, context) {
|
|
var url;
|
|
|
|
if (context["dapp-url"]) {
|
|
url = context["dapp-url"];
|
|
}
|
|
|
|
if (params.url && params.url !== "undefined" && params.url != "") {
|
|
url = params.url;
|
|
if (!/^[a-zA-Z-_]+:/.test(url)) {
|
|
url = 'http://' + url;
|
|
}
|
|
}
|
|
|
|
return {
|
|
title: "Browser",
|
|
dynamicTitle: true,
|
|
markup: status.components.bridgedWebView(url)
|
|
};
|
|
}
|
|
|
|
status.command({
|
|
name: "global",
|
|
title: I18n.t('browse_title'),
|
|
registeredOnly: true,
|
|
description: I18n.t('browse_description'),
|
|
color: "#ffa500",
|
|
fullscreen: true,
|
|
suggestionsTrigger: 'on-send',
|
|
params: [{
|
|
name: "url",
|
|
type: status.types.TEXT,
|
|
placeholder: "URL"
|
|
}],
|
|
onSend: browseSuggestions
|
|
});
|