From 4f4a0854889b7fc7b7964ca50cf76fad2899b941 Mon Sep 17 00:00:00 2001 From: dotansimha Date: Thu, 26 Jan 2017 17:45:02 +0200 Subject: [PATCH] Step 13.38: Implement getPic --- src/pages/chats/new-chat.ts | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/pages/chats/new-chat.ts b/src/pages/chats/new-chat.ts index df3f90019..7240a09c1 100644 --- a/src/pages/chats/new-chat.ts +++ b/src/pages/chats/new-chat.ts @@ -1,7 +1,7 @@ import { Component, OnInit } from '@angular/core'; -import { Chats, Users } from 'api/collections'; +import { Chats, Users, Pictures } from 'api/collections'; import { User } from 'api/models'; -import { AlertController, ViewController } from 'ionic-angular'; +import { AlertController, Platform, ViewController } from 'ionic-angular'; import { MeteorObservable } from 'meteor-rxjs'; import { _ } from 'meteor/underscore'; import { Observable, Subscription, BehaviorSubject } from 'rxjs'; @@ -18,7 +18,8 @@ export class NewChatComponent implements OnInit { constructor( private alertCtrl: AlertController, - private viewCtrl: ViewController + private viewCtrl: ViewController, + private platform: Platform ) { this.senderId = Meteor.userId(); this.searchPattern = new BehaviorSubject(undefined); @@ -107,4 +108,12 @@ export class NewChatComponent implements OnInit { alert.present(); } + + getPic(pictureId): string { + let platform = this.platform.is('android') ? "android" : + this.platform.is('ios') ? "ios" : ""; + platform = this.platform.is('cordova') ? platform : ""; + + return Pictures.getPictureUrl(pictureId, platform); + } }