src/pages/profile/profile.ts
Generated class for the ProfilePage page.
| selector | page-profile |
| templateUrl | profile.html |
Properties |
|
Methods |
constructor(navCtrl: NavController, navParams: NavParams, userService: UserService, upSvc: UploadService, popoverCtrl: PopoverController, zone: NgZone, chatManager: ChatManager, events: Events)
|
||||||||||||||||||||||||||||||||||||
|
Defined in src/pages/profile/profile.ts:26
|
||||||||||||||||||||||||||||||||||||
|
Parameters :
|
| displayImage | ||||||||
displayImage(uidContact: )
|
||||||||
|
Defined in src/pages/profile/profile.ts:90
|
||||||||
|
carico url immagine profilo passando id utente
Parameters :
Returns :
void
|
| goBack |
goBack()
|
|
Defined in src/pages/profile/profile.ts:109
|
|
chiudo il popup profilo utente
Returns :
void
|
| initialize |
initialize()
|
|
Defined in src/pages/profile/profile.ts:54
|
|
imposto subsribe dettaglio utente controllo se sono nel profilo currentuser oppure usercon cui converso carico dettaglio user
Returns :
void
|
| ngOnInit |
ngOnInit()
|
|
Defined in src/pages/profile/profile.ts:46
|
|
Returns :
void
|
| presentPopover | ||||||||
presentPopover(myEvent: )
|
||||||||
|
Defined in src/pages/profile/profile.ts:77
|
||||||||
|
metodo richiamato dalla pg html del current user alla pressione sul pulsante modifica della foto profillo apro PopoverProfilePage passando id current user
Parameters :
Returns :
void
|
| Public chatManager |
chatManager:
|
Type : ChatManager
|
|
Defined in src/pages/profile/profile.ts:38
|
| Public currentUserDetail |
currentUserDetail:
|
Type : UserModel
|
|
Defined in src/pages/profile/profile.ts:23
|
| Public events |
events:
|
Type : Events
|
|
Defined in src/pages/profile/profile.ts:39
|
| Public navCtrl |
navCtrl:
|
Type : NavController
|
|
Defined in src/pages/profile/profile.ts:31
|
| Public navParams |
navParams:
|
Type : NavParams
|
|
Defined in src/pages/profile/profile.ts:32
|
| Public popoverCtrl |
popoverCtrl:
|
Type : PopoverController
|
|
Defined in src/pages/profile/profile.ts:36
|
| Public profileYourself |
profileYourself:
|
Type : boolean
|
|
Defined in src/pages/profile/profile.ts:26
|
| Public uidUser |
uidUser:
|
Type : string
|
|
Defined in src/pages/profile/profile.ts:24
|
| Public upSvc |
upSvc:
|
Type : UploadService
|
|
Defined in src/pages/profile/profile.ts:35
|
| Public userDetail |
userDetail:
|
Type : UserModel
|
|
Defined in src/pages/profile/profile.ts:22
|
| Public userService |
userService:
|
Type : UserService
|
|
Defined in src/pages/profile/profile.ts:33
|
| Public zone |
zone:
|
Type : NgZone
|
|
Defined in src/pages/profile/profile.ts:37
|
import { Component, NgZone } from '@angular/core';
import { PopoverController, IonicPage, NavController, NavParams } from 'ionic-angular';
import { Events } from 'ionic-angular';
// models
import { UserModel } from '../../models/user';
// services
import { UploadService } from '../../providers/upload-service/upload-service';
import { UserService } from '../../providers/user/user';
import { ChatManager } from '../../providers/chat-manager/chat-manager';
// pages
import { PopoverProfilePage } from '../popover-profile/popover-profile';
/**
* Generated class for the ProfilePage page.
*/
@IonicPage()
@Component({
selector: 'page-profile',
templateUrl: 'profile.html',
})
export class ProfilePage {
public userDetail: UserModel;
public currentUserDetail: UserModel;
public uidUser: string;
public profileYourself: boolean;
//public selectedFiles: FileList;
//public currentUpload: UploadModel;
constructor(
public navCtrl: NavController,
public navParams: NavParams,
public userService: UserService,
//public navProxy: NavProxyService,
public upSvc: UploadService,
public popoverCtrl: PopoverController,
public zone: NgZone,
public chatManager: ChatManager,
public events: Events
) {
this.uidUser = navParams.get('uidUser');
}
/**
*
*/
ngOnInit() {
this.initialize();
}
/**
* imposto subsribe dettaglio utente
* controllo se sono nel profilo currentuser oppure usercon cui converso
* carico dettaglio user
*/
initialize(){
this.events.subscribe('loadUserDetail:complete', userDetail => {
this.userDetail = userDetail;
});
if (!this.uidUser){ // || this.userDetail.uid == this.uidUser
this.profileYourself = true;
this.currentUserDetail = this.chatManager.getLoggedUser();
this.displayImage(this.currentUserDetail.uid);
}
else {
this.profileYourself = false;
console.log('this.uidUser',this.uidUser);
this.userDetail = new UserModel(this.uidUser, '', '', this.uidUser, '', '');
this.userService.loadUserDetail(this.uidUser);
this.displayImage(this.uidUser);
}
}
/**
* metodo richiamato dalla pg html del current user
* alla pressione sul pulsante modifica della foto profillo
* apro PopoverProfilePage passando id current user
* @param myEvent
*/
presentPopover(myEvent) {
let popover = this.popoverCtrl.create(PopoverProfilePage,{uidContact:this.currentUserDetail.uid});
popover.present({
ev: myEvent
});
popover.onDidDismiss((data: string) => {
//alert("popover.onDidDismiss: "+data);
console.log(" ********* data::: ", data);
});
}
/**
* carico url immagine profilo passando id utente
*/
displayImage(uidContact){
const that = this;
this.upSvc.display(uidContact)
.then((url) => {
that.zone.run(() => {
if(that.profileYourself){
that.currentUserDetail.imageurl = url;
}else{
that.userDetail.imageurl = url;
}
});
})
.catch((error)=>{
console.log("error::: ",error);
});
}
/**
* chiudo il popup profilo utente
*/
goBack(){
this.navCtrl.pop();
}
}
<!--
Generated template for the ProfilePage page.
See http://ionicframework.com/docs/components/#navigation for more info on
Ionic pages and navigation.
-->
<ion-header>
<ion-navbar hideBackButton>
<ion-title>
<div *ngIf="profileYourself">{{currentUserDetail.fullname}}</div>
<div *ngIf="!profileYourself">{{userDetail.fullname}}</div>
</ion-title>
<ion-buttons left>
<button ion-button icon-only (click)="goBack()">
<ion-icon name="close"></ion-icon>
</button>
</ion-buttons>
</ion-navbar>
</ion-header>
<ion-content padding class="speaker-detail">
<div text-center>
<img class="clip-circle" *ngIf="profileYourself" src="{{this.currentUserDetail.imageurl}}" alt="user" onError="this.src='assets/img/no_image.png';">
<img class="clip-circle" *ngIf="!profileYourself" src="{{this.userDetail.imageurl}}" alt="user" onError="this.src='assets/img/no_image.png';">
<!-- <button ion-button icon-only clear small color="twitter">
<ion-icon name="logo-twitter"></ion-icon>
</button>
<button ion-button icon-only clear small color="github">
<ion-icon name="logo-github"></ion-icon>
</button>
<button ion-button icon-only clear small color="instagram">
<ion-icon name="logo-instagram"></ion-icon>
</button> -->
<button *ngIf="profileYourself" class="icon_modify" icon-only (click)="presentPopover($event)">
<ion-icon name="create"></ion-icon>
</button>
</div>
<div class="uid-contact">
<div *ngIf="profileYourself">{{currentUserDetail.uid}}</div>
<div *ngIf="!profileYourself">{{userDetail.uid}}</div>
</div>
<ion-item detail-push class="fullname">
<div *ngIf="profileYourself" >{{currentUserDetail.fullname}}</div>
<div *ngIf="!profileYourself">{{userDetail.fullname}}</div>
</ion-item>
<ion-item detail-push *ngIf="profileYourself">
<div class="email">email: {{currentUserDetail.email}}</div>
</ion-item>
<!-- <label>
<input type="file" (change)="detectFiles($event)" multiple>
</label>
<button
[disabled]="!selectedFiles"
(click)="uploadMulti()">
Upload Multiple
</button> -->
<!-- <p>{{speaker.about}}</p> -->
</ion-content>