11import { Component , OnInit } from '@angular/core' ;
2- import { Chats , Messages , Users } from 'api/collections' ;
2+ import { Chats , Messages , Users , Pictures } from 'api/collections' ;
33import { Chat , Message } from 'api/models' ;
4- import { NavController , PopoverController , ModalController , AlertController } from 'ionic-angular' ;
4+ import { NavController , PopoverController , ModalController , AlertController , Platform } from 'ionic-angular' ;
55import { MeteorObservable } from 'meteor-rxjs' ;
66import { Observable , Subscriber } from 'rxjs' ;
77import { MessagesPage } from '../messages/messages' ;
@@ -19,7 +19,8 @@ export class ChatsPage implements OnInit {
1919 private navCtrl : NavController ,
2020 private popoverCtrl : PopoverController ,
2121 private modalCtrl : ModalController ,
22- private alertCtrl : AlertController ) {
22+ private alertCtrl : AlertController ,
23+ private platform : Platform ) {
2324 this . senderId = Meteor . userId ( ) ;
2425 }
2526
@@ -48,7 +49,12 @@ export class ChatsPage implements OnInit {
4849
4950 if ( receiver ) {
5051 chat . title = receiver . profile . name ;
51- chat . picture = receiver . profile . picture ;
52+
53+ let platform = this . platform . is ( 'android' ) ? "android" :
54+ this . platform . is ( 'ios' ) ? "ios" : "" ;
55+ platform = this . platform . is ( 'cordova' ) ? platform : "" ;
56+
57+ chat . picture = Pictures . getPictureUrl ( receiver . profile . pictureId , platform ) ;
5258 }
5359
5460 // This will make the last message reactive
0 commit comments