|
@@ -233,6 +233,7 @@ class ConversationController {
|
|
|
|
|
|
// The conversation receiver
|
|
// The conversation receiver
|
|
public receiver: threema.Receiver;
|
|
public receiver: threema.Receiver;
|
|
|
|
+ public conversation: threema.Conversation;
|
|
public type: threema.ReceiverType;
|
|
public type: threema.ReceiverType;
|
|
|
|
|
|
// The conversation messages
|
|
// The conversation messages
|
|
@@ -342,9 +343,10 @@ class ConversationController {
|
|
}, 100, this), supportsPassive() ? {passive: true} : false);
|
|
}, 100, this), supportsPassive() ? {passive: true} : false);
|
|
}
|
|
}
|
|
|
|
|
|
- // Set receiver and type
|
|
|
|
|
|
+ // Set receiver, conversation and type
|
|
try {
|
|
try {
|
|
this.receiver = webClientService.receivers.getData({type: $stateParams.type, id: $stateParams.id});
|
|
this.receiver = webClientService.receivers.getData({type: $stateParams.type, id: $stateParams.id});
|
|
|
|
+ this.conversation = this.webClientService.conversations.find(this.receiver);
|
|
this.type = $stateParams.type;
|
|
this.type = $stateParams.type;
|
|
|
|
|
|
if (this.receiver.type === undefined) {
|
|
if (this.receiver.type === undefined) {
|
|
@@ -493,7 +495,7 @@ class ConversationController {
|
|
this.webClientService.setQuote(this.receiver);
|
|
this.webClientService.setQuote(this.receiver);
|
|
}
|
|
}
|
|
|
|
|
|
- public showError(errorMessage: string, hideDelayMs = 3000) {
|
|
|
|
|
|
+ public showError(errorMessage?: string, hideDelayMs = 3000) {
|
|
if (errorMessage === undefined || errorMessage.length === 0) {
|
|
if (errorMessage === undefined || errorMessage.length === 0) {
|
|
errorMessage = this.$translate.instant('error.ERROR_OCCURRED');
|
|
errorMessage = this.$translate.instant('error.ERROR_OCCURRED');
|
|
}
|
|
}
|
|
@@ -503,6 +505,15 @@ class ConversationController {
|
|
.position('bottom center')
|
|
.position('bottom center')
|
|
.hideDelay(hideDelayMs));
|
|
.hideDelay(hideDelayMs));
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ public showMessage(msgTranslation: string, hideDelayMs = 3000) {
|
|
|
|
+ this.$mdToast.show(
|
|
|
|
+ this.$mdToast.simple()
|
|
|
|
+ .textContent(this.$translate.instant(msgTranslation))
|
|
|
|
+ .position('bottom center')
|
|
|
|
+ .hideDelay(hideDelayMs));
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* Submit function for input field. Can contain text or file data.
|
|
* Submit function for input field. Can contain text or file data.
|
|
* Return whether sending was successful.
|
|
* Return whether sending was successful.
|
|
@@ -856,6 +867,32 @@ class ConversationController {
|
|
const chat = this.domChatElement;
|
|
const chat = this.domChatElement;
|
|
this.showScrollJump = chat.scrollHeight - (chat.scrollTop + chat.offsetHeight) > 10;
|
|
this.showScrollJump = chat.scrollHeight - (chat.scrollTop + chat.offsetHeight) > 10;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Mark the current conversation as pinned.
|
|
|
|
+ */
|
|
|
|
+ public pinConversation(): void {
|
|
|
|
+ this.webClientService
|
|
|
|
+ .modifyConversation(this.conversation, true)
|
|
|
|
+ .then(() => this.showMessage('messenger.PINNED_CONVERSATION_OK'))
|
|
|
|
+ .catch((msg) => {
|
|
|
|
+ this.showMessage('messenger.PINNED_CONVERSATION_ERROR');
|
|
|
|
+ this.$log.error(this.logTag, 'Pinning conversation failed: ' + msg);
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Mark the current conversation as not pinned.
|
|
|
|
+ */
|
|
|
|
+ public unpinConversation(): void {
|
|
|
|
+ this.webClientService
|
|
|
|
+ .modifyConversation(this.conversation, false)
|
|
|
|
+ .then(() => this.showMessage('messenger.UNPINNED_CONVERSATION_OK'))
|
|
|
|
+ .catch((msg) => {
|
|
|
|
+ this.showMessage('messenger.UNPINNED_CONVERSATION_ERROR');
|
|
|
|
+ this.$log.error(this.logTag, 'Unpinning conversation failed: ' + msg);
|
|
|
|
+ });
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
class NavigationController {
|
|
class NavigationController {
|