From eb1c27f2067db21cb7f37cff991cd7dd48b86e95 Mon Sep 17 00:00:00 2001 From: Amitosh Swain Mahapatra Date: Jun 03 2018 14:50:48 +0000 Subject: Offline caching for services --- diff --git a/package-lock.json b/package-lock.json index 90db4c2..ed38f11 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3673,38 +3673,6 @@ "requires": { "falafel": "1.2.0", "through2": "0.6.5" - }, - "dependencies": { - "isarray": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", - "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=" - }, - "readable-stream": { - "version": "1.0.34", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz", - "integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=", - "requires": { - "core-util-is": "1.0.2", - "inherits": "2.0.3", - "isarray": "0.0.1", - "string_decoder": "0.10.31" - } - }, - "string_decoder": { - "version": "0.10.31", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", - "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=" - }, - "through2": { - "version": "0.6.5", - "resolved": "https://registry.npmjs.org/through2/-/through2-0.6.5.tgz", - "integrity": "sha1-QaucZ7KdVyCQcUEOHXp6lozTrUg=", - "requires": { - "readable-stream": "1.0.34", - "xtend": "4.0.1" - } - } } }, "interpret": { @@ -5801,6 +5769,38 @@ "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=" }, + "through2": { + "version": "0.6.5", + "resolved": "https://registry.npmjs.org/through2/-/through2-0.6.5.tgz", + "integrity": "sha1-QaucZ7KdVyCQcUEOHXp6lozTrUg=", + "requires": { + "readable-stream": "1.0.34", + "xtend": "4.0.1" + }, + "dependencies": { + "isarray": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", + "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=" + }, + "readable-stream": { + "version": "1.0.34", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz", + "integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=", + "requires": { + "core-util-is": "1.0.2", + "inherits": "2.0.3", + "isarray": "0.0.1", + "string_decoder": "0.10.31" + } + }, + "string_decoder": { + "version": "0.10.31", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", + "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=" + } + } + }, "timers-browserify": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/timers-browserify/-/timers-browserify-2.0.6.tgz", @@ -6078,38 +6078,6 @@ "esmangle-evaluator": "1.0.1", "recast": "0.10.43", "through2": "0.6.5" - }, - "dependencies": { - "isarray": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", - "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=" - }, - "readable-stream": { - "version": "1.0.34", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz", - "integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=", - "requires": { - "core-util-is": "1.0.2", - "inherits": "2.0.3", - "isarray": "0.0.1", - "string_decoder": "0.10.31" - } - }, - "string_decoder": { - "version": "0.10.31", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", - "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=" - }, - "through2": { - "version": "0.6.5", - "resolved": "https://registry.npmjs.org/through2/-/through2-0.6.5.tgz", - "integrity": "sha1-QaucZ7KdVyCQcUEOHXp6lozTrUg=", - "requires": { - "readable-stream": "1.0.34", - "xtend": "4.0.1" - } - } } }, "url": { diff --git a/package.json b/package.json index eea4ccf..7c0f55b 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ "@ionic-native/splash-screen": "4.4.0", "@ionic-native/status-bar": "4.4.0", "@ionic-native/toast": "^4.5.3", - "@ionic/storage": "2.1.3", + "@ionic/storage": "^2.1.3", "cordova-android": "7.0.0", "cordova-browser": "5.0.3", "cordova-plugin-calendar": "^4.5.5", diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 84f0ade..7872c11 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -1,6 +1,7 @@ import { BrowserModule } from '@angular/platform-browser'; import { ErrorHandler, NgModule } from '@angular/core'; import { IonicApp, IonicErrorHandler, IonicModule } from 'ionic-angular'; +import { IonicStorageModule } from '@ionic/storage'; import { HttpClientModule } from '@angular/common/http'; import { InAppBrowser } from '@ionic-native/in-app-browser'; import { SplashScreen } from '@ionic-native/splash-screen'; @@ -32,7 +33,8 @@ import { Browser } from '../providers/browser/browser'; imports: [ BrowserModule, HttpClientModule, - IonicModule.forRoot(App) + IonicModule.forRoot(App), + IonicStorageModule.forRoot() ], bootstrap: [IonicApp], entryComponents: [ diff --git a/src/pages/ask/ask.ts b/src/pages/ask/ask.ts index ce42a88..f36a30e 100644 --- a/src/pages/ask/ask.ts +++ b/src/pages/ask/ask.ts @@ -36,7 +36,7 @@ export class AskPage { this.askFedora .getQuestions() .subscribe(questions => { - this.questions = questions; + this.questions = questions || []; }); } diff --git a/src/pages/calendar/calendar.html b/src/pages/calendar/calendar.html index b612521..90390a7 100644 --- a/src/pages/calendar/calendar.html +++ b/src/pages/calendar/calendar.html @@ -15,8 +15,8 @@ - - + + {{ calendar.displayName }} diff --git a/src/pages/calendar/calendar.ts b/src/pages/calendar/calendar.ts index 45f372e..ae22698 100644 --- a/src/pages/calendar/calendar.ts +++ b/src/pages/calendar/calendar.ts @@ -7,7 +7,7 @@ import { FedoCalService, Calendar as CalendarType, Meeting } from '../../provide /** * We default to the QA calendar */ -const DEFAULT_CALENDAR = 'QA'; +const DEFAULT_CALENDAR = { realName:'QA', displayName: 'QA' }; /** * The FedoCal interface @@ -34,13 +34,13 @@ export class CalendarPage { /** * ID of the selected calendar */ - private selectedCalendar: string; + private selectedCalendar: CalendarType; constructor(private fedoCal: FedoCalService, private calendar: Calendar) { this.calendars = []; this.meetings = []; - this.selectedCalendar = DEFAULT_CALENDAR; + this.selectedCalendar = DEFAULT_CALENDAR as CalendarType; } ngOnInit() { @@ -84,4 +84,15 @@ export class CalendarPage { meeting.timeEnd ); } + + /** + * Compares two calendars for similarity + * + * @param a Calendar + * @param b Calendar + * @returns boolean value indicating if both calendars are equal + */ + compareCalendar(a:CalendarType, b:CalendarType) { + return a.realName === b.realName; + } } diff --git a/src/pages/magazine/magazine.html b/src/pages/magazine/magazine.html index caa4791..eb09dac 100644 --- a/src/pages/magazine/magazine.html +++ b/src/pages/magazine/magazine.html @@ -35,7 +35,7 @@ ion-card - +