Skip to content

Commit

Permalink
Fix Unknown in chat list menu; remove extra logging
Browse files Browse the repository at this point in the history
  • Loading branch information
Vitaliy Vlasov committed Nov 29, 2018
1 parent 861e5ab commit 21f1388
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 11 deletions.
3 changes: 0 additions & 3 deletions modules/react-native-desktop-menu/desktop/desktopmenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ void DesktopMenuPrivate::createMenu(const QStringList& items, double callback) {
QObject::connect(menu, &QMenu::triggered, [=](QAction* action) {
bridge->invokePromiseCallback(callback, QVariantList{action->text()});
});
qCDebug(DESKTOPMENU) << "### DesktopMenuPrivate before open";
menu->popup(QCursor::pos());
}

Expand All @@ -44,7 +43,6 @@ DesktopMenu::~DesktopMenu() {
void DesktopMenu::setBridge(Bridge *bridge) {
Q_D(DesktopMenu);

qCDebug(DESKTOPMENU) << "### DesktopMenu::setBridge";
d->bridge = bridge;
}

Expand All @@ -58,7 +56,6 @@ QVariantMap DesktopMenu::constantsToExport() { return QVariantMap(); }

void DesktopMenu::show(const QStringList& items, double callback) {
Q_D(DesktopMenu);
qCDebug(DESKTOPMENU) << "### DesktopMenu::show";
d_ptr->createMenu(items, callback);

}
Expand Down
2 changes: 0 additions & 2 deletions modules/react-native-desktop-menu/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,9 @@ class DesktopMenu {
for (let i = 0; i < menuItems.length; ++i) {
itemMap.set(menuItems[i].text, menuItems[i].onPress);
}
console.warn("###js Before DesktopMenu.show()");
NativeModules.DesktopMenuManager.show(
itemNames,
(name) => {
console.warn("###js DesktopMenu callback invoked");
(itemMap.get(name))();
}
);
Expand Down
5 changes: 2 additions & 3 deletions src/status_im/ui/components/popup_menu/views.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,13 @@
[react/touchable-highlight
{:on-press #(let [right-click? (= "right" (.-button (.-nativeEvent %)))
action (if right-click? right-click-action left-click-action)]
(log/debug "### wrap-with-menu" right-click?)
(action))}
component]]))

(defn get-chat-menu-items [public-key group-chat public? chat-id]
(defn get-chat-menu-items [group-chat public? chat-id]
(->> [(when (and (not group-chat) (not public?))
{:text (i18n/label :t/view-profile)
:on-select #(re-frame/dispatch [:show-profile-desktop public-key])})
:on-select #(re-frame/dispatch [:show-profile-desktop chat-id])})
(when (and group-chat (not public?))
{:text (i18n/label :t/group-info)
:on-select #(re-frame/dispatch [:show-group-chat-profile])})
Expand Down
2 changes: 1 addition & 1 deletion src/status_im/ui/screens/desktop/main/chat/views.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
(i18n/label :t/public-chat)])]]
[react/touchable-highlight
{:on-press #(popup-menu/show-desktop-menu
(popup-menu/get-chat-menu-items public-key group-chat public? chat-id))}
(popup-menu/get-chat-menu-items group-chat public? chat-id))}
[vector-icons/icon :icons/dots-horizontal
{:style {:tint-color colors/black
:width 24
Expand Down
4 changes: 2 additions & 2 deletions src/status_im/ui/screens/desktop/main/tabs/home/views.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,14 @@
[chat-item/message-timestamp (:timestamp last-message)]]])))

(defn chat-list-item [[chat-id
{:keys [group-chat public? public-key] :as chat}]]
{:keys [group-chat public?] :as chat}]]
[react/touchable-highlight
{:on-press (fn [arg]
(let [right-click? (= "right" (.-button (.-nativeEvent arg)))]
(re-frame/dispatch [:chat.ui/navigate-to-chat chat-id])
(when right-click?
(popup-menu/show-desktop-menu
(popup-menu/get-chat-menu-items public-key group-chat public? chat-id)))))}
(popup-menu/get-chat-menu-items group-chat public? chat-id)))))}
[chat-list-item-inner-view (assoc chat :chat-id chat-id)]])

(defn tag-view [tag {:keys [on-press]}]
Expand Down

0 comments on commit 21f1388

Please sign in to comment.