MOBILE-2914 messages: New unstar and add/remove contact icons

main
Albert Gasset 2019-04-30 11:39:55 +02:00
parent dd1076f994
commit ec5ec8036f
2 changed files with 10 additions and 8 deletions

View File

@ -13,14 +13,14 @@
<core-context-menu [aria-label]="'addon.messages.conversationactions' | translate"> <core-context-menu [aria-label]="'addon.messages.conversationactions' | translate">
<core-context-menu-item [hidden]="isSelf || !showInfo || isGroup" [priority]="1000" [content]="'addon.messages.info' | translate" (action)="viewInfo()" iconAction="information-circle"></core-context-menu-item> <core-context-menu-item [hidden]="isSelf || !showInfo || isGroup" [priority]="1000" [content]="'addon.messages.info' | translate" (action)="viewInfo()" iconAction="information-circle"></core-context-menu-item>
<core-context-menu-item [hidden]="isSelf || !showInfo || !isGroup" [priority]="1000" [content]="'addon.messages.groupinfo' | translate" (action)="viewInfo()" iconAction="information-circle"></core-context-menu-item> <core-context-menu-item [hidden]="isSelf || !showInfo || !isGroup" [priority]="1000" [content]="'addon.messages.groupinfo' | translate" (action)="viewInfo()" iconAction="information-circle"></core-context-menu-item>
<core-context-menu-item [hidden]="!groupMessagingEnabled || !conversation" [priority]="800" [content]="(conversation && conversation.isfavourite ? 'addon.messages.removefromfavourites' : 'addon.messages.addtofavourites') | translate" (action)="changeFavourite($event)" [closeOnClick]="false" [iconAction]="favouriteIcon"></core-context-menu-item> <core-context-menu-item [hidden]="!groupMessagingEnabled || !conversation" [priority]="800" [content]="(conversation && conversation.isfavourite ? 'addon.messages.removefromfavourites' : 'addon.messages.addtofavourites') | translate" (action)="changeFavourite($event)" [closeOnClick]="false" [iconAction]="favouriteIcon" [iconSlash]="favouriteIconSlash"></core-context-menu-item>
<core-context-menu-item [hidden]="isSelf || !otherMember || otherMember.isblocked" [priority]="700" [content]="'addon.messages.blockuser' | translate" (action)="blockUser()" [iconAction]="blockIcon"></core-context-menu-item> <core-context-menu-item [hidden]="isSelf || !otherMember || otherMember.isblocked" [priority]="700" [content]="'addon.messages.blockuser' | translate" (action)="blockUser()" [iconAction]="blockIcon"></core-context-menu-item>
<core-context-menu-item [hidden]="isSelf || !otherMember || !otherMember.isblocked" [priority]="700" [content]="'addon.messages.unblockuser' | translate" (action)="unblockUser()" [iconAction]="blockIcon"></core-context-menu-item> <core-context-menu-item [hidden]="isSelf || !otherMember || !otherMember.isblocked" [priority]="700" [content]="'addon.messages.unblockuser' | translate" (action)="unblockUser()" [iconAction]="blockIcon"></core-context-menu-item>
<core-context-menu-item [hidden]="!muteEnabled || !conversation" [priority]="600" [content]="(conversation && conversation.ismuted ? 'addon.messages.unmuteconversation' : 'addon.messages.muteconversation') | translate" (action)="changeMute($event)" [closeOnClick]="false" [iconAction]="muteIcon"></core-context-menu-item> <core-context-menu-item [hidden]="!muteEnabled || !conversation" [priority]="600" [content]="(conversation && conversation.ismuted ? 'addon.messages.unmuteconversation' : 'addon.messages.muteconversation') | translate" (action)="changeMute($event)" [closeOnClick]="false" [iconAction]="muteIcon"></core-context-menu-item>
<core-context-menu-item [hidden]="!canDelete" [priority]="400" [content]="'addon.messages.showdeletemessages' | translate" (action)="toggleDelete()" [iconAction]="(showDelete ? 'checkbox-outline' : 'square-outline')"></core-context-menu-item> <core-context-menu-item [hidden]="!canDelete" [priority]="400" [content]="'addon.messages.showdeletemessages' | translate" (action)="toggleDelete()" [iconAction]="(showDelete ? 'checkbox-outline' : 'square-outline')"></core-context-menu-item>
<core-context-menu-item [hidden]="!groupMessagingEnabled || !conversationId || isGroup" [priority]="200" [content]="'addon.messages.deleteconversation' | translate" (action)="deleteConversation($event)" [closeOnClick]="false" [iconAction]="deleteIcon"></core-context-menu-item> <core-context-menu-item [hidden]="!groupMessagingEnabled || !conversationId || isGroup" [priority]="200" [content]="'addon.messages.deleteconversation' | translate" (action)="deleteConversation($event)" [closeOnClick]="false" [iconAction]="deleteIcon"></core-context-menu-item>
<core-context-menu-item [hidden]="isSelf || !otherMember || otherMember.iscontact || requestContactSent || requestContactReceived" [priority]="100" [content]="'addon.messages.addtoyourcontacts' | translate" (action)="createContactRequest()" [iconAction]="addRemoveIcon"></core-context-menu-item> <core-context-menu-item [hidden]="isSelf || !otherMember || otherMember.iscontact || requestContactSent || requestContactReceived" [priority]="100" [content]="'addon.messages.addtoyourcontacts' | translate" (action)="createContactRequest()" [iconAction]="addRemoveIcon"></core-context-menu-item>
<core-context-menu-item [hidden]="isSelf || !otherMember || !otherMember.iscontact" [priority]="100" [content]="'addon.messages.removefromyourcontacts' | translate" (action)="removeContact()" [iconAction]="addRemoveIcon"></core-context-menu-item> <core-context-menu-item [hidden]="isSelf || !otherMember || !otherMember.iscontact" [priority]="100" [content]="'addon.messages.removefromyourcontacts' | translate" (action)="removeContact()" [iconAction]="addRemoveIcon" [iconSlash]="true"></core-context-menu-item>
</core-context-menu> </core-context-menu>
</core-navbar-buttons> </core-navbar-buttons>
</ion-header> </ion-header>

View File

@ -80,9 +80,10 @@ export class AddonMessagesDiscussionPage implements OnDestroy {
isGroup = false; isGroup = false;
members: any = {}; // Members that wrote a message, indexed by ID. members: any = {}; // Members that wrote a message, indexed by ID.
favouriteIcon = 'fa-star'; favouriteIcon = 'fa-star';
favouriteIconSlash = false;
deleteIcon = 'trash'; deleteIcon = 'trash';
blockIcon = 'close-circle'; blockIcon = 'close-circle';
addRemoveIcon = 'add'; addRemoveIcon = 'person';
otherMember: any; // Other member information (individual conversations only). otherMember: any; // Other member information (individual conversations only).
footerType: 'message' | 'blocked' | 'requiresContact' | 'requestSent' | 'requestReceived' | 'unable'; footerType: 'message' | 'blocked' | 'requiresContact' | 'requestSent' | 'requestReceived' | 'unable';
requestContactSent = false; requestContactSent = false;
@ -244,7 +245,6 @@ export class AddonMessagesDiscussionPage implements OnDestroy {
this.title = member.fullname; this.title = member.fullname;
} }
this.blockIcon = this.otherMember && this.otherMember.isblocked ? 'checkmark-circle' : 'close-circle'; this.blockIcon = this.otherMember && this.otherMember.isblocked ? 'checkmark-circle' : 'close-circle';
this.addRemoveIcon = this.otherMember && this.otherMember.iscontact ? 'remove' : 'add';
})); }));
} else { } else {
this.otherMember = null; this.otherMember = null;
@ -446,7 +446,8 @@ export class AddonMessagesDiscussionPage implements OnDestroy {
this.title = conversation.name; this.title = conversation.name;
this.conversationImage = conversation.imageurl; this.conversationImage = conversation.imageurl;
this.isGroup = conversation.type == AddonMessagesProvider.MESSAGE_CONVERSATION_TYPE_GROUP; this.isGroup = conversation.type == AddonMessagesProvider.MESSAGE_CONVERSATION_TYPE_GROUP;
this.favouriteIcon = conversation.isfavourite ? 'fa-star-o' : 'fa-star'; this.favouriteIcon = 'fa-star';
this.favouriteIconSlash = conversation.isfavourite;
this.muteIcon = conversation.ismuted ? 'volume-up' : 'volume-off'; this.muteIcon = conversation.ismuted ? 'volume-up' : 'volume-off';
if (!this.isGroup) { if (!this.isGroup) {
this.userId = conversation.userid; this.userId = conversation.userid;
@ -1118,7 +1119,8 @@ export class AddonMessagesDiscussionPage implements OnDestroy {
}).catch((error) => { }).catch((error) => {
this.domUtils.showErrorModalDefault(error, 'Error changing favourite state.'); this.domUtils.showErrorModalDefault(error, 'Error changing favourite state.');
}).finally(() => { }).finally(() => {
this.favouriteIcon = this.conversation.isfavourite ? 'fa-star-o' : 'fa-star'; this.favouriteIcon = 'fa-star';
this.favouriteIconSlash = this.conversation.isfavourite;
done && done(); done && done();
}); });
} }
@ -1306,7 +1308,7 @@ export class AddonMessagesDiscussionPage implements OnDestroy {
}).catch((error) => { }).catch((error) => {
this.domUtils.showErrorModalDefault(error, 'core.error', true); this.domUtils.showErrorModalDefault(error, 'core.error', true);
}).finally(() => { }).finally(() => {
this.addRemoveIcon = this.otherMember.iscontact ? 'remove' : 'add'; this.addRemoveIcon = 'person';
}); });
} }
@ -1381,7 +1383,7 @@ export class AddonMessagesDiscussionPage implements OnDestroy {
}).catch((error) => { }).catch((error) => {
this.domUtils.showErrorModalDefault(error, 'core.error', true); this.domUtils.showErrorModalDefault(error, 'core.error', true);
}).finally(() => { }).finally(() => {
this.addRemoveIcon = this.otherMember.iscontact ? 'remove' : 'add'; this.addRemoveIcon = 'person';
}); });
} }