Merge pull request #1690 from crazyserver/MOBILE-2795

Mobile 2795
main
Juan Leyva 2018-12-21 14:53:36 +01:00 committed by GitHub
commit dad3d727b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 39 additions and 21 deletions

View File

@ -5,7 +5,7 @@
<core-loading [hideUntil]="loaded" class="core-loading-center">
<ion-list no-margin>
<a ion-item text-wrap *ngFor="let contact of contacts" [title]="contact.fullname" (click)="selectUser(contact.id)" [class.core-split-item-selected]="contact.id == selectedUserId" class="addon-messages-conversation-item">
<ion-avatar item-start core-user-avatar [user]="contact" [checkOnline]="true" [linkProfile]="false"></ion-avatar>
<ion-avatar item-start core-user-avatar [user]="contact" [checkOnline]="contact.showonlinestatus" [linkProfile]="false"></ion-avatar>
<h2>
<core-format-text [text]="contact.fullname"></core-format-text>
<core-icon *ngIf="contact.isblocked" name="fa-ban" item-end></core-icon>

View File

@ -5,7 +5,7 @@
<core-loading [hideUntil]="loaded" class="core-loading-center">
<ion-list no-margin>
<a ion-item text-wrap *ngFor="let request of requests" [title]="request.fullname" (click)="selectUser(request.id)" [class.core-split-item-selected]="request.id == selectedUserId" class="addon-messages-conversation-item">
<ion-avatar item-start core-user-avatar [user]="request" [checkOnline]="true" [linkProfile]="false"></ion-avatar>
<ion-avatar item-start core-user-avatar [user]="request" [linkProfile]="false"></ion-avatar>
<h2><core-format-text [text]="request.fullname"></core-format-text></h2>
<p *ngIf="!request.iscontact && !request.confirmedOrDeclined">{{ 'addon.messages.wouldliketocontactyou' | translate }}</p>
</a>

View File

@ -19,7 +19,7 @@
<ng-container *ngFor="let contact of contacts[contactType]">
<!-- Don't show deleted users -->
<a ion-item text-wrap *ngIf="contact.profileimageurl || contact.profileimageurlsmall" [title]="contact.fullname" (click)="gotoDiscussion(contact.id)" [class.core-split-item-selected]="contact.id == discussionUserId" class="addon-messages-conversation-item">
<ion-avatar core-user-avatar [user]="contact" item-start></ion-avatar>
<ion-avatar core-user-avatar [user]="contact" item-start [checkOnline]="contact.showonlinestatus"></ion-avatar>
<h2><core-format-text [text]="contact.fullname"></core-format-text></h2>
</a>
</ng-container>

View File

@ -13,7 +13,7 @@
<ion-note item-end>{{ search.results.length }}</ion-note>
</ion-item-divider>
<a ion-item text-wrap *ngFor="let result of search.results" [title]="result.fullname" (click)="gotoDiscussion(result.userid, result.messageid)" [class.core-split-item-selected]="result.userid == discussionUserId" class="addon-message-discussion">
<ion-avatar core-user-avatar [user]="result" item-start></ion-avatar>
<ion-avatar core-user-avatar [user]="result" item-start [checkOnline]="result.showonlinestatus"></ion-avatar>
<h2><core-format-text [text]="result.fullname"></core-format-text></h2>
<p><core-format-text clean="true" singleLine="true" [text]="result.lastmessage"></core-format-text></p>
</a>
@ -21,7 +21,7 @@
<ion-list *ngIf="!search.showResults" no-margin>
<a ion-item text-wrap *ngFor="let discussion of discussions" [title]="discussion.fullname" (click)="gotoDiscussion(discussion.message.user)" [class.core-split-item-selected]="discussion.message.user == discussionUserId" class="addon-message-discussion">
<ion-avatar core-user-avatar [user]="discussion" item-start></ion-avatar>
<ion-avatar core-user-avatar [user]="discussion" item-start [checkOnline]="discussion.showonlinestatus"></ion-avatar>
<h2>
<core-format-text [text]="discussion.fullname"></core-format-text>
</h2>

View File

@ -15,8 +15,8 @@
<core-loading [hideUntil]="loaded">
<ion-item text-center *ngIf="conversation">
<div class="item-avatar-center" *ngIf="conversation.imageurl">
<img class="avatar" [src]="conversation.imageurl" core-external-content [alt]="conversation.name" role="presentation">
<div class="item-avatar-center">
<img class="avatar" [src]="conversation.imageurl" core-external-content [alt]="conversation.name" role="presentation" onError="this.src='assets/img/group-avatar.png'">
</div>
<h2><core-format-text [text]="conversation.name"></core-format-text></h2>
<p><core-format-text *ngIf="conversation.subname" [text]="conversation.subname"></core-format-text></p>

View File

@ -56,7 +56,7 @@ export class AddonMessagesConversationInfoPage implements OnInit {
*/
protected fetchData(): Promise<any> {
// Get the conversation data first.
return this.messagesProvider.getConversation(this.conversationId, false, false, 0, 0).then((conversation) => {
return this.messagesProvider.getConversation(this.conversationId, false, true, 0, 0).then((conversation) => {
this.conversation = conversation;
// Now get the members.

View File

@ -1,9 +1,9 @@
<ion-header>
<ion-navbar core-back-button>
<ion-title>
<img *ngIf="!otherMember && conversationImage" class="core-bar-button-image" [src]="conversationImage" alt="" onError="this.src='assets/img/user-avatar.png'" core-external-content role="presentation" [siteId]="siteId || null">
<ion-avatar *ngIf="otherMember" class="core-bar-button-image" core-user-avatar [user]="otherMember" [linkProfile]="false" [checkOnline]="otherMember.showonlinestatus" item-start></ion-avatar>
<core-format-text [text]="title"></core-format-text>
<img *ngIf="!otherMember && conversationImage" class="core-bar-button-image" [src]="conversationImage" alt="" onError="this.src='assets/img/group-avatar.png'" core-external-content role="presentation" [siteId]="siteId || null">
<ion-avatar *ngIf="otherMember" class="core-bar-button-image" core-user-avatar [user]="otherMember" [linkProfile]="false" [checkOnline]="otherMember.showonlinestatus" item-start (click)="showInfo && viewInfo()"></ion-avatar>
<core-format-text [text]="title" (click)="showInfo && !isGroup && viewInfo()"></core-format-text>
<core-icon *ngIf="conversation && conversation.isfavourite" name="fa-star"></core-icon>
</ion-title>
<ion-buttons end></ion-buttons>

View File

@ -5,6 +5,10 @@ $item-message-note-font-size: 75% !default;
$item-message-mine-bg: $gray-light !default;
ion-app.app-root page-addon-messages-discussion {
.toolbar-title {
padding: 0;
}
ion-content {
background-color: $gray-lighter !important;
}
@ -116,6 +120,7 @@ ion-app.app-root page-addon-messages-discussion {
-ms-flex-item-align: end;
align-self: flex-end;
vertical-align: middle;
@include float('end');
.icon {
font-size: 1.4em;

View File

@ -229,6 +229,8 @@ export class AddonMessagesDiscussionPage implements OnDestroy {
this.conversationImage = member.profileimageurl;
this.title = member.fullname;
}
this.blockIcon = this.otherMember && this.otherMember.isblocked ? 'close-circle' : 'checkmark-circle';
this.addRemoveIcon = this.otherMember && this.otherMember.iscontact ? 'remove' : 'add';
}));
} else {
this.otherMember = null;
@ -391,7 +393,7 @@ export class AddonMessagesDiscussionPage implements OnDestroy {
if (conversationId) {
promise = Promise.resolve(conversationId);
} else {
promise = this.messagesProvider.getConversationBetweenUsers(userId).then((conversation) => {
promise = this.messagesProvider.getConversationBetweenUsers(userId, undefined, true).then((conversation) => {
fallbackConversation = conversation;
return conversation.id;
@ -403,7 +405,7 @@ export class AddonMessagesDiscussionPage implements OnDestroy {
return this.messagesProvider.invalidateConversation(conversationId).catch(() => {
// Ignore errors.
}).then(() => {
return this.messagesProvider.getConversation(conversationId);
return this.messagesProvider.getConversation(conversationId, undefined, true);
}).catch((error) => {
// Get conversation failed, use the fallback one if we have it.
if (fallbackConversation) {
@ -422,8 +424,6 @@ export class AddonMessagesDiscussionPage implements OnDestroy {
this.favouriteIcon = conversation.isfavourite ? 'fa-star-o' : 'fa-star';
if (!this.isGroup) {
this.userId = conversation.userid;
this.blockIcon = this.otherMember && this.otherMember.isblocked ? 'close-circle' : 'checkmark-circle';
this.addRemoveIcon = this.otherMember && this.otherMember.iscontact ? 'remove' : 'add';
}
return true;
@ -1022,7 +1022,7 @@ export class AddonMessagesDiscussionPage implements OnDestroy {
this.conversation.isfavourite = !this.conversation.isfavourite;
// Get the conversation data so it's cached. Don't block the user for this.
this.messagesProvider.getConversation(this.conversation.id);
this.messagesProvider.getConversation(this.conversation.id, undefined, true);
this.eventsProvider.trigger(AddonMessagesProvider.UPDATE_CONVERSATION_LIST_EVENT, {
conversationId: this.conversation.id,

View File

@ -81,8 +81,8 @@
<ng-template #conversationsTemplate let-conversations="conversations">
<a ion-item text-wrap *ngFor="let conversation of conversations" [title]="conversation.name" (click)="gotoConversation(conversation.id, conversation.userid)" [class.core-split-item-selected]="(conversation.id && conversation.id == selectedConversationId) || (conversation.userid && conversation.userid == selectedUserId)" class="addon-message-discussion" id="addon-message-conversation-{{ conversation.id ? conversation.id : 'user-' + conversation.userid }}">
<!-- Group conversation image. -->
<ion-avatar item-start *ngIf="conversation.type != typeIndividual && conversation.imageurl">
<img [src]="conversation.imageurl" [alt]="conversation.name" core-external-content>
<ion-avatar item-start *ngIf="conversation.type != typeIndividual">
<img [src]="conversation.imageurl" [alt]="conversation.name" core-external-content onError="this.src='assets/img/group-avatar.png'">
</ion-avatar>
<!-- Avatar for individual conversations. -->

View File

@ -809,7 +809,8 @@ export class AddonMessagesProvider {
conversationid: conversationId,
limitfrom: limitFrom,
limitnum: limitTo < 1 ? limitTo : limitTo + 1, // If there is a limit, get 1 more than requested.
includecontactrequests: includeContactRequests ? 1 : 0
includecontactrequests: includeContactRequests ? 1 : 0,
includeprivacyinfo: 1,
};
return site.read('core_message_get_conversation_members', params, preSets).then((members) => {

View File

@ -80,4 +80,8 @@ ion-app.app-root.md {
color: $core-color;
}
}
}
.platform-android4_4 .bar-buttons-md {
display: flex;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 972 B

View File

@ -12,4 +12,9 @@ ion-avatar[core-user-avatar] {
background-color: $core-online-color;
}
}
}
.toolbar ion-avatar[core-user-avatar] .contact-status {
width: 10px;
height: 10px;
}

View File

@ -15,6 +15,7 @@
import { Component, Input, OnInit, OnChanges, SimpleChange } from '@angular/core';
import { NavController } from 'ionic-angular';
import { CoreSitesProvider } from '@providers/sites';
import { CoreAppProvider } from '@providers/app';
import { CoreUtilsProvider } from '@providers/utils/utils';
/**
@ -42,7 +43,8 @@ export class CoreUserAvatarComponent implements OnInit, OnChanges {
protected myUser = false;
protected currentUserId: number;
constructor(private navCtrl: NavController, private sitesProvider: CoreSitesProvider, private utils: CoreUtilsProvider) {
constructor(private navCtrl: NavController, private sitesProvider: CoreSitesProvider, private utils: CoreUtilsProvider,
private appProvider: CoreAppProvider) {
this.currentUserId = this.sitesProvider.getCurrentSiteUserId();
}
@ -100,7 +102,8 @@ export class CoreUserAvatarComponent implements OnInit, OnChanges {
return this.user.lastaccess * 1000 >= time;
} else {
return this.user.isonline;
// You have to have Internet access first.
return this.user.isonline && this.appProvider.isOnline();
}
}