Skip to content

Commit 9fceb54

Browse files
dotansimhadarkbasic
authored andcommitted
Step 13.39: Implement getPic
1 parent 0ab346c commit 9fceb54

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

src/pages/chats/new-chat.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Component, OnInit } from '@angular/core';
2-
import { Chats, Users } from 'api/collections';
2+
import { Chats, Users, Pictures } from 'api/collections';
33
import { User } from 'api/models';
4-
import { AlertController, ViewController } from 'ionic-angular';
4+
import { AlertController, Platform, ViewController } from 'ionic-angular';
55
import { MeteorObservable } from 'meteor-rxjs';
66
import * as _ from 'lodash';
77
import { Observable, Subscription, BehaviorSubject } from 'rxjs';
@@ -18,7 +18,8 @@ export class NewChatComponent implements OnInit {
1818

1919
constructor(
2020
private alertCtrl: AlertController,
21-
private viewCtrl: ViewController
21+
private viewCtrl: ViewController,
22+
private platform: Platform
2223
) {
2324
this.senderId = Meteor.userId();
2425
this.searchPattern = new BehaviorSubject(undefined);
@@ -107,4 +108,12 @@ export class NewChatComponent implements OnInit {
107108

108109
alert.present();
109110
}
111+
112+
getPic(pictureId): string {
113+
let platform = this.platform.is('android') ? "android" :
114+
this.platform.is('ios') ? "ios" : "";
115+
platform = this.platform.is('cordova') ? platform : "";
116+
117+
return Pictures.getPictureUrl(pictureId, platform);
118+
}
110119
}

0 commit comments

Comments
 (0)