Skip to content

Commit 123b997

Browse files
dotansimhadarkbasic
authored andcommitted
Step 13.37: Fetch user image from server
1 parent 86d7442 commit 123b997

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

src/pages/chats/chats.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Component, OnInit } from '@angular/core';
2-
import { Chats, Messages, Users } from 'api/collections';
2+
import { Chats, Messages, Users, Pictures } from 'api/collections';
33
import { Chat, Message } from 'api/models';
4-
import { NavController, PopoverController, ModalController, AlertController } from 'ionic-angular';
4+
import { NavController, PopoverController, ModalController, AlertController, Platform } from 'ionic-angular';
55
import { MeteorObservable } from 'meteor-rxjs';
66
import { Observable, Subscriber } from 'rxjs';
77
import { 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

Comments
 (0)