Skip to content

Commit

Permalink
Deep linking
Browse files Browse the repository at this point in the history
  • Loading branch information
paulnagle committed Jan 28, 2024
1 parent 204e1d9 commit 76ebd41
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 44 deletions.
22 changes: 20 additions & 2 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import { Component } from '@angular/core';
import { Component, NgZone } from '@angular/core';

import { Platform } from '@ionic/angular';
import { TranslateService } from '@ngx-translate/core';
import { StorageService } from './services/storage.service'
import { SplashScreen } from '@capacitor/splash-screen';
import { App, URLOpenListenerEvent } from '@capacitor/app';
import { Router } from '@angular/router';

@Component({
selector: 'app-root',
Expand Down Expand Up @@ -57,7 +59,9 @@ export class AppComponent {
constructor(
private platform: Platform,
private translate: TranslateService,
private storage: StorageService
private storage: StorageService,
private router: Router,
private zone: NgZone
) {
this.initializeApp();
}
Expand All @@ -74,5 +78,19 @@ export class AppComponent {
this.translate.use('en');
this.storage.set('language', 'en');
}

App.addListener('appUrlOpen', (event: URLOpenListenerEvent) => {
this.zone.run(() => {
// Example url: https://beerswift.app/tabs/tab2
// slug = /tabs/tab2
const slug = event.url.split(".app").pop();
if (slug) {
this.router.navigateByUrl(slug);
}
// If no match, do nothing - let regular routing
// logic take over
});
});
}

}
67 changes: 26 additions & 41 deletions src/app/components/meeting-list/meeting-list.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,48 +26,33 @@
</ion-list>
</div>




<ion-accordion-group #accordionGroup>
<!-- <ng-template #elseBlock><ion-accordion-group [multiple]="true" [value]="['all']" [disabled]="true"></ng-template> -->



<div *ngFor="let dailyList of meetingListGroupedByDay">

<ion-accordion value="{{ dailyList[0].weekday_tinyint }}">
<ion-item slot="header" [color]="isToday(dailyList[0].weekday_tinyint) ? 'secondary' : 'primary'">

<div ngSwitch="{{ dailyList[0].weekday_tinyint }}">
<div *ngSwitchCase="'1'">
<ion-label>{{'SUNDAY' | translate}} ({{dayCount[0]}})</ion-label></div>
<div *ngSwitchCase="'2'">
<ion-label>{{'MONDAY' | translate}} ({{dayCount[1]}})</ion-label></div>
<div *ngSwitchCase="'3'">
<ion-label>{{'TUESDAY' | translate}} ({{dayCount[2]}})</ion-label></div>
<div *ngSwitchCase="'4'">
<ion-label>{{'WEDNESDAY' | translate}} ({{dayCount[3]}})</ion-label></div>
<div *ngSwitchCase="'5'">
<ion-label>{{'THURSDAY' | translate}} ({{dayCount[4]}})</ion-label></div>
<div *ngSwitchCase="'6'">
<ion-label>{{'FRIDAY' | translate}} ({{dayCount[5]}})</ion-label></div>
<div *ngSwitchCase="'7'">
<ion-label>{{'SATURDAY' | translate}} ({{dayCount[6]}})</ion-label></div>
<div *ngSwitchDefault>Nothing Found.</div>
</div>

</ion-item>

<div slot="content">

<ion-list *ngFor="let meeting of dailyList; let j = index">
<app-meeting-card [data]="meeting" MeetingType="{{ localMeetingType }}"></app-meeting-card>
</ion-list>
<div *ngFor="let dailyList of meetingListGroupedByDay">
<ion-accordion value="{{ dailyList[0].weekday_tinyint }}">
<ion-item slot="header" [color]="isToday(dailyList[0].weekday_tinyint) ? 'secondary' : 'primary'">
<div ngSwitch="{{ dailyList[0].weekday_tinyint }}">
<div *ngSwitchCase="'1'">
<ion-label>{{'SUNDAY' | translate}} ({{dayCount[0]}})</ion-label></div>
<div *ngSwitchCase="'2'">
<ion-label>{{'MONDAY' | translate}} ({{dayCount[1]}})</ion-label></div>
<div *ngSwitchCase="'3'">
<ion-label>{{'TUESDAY' | translate}} ({{dayCount[2]}})</ion-label></div>
<div *ngSwitchCase="'4'">
<ion-label>{{'WEDNESDAY' | translate}} ({{dayCount[3]}})</ion-label></div>
<div *ngSwitchCase="'5'">
<ion-label>{{'THURSDAY' | translate}} ({{dayCount[4]}})</ion-label></div>
<div *ngSwitchCase="'6'">
<ion-label>{{'FRIDAY' | translate}} ({{dayCount[5]}})</ion-label></div>
<div *ngSwitchCase="'7'">
<ion-label>{{'SATURDAY' | translate}} ({{dayCount[6]}})</ion-label></div>
<div *ngSwitchDefault>Nothing Found.</div>
</div>

</ion-accordion>
</ion-item>
<div slot="content">
<ion-list *ngFor="let meeting of dailyList; let j = index">
<app-meeting-card [data]="meeting" MeetingType="{{ localMeetingType }}"></app-meeting-card>
</ion-list>
</div>


</ion-accordion>
</div>
</ion-accordion-group>
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ ion-icon {

ion-accordion.accordion-expanding,
ion-accordion.accordion-expanded {
// width: calc(100% - 8px);
padding-top: 4px;
padding-left: 4px;
padding-right: 4px;
Expand Down

0 comments on commit 76ebd41

Please sign in to comment.