Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Traders chat #3165

Merged
merged 35 commits into from
Aug 30, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
b5b126c
Refactor Chat out of TraderDisputeView
sqrrm May 23, 2019
390fc44
Send acks when capability found
sqrrm May 25, 2019
b1362a9
Separate most of Chat and arbitration
sqrrm May 25, 2019
1a25678
Move close ticket button creation to arbitration
sqrrm May 25, 2019
2d77f32
Handle Chat message subscription inside Chat
sqrrm May 25, 2019
1b1dce1
Add ChatManager
sqrrm May 30, 2019
b93e7ba
Add trader chat
sqrrm May 25, 2019
3b87045
Make attachments optional
sqrrm Jun 3, 2019
fb71c32
Test trade chat UI
sqrrm Jun 3, 2019
0217c3d
Add comments on BSQ trade fee calculation
sqrrm Jun 5, 2019
2375880
Change message box aid
sqrrm Jun 5, 2019
13f2651
Add basic chat UI
sqrrm Jun 5, 2019
329572c
Merge branch 'master_upstream' into sq-add-trader-chat
chimp1984 Aug 29, 2019
5d338e6
Fix merge issues
chimp1984 Aug 29, 2019
cb67376
Update string
chimp1984 Aug 29, 2019
8e3a351
Add comments, cleanup, fix wrong param name
chimp1984 Aug 29, 2019
2189cba
Show chat in popup instead of tab (WIP)
chimp1984 Aug 29, 2019
bfb111d
Add close handler to popup
chimp1984 Aug 29, 2019
fa43f03
Merge branch 'master_upstream' into sq-add-trader-chat
chimp1984 Aug 29, 2019
29e957a
Apply changes from master
chimp1984 Aug 29, 2019
855cb4f
Add missing allServicesInitialized check
chimp1984 Aug 29, 2019
e0c1a85
Add wasDisplayed field to chatMsg
chimp1984 Aug 29, 2019
81a93b5
Add onAllServicesInitialized call, rename method
chimp1984 Aug 29, 2019
a2cd808
Add missing setWasDisplayed
chimp1984 Aug 29, 2019
6304c9e
Add badge for num new chat msg
chimp1984 Aug 29, 2019
5c1999f
Fix wrong pubkey
chimp1984 Aug 29, 2019
663d859
Add chat rules system msg; cleanups
chimp1984 Aug 29, 2019
5e267fa
Handle nullables
chimp1984 Aug 29, 2019
964ca64
Fix positioning of badge
ripcurlx Aug 30, 2019
8edd261
Use button instead of label to fix tooltip font size, use material de…
ripcurlx Aug 30, 2019
fa30720
Update core/src/main/resources/i18n/displayStrings.properties
chimp1984 Aug 30, 2019
16d3bc5
Update core/src/main/resources/i18n/displayStrings.properties
chimp1984 Aug 30, 2019
c615780
Update tradeChat.rules
chimp1984 Aug 30, 2019
57ec0db
Persist chat position. Improve listener handling.
chimp1984 Aug 30, 2019
50baa9b
Close chat window if dispute gets closed
chimp1984 Aug 30, 2019
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
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,12 @@
public class DisputeChatSession extends ChatSession {
private static final Logger log = LoggerFactory.getLogger(DisputeChatSession.class);

@Nullable
private Dispute dispute;
private DisputeManager disputeManager;

public DisputeChatSession(
@Nullable Dispute dispute,
DisputeManager disputeManager
) {
public DisputeChatSession(@Nullable Dispute dispute,
DisputeManager disputeManager) {
super(DisputeCommunicationMessage.Type.DISPUTE);
this.dispute = dispute;
this.disputeManager = disputeManager;
Expand Down
3 changes: 1 addition & 2 deletions core/src/main/java/bisq/core/trade/TradeManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ public class TradeManager implements PersistedDataHost {
private static final Logger log = LoggerFactory.getLogger(TradeManager.class);

private final User user;
@Getter
private final KeyRing keyRing;
private final BtcWalletService btcWalletService;
private final BsqWalletService bsqWalletService;
Expand All @@ -109,7 +110,6 @@ public class TradeManager implements PersistedDataHost {
private final ClosedTradableManager closedTradableManager;
private final FailedTradesManager failedTradesManager;
private final P2PService p2PService;
private final WalletsSetup walletsSetup;
private final PriceFeedService priceFeedService;
private final FilterManager filterManager;
private final TradeStatisticsManager tradeStatisticsManager;
Expand Down Expand Up @@ -164,7 +164,6 @@ public TradeManager(User user,
this.closedTradableManager = closedTradableManager;
this.failedTradesManager = failedTradesManager;
this.p2PService = p2PService;
this.walletsSetup = walletsSetup;
this.priceFeedService = priceFeedService;
this.filterManager = filterManager;
this.tradeStatisticsManager = tradeStatisticsManager;
Expand Down
13 changes: 11 additions & 2 deletions core/src/main/resources/i18n/displayStrings.properties
Original file line number Diff line number Diff line change
Expand Up @@ -608,8 +608,17 @@ portfolio.pending.step2_seller.waitPayment.msg=The deposit transaction has at le
portfolio.pending.step2_seller.warn=The BTC buyer still has not done the {0} payment.\nYou need to wait until they have started the payment.\nIf the trade has not been completed on {1} the arbitrator will investigate.
portfolio.pending.step2_seller.openForDispute=The BTC buyer has not started his payment!\nThe max. allowed period for the trade has elapsed.\nYou can wait longer and give the trading peer more time or contact the arbitrator for opening a dispute.

portfolio.pending.chatWindowTitle=Chat window for trade with ID ''{0}''
portfolio.pending.openChat=Open chat window
tradeChat.chatWindowTitle=Chat window for trade with ID ''{0}''
tradeChat.openChat=Open chat window
tradeChat.rules=You can communicate with your trade peer to resolve potential problems with this trade. It is not mandatory to reply in \
the chat. If a trader violates the below rules, open a dispute with 'cmd + o' and report it to the arbitrator.\n\n\
Chat rules:\n\
\t● Do not send links to unknown URLs (risk of malware). Links to a block explorer are permitted.\n\
\t● Do not try to motivate peer to trade outside of Bisq (no security).\n\
\t● Keep conversation friendly and respectful.\n\
\t● Do not engage in any form of social engineering scam attempts.\n\
\t● Respect if the peer is not responding and prefers to not communicate via the chat.\n\
\t● Keep conversation scope limited to the trade. This chat is not a messenger replacement or trollbox.

# suppress inspection "UnusedProperty"
message.state.UNDEFINED=Undefined
Expand Down
4 changes: 3 additions & 1 deletion desktop/src/main/java/bisq/desktop/main/Chat/Chat.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import bisq.core.chat.ChatManager;
import bisq.core.chat.ChatSession;
import bisq.core.locale.Res;
import bisq.core.trade.TradeChatSession;
import bisq.core.util.BSFormatter;

import bisq.network.p2p.NodeAddress;
Expand Down Expand Up @@ -200,8 +201,9 @@ public void display(ChatSession chatSession, @Nullable Button extraButton,
inputTextArea = new BisqTextArea();
inputTextArea.setPrefHeight(70);
inputTextArea.setWrapText(true);
if (chatSession.isClient())
if (chatSession instanceof TradeChatSession || chatSession.isClient()) {
inputTextArea.setPromptText(Res.get("support.input.prompt"));
}

sendButton = new AutoTooltipButton(Res.get("support.send"));
sendButton.setDefaultButton(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,19 @@ private void openChat(Trade trade) {
if (chatPopupStage != null)
chatPopupStage.close();

if (trade.getCommunicationMessages().isEmpty()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will make receivers of messages from peers not see the code of conduct message

DisputeCommunicationMessage disputeCommunicationMessage = new DisputeCommunicationMessage(
DisputeCommunicationMessage.Type.TRADE,
trade.getId(),
0,
false,
Res.get("tradeChat.rules"),
new NodeAddress("null:0000")
);
disputeCommunicationMessage.setSystemMessage(true);
trade.getCommunicationMessages().add(disputeCommunicationMessage);
}

trade.getCommunicationMessages().forEach(m -> m.setWasDisplayed(true));
trade.persist();
tradeIdOfOpenChat = trade.getId();
Expand All @@ -326,7 +339,7 @@ private void openChat(Trade trade) {
tradeChat.initialize();

AnchorPane pane = new AnchorPane(tradeChat);
pane.setPrefSize(600, 400);
pane.setPrefSize(700, 500);
AnchorPane.setLeftAnchor(tradeChat, 10d);
AnchorPane.setRightAnchor(tradeChat, 10d);
AnchorPane.setTopAnchor(tradeChat, -20d);
Expand All @@ -344,7 +357,7 @@ private void openChat(Trade trade) {
tradeChat.scrollToBottom();

chatPopupStage = new Stage();
chatPopupStage.setTitle(Res.get("portfolio.pending.chatWindowTitle", trade.getShortId()));
chatPopupStage.setTitle(Res.get("tradeChat.chatWindowTitle", trade.getShortId()));
StackPane owner = MainView.getRootContainer();
Scene rootScene = owner.getScene();
chatPopupStage.initOwner(rootScene.getWindow());
Expand Down Expand Up @@ -642,7 +655,7 @@ public void updateItem(final PendingTradesListItem newItem, boolean empty) {
Trade trade = newItem.getTrade();

Label icon = AwesomeDude.createIconLabel(AwesomeIcon.COMMENTS_ALT, "25");
Tooltip.install(icon, new Tooltip(Res.get("portfolio.pending.openChat")));
Tooltip.install(icon, new Tooltip(Res.get("tradeChat.openChat")));

JFXBadge numNewMsg = new JFXBadge(icon);
// FIXME does not take position...
Expand Down