Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions ios/App/App/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
<true/>
<key>NSCameraUsageDescription</key>
<string>Scanning Attendee badge QR codes</string>
<key>NSCalendarsWriteOnlyAccessUsageDescription</key>
<string>Add PyCon US sessions to your calendar</string>
<key>NSCalendarsUsageDescription</key>
<string>Add PyCon US sessions to your calendar</string>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
Expand Down
1 change: 1 addition & 0 deletions ios/App/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def capacitor_pods
pod 'CapacitorShare', :path => '../../node_modules/@capacitor/share'
pod 'CapacitorSplashScreen', :path => '../../node_modules/@capacitor/splash-screen'
pod 'CapacitorStatusBar', :path => '../../node_modules/@capacitor/status-bar'
pod 'EbarooniCapacitorCalendar', :path => '../../node_modules/@ebarooni/capacitor-calendar'
end

target 'PyCon US' do
Expand Down
13 changes: 13 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"@capacitor/splash-screen": "^7.0.0",
"@capacitor/status-bar": "^7.0.0",
"@ciag/ngx-pinch-zoom": "13.3.0",
"@ebarooni/capacitor-calendar": "^7.2.0",
"@ionic/angular": "^8.4.3",
"@ionic/storage-angular": "^4.0.0",
"@json-editor/json-editor": "2.14.1",
Expand Down
7 changes: 7 additions & 0 deletions src/app/pages/schedule-list/schedule-list.page.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@
<ion-searchbar [(ngModel)]="sessionQueryText" [debounce]="250" showCancelButton="focus" inputmode="search" (ionClear)="resetSessions()" (ionCancel)="resetSessions()" (ionChange)="searchSessions()" placeholder="Search"></ion-searchbar>
</ion-toolbar>

<div *ngIf="displaySessions?.length > 0 && !isOpenSpaceView" class="ion-padding-horizontal ion-padding-bottom">
<ion-button fill="outline" size="small" expand="block" (click)="favoriteAll()">
<ion-icon slot="start" name="star-outline"></ion-icon>
Favorite all {{trackName | trackName : 'plural'}}
</ion-button>
</div>

<!-- Regular sessions display -->
<ion-list *ngIf="!isOpenSpaceView">
<ion-item *ngFor="let session of displaySessions" [hidden]="session.hide" detail="true" routerLink="/app/tabs/schedule/session/{{session.id}}" [attr.track]="session.track | lowercase" class="session-list-item">
Expand Down
13 changes: 12 additions & 1 deletion src/app/pages/schedule-list/schedule-list.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ import { Component, ChangeDetectorRef, ViewChild, OnInit } from '@angular/core';
import { ConferenceData } from '../../providers/conference-data';
import { ActivatedRoute } from '@angular/router';
import { Config, InfiniteScrollCustomEvent, LoadingController } from '@ionic/angular';
import { InAppBrowser, DefaultWebViewOptions } from '@capacitor/inappbrowser';
import { LiveUpdateService } from '../../providers/live-update.service';
import { UserData } from '../../providers/user-data';
import { environment } from '../../../environments/environment';

const slugify = str =>
str
Expand Down Expand Up @@ -39,10 +42,11 @@ export class ScheduleListPage implements OnInit {
constructor(
public confData: ConferenceData,
public config: Config,
private changeDetection: ChangeDetectorRef,
private changeDetectorRef: ChangeDetectorRef,
private loadingCtrl: LoadingController,
private route: ActivatedRoute,
public liveUpdateService: LiveUpdateService,
private userData: UserData,
) { }


Expand Down Expand Up @@ -72,6 +76,13 @@ export class ScheduleListPage implements OnInit {
this.reloadSessions();
}

async favoriteAll() {
const sessions = this.displaySessions?.filter(s => !s.hide && s.id) || [];
const ids = sessions.map(s => String(s.id));
await this.userData.addFavorites(ids);
this.changeDetectorRef.detectChanges();
}

organizeSessionsByDay() {
if (!this.isOpenSpaceView) return;

Expand Down
3 changes: 3 additions & 0 deletions src/app/pages/session-detail/session-detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
<ion-back-button [defaultHref]="defaultHref"></ion-back-button>
</ion-buttons>
<ion-buttons slot="end">
<ion-button (click)="addToCalendar()">
<ion-icon slot="icon-only" name="calendar-outline"></ion-icon>
</ion-button>
<ion-button (click)="toggleFavorite()">
<ion-icon *ngIf="!isFavorite" slot="icon-only" name="star-outline"></ion-icon>
<ion-icon *ngIf="isFavorite" slot="icon-only" name="star" color="warning"></ion-icon>
Expand Down
21 changes: 20 additions & 1 deletion src/app/pages/session-detail/session-detail.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Component } from '@angular/core';
import { InAppBrowser, DefaultWebViewOptions } from '@capacitor/inappbrowser';

import { CapacitorCalendar } from '@ebarooni/capacitor-calendar';
import { ConferenceData } from '../../providers/conference-data';
import { ActivatedRoute } from '@angular/router';
import { UserData } from '../../providers/user-data';
Expand Down Expand Up @@ -60,6 +60,25 @@ export class SessionDetailPage {
}
}

async addToCalendar() {
if (!this.session) return;

await CapacitorCalendar.requestWriteOnlyCalendarAccess();

const speakers = this.session.speakers?.map((s: any) => s.name).join(', ') || '';
const description = speakers ? `Speakers: ${speakers}` : '';

await CapacitorCalendar.createEventWithPrompt({
title: this.session.name,
location: this.session.location || '',
description,
startDate: new Date(this.session.startUtc).getTime(),
endDate: new Date(this.session.endUtc).getTime(),
isAllDay: false,
url: environment.baseUrl + '/2026/schedule/presentation/' + this.session.id + '/',
});
}

onDescriptionClick(event: Event) {
const target = event.target as HTMLElement;
const anchor = target.closest('a') as HTMLAnchorElement;
Expand Down
8 changes: 8 additions & 0 deletions src/app/providers/conference-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ export class ConferenceData {
"speakerNames": [],
"timeStart": start.toLocaleTimeString([], {timeZone: environment.timezone, hour: 'numeric', minute:'2-digit'}).toLowerCase(),
"timeEnd": end.toLocaleString([], {timeZone: environment.timezone, hour: 'numeric', minute:'2-digit'}).toLowerCase(),
"startUtc": openSpace.start,
"endUtc": openSpace.end,
"track": "Open Space",
"tracks": ["open-space"],
"id": openSpace.conf_key + 9000,
Expand Down Expand Up @@ -241,6 +243,8 @@ export class ConferenceData {
"speakerNames": slot.authors,
"timeStart": start.toLocaleTimeString([], {timeZone: environment.timezone, hour: 'numeric', minute:'2-digit'}).toLowerCase(),
"timeEnd": end.toLocaleString([], {timeZone: environment.timezone, hour: 'numeric', minute:'2-digit'}).toLowerCase(),
"startUtc": slot.start,
"endUtc": slot.end,
"track": slot.kind.charAt(0).toUpperCase() + slot.kind.slice(1),
"tracks": [slot.kind.charAt(0).toUpperCase() + slot.kind.slice(1)],
"id": slot.conf_key,
Expand Down Expand Up @@ -304,6 +308,8 @@ export class ConferenceData {
"speakerNames": shared_session.authors,
"timeStart": start.toLocaleTimeString([], {timeZone: environment.timezone, hour: 'numeric', minute:'2-digit'}).toLowerCase(),
"timeEnd": end.toLocaleString([], {timeZone: environment.timezone, hour: 'numeric', minute:'2-digit'}).toLowerCase(),
"startUtc": slot.start,
"endUtc": slot.end,
"trackSlug": slot.kind + 's',
"track": slot.kind.charAt(0).toUpperCase() + slot.kind.slice(1),
"tracks": [slot.kind.charAt(0).toUpperCase() + slot.kind.slice(1)],
Expand Down Expand Up @@ -375,6 +381,8 @@ export class ConferenceData {
"speakerNames": [],
"timeStart": start.toLocaleTimeString([], {timeZone: environment.timezone, hour: 'numeric', minute:'2-digit'}).toLowerCase(),
"timeEnd": end.toLocaleString([], {timeZone: environment.timezone, hour: 'numeric', minute:'2-digit'}).toLowerCase(),
"startUtc": slot.start,
"endUtc": slot.end,
"track": trackName,
"tracks": [trackName],
"id": slot.kind + "-" + slot.room + "-" + slot.start,
Expand Down
18 changes: 18 additions & 0 deletions src/app/providers/user-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,24 @@ export class UserData {
});
}

async addFavorites(sessionIds: string[]): Promise<void> {
const data = await this.storage.get('favorite_sessions');
this.favorites = (data === null) ? [] : data;

const ids = sessionIds.map(String);
const newIds = ids.filter(id => this.favorites.indexOf(id) === -1);
if (newIds.length === 0) return;

this.favorites.push(...newIds);
await this.storage.set('favorite_sessions', this.favorites);
this.isLoggedIn().then((loggedIn) => {
if (loggedIn) {
this.pycon.patchUserData({ favorites: this.favorites });
}
});
this.favoritesSubject.next();
}

removeFavorite(sessionId: string): void {
this.storage.get('favorite_sessions').then((data) => {
this.favorites = (data === null)? [] : data;
Expand Down
Loading