Update transitions. Maybe add patch for clearing history on iOS.

This commit is contained in:
Georgi Prodanov 2017-03-09 17:14:18 +02:00
Родитель 699e9e9e76
Коммит abb3f7490d
4 изменённых файлов: 16 добавлений и 3 удалений

Просмотреть файл

@ -76,7 +76,8 @@ export class EditEventComponent implements OnInit {
return this._alertsService.showSuccess(`Event "${this.event.Name}" updated!`); return this._alertsService.showSuccess(`Event "${this.event.Name}" updated!`);
}) })
.then((res) => { .then((res) => {
this._routerExtensions.navigate([`/events/${this.event.Id}`]); let transition = utilities.getReversePageTransition();
this._routerExtensions.navigate([`/events/${this.event.Id}`], { clearHistory: true, transition });
}) })
.catch(err => { .catch(err => {
if (err) { if (err) {

Просмотреть файл

@ -96,6 +96,10 @@ export class EventDetailsComponent implements OnInit {
this._routerExtensions.navigate([`/events/${this.event.Id}/edit`]); this._routerExtensions.navigate([`/events/${this.event.Id}/edit`]);
} }
canGoBack() {
return this._routerExtensions.canGoBack();
}
canEdit() { canEdit() {
return this._currentUser && this.event && !this.isPastEvent && this.event.Owner === this._currentUser.Id; return this._currentUser && this.event && !this.isPastEvent && this.event.Owner === this._currentUser.Id;
} }
@ -158,8 +162,9 @@ export class EventDetailsComponent implements OnInit {
onBack() { onBack() {
if (this._routerExtensions.canGoBack()) { if (this._routerExtensions.canGoBack()) {
this._routerExtensions.back(); this._routerExtensions.back();
} else { } else { // simulate going back
this._routerExtensions.navigate(['/events'], { clearHistory: true }); let transition = utilities.getReversePageTransition();
this._routerExtensions.navigate(['/events'], { clearHistory: true, transition });
} }
} }

Просмотреть файл

@ -2,6 +2,9 @@
<ScrollView class="cntnr"> <ScrollView class="cntnr">
<ActionBarExtension> <ActionBarExtension>
<NavigationButton *ngIf="isAndroid" icon="res://icon_back" (tap)="onBack()"></NavigationButton> <NavigationButton *ngIf="isAndroid" icon="res://icon_back" (tap)="onBack()"></NavigationButton>
<ActionItem *ngIf="!isAndroid && !canGoBack()" ios.systemIcon="1" ios.position="left" (tap)="onBack()">
<label text="Back"></label>
</ActionItem>
<ActionItem *ngIf="canEdit()" (tap)="onEdit()" ios.position="right"> <ActionItem *ngIf="canEdit()" (tap)="onEdit()" ios.position="right">
<StackLayout> <StackLayout>
<Label class="button if" text="&#x65;"></Label> <Label class="button if" text="&#x65;"></Label>

Просмотреть файл

@ -119,3 +119,7 @@ export function getMenuTransition() {
export function getPageTransition() { export function getPageTransition() {
return getTransition(); return getTransition();
} }
export function getReversePageTransition() {
return getTransition('slideRight');
}