├── .firebaserc ├── .gitignore ├── CHANGELOG.md ├── README.md ├── angular.json ├── config.xml ├── firebase.json ├── functions ├── lib │ ├── fcm.js │ ├── fcm.js.map │ ├── index.js │ └── index.js.map ├── package-lock.json ├── package.json ├── src │ ├── fcm.ts │ └── index.ts ├── tsconfig.json └── tslint.json ├── ionic.config.json ├── package-lock.json ├── package.json ├── resources ├── README.md ├── android │ ├── icon │ │ ├── drawable-hdpi-icon.png │ │ ├── drawable-ldpi-icon.png │ │ ├── drawable-mdpi-icon.png │ │ ├── drawable-xhdpi-icon.png │ │ ├── drawable-xxhdpi-icon.png │ │ └── drawable-xxxhdpi-icon.png │ └── splash │ │ ├── drawable-land-hdpi-screen.png │ │ ├── drawable-land-ldpi-screen.png │ │ ├── drawable-land-mdpi-screen.png │ │ ├── drawable-land-xhdpi-screen.png │ │ ├── drawable-land-xxhdpi-screen.png │ │ ├── drawable-land-xxxhdpi-screen.png │ │ ├── drawable-port-hdpi-screen.png │ │ ├── drawable-port-ldpi-screen.png │ │ ├── drawable-port-mdpi-screen.png │ │ ├── drawable-port-xhdpi-screen.png │ │ ├── drawable-port-xxhdpi-screen.png │ │ └── drawable-port-xxxhdpi-screen.png ├── icon.png ├── icon.png.md5 ├── ios │ ├── icon │ │ ├── icon-1024.png │ │ ├── icon-40.png │ │ ├── icon-40@2x.png │ │ ├── icon-40@3x.png │ │ ├── icon-50.png │ │ ├── icon-50@2x.png │ │ ├── icon-60.png │ │ ├── icon-60@2x.png │ │ ├── icon-60@3x.png │ │ ├── icon-72.png │ │ ├── icon-72@2x.png │ │ ├── icon-76.png │ │ ├── icon-76@2x.png │ │ ├── icon-83.5@2x.png │ │ ├── icon-small.png │ │ ├── icon-small@2x.png │ │ ├── icon-small@3x.png │ │ ├── icon.png │ │ └── icon@2x.png │ └── splash │ │ ├── Default-568h@2x~iphone.png │ │ ├── Default-667h.png │ │ ├── Default-736h.png │ │ ├── Default-Landscape-736h.png │ │ ├── Default-Landscape@2x~ipad.png │ │ ├── Default-Landscape@~ipadpro.png │ │ ├── Default-Landscape~ipad.png │ │ ├── Default-Portrait@2x~ipad.png │ │ ├── Default-Portrait@~ipadpro.png │ │ ├── Default-Portrait~ipad.png │ │ ├── Default@2x~iphone.png │ │ ├── Default@2x~universal~anyany.png │ │ └── Default~iphone.png ├── splash.png └── splash.png.md5 ├── src ├── app │ ├── app-routing.module.ts │ ├── app.component.html │ ├── app.component.spec.ts │ ├── app.component.ts │ ├── app.module.ts │ ├── fcm │ │ ├── fcm.module.ts │ │ ├── fcm.page.html │ │ ├── fcm.page.scss │ │ ├── fcm.page.spec.ts │ │ └── fcm.page.ts │ ├── guards │ │ ├── auth.guard.ts │ │ └── tutorial.guard.ts │ ├── home │ │ ├── home.module.ts │ │ ├── home.page.html │ │ ├── home.page.scss │ │ ├── home.page.spec.ts │ │ └── home.page.ts │ ├── services │ │ ├── auth.service.ts │ │ ├── db.service.ts │ │ └── fcm.service.ts │ ├── shared │ │ ├── device │ │ │ ├── device.component.html │ │ │ ├── device.component.scss │ │ │ ├── device.component.spec.ts │ │ │ └── device.component.ts │ │ ├── login │ │ │ ├── login.component.html │ │ │ ├── login.component.scss │ │ │ ├── login.component.spec.ts │ │ │ └── login.component.ts │ │ ├── profile │ │ │ ├── profile.component.html │ │ │ ├── profile.component.scss │ │ │ ├── profile.component.spec.ts │ │ │ └── profile.component.ts │ │ └── shared.module.ts │ ├── todo │ │ ├── todo-detail │ │ │ ├── todo-detail.component.html │ │ │ ├── todo-detail.component.scss │ │ │ ├── todo-detail.component.spec.ts │ │ │ └── todo-detail.component.ts │ │ ├── todo-form │ │ │ ├── todo-form.component.html │ │ │ ├── todo-form.component.scss │ │ │ ├── todo-form.component.spec.ts │ │ │ └── todo-form.component.ts │ │ ├── todo.module.ts │ │ ├── todo.page.html │ │ ├── todo.page.scss │ │ ├── todo.page.spec.ts │ │ └── todo.page.ts │ └── tutorial │ │ ├── tutorial.module.ts │ │ ├── tutorial.page.html │ │ ├── tutorial.page.scss │ │ ├── tutorial.page.spec.ts │ │ └── tutorial.page.ts ├── assets │ ├── fonts │ │ ├── Cairo │ │ │ ├── Cairo-Black.ttf │ │ │ ├── Cairo-Bold.ttf │ │ │ ├── Cairo-ExtraLight.ttf │ │ │ ├── Cairo-Light.ttf │ │ │ ├── Cairo-Regular.ttf │ │ │ ├── Cairo-SemiBold.ttf │ │ │ └── OFL.txt │ │ └── Rokkitt │ │ │ ├── OFL.txt │ │ │ ├── Rokkitt-Black.ttf │ │ │ ├── Rokkitt-Bold.ttf │ │ │ ├── Rokkitt-ExtraBold.ttf │ │ │ ├── Rokkitt-ExtraLight.ttf │ │ │ ├── Rokkitt-Light.ttf │ │ │ ├── Rokkitt-Medium.ttf │ │ │ ├── Rokkitt-Regular.ttf │ │ │ ├── Rokkitt-SemiBold.ttf │ │ │ └── Rokkitt-Thin.ttf │ ├── icon │ │ ├── anon.svg │ │ └── favicon.png │ └── slides │ │ ├── step1.svg │ │ ├── step2.svg │ │ └── step3.svg ├── environments │ ├── environment.prod.ts │ └── environment.ts ├── firebase-messaging-sw.js ├── global.scss ├── index.html ├── karma.conf.js ├── main.ts ├── polyfills.ts ├── test.ts ├── theme │ └── variables.scss ├── tsconfig.app.json └── tsconfig.spec.json ├── tsconfig.json └── tslint.json /.firebaserc: -------------------------------------------------------------------------------- 1 | { 2 | "projects": { 3 | "default": "ionic4-fire" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Specifies intentionally untracked files to ignore when using Git 2 | # http://git-scm.com/docs/gitignore 3 | .firebase 4 | google-services.json 5 | GoogleService-Info.plist 6 | 7 | functions/node_modules 8 | functions/lib 9 | IonFire-0-0-1.apk 10 | my-release-key.keystore 11 | NOTES.md 12 | 13 | *~ 14 | *.sw[mnpcod] 15 | *.log 16 | *.tmp 17 | *.tmp.* 18 | log.txt 19 | *.sublime-project 20 | *.sublime-workspace 21 | .vscode/ 22 | npm-debug.log* 23 | 24 | .idea/ 25 | .ionic/ 26 | .sourcemaps/ 27 | .sass-cache/ 28 | .tmp/ 29 | .versions/ 30 | coverage/ 31 | www/ 32 | node_modules/ 33 | tmp/ 34 | temp/ 35 | platforms/ 36 | plugins/ 37 | plugins/android.json 38 | plugins/ios.json 39 | $RECYCLE.BIN/ 40 | 41 | .DS_Store 42 | Thumbs.db 43 | UserInterfaceState.xcuserstate 44 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## Updates from 4.0-beta to 4.6 (July 10th, 2019) 2 | 3 | - Updated all dependencies 4 | - Changed all `href` links to `routerLink`. 5 | - Updated `angular.json` to properly reference Ionic Icons 6 | - Replaced `Menu` to `MenuController` (app.component.ts). 7 | - Removed `Slide` component in favor of vanilla `ion-slide` component. 8 | - Fixed `ion-item` click event bubbling that prevented clicks on children (todo.page.html) -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | # Ionic4 + Firebase Master Course 4 | 5 | - [Enroll in the Course](https://fireship.io/courses/ionic) 6 | - [Try the Live Demo](https://ionic4-fire.web.app/). 7 | 8 | 9 | Build a complete cross-platform app for the web, iOS, and Android using Ionic v4 (Angular) & Firebase. 10 | 11 | ## Features 12 | 13 | - Ionic v4 + Angular Fundamentals 14 | - App Intro Slider 15 | - Routing & Navigation 16 | - User Authentication 17 | - Firestore Realtime CRUD 18 | - Firebase Cloud Messaging (Push Notifications) 19 | - Cloud Functions with NodeJS 20 | - Native Packaging and Deployment 21 | 22 | ## Install 23 | 24 | ``` 25 | npm i ionic -g 26 | npm i firebase -g 27 | 28 | git clone my-project 29 | cd my-project 30 | 31 | npm install 32 | ionic s 33 | ``` -------------------------------------------------------------------------------- /angular.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "./node_modules/@angular-devkit/core/src/workspace/workspace-schema.json", 3 | "version": 1, 4 | "defaultProject": "app", 5 | "projects": { 6 | "app": { 7 | "root": "", 8 | "sourceRoot": "src", 9 | "projectType": "application", 10 | "prefix": "app", 11 | "schematics": {}, 12 | "architect": { 13 | "build": { 14 | "builder": "@angular-devkit/build-angular:browser", 15 | "options": { 16 | "progress": false, 17 | "outputPath": "www", 18 | "index": "src/index.html", 19 | "main": "src/main.ts", 20 | "polyfills": "src/polyfills.ts", 21 | "tsConfig": "src/tsconfig.app.json", 22 | "assets": [ 23 | "src/firebase-messaging-sw.js", 24 | { 25 | "glob": "**/*", 26 | "input": "src/assets", 27 | "output": "assets" 28 | }, 29 | { 30 | "glob": "**/*.svg", 31 | "input": "node_modules/ionicons/dist/ionicons/svg", 32 | "output": "./svg" 33 | } 34 | ], 35 | "styles": [{ 36 | "input": "src/theme/variables.scss" 37 | }, 38 | { 39 | "input": "src/global.scss" 40 | } 41 | ], 42 | "scripts": [] 43 | }, 44 | "configurations": { 45 | "production": { 46 | "fileReplacements": [{ 47 | "replace": "src/environments/environment.ts", 48 | "with": "src/environments/environment.prod.ts" 49 | }], 50 | "optimization": true, 51 | "outputHashing": "all", 52 | "sourceMap": false, 53 | "extractCss": true, 54 | "namedChunks": false, 55 | "aot": true, 56 | "extractLicenses": true, 57 | "vendorChunk": false, 58 | "buildOptimizer": true 59 | } 60 | } 61 | }, 62 | "serve": { 63 | "builder": "@angular-devkit/build-angular:dev-server", 64 | "options": { 65 | "browserTarget": "app:build" 66 | }, 67 | "configurations": { 68 | "production": { 69 | "browserTarget": "app:build:production" 70 | } 71 | } 72 | }, 73 | "extract-i18n": { 74 | "builder": "@angular-devkit/build-angular:extract-i18n", 75 | "options": { 76 | "browserTarget": "app:build" 77 | } 78 | }, 79 | "test": { 80 | "builder": "@angular-devkit/build-angular:karma", 81 | "options": { 82 | "main": "src/test.ts", 83 | "polyfills": "src/polyfills.ts", 84 | "tsConfig": "src/tsconfig.spec.json", 85 | "karmaConfig": "src/karma.conf.js", 86 | "styles": [ 87 | "styles.css" 88 | ], 89 | "scripts": [], 90 | "assets": [{ 91 | "glob": "favicon.ico", 92 | "input": "src/", 93 | "output": "/" 94 | }, 95 | { 96 | "glob": "**/*", 97 | "input": "src/assets", 98 | "output": "/assets" 99 | } 100 | ] 101 | } 102 | }, 103 | "lint": { 104 | "builder": "@angular-devkit/build-angular:tslint", 105 | "options": { 106 | "tsConfig": [ 107 | "src/tsconfig.app.json", 108 | "src/tsconfig.spec.json" 109 | ], 110 | "exclude": [ 111 | "**/node_modules/**" 112 | ] 113 | } 114 | }, 115 | "ionic-cordova-build": { 116 | "builder": "@ionic/ng-toolkit:cordova-build", 117 | "options": { 118 | "browserTarget": "app:build" 119 | }, 120 | "configurations": { 121 | "production": { 122 | "browserTarget": "app:build:production" 123 | } 124 | } 125 | }, 126 | "ionic-cordova-serve": { 127 | "builder": "@ionic/ng-toolkit:cordova-serve", 128 | "options": { 129 | "cordovaBuildTarget": "app:ionic-cordova-build", 130 | "devServerTarget": "app:serve" 131 | }, 132 | "configurations": { 133 | "production": { 134 | "cordovaBuildTarget": "app:ionic-cordova-build:production", 135 | "devServerTarget": "app:serve:production" 136 | } 137 | } 138 | } 139 | } 140 | }, 141 | "app-e2e": { 142 | "root": "e2e/", 143 | "projectType": "application", 144 | "architect": { 145 | "e2e": { 146 | "builder": "@angular-devkit/build-angular:protractor", 147 | "options": { 148 | "protractorConfig": "e2e/protractor.conf.js", 149 | "devServerTarget": "app:serve" 150 | } 151 | }, 152 | "lint": { 153 | "builder": "@angular-devkit/build-angular:tslint", 154 | "options": { 155 | "tsConfig": "e2e/tsconfig.e2e.json", 156 | "exclude": [ 157 | "**/node_modules/**" 158 | ] 159 | } 160 | } 161 | } 162 | } 163 | }, 164 | "cli": { 165 | "defaultCollection": "@ionic/schematics-angular" 166 | }, 167 | "schematics": { 168 | "@ionic/schematics-angular:component": { 169 | "styleext": "scss" 170 | }, 171 | "@ionic/schematics-angular:page": { 172 | "styleext": "scss" 173 | } 174 | } 175 | } -------------------------------------------------------------------------------- /config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | ionCourse 4 | An Awesome Ionic Firebase App 5 | Ionic Framework Team 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | -------------------------------------------------------------------------------- /firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "functions": { 3 | "predeploy": [ 4 | "npm --prefix \"$RESOURCE_DIR\" run lint", 5 | "npm --prefix \"$RESOURCE_DIR\" run build" 6 | ], 7 | "source": "functions" 8 | }, 9 | "hosting": { 10 | "public": "www", 11 | "ignore": [ 12 | "firebase.json", 13 | "**/.*", 14 | "**/node_modules/**" 15 | ], 16 | "rewrites": [ 17 | { 18 | "source": "**", 19 | "destination": "/index.html" 20 | } 21 | ] 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /functions/lib/fcm.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { 3 | return new (P || (P = Promise))(function (resolve, reject) { 4 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } 5 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } 6 | function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } 7 | step((generator = generator.apply(thisArg, _arguments || [])).next()); 8 | }); 9 | }; 10 | Object.defineProperty(exports, "__esModule", { value: true }); 11 | const functions = require("firebase-functions"); 12 | const admin = require("firebase-admin"); 13 | exports.subscribeToTopic = functions.https.onCall((data, context) => __awaiter(this, void 0, void 0, function* () { 14 | yield admin.messaging().subscribeToTopic(data.token, data.topic); 15 | return `subscribed to ${data.topic}`; 16 | })); 17 | exports.unsubscribeFromTopic = functions.https.onCall((data, context) => __awaiter(this, void 0, void 0, function* () { 18 | yield admin.messaging().unsubscribeFromTopic(data.token, data.topic); 19 | return `unsubscribed from ${data.topic}`; 20 | })); 21 | exports.sendOnFirestoreCreate = functions.firestore 22 | .document('discounts/{discountId}') 23 | .onCreate((snapshot) => __awaiter(this, void 0, void 0, function* () { 24 | const discount = snapshot.data(); 25 | const notification = { 26 | title: 'Hello from Ionic4 + Firebase', 27 | body: discount.headline 28 | }; 29 | const payload = { 30 | notification, 31 | webpush: { 32 | notification: { 33 | vibrate: [200, 100, 200], 34 | icon: 'https://angularfirebase.com/images/logo.png', 35 | actions: [ 36 | { 37 | action: 'like', 38 | title: '👍 Yaaay!' 39 | }, 40 | { 41 | action: 'dislike', 42 | title: '☹ Boooo!' 43 | } 44 | ] 45 | } 46 | }, 47 | topic: 'discounts' 48 | }; 49 | return admin.messaging().send(payload); 50 | })); 51 | //# sourceMappingURL=fcm.js.map -------------------------------------------------------------------------------- /functions/lib/fcm.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"fcm.js","sourceRoot":"","sources":["../src/fcm.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,gDAAgD;AAChD,wCAAwC;AAE3B,QAAA,gBAAgB,GAAG,SAAS,CAAC,KAAK,CAAC,MAAM,CACpD,CAAO,IAAI,EAAE,OAAO,EAAE,EAAE;IACtB,MAAM,KAAK,CAAC,SAAS,EAAE,CAAC,gBAAgB,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;IAEjE,OAAO,iBAAiB,IAAI,CAAC,KAAK,EAAE,CAAC;AACvC,CAAC,CAAA,CACF,CAAC;AAEW,QAAA,oBAAoB,GAAG,SAAS,CAAC,KAAK,CAAC,MAAM,CACxD,CAAO,IAAI,EAAE,OAAO,EAAE,EAAE;IACtB,MAAM,KAAK,CAAC,SAAS,EAAE,CAAC,oBAAoB,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;IAErE,OAAO,qBAAqB,IAAI,CAAC,KAAK,EAAE,CAAC;AAC3C,CAAC,CAAA,CACF,CAAC;AAEW,QAAA,qBAAqB,GAAG,SAAS,CAAC,SAAS;KACrD,QAAQ,CAAC,wBAAwB,CAAC;KAClC,QAAQ,CAAC,CAAM,QAAQ,EAAC,EAAE;IACzB,MAAM,QAAQ,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAC;IAEjC,MAAM,YAAY,GAAiC;QACjD,KAAK,EAAE,8BAA8B;QACrC,IAAI,EAAE,QAAQ,CAAC,QAAQ;KACxB,CAAC;IAEF,MAAM,OAAO,GAA4B;QACvC,YAAY;QACZ,OAAO,EAAE;YACP,YAAY,EAAE;gBACZ,OAAO,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC;gBACxB,IAAI,EAAE,6CAA6C;gBACnD,OAAO,EAAE;oBACP;wBACE,MAAM,EAAE,MAAM;wBACd,KAAK,EAAE,WAAW;qBACnB;oBACD;wBACE,MAAM,EAAE,SAAS;wBACjB,KAAK,EAAE,UAAU;qBAClB;iBACF;aACF;SACF;QACD,KAAK,EAAE,WAAW;KACnB,CAAC;IAEF,OAAO,KAAK,CAAC,SAAS,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AACzC,CAAC,CAAA,CAAC,CAAC"} -------------------------------------------------------------------------------- /functions/lib/index.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | const admin = require("firebase-admin"); 4 | admin.initializeApp(); 5 | var fcm_1 = require("./fcm"); 6 | exports.subscribeToTopic = fcm_1.subscribeToTopic; 7 | exports.unsubscribeFromTopic = fcm_1.unsubscribeFromTopic; 8 | exports.sendOnFirestoreCreate = fcm_1.sendOnFirestoreCreate; 9 | //# sourceMappingURL=index.js.map -------------------------------------------------------------------------------- /functions/lib/index.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AAAA,wCAAwC;AACxC,KAAK,CAAC,aAAa,EAAE,CAAC;AAEtB,6BAIe;AAHb,iCAAA,gBAAgB,CAAA;AAChB,qCAAA,oBAAoB,CAAA;AACpB,sCAAA,qBAAqB,CAAA"} -------------------------------------------------------------------------------- /functions/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "functions", 3 | "scripts": { 4 | "lint": "tslint --project tsconfig.json", 5 | "build": "tsc", 6 | "serve": "npm run build && firebase serve --only functions", 7 | "shell": "npm run build && firebase functions:shell", 8 | "start": "npm run shell", 9 | "deploy": "firebase deploy --only functions", 10 | "logs": "firebase functions:log" 11 | }, 12 | "main": "lib/index.js", 13 | "dependencies": { 14 | "firebase-admin": "~6.0.0", 15 | "firebase-functions": "^2.0.3" 16 | }, 17 | "devDependencies": { 18 | "tslint": "~5.8.0", 19 | "typescript": "~2.8.3" 20 | }, 21 | "private": true 22 | } -------------------------------------------------------------------------------- /functions/src/fcm.ts: -------------------------------------------------------------------------------- 1 | import * as functions from 'firebase-functions'; 2 | import * as admin from 'firebase-admin'; 3 | 4 | export const subscribeToTopic = functions.https.onCall( 5 | async (data, context) => { 6 | await admin.messaging().subscribeToTopic(data.token, data.topic); 7 | 8 | return `subscribed to ${data.topic}`; 9 | } 10 | ); 11 | 12 | export const unsubscribeFromTopic = functions.https.onCall( 13 | async (data, context) => { 14 | await admin.messaging().unsubscribeFromTopic(data.token, data.topic); 15 | 16 | return `unsubscribed from ${data.topic}`; 17 | } 18 | ); 19 | 20 | export const sendOnFirestoreCreate = functions.firestore 21 | .document('discounts/{discountId}') 22 | .onCreate(async snapshot => { 23 | const discount = snapshot.data(); 24 | 25 | const notification: admin.messaging.Notification = { 26 | title: 'Hello from Ionic4 + Firebase', 27 | body: discount.headline 28 | }; 29 | 30 | const payload: admin.messaging.Message = { 31 | notification, 32 | webpush: { 33 | notification: { 34 | vibrate: [200, 100, 200], 35 | icon: 'https://angularfirebase.com/images/logo.png', 36 | actions: [ 37 | { 38 | action: 'like', 39 | title: '👍 Yaaay!' 40 | }, 41 | { 42 | action: 'dislike', 43 | title: '☹ Boooo!' 44 | } 45 | ] 46 | } 47 | }, 48 | topic: 'discounts' 49 | }; 50 | 51 | return admin.messaging().send(payload); 52 | }); 53 | -------------------------------------------------------------------------------- /functions/src/index.ts: -------------------------------------------------------------------------------- 1 | import * as admin from 'firebase-admin'; 2 | admin.initializeApp(); 3 | 4 | export { 5 | subscribeToTopic, 6 | unsubscribeFromTopic, 7 | sendOnFirestoreCreate 8 | } from './fcm'; 9 | -------------------------------------------------------------------------------- /functions/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "lib": ["es6"], 4 | "module": "commonjs", 5 | "noImplicitReturns": true, 6 | "outDir": "lib", 7 | "sourceMap": true, 8 | "target": "es6", 9 | "skipLibCheck": true, 10 | "typeRoots": ["./functions/node_modules/@types"] 11 | }, 12 | "compileOnSave": true, 13 | "include": ["src"] 14 | } 15 | -------------------------------------------------------------------------------- /functions/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | // -- Strict errors -- 4 | // These lint rules are likely always a good idea. 5 | 6 | // Force function overloads to be declared together. This ensures readers understand APIs. 7 | "adjacent-overload-signatures": true, 8 | 9 | // Do not allow the subtle/obscure comma operator. 10 | "ban-comma-operator": true, 11 | 12 | // Do not allow internal modules or namespaces . These are deprecated in favor of ES6 modules. 13 | "no-namespace": true, 14 | 15 | // Do not allow parameters to be reassigned. To avoid bugs, developers should instead assign new values to new vars. 16 | "no-parameter-reassignment": true, 17 | 18 | // Force the use of ES6-style imports instead of /// imports. 19 | "no-reference": true, 20 | 21 | // Do not allow type assertions that do nothing. This is a big warning that the developer may not understand the 22 | // code currently being edited (they may be incorrectly handling a different type case that does not exist). 23 | "no-unnecessary-type-assertion": true, 24 | 25 | // Disallow nonsensical label usage. 26 | "label-position": true, 27 | 28 | // Disallows the (often typo) syntax if (var1 = var2). Replace with if (var2) { var1 = var2 }. 29 | "no-conditional-assignment": true, 30 | 31 | // Disallows constructors for primitive types (e.g. new Number('123'), though Number('123') is still allowed). 32 | "no-construct": true, 33 | 34 | // Do not allow super() to be called twice in a constructor. 35 | "no-duplicate-super": true, 36 | 37 | // Do not allow the same case to appear more than once in a switch block. 38 | "no-duplicate-switch-case": true, 39 | 40 | // Do not allow a variable to be declared more than once in the same block. Consider function parameters in this 41 | // rule. 42 | "no-duplicate-variable": [true, "check-parameters"], 43 | 44 | // Disallows a variable definition in an inner scope from shadowing a variable in an outer scope. Developers should 45 | // instead use a separate variable name. 46 | "no-shadowed-variable": true, 47 | 48 | // Empty blocks are almost never needed. Allow the one general exception: empty catch blocks. 49 | "no-empty": [true, "allow-empty-catch"], 50 | 51 | // Functions must either be handled directly (e.g. with a catch() handler) or returned to another function. 52 | // This is a major source of errors in Cloud Functions and the team strongly recommends leaving this rule on. 53 | "no-floating-promises": true, 54 | 55 | // Do not allow any imports for modules that are not in package.json. These will almost certainly fail when 56 | // deployed. 57 | "no-implicit-dependencies": true, 58 | 59 | // The 'this' keyword can only be used inside of classes. 60 | "no-invalid-this": true, 61 | 62 | // Do not allow strings to be thrown because they will not include stack traces. Throw Errors instead. 63 | "no-string-throw": true, 64 | 65 | // Disallow control flow statements, such as return, continue, break, and throw in finally blocks. 66 | "no-unsafe-finally": true, 67 | 68 | // Do not allow variables to be used before they are declared. 69 | "no-use-before-declare": true, 70 | 71 | // Expressions must always return a value. Avoids common errors like const myValue = functionReturningVoid(); 72 | "no-void-expression": [true, "ignore-arrow-function-shorthand"], 73 | 74 | // Disallow duplicate imports in the same file. 75 | "no-duplicate-imports": true, 76 | 77 | 78 | // -- Strong Warnings -- 79 | // These rules should almost never be needed, but may be included due to legacy code. 80 | // They are left as a warning to avoid frustration with blocked deploys when the developer 81 | // understand the warning and wants to deploy anyway. 82 | 83 | // Warn when an empty interface is defined. These are generally not useful. 84 | "no-empty-interface": {"severity": "warning"}, 85 | 86 | // Warn when an import will have side effects. 87 | "no-import-side-effect": {"severity": "warning"}, 88 | 89 | // Warn when variables are defined with var. Var has subtle meaning that can lead to bugs. Strongly prefer const for 90 | // most values and let for values that will change. 91 | "no-var-keyword": {"severity": "warning"}, 92 | 93 | // Prefer === and !== over == and !=. The latter operators support overloads that are often accidental. 94 | "triple-equals": {"severity": "warning"}, 95 | 96 | // Warn when using deprecated APIs. 97 | "deprecation": {"severity": "warning"}, 98 | 99 | // -- Light Warnigns -- 100 | // These rules are intended to help developers use better style. Simpler code has fewer bugs. These would be "info" 101 | // if TSLint supported such a level. 102 | 103 | // prefer for( ... of ... ) to an index loop when the index is only used to fetch an object from an array. 104 | // (Even better: check out utils like .map if transforming an array!) 105 | "prefer-for-of": {"severity": "warning"}, 106 | 107 | // Warns if function overloads could be unified into a single function with optional or rest parameters. 108 | "unified-signatures": {"severity": "warning"}, 109 | 110 | // Warns if code has an import or variable that is unused. 111 | "no-unused-variable": {"severity": "warning"}, 112 | 113 | // Prefer const for values that will not change. This better documents code. 114 | "prefer-const": {"severity": "warning"}, 115 | 116 | // Multi-line object liiterals and function calls should have a trailing comma. This helps avoid merge conflicts. 117 | "trailing-comma": {"severity": "warning"} 118 | }, 119 | 120 | "defaultSeverity": "error" 121 | } 122 | -------------------------------------------------------------------------------- /ionic.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ionCourse", 3 | "integrations": { 4 | "cordova": {} 5 | }, 6 | "type": "angular" 7 | } -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ion-course", 3 | "version": "0.0.1", 4 | "author": "Ionic Framework", 5 | "homepage": "http://ionicframework.com/", 6 | "scripts": { 7 | "ng": "ng", 8 | "start": "ng serve", 9 | "build": "ng build", 10 | "test": "ng test", 11 | "lint": "ng lint", 12 | "e2e": "ng e2e" 13 | }, 14 | "private": true, 15 | "dependencies": { 16 | "@angular/common": "~7.2.2", 17 | "@angular/core": "~7.2.2", 18 | "@angular/fire": "^5.2.1", 19 | "@angular/forms": "~7.2.2", 20 | "@angular/http": "~7.2.2", 21 | "@angular/platform-browser": "~7.2.2", 22 | "@angular/platform-browser-dynamic": "~7.2.2", 23 | "@angular/router": "~7.2.2", 24 | "@ionic-native/core": "5.1.0", 25 | "@ionic-native/firebase": "^5.1.0", 26 | "@ionic-native/google-plus": "^5.1.0", 27 | "@ionic-native/splash-screen": "5.1.0", 28 | "@ionic-native/status-bar": "5.0.0", 29 | "@ionic/angular": "^4.6.2", 30 | "@ionic/storage": "^2.2.0", 31 | "add": "2.0.6", 32 | "cordova-android": "7.0.0", 33 | "cordova-ios": "4.5.5", 34 | "cordova-plugin-compat": "^1.2.0", 35 | "cordova-plugin-device": "^2.0.2", 36 | "cordova-plugin-firebase": "^2.0.0", 37 | "cordova-plugin-googleplus": "^5.3.1", 38 | "cordova-plugin-ionic-keyboard": "^2.1.2", 39 | "cordova-plugin-ionic-webview": "^2.1.3", 40 | "cordova-plugin-splashscreen": "^5.0.2", 41 | "cordova-plugin-whitelist": "^1.3.3", 42 | "cordova-sqlite-storage": "^2.4.0", 43 | "cordova-support-google-services": "^1.2.1", 44 | "core-js": "^2.5.4", 45 | "firebase": "^6.3.0", 46 | "promise-polyfill": "^8.1.0", 47 | "rxjs": "6.5.1", 48 | "tslib": "^1.9.0", 49 | "zone.js": "^0.8.26" 50 | }, 51 | "devDependencies": { 52 | "@angular-devkit/architect": "~0.13.8", 53 | "@angular-devkit/build-angular": "~0.13.8", 54 | "@angular-devkit/core": "~7.3.8", 55 | "@angular-devkit/schematics": "~7.3.8", 56 | "@angular/cli": "~7.3.8", 57 | "@angular/compiler": "~7.2.2", 58 | "@angular/compiler-cli": "~7.2.2", 59 | "@angular/language-service": "~7.2.2", 60 | "@ionic/angular-toolkit": "~1.5.1", 61 | "@types/jasmine": "~2.8.8", 62 | "@types/jasminewd2": "~2.0.3", 63 | "@types/lodash": "^4.14.136", 64 | "@types/node": "~12.0.0", 65 | "codelyzer": "~4.5.0", 66 | "jasmine-core": "~2.99.1", 67 | "jasmine-spec-reporter": "~4.2.1", 68 | "karma": "~3.0.0", 69 | "karma-chrome-launcher": "~2.2.0", 70 | "karma-coverage-istanbul-reporter": "~2.0.0", 71 | "karma-jasmine": "~1.1.1", 72 | "karma-jasmine-html-reporter": "^0.2.2", 73 | "protractor": "~5.4.0", 74 | "ts-node": "~7.0.0", 75 | "tslint": "~5.11.0", 76 | "typescript": "~3.1.6" 77 | }, 78 | "description": "An Ionic project", 79 | "cordova": { 80 | "plugins": { 81 | "cordova-sqlite-storage": {}, 82 | "cordova-plugin-buildinfo": {}, 83 | "cordova-universal-links-plugin": {}, 84 | "cordova-plugin-browsertab": {}, 85 | "cordova-plugin-inappbrowser": {}, 86 | "cordova-plugin-customurlscheme": { 87 | "URL_SCHEME": "ionfire.page.link" 88 | }, 89 | "cordova-plugin-googleplus": { 90 | "REVERSED_CLIENT_ID": "com.googleusercontent.apps.1085404550227-0mrc1eels3bch1pvt2740nj7uqqakm10", 91 | "WEB_APPLICATION_CLIENT_ID": "1085404550227-h1iabv9megngs4eleo7kd5khoo4fkn98.apps.googleusercontent.com" 92 | }, 93 | "cordova-plugin-whitelist": {}, 94 | "cordova-plugin-device": {}, 95 | "cordova-plugin-splashscreen": {}, 96 | "cordova-plugin-ionic-webview": {}, 97 | "cordova-plugin-ionic-keyboard": {}, 98 | "cordova-plugin-firebase": {}, 99 | "cordova-support-google-services": {} 100 | }, 101 | "platforms": [ 102 | "ios", 103 | "android" 104 | ] 105 | } 106 | } 107 | -------------------------------------------------------------------------------- /resources/README.md: -------------------------------------------------------------------------------- 1 | These are Cordova resources. You can replace icon.png and splash.png and run 2 | `ionic cordova resources` to generate custom icons and splash screens for your 3 | app. See `ionic cordova resources --help` for details. 4 | 5 | Cordova reference documentation: 6 | 7 | - Icons: https://cordova.apache.org/docs/en/latest/config_ref/images.html 8 | - Splash Screens: https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-splashscreen/ 9 | -------------------------------------------------------------------------------- /resources/android/icon/drawable-hdpi-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codediodeio/ionic4-master-course/ece8a61fb84de08e9e52b93234ff5fd349c16195/resources/android/icon/drawable-hdpi-icon.png -------------------------------------------------------------------------------- /resources/android/icon/drawable-ldpi-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codediodeio/ionic4-master-course/ece8a61fb84de08e9e52b93234ff5fd349c16195/resources/android/icon/drawable-ldpi-icon.png -------------------------------------------------------------------------------- /resources/android/icon/drawable-mdpi-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codediodeio/ionic4-master-course/ece8a61fb84de08e9e52b93234ff5fd349c16195/resources/android/icon/drawable-mdpi-icon.png -------------------------------------------------------------------------------- /resources/android/icon/drawable-xhdpi-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codediodeio/ionic4-master-course/ece8a61fb84de08e9e52b93234ff5fd349c16195/resources/android/icon/drawable-xhdpi-icon.png -------------------------------------------------------------------------------- /resources/android/icon/drawable-xxhdpi-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codediodeio/ionic4-master-course/ece8a61fb84de08e9e52b93234ff5fd349c16195/resources/android/icon/drawable-xxhdpi-icon.png -------------------------------------------------------------------------------- /resources/android/icon/drawable-xxxhdpi-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codediodeio/ionic4-master-course/ece8a61fb84de08e9e52b93234ff5fd349c16195/resources/android/icon/drawable-xxxhdpi-icon.png -------------------------------------------------------------------------------- /resources/android/splash/drawable-land-hdpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codediodeio/ionic4-master-course/ece8a61fb84de08e9e52b93234ff5fd349c16195/resources/android/splash/drawable-land-hdpi-screen.png -------------------------------------------------------------------------------- /resources/android/splash/drawable-land-ldpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codediodeio/ionic4-master-course/ece8a61fb84de08e9e52b93234ff5fd349c16195/resources/android/splash/drawable-land-ldpi-screen.png -------------------------------------------------------------------------------- /resources/android/splash/drawable-land-mdpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codediodeio/ionic4-master-course/ece8a61fb84de08e9e52b93234ff5fd349c16195/resources/android/splash/drawable-land-mdpi-screen.png -------------------------------------------------------------------------------- /resources/android/splash/drawable-land-xhdpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codediodeio/ionic4-master-course/ece8a61fb84de08e9e52b93234ff5fd349c16195/resources/android/splash/drawable-land-xhdpi-screen.png -------------------------------------------------------------------------------- /resources/android/splash/drawable-land-xxhdpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codediodeio/ionic4-master-course/ece8a61fb84de08e9e52b93234ff5fd349c16195/resources/android/splash/drawable-land-xxhdpi-screen.png -------------------------------------------------------------------------------- /resources/android/splash/drawable-land-xxxhdpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codediodeio/ionic4-master-course/ece8a61fb84de08e9e52b93234ff5fd349c16195/resources/android/splash/drawable-land-xxxhdpi-screen.png -------------------------------------------------------------------------------- /resources/android/splash/drawable-port-hdpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codediodeio/ionic4-master-course/ece8a61fb84de08e9e52b93234ff5fd349c16195/resources/android/splash/drawable-port-hdpi-screen.png -------------------------------------------------------------------------------- /resources/android/splash/drawable-port-ldpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codediodeio/ionic4-master-course/ece8a61fb84de08e9e52b93234ff5fd349c16195/resources/android/splash/drawable-port-ldpi-screen.png -------------------------------------------------------------------------------- /resources/android/splash/drawable-port-mdpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codediodeio/ionic4-master-course/ece8a61fb84de08e9e52b93234ff5fd349c16195/resources/android/splash/drawable-port-mdpi-screen.png -------------------------------------------------------------------------------- /resources/android/splash/drawable-port-xhdpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codediodeio/ionic4-master-course/ece8a61fb84de08e9e52b93234ff5fd349c16195/resources/android/splash/drawable-port-xhdpi-screen.png -------------------------------------------------------------------------------- /resources/android/splash/drawable-port-xxhdpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codediodeio/ionic4-master-course/ece8a61fb84de08e9e52b93234ff5fd349c16195/resources/android/splash/drawable-port-xxhdpi-screen.png -------------------------------------------------------------------------------- /resources/android/splash/drawable-port-xxxhdpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codediodeio/ionic4-master-course/ece8a61fb84de08e9e52b93234ff5fd349c16195/resources/android/splash/drawable-port-xxxhdpi-screen.png -------------------------------------------------------------------------------- /resources/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codediodeio/ionic4-master-course/ece8a61fb84de08e9e52b93234ff5fd349c16195/resources/icon.png -------------------------------------------------------------------------------- /resources/icon.png.md5: -------------------------------------------------------------------------------- 1 | 204d2f754edfb554ceba627bbb51b3c5 -------------------------------------------------------------------------------- /resources/ios/icon/icon-1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codediodeio/ionic4-master-course/ece8a61fb84de08e9e52b93234ff5fd349c16195/resources/ios/icon/icon-1024.png -------------------------------------------------------------------------------- /resources/ios/icon/icon-40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codediodeio/ionic4-master-course/ece8a61fb84de08e9e52b93234ff5fd349c16195/resources/ios/icon/icon-40.png -------------------------------------------------------------------------------- /resources/ios/icon/icon-40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codediodeio/ionic4-master-course/ece8a61fb84de08e9e52b93234ff5fd349c16195/resources/ios/icon/icon-40@2x.png -------------------------------------------------------------------------------- /resources/ios/icon/icon-40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codediodeio/ionic4-master-course/ece8a61fb84de08e9e52b93234ff5fd349c16195/resources/ios/icon/icon-40@3x.png -------------------------------------------------------------------------------- /resources/ios/icon/icon-50.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codediodeio/ionic4-master-course/ece8a61fb84de08e9e52b93234ff5fd349c16195/resources/ios/icon/icon-50.png -------------------------------------------------------------------------------- /resources/ios/icon/icon-50@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codediodeio/ionic4-master-course/ece8a61fb84de08e9e52b93234ff5fd349c16195/resources/ios/icon/icon-50@2x.png -------------------------------------------------------------------------------- /resources/ios/icon/icon-60.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codediodeio/ionic4-master-course/ece8a61fb84de08e9e52b93234ff5fd349c16195/resources/ios/icon/icon-60.png -------------------------------------------------------------------------------- /resources/ios/icon/icon-60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codediodeio/ionic4-master-course/ece8a61fb84de08e9e52b93234ff5fd349c16195/resources/ios/icon/icon-60@2x.png -------------------------------------------------------------------------------- /resources/ios/icon/icon-60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codediodeio/ionic4-master-course/ece8a61fb84de08e9e52b93234ff5fd349c16195/resources/ios/icon/icon-60@3x.png -------------------------------------------------------------------------------- /resources/ios/icon/icon-72.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codediodeio/ionic4-master-course/ece8a61fb84de08e9e52b93234ff5fd349c16195/resources/ios/icon/icon-72.png -------------------------------------------------------------------------------- /resources/ios/icon/icon-72@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codediodeio/ionic4-master-course/ece8a61fb84de08e9e52b93234ff5fd349c16195/resources/ios/icon/icon-72@2x.png -------------------------------------------------------------------------------- /resources/ios/icon/icon-76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codediodeio/ionic4-master-course/ece8a61fb84de08e9e52b93234ff5fd349c16195/resources/ios/icon/icon-76.png -------------------------------------------------------------------------------- /resources/ios/icon/icon-76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codediodeio/ionic4-master-course/ece8a61fb84de08e9e52b93234ff5fd349c16195/resources/ios/icon/icon-76@2x.png -------------------------------------------------------------------------------- /resources/ios/icon/icon-83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codediodeio/ionic4-master-course/ece8a61fb84de08e9e52b93234ff5fd349c16195/resources/ios/icon/icon-83.5@2x.png -------------------------------------------------------------------------------- /resources/ios/icon/icon-small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codediodeio/ionic4-master-course/ece8a61fb84de08e9e52b93234ff5fd349c16195/resources/ios/icon/icon-small.png -------------------------------------------------------------------------------- /resources/ios/icon/icon-small@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codediodeio/ionic4-master-course/ece8a61fb84de08e9e52b93234ff5fd349c16195/resources/ios/icon/icon-small@2x.png -------------------------------------------------------------------------------- /resources/ios/icon/icon-small@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codediodeio/ionic4-master-course/ece8a61fb84de08e9e52b93234ff5fd349c16195/resources/ios/icon/icon-small@3x.png -------------------------------------------------------------------------------- /resources/ios/icon/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codediodeio/ionic4-master-course/ece8a61fb84de08e9e52b93234ff5fd349c16195/resources/ios/icon/icon.png -------------------------------------------------------------------------------- /resources/ios/icon/icon@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codediodeio/ionic4-master-course/ece8a61fb84de08e9e52b93234ff5fd349c16195/resources/ios/icon/icon@2x.png -------------------------------------------------------------------------------- /resources/ios/splash/Default-568h@2x~iphone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codediodeio/ionic4-master-course/ece8a61fb84de08e9e52b93234ff5fd349c16195/resources/ios/splash/Default-568h@2x~iphone.png -------------------------------------------------------------------------------- /resources/ios/splash/Default-667h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codediodeio/ionic4-master-course/ece8a61fb84de08e9e52b93234ff5fd349c16195/resources/ios/splash/Default-667h.png -------------------------------------------------------------------------------- /resources/ios/splash/Default-736h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codediodeio/ionic4-master-course/ece8a61fb84de08e9e52b93234ff5fd349c16195/resources/ios/splash/Default-736h.png -------------------------------------------------------------------------------- /resources/ios/splash/Default-Landscape-736h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codediodeio/ionic4-master-course/ece8a61fb84de08e9e52b93234ff5fd349c16195/resources/ios/splash/Default-Landscape-736h.png -------------------------------------------------------------------------------- /resources/ios/splash/Default-Landscape@2x~ipad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codediodeio/ionic4-master-course/ece8a61fb84de08e9e52b93234ff5fd349c16195/resources/ios/splash/Default-Landscape@2x~ipad.png -------------------------------------------------------------------------------- /resources/ios/splash/Default-Landscape@~ipadpro.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codediodeio/ionic4-master-course/ece8a61fb84de08e9e52b93234ff5fd349c16195/resources/ios/splash/Default-Landscape@~ipadpro.png -------------------------------------------------------------------------------- /resources/ios/splash/Default-Landscape~ipad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codediodeio/ionic4-master-course/ece8a61fb84de08e9e52b93234ff5fd349c16195/resources/ios/splash/Default-Landscape~ipad.png -------------------------------------------------------------------------------- /resources/ios/splash/Default-Portrait@2x~ipad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codediodeio/ionic4-master-course/ece8a61fb84de08e9e52b93234ff5fd349c16195/resources/ios/splash/Default-Portrait@2x~ipad.png -------------------------------------------------------------------------------- /resources/ios/splash/Default-Portrait@~ipadpro.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codediodeio/ionic4-master-course/ece8a61fb84de08e9e52b93234ff5fd349c16195/resources/ios/splash/Default-Portrait@~ipadpro.png -------------------------------------------------------------------------------- /resources/ios/splash/Default-Portrait~ipad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codediodeio/ionic4-master-course/ece8a61fb84de08e9e52b93234ff5fd349c16195/resources/ios/splash/Default-Portrait~ipad.png -------------------------------------------------------------------------------- /resources/ios/splash/Default@2x~iphone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codediodeio/ionic4-master-course/ece8a61fb84de08e9e52b93234ff5fd349c16195/resources/ios/splash/Default@2x~iphone.png -------------------------------------------------------------------------------- /resources/ios/splash/Default@2x~universal~anyany.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codediodeio/ionic4-master-course/ece8a61fb84de08e9e52b93234ff5fd349c16195/resources/ios/splash/Default@2x~universal~anyany.png -------------------------------------------------------------------------------- /resources/ios/splash/Default~iphone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codediodeio/ionic4-master-course/ece8a61fb84de08e9e52b93234ff5fd349c16195/resources/ios/splash/Default~iphone.png -------------------------------------------------------------------------------- /resources/splash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codediodeio/ionic4-master-course/ece8a61fb84de08e9e52b93234ff5fd349c16195/resources/splash.png -------------------------------------------------------------------------------- /resources/splash.png.md5: -------------------------------------------------------------------------------- 1 | abcef3c44b3de85c85835f4ff27dd72e -------------------------------------------------------------------------------- /src/app/app-routing.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { Routes, RouterModule } from '@angular/router'; 3 | import { TutorialGuard } from './guards/tutorial.guard'; 4 | import { AuthGuard } from './guards/auth.guard'; 5 | 6 | const routes: Routes = [ 7 | { 8 | path: '', 9 | loadChildren: './home/home.module#HomePageModule', 10 | canActivate: [TutorialGuard] 11 | }, 12 | { 13 | path: 'todo', 14 | loadChildren: './todo/todo.module#TodoPageModule', 15 | canActivate: [AuthGuard] 16 | }, 17 | { 18 | path: 'tutorial', 19 | loadChildren: './tutorial/tutorial.module#TutorialPageModule' 20 | }, 21 | { path: 'fcm', loadChildren: './fcm/fcm.module#FcmPageModule' } 22 | ]; 23 | @NgModule({ 24 | imports: [RouterModule.forRoot(routes)], 25 | exports: [RouterModule] 26 | }) 27 | export class AppRoutingModule {} 28 | -------------------------------------------------------------------------------- /src/app/app.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Menu 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | Home 15 | 16 | 17 | Intro Tutorial 18 | 19 | 20 | Todo List 21 | 22 | 23 | 24 | Push Notifications FCM 25 | 26 | 27 | Camera 28 | 29 | Soon 30 | 31 | 32 | 33 | Maps 34 | 35 | Soon 36 | 37 | 38 | 39 | In-app Payments 40 | 41 | Soon 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /src/app/app.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; 2 | import { TestBed, async } from '@angular/core/testing'; 3 | 4 | import { Platform } from '@ionic/angular'; 5 | import { SplashScreen } from '@ionic-native/splash-screen/ngx'; 6 | import { StatusBar } from '@ionic-native/status-bar/ngx'; 7 | 8 | import { AppComponent } from './app.component'; 9 | 10 | describe('AppComponent', () => { 11 | 12 | let statusBarSpy, splashScreenSpy, platformReadySpy, platformSpy; 13 | 14 | beforeEach(async(() => { 15 | statusBarSpy = jasmine.createSpyObj('StatusBar', ['styleDefault']); 16 | splashScreenSpy = jasmine.createSpyObj('SplashScreen', ['hide']); 17 | platformReadySpy = Promise.resolve(); 18 | platformSpy = jasmine.createSpyObj('Platform', { ready: platformReadySpy }); 19 | 20 | TestBed.configureTestingModule({ 21 | declarations: [AppComponent], 22 | schemas: [CUSTOM_ELEMENTS_SCHEMA], 23 | providers: [ 24 | { provide: StatusBar, useValue: statusBarSpy }, 25 | { provide: SplashScreen, useValue: splashScreenSpy }, 26 | { provide: Platform, useValue: platformSpy }, 27 | ], 28 | }).compileComponents(); 29 | })); 30 | 31 | it('should create the app', () => { 32 | const fixture = TestBed.createComponent(AppComponent); 33 | const app = fixture.debugElement.componentInstance; 34 | expect(app).toBeTruthy(); 35 | }); 36 | 37 | it('should initialize the app', async () => { 38 | TestBed.createComponent(AppComponent); 39 | expect(platformSpy.ready).toHaveBeenCalled(); 40 | await platformReadySpy; 41 | expect(statusBarSpy.styleDefault).toHaveBeenCalled(); 42 | expect(splashScreenSpy.hide).toHaveBeenCalled(); 43 | }); 44 | 45 | // TODO: add more tests! 46 | 47 | }); 48 | -------------------------------------------------------------------------------- /src/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | import { Platform, MenuController } from '@ionic/angular'; 4 | import { SplashScreen } from '@ionic-native/splash-screen/ngx'; 5 | import { StatusBar } from '@ionic-native/status-bar/ngx'; 6 | 7 | import { AuthService } from './services/auth.service'; 8 | import { Storage } from '@ionic/storage'; 9 | import { Router } from '@angular/router'; 10 | import { FcmService } from './services/fcm.service'; 11 | 12 | @Component({ 13 | selector: 'app-root', 14 | templateUrl: 'app.component.html' 15 | }) 16 | export class AppComponent { 17 | 18 | constructor( 19 | private platform: Platform, 20 | private splashScreen: SplashScreen, 21 | private statusBar: StatusBar, 22 | private auth: AuthService, 23 | private storage: Storage, 24 | private router: Router, 25 | private fcm: FcmService, 26 | private menu: MenuController 27 | ) { 28 | this.initializeApp(); 29 | } 30 | 31 | initializeApp() { 32 | this.platform.ready().then(() => { 33 | this.statusBar.styleDefault(); 34 | this.splashScreen.hide(); 35 | this.fcm.getPermission().subscribe(); 36 | this.fcm.listenToMessages().subscribe(); 37 | }); 38 | } 39 | 40 | async resetTutorial() { 41 | await this.storage.set('tutorialComplete', false); 42 | await this.router.navigateByUrl('/tutorial'); 43 | this.menu.close(); 44 | } 45 | 46 | closeMenu() { 47 | this.menu.close(); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/app/app.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { BrowserModule } from '@angular/platform-browser'; 3 | import { RouteReuseStrategy } from '@angular/router'; 4 | 5 | import { IonicModule, IonicRouteStrategy } from '@ionic/angular'; 6 | import { SplashScreen } from '@ionic-native/splash-screen/ngx'; 7 | import { StatusBar } from '@ionic-native/status-bar/ngx'; 8 | 9 | import { AppRoutingModule } from './app-routing.module'; 10 | import { AppComponent } from './app.component'; 11 | import { IonicStorageModule } from '@ionic/storage'; 12 | 13 | import { environment } from '../environments/environment'; 14 | import { AngularFireModule } from '@angular/fire'; 15 | import { AngularFirestoreModule } from '@angular/fire/firestore'; 16 | import { AngularFireAuthModule } from '@angular/fire/auth'; 17 | import { AngularFireFunctionsModule } from '@angular/fire/functions'; 18 | import { AngularFireMessagingModule } from '@angular/fire/messaging'; 19 | 20 | import { GooglePlus } from '@ionic-native/google-plus/ngx'; 21 | import { Firebase } from '@ionic-native/firebase/ngx'; 22 | 23 | @NgModule({ 24 | declarations: [AppComponent], 25 | entryComponents: [], 26 | imports: [ 27 | BrowserModule, 28 | IonicModule.forRoot(), 29 | IonicStorageModule.forRoot(), 30 | AppRoutingModule, 31 | AngularFireModule.initializeApp(environment.firebase), 32 | AngularFirestoreModule, 33 | AngularFireAuthModule, 34 | AngularFireFunctionsModule, 35 | AngularFireMessagingModule 36 | ], 37 | providers: [ 38 | Firebase, 39 | GooglePlus, 40 | StatusBar, 41 | SplashScreen, 42 | { provide: RouteReuseStrategy, useClass: IonicRouteStrategy } 43 | ], 44 | bootstrap: [AppComponent] 45 | }) 46 | export class AppModule {} 47 | -------------------------------------------------------------------------------- /src/app/fcm/fcm.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { CommonModule } from '@angular/common'; 3 | import { FormsModule } from '@angular/forms'; 4 | import { Routes, RouterModule } from '@angular/router'; 5 | 6 | import { IonicModule } from '@ionic/angular'; 7 | 8 | import { FcmPage } from './fcm.page'; 9 | 10 | const routes: Routes = [ 11 | { 12 | path: '', 13 | component: FcmPage 14 | } 15 | ]; 16 | 17 | @NgModule({ 18 | imports: [ 19 | CommonModule, 20 | FormsModule, 21 | IonicModule, 22 | RouterModule.forChild(routes) 23 | ], 24 | declarations: [FcmPage] 25 | }) 26 | export class FcmPageModule {} 27 | -------------------------------------------------------------------------------- /src/app/fcm/fcm.page.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Firebase Cloud Messaging 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | Step 1: Topic-based Push Notifications 16 | 17 | 18 |

When the app is opened, 19 | FCM will display a push notification in the foreground. When closed, it will send the notification to the native 20 | device (or browser via the service worker). First, you must get permission from the device. 21 |

22 | 23 |

24 | Token: 25 | {{ fcm.token }} 26 |

27 | 28 | Grant Permission 29 |
30 |
31 | 32 | 33 | 34 | Step 2: Subscribe to a Topic 35 | 36 | 37 |

Second, subscribe the user to 38 | discount notifications using Callable Firebase Cloud Functions

39 | 40 | Subscribe to Topic 41 |
42 | 43 | 44 |
45 | 46 | 47 | 48 | Step 3: Broadcast a Notification 49 | 50 | 51 |

Third, we create a new random discount document in Firestore, triggering the notifcation to be broadcast to all 52 | subscribers to this topic. Give it up to 10 seconds to broadcast. Close the app to see it in the background.

53 | Trigger Message 54 |
55 |
56 | 57 | 58 | 59 | 60 | Unsubscribe from a topic 61 | 62 | 63 |

Lastly, give your user a way to unsubscribe from this topic.

64 | Unsubscribe from Topic 65 |
66 |
67 | 68 |
-------------------------------------------------------------------------------- /src/app/fcm/fcm.page.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codediodeio/ionic4-master-course/ece8a61fb84de08e9e52b93234ff5fd349c16195/src/app/fcm/fcm.page.scss -------------------------------------------------------------------------------- /src/app/fcm/fcm.page.spec.ts: -------------------------------------------------------------------------------- 1 | import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; 2 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 3 | 4 | import { FcmPage } from './fcm.page'; 5 | 6 | describe('FcmPage', () => { 7 | let component: FcmPage; 8 | let fixture: ComponentFixture; 9 | 10 | beforeEach(async(() => { 11 | TestBed.configureTestingModule({ 12 | declarations: [ FcmPage ], 13 | schemas: [CUSTOM_ELEMENTS_SCHEMA], 14 | }) 15 | .compileComponents(); 16 | })); 17 | 18 | beforeEach(() => { 19 | fixture = TestBed.createComponent(FcmPage); 20 | component = fixture.componentInstance; 21 | fixture.detectChanges(); 22 | }); 23 | 24 | it('should create', () => { 25 | expect(component).toBeTruthy(); 26 | }); 27 | }); 28 | -------------------------------------------------------------------------------- /src/app/fcm/fcm.page.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { FcmService } from '../services/fcm.service'; 3 | import { DbService } from '../services/db.service'; 4 | 5 | @Component({ 6 | selector: 'app-fcm', 7 | templateUrl: './fcm.page.html', 8 | styleUrls: ['./fcm.page.scss'] 9 | }) 10 | export class FcmPage implements OnInit { 11 | constructor(public fcm: FcmService, private db: DbService) {} 12 | 13 | ngOnInit() {} 14 | 15 | getPermission() { 16 | this.fcm.getPermission().subscribe(); 17 | } 18 | 19 | randomDiscount() { 20 | const random = Math.round(Math.random() * 100); 21 | 22 | const headline = `New discount for ${random}% off!!!`; 23 | 24 | this.db.updateAt('discounts', { headline }); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/app/guards/auth.guard.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { 3 | CanActivate, 4 | ActivatedRouteSnapshot, 5 | RouterStateSnapshot 6 | } from '@angular/router'; 7 | import { AuthService } from '../services/auth.service'; 8 | import { AlertController } from '@ionic/angular'; 9 | 10 | @Injectable({ 11 | providedIn: 'root' 12 | }) 13 | export class AuthGuard implements CanActivate { 14 | constructor( 15 | private auth: AuthService, 16 | private alertController: AlertController 17 | ) {} 18 | 19 | async canActivate( 20 | next: ActivatedRouteSnapshot, 21 | state: RouterStateSnapshot 22 | ): Promise { 23 | const uid = await this.auth.uid(); 24 | const isLoggedIn = !!uid; 25 | 26 | if (!isLoggedIn) { 27 | const alert = await this.alertController.create({ 28 | header: 'Blocked', 29 | subHeader: 'Users only', 30 | message: 'You have been blocked by the router guard...', 31 | buttons: ['OK'] 32 | }); 33 | 34 | await alert.present(); 35 | } 36 | 37 | return isLoggedIn; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/app/guards/tutorial.guard.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { 3 | CanActivate, 4 | ActivatedRouteSnapshot, 5 | RouterStateSnapshot, 6 | Router 7 | } from '@angular/router'; 8 | import { Observable } from 'rxjs'; 9 | 10 | import { Storage } from '@ionic/storage'; 11 | 12 | @Injectable({ 13 | providedIn: 'root' 14 | }) 15 | export class TutorialGuard implements CanActivate { 16 | constructor(private storage: Storage, private router: Router) {} 17 | async canActivate( 18 | next: ActivatedRouteSnapshot, 19 | state: RouterStateSnapshot 20 | ): Promise { 21 | const isComplete = await this.storage.get('tutorialComplete'); 22 | 23 | if (!isComplete) { 24 | this.router.navigateByUrl('/tutorial'); 25 | } 26 | 27 | return isComplete; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/app/home/home.module.ts: -------------------------------------------------------------------------------- 1 | import { IonicModule } from '@ionic/angular'; 2 | import { RouterModule } from '@angular/router'; 3 | import { NgModule } from '@angular/core'; 4 | import { CommonModule } from '@angular/common'; 5 | import { FormsModule } from '@angular/forms'; 6 | import { HomePage } from './home.page'; 7 | import { SharedModule } from '../shared/shared.module'; 8 | 9 | @NgModule({ 10 | imports: [ 11 | IonicModule, 12 | CommonModule, 13 | FormsModule, 14 | SharedModule, 15 | RouterModule.forChild([{ path: '', component: HomePage }]) 16 | ], 17 | declarations: [HomePage] 18 | }) 19 | export class HomePageModule {} 20 | -------------------------------------------------------------------------------- /src/app/home/home.page.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Home 8 | 9 | 10 | 11 | 12 | 20 | 21 | 22 | 23 | Login Component 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | Features 33 | 34 | 35 | 36 | 37 | 38 | 39 | Firestore Todo List 40 | 41 | 42 | 43 | 44 | Firebase Cloud Messaging 45 | 46 | 47 | 48 | 49 | 50 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /src/app/home/home.page.scss: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/app/home/home.page.spec.ts: -------------------------------------------------------------------------------- 1 | import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; 2 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 3 | 4 | import { HomePage } from './home.page'; 5 | 6 | describe('HomePage', () => { 7 | let component: HomePage; 8 | let fixture: ComponentFixture; 9 | 10 | beforeEach(async(() => { 11 | TestBed.configureTestingModule({ 12 | declarations: [HomePage], 13 | schemas: [CUSTOM_ELEMENTS_SCHEMA], 14 | }).compileComponents(); 15 | })); 16 | 17 | beforeEach(() => { 18 | fixture = TestBed.createComponent(HomePage); 19 | component = fixture.componentInstance; 20 | fixture.detectChanges(); 21 | }); 22 | 23 | it('should create', () => { 24 | expect(component).toBeTruthy(); 25 | }); 26 | }); 27 | -------------------------------------------------------------------------------- /src/app/home/home.page.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | // import { Plugins } from '@capacitor/core'; 4 | // const { Device } = Plugins; 5 | 6 | @Component({ 7 | selector: 'app-home', 8 | templateUrl: 'home.page.html', 9 | styleUrls: ['home.page.scss'] 10 | }) 11 | export class HomePage { 12 | // device; 13 | constructor() {} 14 | } 15 | -------------------------------------------------------------------------------- /src/app/services/auth.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Router } from '@angular/router'; 3 | import { auth } from 'firebase/app'; 4 | import { AngularFireAuth } from '@angular/fire/auth'; 5 | 6 | import { Observable, of } from 'rxjs'; 7 | import { switchMap, take, map } from 'rxjs/operators'; 8 | import { DbService } from './db.service'; 9 | 10 | import { GooglePlus } from '@ionic-native/google-plus/ngx'; 11 | import { Platform } from '@ionic/angular'; 12 | 13 | import { LoadingController } from '@ionic/angular'; 14 | import { Storage } from '@ionic/storage'; 15 | 16 | @Injectable({ 17 | providedIn: 'root' 18 | }) 19 | export class AuthService { 20 | user$: Observable; 21 | 22 | constructor( 23 | private afAuth: AngularFireAuth, 24 | private db: DbService, 25 | private router: Router, 26 | private gplus: GooglePlus, 27 | private platform: Platform, 28 | private loadingController: LoadingController, 29 | private storage: Storage 30 | ) { 31 | this.user$ = this.afAuth.authState.pipe( 32 | switchMap(user => (user ? db.doc$(`users/${user.uid}`) : of(null))) 33 | ); 34 | 35 | this.handleRedirect(); 36 | } 37 | 38 | uid() { 39 | return this.user$ 40 | .pipe( 41 | take(1), 42 | map(u => u && u.uid) 43 | ) 44 | .toPromise(); 45 | } 46 | 47 | async anonymousLogin() { 48 | const credential = await this.afAuth.auth.signInAnonymously(); 49 | return await this.updateUserData(credential.user); 50 | } 51 | 52 | private updateUserData({ uid, email, displayName, photoURL, isAnonymous }) { 53 | // Sets user data to firestore on login 54 | 55 | const path = `users/${uid}`; 56 | 57 | const data = { 58 | uid, 59 | email, 60 | displayName, 61 | photoURL, 62 | isAnonymous 63 | }; 64 | 65 | return this.db.updateAt(path, data); 66 | } 67 | 68 | async signOut() { 69 | await this.afAuth.auth.signOut(); 70 | return this.router.navigate(['/']); 71 | } 72 | 73 | //// GOOGLE AUTH 74 | 75 | setRedirect(val) { 76 | this.storage.set('authRedirect', val); 77 | } 78 | 79 | async isRedirect() { 80 | return await this.storage.get('authRedirect'); 81 | } 82 | 83 | async googleLogin() { 84 | try { 85 | let user; 86 | 87 | if (this.platform.is('cordova')) { 88 | user = await this.nativeGoogleLogin(); 89 | } else { 90 | await this.setRedirect(true); 91 | const provider = new auth.GoogleAuthProvider(); 92 | user = await this.afAuth.auth.signInWithRedirect(provider); 93 | } 94 | 95 | return await this.updateUserData(user); 96 | } catch (err) { 97 | console.log(err); 98 | } 99 | } 100 | 101 | // Handle login with redirect for web Google auth 102 | private async handleRedirect() { 103 | if ((await this.isRedirect()) !== true) { 104 | return null; 105 | } 106 | const loading = await this.loadingController.create(); 107 | await loading.present(); 108 | 109 | const result = await this.afAuth.auth.getRedirectResult(); 110 | 111 | if (result.user) { 112 | await this.updateUserData(result.user); 113 | } 114 | 115 | await loading.dismiss(); 116 | 117 | await this.setRedirect(false); 118 | 119 | return result; 120 | } 121 | 122 | async nativeGoogleLogin(): Promise { 123 | const gplusUser = await this.gplus.login({ 124 | webClientId: 125 | '1085404550227-h1iabv9megngs4eleo7kd5khoo4fkn98.apps.googleusercontent.com', 126 | offline: true, 127 | scopes: 'profile email' 128 | }); 129 | 130 | return await this.afAuth.auth.signInWithCredential( 131 | auth.GoogleAuthProvider.credential(gplusUser.idToken) 132 | ); 133 | } 134 | } 135 | -------------------------------------------------------------------------------- /src/app/services/db.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { AngularFirestore } from '@angular/fire/firestore'; 3 | import { map } from 'rxjs/operators'; 4 | import { Observable } from 'rxjs'; 5 | 6 | @Injectable({ 7 | providedIn: 'root' 8 | }) 9 | export class DbService { 10 | constructor(private afs: AngularFirestore) {} 11 | 12 | collection$(path, query?) { 13 | return this.afs 14 | .collection(path, query) 15 | .snapshotChanges() 16 | .pipe( 17 | map(actions => { 18 | return actions.map(a => { 19 | const data: Object = a.payload.doc.data(); 20 | const id = a.payload.doc.id; 21 | return { id, ...data }; 22 | }); 23 | }) 24 | ); 25 | } 26 | 27 | doc$(path): Observable { 28 | return this.afs 29 | .doc(path) 30 | .snapshotChanges() 31 | .pipe( 32 | map(doc => { 33 | return { id: doc.payload.id, ...doc.payload.data() }; 34 | }) 35 | ); 36 | } 37 | 38 | /** 39 | * @param {string} path 'collection' or 'collection/docID' 40 | * @param {object} data new data 41 | * 42 | * Creates or updates data on a collection or document. 43 | **/ 44 | updateAt(path: string, data: Object): Promise { 45 | const segments = path.split('/').filter(v => v); 46 | if (segments.length % 2) { 47 | // Odd is always a collection 48 | return this.afs.collection(path).add(data); 49 | } else { 50 | // Even is always document 51 | return this.afs.doc(path).set(data, { merge: true }); 52 | } 53 | } 54 | 55 | /** 56 | * @param {string} path path to document 57 | * 58 | * Deletes document from Firestore 59 | **/ 60 | delete(path) { 61 | return this.afs.doc(path).delete(); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /src/app/services/fcm.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { AngularFireMessaging } from '@angular/fire/messaging'; 3 | import { AngularFireFunctions } from '@angular/fire/functions'; 4 | import { ToastController, Platform } from '@ionic/angular'; 5 | import { tap } from 'rxjs/operators'; 6 | 7 | // Fixing temporary bug in AngularFire 8 | import * as app from 'firebase/app'; 9 | import { Firebase } from '@ionic-native/firebase/ngx'; 10 | import { from } from 'rxjs'; 11 | 12 | @Injectable({ 13 | providedIn: 'root' 14 | }) 15 | export class FcmService { 16 | token; 17 | 18 | constructor( 19 | private afMessaging: AngularFireMessaging, 20 | private fun: AngularFireFunctions, 21 | private toastController: ToastController, 22 | private firebaseNative: Firebase, 23 | private platform: Platform 24 | ) { 25 | try { 26 | const _messaging = app.messaging(); 27 | _messaging.onTokenRefresh = _messaging.onTokenRefresh.bind(_messaging); 28 | _messaging.onMessage = _messaging.onMessage.bind(_messaging); 29 | } catch (e) {} 30 | } 31 | 32 | async makeToast(message) { 33 | const toast = await this.toastController.create({ 34 | message, 35 | duration: 5000, 36 | position: 'top', 37 | showCloseButton: true, 38 | closeButtonText: 'dismiss' 39 | }); 40 | toast.present(); 41 | } 42 | 43 | getPermission() { 44 | let token$; 45 | if (this.platform.is('cordova')) { 46 | token$ = from(this.getPermissionNative()); 47 | } else { 48 | token$ = this.getPermissionWeb(); 49 | } 50 | return token$.pipe( 51 | tap(token => { 52 | this.token = token; 53 | }) 54 | ); 55 | } 56 | 57 | private getPermissionWeb() { 58 | return this.afMessaging.requestToken; 59 | } 60 | 61 | private async getPermissionNative() { 62 | let token; 63 | 64 | if (this.platform.is('ios')) { 65 | await this.firebaseNative.grantPermission(); 66 | } 67 | 68 | token = await this.firebaseNative.getToken(); 69 | 70 | return token; 71 | } 72 | 73 | listenToMessages() { 74 | let messages$; 75 | if (this.platform.is('cordova')) { 76 | messages$ = this.firebaseNative.onNotificationOpen(); 77 | } else { 78 | messages$ = this.afMessaging.messages; 79 | } 80 | 81 | return messages$.pipe(tap(v => this.showMessages(v))); 82 | } 83 | 84 | private showMessages(payload) { 85 | let body; 86 | if (this.platform.is('android')) { 87 | body = payload.body; 88 | } else { 89 | body = payload.notification.body; 90 | } 91 | 92 | this.makeToast(body); 93 | } 94 | 95 | sub(topic) { 96 | this.fun 97 | .httpsCallable('subscribeToTopic')({ topic, token: this.token }) 98 | .pipe(tap(_ => this.makeToast(`subscribed to ${topic}`))) 99 | .subscribe(); 100 | } 101 | 102 | unsub(topic) { 103 | this.fun 104 | .httpsCallable('unsubscribeFromTopic')({ topic, token: this.token }) 105 | .pipe(tap(_ => this.makeToast(`unsubscribed from ${topic}`))) 106 | .subscribe(); 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /src/app/shared/device/device.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |
6 | {{ d.key }}: {{ d.value }} 7 |
8 | 9 |
10 | 11 |
-------------------------------------------------------------------------------- /src/app/shared/device/device.component.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codediodeio/ionic4-master-course/ece8a61fb84de08e9e52b93234ff5fd349c16195/src/app/shared/device/device.component.scss -------------------------------------------------------------------------------- /src/app/shared/device/device.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { DeviceComponent } from './device.component'; 4 | 5 | describe('DeviceComponent', () => { 6 | let component: DeviceComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ DeviceComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(DeviceComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/shared/device/device.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from "@angular/core"; 2 | 3 | // import { Plugins } from '@capacitor/core'; 4 | // const { Device } = Plugins; 5 | 6 | @Component({ 7 | selector: "app-device", 8 | templateUrl: "./device.component.html", 9 | styleUrls: ["./device.component.scss"] 10 | }) 11 | export class DeviceComponent implements OnInit { 12 | device; 13 | 14 | constructor() {} 15 | 16 | ngOnInit() { 17 | // this.device = Device.getInfo(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/app/shared/login/login.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Logout 6 | 7 | 8 | 9 | 10 | 11 | 12 | Login with Google 13 | 14 | 15 | 16 | Login Anonymously 17 | 18 | -------------------------------------------------------------------------------- /src/app/shared/login/login.component.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codediodeio/ionic4-master-course/ece8a61fb84de08e9e52b93234ff5fd349c16195/src/app/shared/login/login.component.scss -------------------------------------------------------------------------------- /src/app/shared/login/login.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { LoginComponent } from './login.component'; 4 | 5 | describe('LoginComponent', () => { 6 | let component: LoginComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ LoginComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(LoginComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/shared/login/login.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { AuthService } from '../../services/auth.service'; 3 | 4 | @Component({ 5 | selector: 'app-login', 6 | templateUrl: './login.component.html', 7 | styleUrls: ['./login.component.scss'] 8 | }) 9 | export class LoginComponent implements OnInit { 10 | constructor(public auth: AuthService) {} 11 | 12 | ngOnInit() {} 13 | } 14 | -------------------------------------------------------------------------------- /src/app/shared/profile/profile.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | UID: {{ user.uid }} 4 | 5 | {{ user.displayName || 'Mysterious User' }} 6 | 7 | 8 | 9 | Anonymous: {{ user.isAnonymous }}
Email: {{ user.email || 'unknown' }} 10 |
11 |
-------------------------------------------------------------------------------- /src/app/shared/profile/profile.component.scss: -------------------------------------------------------------------------------- 1 | img { 2 | max-width: 100px; 3 | flex-flow: row 4 | } -------------------------------------------------------------------------------- /src/app/shared/profile/profile.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { ProfileComponent } from './profile.component'; 4 | 5 | describe('ProfileComponent', () => { 6 | let component: ProfileComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ ProfileComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(ProfileComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/shared/profile/profile.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit, Input } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-profile', 5 | templateUrl: './profile.component.html', 6 | styleUrls: ['./profile.component.scss'] 7 | }) 8 | export class ProfileComponent implements OnInit { 9 | @Input() 10 | user; 11 | 12 | constructor() {} 13 | 14 | ngOnInit() {} 15 | } 16 | -------------------------------------------------------------------------------- /src/app/shared/shared.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { CommonModule } from '@angular/common'; 3 | import { LoginComponent } from '../shared/login/login.component'; 4 | import { IonicModule } from '@ionic/angular'; 5 | import { ProfileComponent } from './profile/profile.component'; 6 | import { DeviceComponent } from './device/device.component'; 7 | 8 | @NgModule({ 9 | imports: [CommonModule, IonicModule], 10 | declarations: [LoginComponent, ProfileComponent, DeviceComponent], 11 | exports: [LoginComponent, ProfileComponent, DeviceComponent] 12 | }) 13 | export class SharedModule {} 14 | -------------------------------------------------------------------------------- /src/app/todo/todo-detail/todo-detail.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | {{ todo.id }} 16 | 17 | 18 | 19 |

20 | {{ prop.key }}: {{ prop.value }} 21 |

22 |
23 |
24 | 25 |
-------------------------------------------------------------------------------- /src/app/todo/todo-detail/todo-detail.component.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codediodeio/ionic4-master-course/ece8a61fb84de08e9e52b93234ff5fd349c16195/src/app/todo/todo-detail/todo-detail.component.scss -------------------------------------------------------------------------------- /src/app/todo/todo-detail/todo-detail.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { TodoDetailComponent } from './todo-detail.component'; 4 | 5 | describe('TodoDetailComponent', () => { 6 | let component: TodoDetailComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ TodoDetailComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(TodoDetailComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/todo/todo-detail/todo-detail.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { ActivatedRoute } from '@angular/router'; 3 | import { DbService } from '../../services/db.service'; 4 | 5 | @Component({ 6 | selector: 'app-todo-detail', 7 | templateUrl: './todo-detail.component.html', 8 | styleUrls: ['./todo-detail.component.scss'] 9 | }) 10 | export class TodoDetailComponent implements OnInit { 11 | todo$; 12 | 13 | constructor(private route: ActivatedRoute, private db: DbService) {} 14 | 15 | ngOnInit() { 16 | const id = this.route.snapshot.paramMap.get('id'); 17 | this.todo$ = this.db.doc$(`todos/${id}`); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/app/todo/todo-form/todo-form.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Create New Todo 4 | Update {{ todo.id }} 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 |
13 | 14 | Todo Details 15 | 16 | 17 | Status 18 | 19 | 20 | 21 | 22 | Pending 23 | 24 | 25 | 26 | 27 | Complete 28 | 29 | 30 | 31 | 32 | 33 | 34 | {{ todo ? 'Update!' : 'Create!' }} 35 |
36 | 37 | 38 | 39 | 40 |
-------------------------------------------------------------------------------- /src/app/todo/todo-form/todo-form.component.scss: -------------------------------------------------------------------------------- 1 | ion-textarea { 2 | font-size: 1.5em; 3 | font-weight: bold; 4 | } -------------------------------------------------------------------------------- /src/app/todo/todo-form/todo-form.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { TodoFormComponent } from './todo-form.component'; 4 | 5 | describe('TodoFormComponent', () => { 6 | let component: TodoFormComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ TodoFormComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(TodoFormComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/todo/todo-form/todo-form.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { ModalController, NavParams } from '@ionic/angular'; 3 | import { DbService } from '../../services/db.service'; 4 | import { FormGroup, FormBuilder, Validators } from '@angular/forms'; 5 | import { AuthService } from '../../services/auth.service'; 6 | 7 | @Component({ 8 | selector: 'app-todo-form', 9 | templateUrl: './todo-form.component.html', 10 | styleUrls: ['./todo-form.component.scss'] 11 | }) 12 | export class TodoFormComponent implements OnInit { 13 | constructor( 14 | private db: DbService, 15 | private auth: AuthService, 16 | public modal: ModalController, 17 | private fb: FormBuilder // private params: NavParams 18 | ) {} 19 | 20 | todoForm: FormGroup; 21 | 22 | todo; 23 | 24 | ngOnInit() { 25 | const data = { 26 | content: '', 27 | status: 'pending', 28 | ...this.todo 29 | }; 30 | this.todoForm = this.fb.group({ 31 | content: [ 32 | data.content, 33 | [ 34 | Validators.required, 35 | Validators.minLength(1), 36 | Validators.maxLength(250) 37 | ] 38 | ], 39 | status: [data.status, [Validators.required]] 40 | }); 41 | } 42 | 43 | async createTodo() { 44 | const uid = await this.auth.uid(); 45 | const id = this.todo ? this.todo.id : ''; 46 | const data = { 47 | uid, 48 | createdAt: Date.now(), 49 | ...this.todo, 50 | ...this.todoForm.value 51 | }; 52 | 53 | this.db.updateAt(`todos/${id}`, data); 54 | this.modal.dismiss(); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/app/todo/todo.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { CommonModule } from '@angular/common'; 3 | import { FormsModule, ReactiveFormsModule } from '@angular/forms'; 4 | import { Routes, RouterModule } from '@angular/router'; 5 | 6 | import { IonicModule } from '@ionic/angular'; 7 | 8 | import { TodoPage } from './todo.page'; 9 | import { TodoFormComponent } from './todo-form/todo-form.component'; 10 | import { TodoDetailComponent } from './todo-detail/todo-detail.component'; 11 | 12 | const routes: Routes = [ 13 | { 14 | path: '', 15 | component: TodoPage 16 | }, 17 | { 18 | path: ':id', 19 | component: TodoDetailComponent 20 | } 21 | ]; 22 | 23 | @NgModule({ 24 | imports: [ 25 | CommonModule, 26 | FormsModule, 27 | IonicModule, 28 | RouterModule.forChild(routes), 29 | ReactiveFormsModule 30 | ], 31 | declarations: [TodoPage, TodoFormComponent, TodoDetailComponent], 32 | entryComponents: [TodoFormComponent] 33 | }) 34 | export class TodoPageModule {} 35 | -------------------------------------------------------------------------------- /src/app/todo/todo.page.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | My Todo List 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | All 17 | 18 | 19 | Complete 20 | 21 | 22 | Pending 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | {{ todo.content }} 33 | 34 | 35 | 36 | 40 | 41 | 42 | 43 | 44 | 45 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | -------------------------------------------------------------------------------- /src/app/todo/todo.page.scss: -------------------------------------------------------------------------------- 1 | .complete { 2 | text-decoration: line-through; 3 | color: var(--ion-color-medium); 4 | } 5 | 6 | ion-button { 7 | margin-left: 5px; 8 | } -------------------------------------------------------------------------------- /src/app/todo/todo.page.spec.ts: -------------------------------------------------------------------------------- 1 | import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; 2 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 3 | 4 | import { TodoPage } from './todo.page'; 5 | 6 | describe('TodoPage', () => { 7 | let component: TodoPage; 8 | let fixture: ComponentFixture; 9 | 10 | beforeEach(async(() => { 11 | TestBed.configureTestingModule({ 12 | declarations: [ TodoPage ], 13 | schemas: [CUSTOM_ELEMENTS_SCHEMA], 14 | }) 15 | .compileComponents(); 16 | })); 17 | 18 | beforeEach(() => { 19 | fixture = TestBed.createComponent(TodoPage); 20 | component = fixture.componentInstance; 21 | fixture.detectChanges(); 22 | }); 23 | 24 | it('should create', () => { 25 | expect(component).toBeTruthy(); 26 | }); 27 | }); 28 | -------------------------------------------------------------------------------- /src/app/todo/todo.page.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { BehaviorSubject } from 'rxjs'; 3 | import { switchMap, map, shareReplay } from 'rxjs/operators'; 4 | import { DbService } from '../services/db.service'; 5 | import { AuthService } from '../services/auth.service'; 6 | 7 | import { ModalController } from '@ionic/angular'; 8 | import { TodoFormComponent } from './todo-form/todo-form.component'; 9 | 10 | @Component({ 11 | selector: 'app-todo', 12 | templateUrl: './todo.page.html', 13 | styleUrls: ['./todo.page.scss'] 14 | }) 15 | export class TodoPage implements OnInit { 16 | todos; 17 | filtered; 18 | 19 | filter = new BehaviorSubject(null); 20 | 21 | constructor( 22 | public db: DbService, 23 | public modal: ModalController, 24 | public auth: AuthService 25 | ) {} 26 | 27 | ngOnInit() { 28 | this.todos = this.auth.user$.pipe( 29 | switchMap(user => 30 | this.db.collection$('todos', ref => 31 | ref 32 | .where('uid', '==', user.uid) 33 | .orderBy('createdAt', 'desc') 34 | .limit(25) 35 | ) 36 | ), 37 | shareReplay(1) 38 | ); 39 | 40 | this.filtered = this.filter.pipe( 41 | switchMap(status => { 42 | return this.todos.pipe( 43 | map(arr => 44 | (arr as any[]).filter( 45 | obj => (status ? obj.status === status : true) 46 | ) 47 | ) 48 | ); 49 | }) 50 | ); 51 | } 52 | 53 | deleteTodo(todo) { 54 | this.db.delete(`todos/${todo.id}`); 55 | } 56 | 57 | toggleStatus(todo) { 58 | const status = todo.status === 'complete' ? 'pending' : 'complete'; 59 | this.db.updateAt(`todos/${todo.id}`, { status }); 60 | } 61 | 62 | updateFilter(val) { 63 | this.filter.next(val); 64 | } 65 | 66 | async presentTodoForm(todo?: any) { 67 | const modal = await this.modal.create({ 68 | component: TodoFormComponent, 69 | componentProps: { todo } 70 | }); 71 | return await modal.present(); 72 | } 73 | 74 | trackById(idx, todo) { 75 | return todo.id; 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /src/app/tutorial/tutorial.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { CommonModule } from '@angular/common'; 3 | import { FormsModule } from '@angular/forms'; 4 | import { Routes, RouterModule } from '@angular/router'; 5 | 6 | import { IonicModule } from '@ionic/angular'; 7 | import { TutorialPage } from './tutorial.page'; 8 | 9 | const routes: Routes = [ 10 | { 11 | path: '', 12 | component: TutorialPage 13 | } 14 | ]; 15 | 16 | @NgModule({ 17 | imports: [ 18 | CommonModule, 19 | FormsModule, 20 | IonicModule, 21 | RouterModule.forChild(routes) 22 | ], 23 | declarations: [TutorialPage] 24 | }) 25 | export class TutorialPageModule {} 26 | -------------------------------------------------------------------------------- /src/app/tutorial/tutorial.page.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |

Explore the Demo

5 |

6 | The Ionic Master Course demo app explores the possibilites in Ionic 4. 7 |

8 | Next 9 |
10 | 11 | 12 | 13 |

Watch the Videos

14 |

Each feature and concept is backed by a video tutorial and source code.

15 | Next 16 |
17 | 18 | 19 | 20 |

Deploy your Own

21 |

22 | Build and deploy your own app to the web, Apple App Store, and Google Play 23 |

24 | 25 | Sounds Awesome! 26 |
27 |
-------------------------------------------------------------------------------- /src/app/tutorial/tutorial.page.scss: -------------------------------------------------------------------------------- 1 | ion-slides { 2 | width: 100vw; 3 | } 4 | 5 | ion-slide { 6 | height: 100vh; 7 | width: 100% !important; 8 | flex-direction: column; 9 | text-align: justify; 10 | } 11 | 12 | ion-img { 13 | max-width: 50vw; 14 | max-height: 50vh; 15 | overflow: hidden; 16 | } 17 | 18 | p { 19 | padding: 1em; 20 | } 21 | 22 | .step-one { 23 | background: var(--ion-color-primary); 24 | color: var(--ion-color-primary-contrast); 25 | } 26 | 27 | .step-two { 28 | background: var(--ion-color-success); 29 | color: var(--ion-color-success-contrast); 30 | } 31 | 32 | .step-three { 33 | background: var(--ion-color-dark); 34 | color: var(--ion-color-dark-contrast); 35 | } -------------------------------------------------------------------------------- /src/app/tutorial/tutorial.page.spec.ts: -------------------------------------------------------------------------------- 1 | import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; 2 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 3 | 4 | import { TutorialPage } from './tutorial.page'; 5 | 6 | describe('TutorialPage', () => { 7 | let component: TutorialPage; 8 | let fixture: ComponentFixture; 9 | 10 | beforeEach(async(() => { 11 | TestBed.configureTestingModule({ 12 | declarations: [ TutorialPage ], 13 | schemas: [CUSTOM_ELEMENTS_SCHEMA], 14 | }) 15 | .compileComponents(); 16 | })); 17 | 18 | beforeEach(() => { 19 | fixture = TestBed.createComponent(TutorialPage); 20 | component = fixture.componentInstance; 21 | fixture.detectChanges(); 22 | }); 23 | 24 | it('should create', () => { 25 | expect(component).toBeTruthy(); 26 | }); 27 | }); 28 | -------------------------------------------------------------------------------- /src/app/tutorial/tutorial.page.ts: -------------------------------------------------------------------------------- 1 | import { Component, ViewChild } from '@angular/core'; 2 | import { Storage } from '@ionic/storage'; 3 | import { Router } from '@angular/router'; 4 | 5 | @Component({ 6 | selector: 'app-tutorial', 7 | templateUrl: './tutorial.page.html', 8 | styleUrls: ['./tutorial.page.scss'] 9 | }) 10 | export class TutorialPage { 11 | constructor(private storage: Storage, private router: Router) {} 12 | 13 | @ViewChild('slides') slides; 14 | 15 | async finish() { 16 | await this.storage.set('tutorialComplete', true); 17 | this.router.navigateByUrl('/'); 18 | } 19 | 20 | next() { 21 | this.slides.slideNext(); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/assets/fonts/Cairo/Cairo-Black.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codediodeio/ionic4-master-course/ece8a61fb84de08e9e52b93234ff5fd349c16195/src/assets/fonts/Cairo/Cairo-Black.ttf -------------------------------------------------------------------------------- /src/assets/fonts/Cairo/Cairo-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codediodeio/ionic4-master-course/ece8a61fb84de08e9e52b93234ff5fd349c16195/src/assets/fonts/Cairo/Cairo-Bold.ttf -------------------------------------------------------------------------------- /src/assets/fonts/Cairo/Cairo-ExtraLight.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codediodeio/ionic4-master-course/ece8a61fb84de08e9e52b93234ff5fd349c16195/src/assets/fonts/Cairo/Cairo-ExtraLight.ttf -------------------------------------------------------------------------------- /src/assets/fonts/Cairo/Cairo-Light.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codediodeio/ionic4-master-course/ece8a61fb84de08e9e52b93234ff5fd349c16195/src/assets/fonts/Cairo/Cairo-Light.ttf -------------------------------------------------------------------------------- /src/assets/fonts/Cairo/Cairo-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codediodeio/ionic4-master-course/ece8a61fb84de08e9e52b93234ff5fd349c16195/src/assets/fonts/Cairo/Cairo-Regular.ttf -------------------------------------------------------------------------------- /src/assets/fonts/Cairo/Cairo-SemiBold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codediodeio/ionic4-master-course/ece8a61fb84de08e9e52b93234ff5fd349c16195/src/assets/fonts/Cairo/Cairo-SemiBold.ttf -------------------------------------------------------------------------------- /src/assets/fonts/Cairo/OFL.txt: -------------------------------------------------------------------------------- 1 | Copyright 2009 The Cairo Project Authors (gaber@gaberism.net) 2 | 3 | This Font Software is licensed under the SIL Open Font License, Version 1.1. 4 | This license is copied below, and is also available with a FAQ at: 5 | http://scripts.sil.org/OFL 6 | 7 | 8 | ----------------------------------------------------------- 9 | SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 10 | ----------------------------------------------------------- 11 | 12 | PREAMBLE 13 | The goals of the Open Font License (OFL) are to stimulate worldwide 14 | development of collaborative font projects, to support the font creation 15 | efforts of academic and linguistic communities, and to provide a free and 16 | open framework in which fonts may be shared and improved in partnership 17 | with others. 18 | 19 | The OFL allows the licensed fonts to be used, studied, modified and 20 | redistributed freely as long as they are not sold by themselves. The 21 | fonts, including any derivative works, can be bundled, embedded, 22 | redistributed and/or sold with any software provided that any reserved 23 | names are not used by derivative works. The fonts and derivatives, 24 | however, cannot be released under any other type of license. The 25 | requirement for fonts to remain under this license does not apply 26 | to any document created using the fonts or their derivatives. 27 | 28 | DEFINITIONS 29 | "Font Software" refers to the set of files released by the Copyright 30 | Holder(s) under this license and clearly marked as such. This may 31 | include source files, build scripts and documentation. 32 | 33 | "Reserved Font Name" refers to any names specified as such after the 34 | copyright statement(s). 35 | 36 | "Original Version" refers to the collection of Font Software components as 37 | distributed by the Copyright Holder(s). 38 | 39 | "Modified Version" refers to any derivative made by adding to, deleting, 40 | or substituting -- in part or in whole -- any of the components of the 41 | Original Version, by changing formats or by porting the Font Software to a 42 | new environment. 43 | 44 | "Author" refers to any designer, engineer, programmer, technical 45 | writer or other person who contributed to the Font Software. 46 | 47 | PERMISSION & CONDITIONS 48 | Permission is hereby granted, free of charge, to any person obtaining 49 | a copy of the Font Software, to use, study, copy, merge, embed, modify, 50 | redistribute, and sell modified and unmodified copies of the Font 51 | Software, subject to the following conditions: 52 | 53 | 1) Neither the Font Software nor any of its individual components, 54 | in Original or Modified Versions, may be sold by itself. 55 | 56 | 2) Original or Modified Versions of the Font Software may be bundled, 57 | redistributed and/or sold with any software, provided that each copy 58 | contains the above copyright notice and this license. These can be 59 | included either as stand-alone text files, human-readable headers or 60 | in the appropriate machine-readable metadata fields within text or 61 | binary files as long as those fields can be easily viewed by the user. 62 | 63 | 3) No Modified Version of the Font Software may use the Reserved Font 64 | Name(s) unless explicit written permission is granted by the corresponding 65 | Copyright Holder. This restriction only applies to the primary font name as 66 | presented to the users. 67 | 68 | 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font 69 | Software shall not be used to promote, endorse or advertise any 70 | Modified Version, except to acknowledge the contribution(s) of the 71 | Copyright Holder(s) and the Author(s) or with their explicit written 72 | permission. 73 | 74 | 5) The Font Software, modified or unmodified, in part or in whole, 75 | must be distributed entirely under this license, and must not be 76 | distributed under any other license. The requirement for fonts to 77 | remain under this license does not apply to any document created 78 | using the Font Software. 79 | 80 | TERMINATION 81 | This license becomes null and void if any of the above conditions are 82 | not met. 83 | 84 | DISCLAIMER 85 | THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 86 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF 87 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT 88 | OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE 89 | COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 90 | INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL 91 | DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 92 | FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM 93 | OTHER DEALINGS IN THE FONT SOFTWARE. 94 | -------------------------------------------------------------------------------- /src/assets/fonts/Rokkitt/OFL.txt: -------------------------------------------------------------------------------- 1 | Copyright 2016 The Rokkit Project Authors (contact@sansoxygen.com) 2 | 3 | This Font Software is licensed under the SIL Open Font License, Version 1.1. 4 | This license is copied below, and is also available with a FAQ at: 5 | http://scripts.sil.org/OFL 6 | 7 | 8 | ----------------------------------------------------------- 9 | SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 10 | ----------------------------------------------------------- 11 | 12 | PREAMBLE 13 | The goals of the Open Font License (OFL) are to stimulate worldwide 14 | development of collaborative font projects, to support the font creation 15 | efforts of academic and linguistic communities, and to provide a free and 16 | open framework in which fonts may be shared and improved in partnership 17 | with others. 18 | 19 | The OFL allows the licensed fonts to be used, studied, modified and 20 | redistributed freely as long as they are not sold by themselves. The 21 | fonts, including any derivative works, can be bundled, embedded, 22 | redistributed and/or sold with any software provided that any reserved 23 | names are not used by derivative works. The fonts and derivatives, 24 | however, cannot be released under any other type of license. The 25 | requirement for fonts to remain under this license does not apply 26 | to any document created using the fonts or their derivatives. 27 | 28 | DEFINITIONS 29 | "Font Software" refers to the set of files released by the Copyright 30 | Holder(s) under this license and clearly marked as such. This may 31 | include source files, build scripts and documentation. 32 | 33 | "Reserved Font Name" refers to any names specified as such after the 34 | copyright statement(s). 35 | 36 | "Original Version" refers to the collection of Font Software components as 37 | distributed by the Copyright Holder(s). 38 | 39 | "Modified Version" refers to any derivative made by adding to, deleting, 40 | or substituting -- in part or in whole -- any of the components of the 41 | Original Version, by changing formats or by porting the Font Software to a 42 | new environment. 43 | 44 | "Author" refers to any designer, engineer, programmer, technical 45 | writer or other person who contributed to the Font Software. 46 | 47 | PERMISSION & CONDITIONS 48 | Permission is hereby granted, free of charge, to any person obtaining 49 | a copy of the Font Software, to use, study, copy, merge, embed, modify, 50 | redistribute, and sell modified and unmodified copies of the Font 51 | Software, subject to the following conditions: 52 | 53 | 1) Neither the Font Software nor any of its individual components, 54 | in Original or Modified Versions, may be sold by itself. 55 | 56 | 2) Original or Modified Versions of the Font Software may be bundled, 57 | redistributed and/or sold with any software, provided that each copy 58 | contains the above copyright notice and this license. These can be 59 | included either as stand-alone text files, human-readable headers or 60 | in the appropriate machine-readable metadata fields within text or 61 | binary files as long as those fields can be easily viewed by the user. 62 | 63 | 3) No Modified Version of the Font Software may use the Reserved Font 64 | Name(s) unless explicit written permission is granted by the corresponding 65 | Copyright Holder. This restriction only applies to the primary font name as 66 | presented to the users. 67 | 68 | 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font 69 | Software shall not be used to promote, endorse or advertise any 70 | Modified Version, except to acknowledge the contribution(s) of the 71 | Copyright Holder(s) and the Author(s) or with their explicit written 72 | permission. 73 | 74 | 5) The Font Software, modified or unmodified, in part or in whole, 75 | must be distributed entirely under this license, and must not be 76 | distributed under any other license. The requirement for fonts to 77 | remain under this license does not apply to any document created 78 | using the Font Software. 79 | 80 | TERMINATION 81 | This license becomes null and void if any of the above conditions are 82 | not met. 83 | 84 | DISCLAIMER 85 | THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 86 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF 87 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT 88 | OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE 89 | COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 90 | INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL 91 | DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 92 | FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM 93 | OTHER DEALINGS IN THE FONT SOFTWARE. 94 | -------------------------------------------------------------------------------- /src/assets/fonts/Rokkitt/Rokkitt-Black.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codediodeio/ionic4-master-course/ece8a61fb84de08e9e52b93234ff5fd349c16195/src/assets/fonts/Rokkitt/Rokkitt-Black.ttf -------------------------------------------------------------------------------- /src/assets/fonts/Rokkitt/Rokkitt-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codediodeio/ionic4-master-course/ece8a61fb84de08e9e52b93234ff5fd349c16195/src/assets/fonts/Rokkitt/Rokkitt-Bold.ttf -------------------------------------------------------------------------------- /src/assets/fonts/Rokkitt/Rokkitt-ExtraBold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codediodeio/ionic4-master-course/ece8a61fb84de08e9e52b93234ff5fd349c16195/src/assets/fonts/Rokkitt/Rokkitt-ExtraBold.ttf -------------------------------------------------------------------------------- /src/assets/fonts/Rokkitt/Rokkitt-ExtraLight.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codediodeio/ionic4-master-course/ece8a61fb84de08e9e52b93234ff5fd349c16195/src/assets/fonts/Rokkitt/Rokkitt-ExtraLight.ttf -------------------------------------------------------------------------------- /src/assets/fonts/Rokkitt/Rokkitt-Light.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codediodeio/ionic4-master-course/ece8a61fb84de08e9e52b93234ff5fd349c16195/src/assets/fonts/Rokkitt/Rokkitt-Light.ttf -------------------------------------------------------------------------------- /src/assets/fonts/Rokkitt/Rokkitt-Medium.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codediodeio/ionic4-master-course/ece8a61fb84de08e9e52b93234ff5fd349c16195/src/assets/fonts/Rokkitt/Rokkitt-Medium.ttf -------------------------------------------------------------------------------- /src/assets/fonts/Rokkitt/Rokkitt-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codediodeio/ionic4-master-course/ece8a61fb84de08e9e52b93234ff5fd349c16195/src/assets/fonts/Rokkitt/Rokkitt-Regular.ttf -------------------------------------------------------------------------------- /src/assets/fonts/Rokkitt/Rokkitt-SemiBold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codediodeio/ionic4-master-course/ece8a61fb84de08e9e52b93234ff5fd349c16195/src/assets/fonts/Rokkitt/Rokkitt-SemiBold.ttf -------------------------------------------------------------------------------- /src/assets/fonts/Rokkitt/Rokkitt-Thin.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codediodeio/ionic4-master-course/ece8a61fb84de08e9e52b93234ff5fd349c16195/src/assets/fonts/Rokkitt/Rokkitt-Thin.ttf -------------------------------------------------------------------------------- /src/assets/icon/anon.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 12 | 13 | 14 | 18 | 19 | 20 | 22 | 23 | 24 | 26 | 27 | 28 | 31 | 32 | 33 | 35 | 36 | 37 | 38 | 40 | 41 | 42 | 43 | 44 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | -------------------------------------------------------------------------------- /src/assets/icon/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codediodeio/ionic4-master-course/ece8a61fb84de08e9e52b93234ff5fd349c16195/src/assets/icon/favicon.png -------------------------------------------------------------------------------- /src/assets/slides/step1.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 8 | 10 | 12 | 14 | 16 | 18 | 22 | 24 | 27 | 29 | 31 | 34 | 36 | 38 | 40 | 43 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | -------------------------------------------------------------------------------- /src/assets/slides/step2.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 7 | 9 | 12 | 14 | 17 | 19 | 20 | 22 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /src/assets/slides/step3.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 7 | 13 | 20 | 23 | 26 | 28 | 30 | 34 | 36 | 42 | 44 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /src/environments/environment.prod.ts: -------------------------------------------------------------------------------- 1 | export const environment = { 2 | production: true, 3 | firebase: { 4 | apiKey: 'AIzaSyDZQvOwS46f2Hoa1Edds3SB29sECeQP01o', 5 | authDomain: 'ionic4-fire.firebaseapp.com', 6 | databaseURL: 'https://ionic4-fire.firebaseio.com', 7 | projectId: 'ionic4-fire', 8 | storageBucket: 'ionic4-fire.appspot.com', 9 | messagingSenderId: '1085404550227' 10 | } 11 | }; 12 | -------------------------------------------------------------------------------- /src/environments/environment.ts: -------------------------------------------------------------------------------- 1 | // The file contents for the current environment will overwrite these during build. 2 | // The build system defaults to the dev environment which uses `environment.ts`, but if you do 3 | // `ng build --env=prod` then `environment.prod.ts` will be used instead. 4 | // The list of which env maps to which file can be found in `.angular-cli.json`. 5 | export const environment = { 6 | production: false, 7 | firebase: { 8 | apiKey: 'AIzaSyDZQvOwS46f2Hoa1Edds3SB29sECeQP01o', 9 | authDomain: 'ionic4-fire.firebaseapp.com', 10 | databaseURL: 'https://ionic4-fire.firebaseio.com', 11 | projectId: 'ionic4-fire', 12 | storageBucket: 'ionic4-fire.appspot.com', 13 | messagingSenderId: '1085404550227' 14 | } 15 | }; 16 | -------------------------------------------------------------------------------- /src/firebase-messaging-sw.js: -------------------------------------------------------------------------------- 1 | // Give the service worker access to Firebase Messaging. 2 | // Note that you can only use Firebase Messaging here, other Firebase libraries 3 | // are not available in the service worker. 4 | importScripts('https://www.gstatic.com/firebasejs/5.4.2/firebase-app.js'); 5 | importScripts('https://www.gstatic.com/firebasejs/5.4.2/firebase-messaging.js'); 6 | 7 | // Initialize the Firebase app in the service worker by passing in the 8 | // messagingSenderId. 9 | firebase.initializeApp({ 10 | 'messagingSenderId': '1085404550227' 11 | }); 12 | 13 | // Retrieve an instance of Firebase Messaging so that it can handle background 14 | // messages. 15 | const messaging = firebase.messaging(); -------------------------------------------------------------------------------- /src/global.scss: -------------------------------------------------------------------------------- 1 | // http://ionicframework.com/docs/theming/ 2 | @import "~@ionic/angular/css/core.css"; 3 | @import "~@ionic/angular/css/normalize.css"; 4 | @import "~@ionic/angular/css/structure.css"; 5 | @import "~@ionic/angular/css/typography.css"; 6 | @import "~@ionic/angular/css/padding.css"; 7 | @import "~@ionic/angular/css/float-elements.css"; 8 | @import "~@ionic/angular/css/text-alignment.css"; 9 | @import "~@ionic/angular/css/text-transformation.css"; 10 | @import "~@ionic/angular/css/flex-utils.css"; 11 | body { 12 | font-family: var(--body-font); 13 | } 14 | 15 | h1, 16 | h2, 17 | h3, 18 | h4, 19 | h5, 20 | ion-title { 21 | font-family: var(--heading-font); 22 | } -------------------------------------------------------------------------------- /src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Ionic App 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/karma.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration file, see link for more information 2 | // https://karma-runner.github.io/1.0/config/configuration-file.html 3 | 4 | module.exports = function (config) { 5 | config.set({ 6 | basePath: '', 7 | frameworks: ['jasmine', '@angular-devkit/build-angular'], 8 | plugins: [ 9 | require('karma-jasmine'), 10 | require('karma-chrome-launcher'), 11 | require('karma-jasmine-html-reporter'), 12 | require('karma-coverage-istanbul-reporter'), 13 | require('@angular-devkit/build-angular/plugins/karma') 14 | ], 15 | client: { 16 | clearContext: false // leave Jasmine Spec Runner output visible in browser 17 | }, 18 | coverageIstanbulReporter: { 19 | dir: require('path').join(__dirname, 'coverage'), 20 | reports: ['html', 'lcovonly'], 21 | fixWebpackSourcePaths: true 22 | }, 23 | reporters: ['progress', 'kjhtml'], 24 | port: 9876, 25 | colors: true, 26 | logLevel: config.LOG_INFO, 27 | autoWatch: true, 28 | browsers: ['Chrome'], 29 | singleRun: false 30 | }); 31 | }; 32 | -------------------------------------------------------------------------------- /src/main.ts: -------------------------------------------------------------------------------- 1 | import { enableProdMode } from '@angular/core'; 2 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 3 | 4 | import { AppModule } from './app/app.module'; 5 | import { environment } from './environments/environment'; 6 | 7 | if (environment.production) { 8 | enableProdMode(); 9 | } 10 | 11 | platformBrowserDynamic().bootstrapModule(AppModule) 12 | .catch(err => console.log(err)); 13 | -------------------------------------------------------------------------------- /src/polyfills.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file includes polyfills needed by Angular and is loaded before the app. 3 | * You can add your own extra polyfills to this file. 4 | * 5 | * This file is divided into 2 sections: 6 | * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers. 7 | * 2. Application imports. Files imported after ZoneJS that should be loaded before your main 8 | * file. 9 | * 10 | * The current setup is for so-called "evergreen" browsers; the last versions of browsers that 11 | * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera), 12 | * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile. 13 | * 14 | * Learn more in https://angular.io/docs/ts/latest/guide/browser-support.html 15 | */ 16 | 17 | /*************************************************************************************************** 18 | * BROWSER POLYFILLS 19 | */ 20 | 21 | /** IE9, IE10 and IE11 requires all of the following polyfills. **/ 22 | // import 'core-js/es6/symbol'; 23 | // import 'core-js/es6/object'; 24 | // import 'core-js/es6/function'; 25 | // import 'core-js/es6/parse-int'; 26 | // import 'core-js/es6/parse-float'; 27 | // import 'core-js/es6/number'; 28 | // import 'core-js/es6/math'; 29 | // import 'core-js/es6/string'; 30 | // import 'core-js/es6/date'; 31 | // import 'core-js/es6/array'; 32 | // import 'core-js/es6/regexp'; 33 | // import 'core-js/es6/map'; 34 | // import 'core-js/es6/weak-map'; 35 | // import 'core-js/es6/set'; 36 | 37 | /** IE10 and IE11 requires the following for NgClass support on SVG elements */ 38 | // import 'classlist.js'; // Run `npm install --save classlist.js`. 39 | 40 | /** IE10 and IE11 requires the following for the Reflect API. */ 41 | // import 'core-js/es6/reflect'; 42 | 43 | 44 | /** Evergreen browsers require these. **/ 45 | // Used for reflect-metadata in JIT. If you use AOT (and only Angular decorators), you can remove. 46 | import 'core-js/es7/reflect'; 47 | 48 | 49 | /** 50 | * Required to support Web Animations `@angular/platform-browser/animations`. 51 | * Needed for: All but Chrome, Firefox and Opera. http://caniuse.com/#feat=web-animation 52 | **/ 53 | // import 'web-animations-js'; // Run `npm install --save web-animations-js`. 54 | 55 | 56 | 57 | /*************************************************************************************************** 58 | * Zone JS is required by Angular itself. 59 | */ 60 | import 'zone.js/dist/zone'; // Included with Angular CLI. 61 | 62 | 63 | 64 | /*************************************************************************************************** 65 | * APPLICATION IMPORTS 66 | */ 67 | 68 | /** 69 | * Date, currency, decimal and percent pipes. 70 | * Needed for: All but Chrome, Firefox, Edge, IE11 and Safari 10 71 | */ 72 | // import 'intl'; // Run `npm install --save intl`. 73 | /** 74 | * Need to import at least one locale-data with intl. 75 | */ 76 | // import 'intl/locale-data/jsonp/en'; 77 | -------------------------------------------------------------------------------- /src/test.ts: -------------------------------------------------------------------------------- 1 | // This file is required by karma.conf.js and loads recursively all the .spec and framework files 2 | 3 | import 'zone.js/dist/zone-testing'; 4 | import { getTestBed } from '@angular/core/testing'; 5 | import { 6 | BrowserDynamicTestingModule, 7 | platformBrowserDynamicTesting 8 | } from '@angular/platform-browser-dynamic/testing'; 9 | 10 | declare const require: any; 11 | 12 | // First, initialize the Angular testing environment. 13 | getTestBed().initTestEnvironment( 14 | BrowserDynamicTestingModule, 15 | platformBrowserDynamicTesting() 16 | ); 17 | // Then we find all the tests. 18 | const context = require.context('./', true, /\.spec\.ts$/); 19 | // And load the modules. 20 | context.keys().map(context); 21 | -------------------------------------------------------------------------------- /src/theme/variables.scss: -------------------------------------------------------------------------------- 1 | // Ionic Variables and Theming. For more info, please see: 2 | // http://ionicframework.com/docs/theming/ 3 | 4 | /** Ionic CSS Variables **/ 5 | 6 | :root { 7 | /** primary **/ 8 | --ion-color-primary: #488aff; 9 | --ion-color-primary-rgb: 72, 138, 255; 10 | --ion-color-primary-contrast: #fff; 11 | --ion-color-primary-contrast-rgb: 255, 255, 255; 12 | --ion-color-primary-shade: #3f79e0; 13 | --ion-color-primary-tint: #5a96ff; 14 | /** secondary **/ 15 | --ion-color-secondary: #32db64; 16 | --ion-color-secondary-rgb: 50, 219, 100; 17 | --ion-color-secondary-contrast: #fff; 18 | --ion-color-secondary-contrast-rgb: 255, 255, 255; 19 | --ion-color-secondary-shade: #2cc158; 20 | --ion-color-secondary-tint: #47df74; 21 | /** tertiary **/ 22 | --ion-color-tertiary: #f4a942; 23 | --ion-color-tertiary-rgb: 244, 169, 66; 24 | --ion-color-tertiary-contrast: #fff; 25 | --ion-color-tertiary-contrast-rgb: 255, 255, 255; 26 | --ion-color-tertiary-shade: #d7953a; 27 | --ion-color-tertiary-tint: #f5b255; 28 | /** success **/ 29 | --ion-color-success: #10dc60; 30 | --ion-color-success-rgb: 16, 220, 96; 31 | --ion-color-success-contrast: #fff; 32 | --ion-color-success-contrast-rgb: 255, 255, 255; 33 | --ion-color-success-shade: #0ec254; 34 | --ion-color-success-tint: #28e070; 35 | /** warning **/ 36 | --ion-color-warning: #ffce00; 37 | --ion-color-warning-rgb: 255, 206, 0; 38 | --ion-color-warning-contrast: #000; 39 | --ion-color-warning-contrast-rgb: 0, 0, 0; 40 | --ion-color-warning-shade: #e0b500; 41 | --ion-color-warning-tint: #ffd31a; 42 | /** danger **/ 43 | --ion-color-danger: #f53d3d; 44 | --ion-color-danger-rgb: 245, 61, 61; 45 | --ion-color-danger-contrast: #fff; 46 | --ion-color-danger-contrast-rgb: 255, 255, 255; 47 | --ion-color-danger-shade: #d83636; 48 | --ion-color-danger-tint: #f65050; 49 | /** light **/ 50 | --ion-color-light: #f4f4f4; 51 | --ion-color-light-rgb: 244, 244, 244; 52 | --ion-color-light-contrast: #000; 53 | --ion-color-light-contrast-rgb: 0, 0, 0; 54 | --ion-color-light-shade: #d7d7d7; 55 | --ion-color-light-tint: #f5f5f5; 56 | /** medium **/ 57 | --ion-color-medium: #989aa2; 58 | --ion-color-medium-rgb: 152, 154, 162; 59 | --ion-color-medium-contrast: #000; 60 | --ion-color-medium-contrast-rgb: 0, 0, 0; 61 | --ion-color-medium-shade: #86888f; 62 | --ion-color-medium-tint: #a2a4ab; 63 | /** dark **/ 64 | --ion-color-dark: #222; 65 | --ion-color-dark-rgb: 34, 34, 34; 66 | --ion-color-dark-contrast: #fff; 67 | --ion-color-dark-contrast-rgb: 255, 255, 255; 68 | --ion-color-dark-shade: #1e1e1e; 69 | --ion-color-dark-tint: #383838; 70 | --body-font: 'Cairo'; 71 | --heading-font: 'Rokkitt'; 72 | --ion-font-family: var(--body-font); 73 | } 74 | 75 | :root[mode=ios] { 76 | --ion-font-family: var( --body-font) !important; 77 | } 78 | 79 | :root[mode=md] { 80 | --ion-font-family: var( --body-font) !important; 81 | } 82 | 83 | @font-face { 84 | font-family: 'Cairo'; 85 | src: url('/assets/fonts/Cairo/Cairo-Regular.ttf'); 86 | } 87 | 88 | @font-face { 89 | font-family: 'Rokkitt'; 90 | src: url('/assets/fonts/Rokkitt/Rokkitt-Bold.ttf'); 91 | font-weight: bold; 92 | } -------------------------------------------------------------------------------- /src/tsconfig.app.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/app", 5 | "baseUrl": "./", 6 | "module": "es2015" 7 | }, 8 | "exclude": [ 9 | "test.ts", 10 | "**/*.spec.ts" 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /src/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/spec", 5 | "baseUrl": "./", 6 | "module": "commonjs", 7 | "types": [ 8 | "jasmine", 9 | "node" 10 | ] 11 | }, 12 | "files": [ 13 | "test.ts" 14 | ], 15 | "include": [ 16 | "polyfills.ts", 17 | "**/*.spec.ts", 18 | "**/*.d.ts" 19 | ] 20 | } 21 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": false, 3 | "compilerOptions": { 4 | "outDir": "./dist/out-tsc", 5 | "sourceMap": true, 6 | "declaration": false, 7 | "moduleResolution": "node", 8 | "emitDecoratorMetadata": true, 9 | "experimentalDecorators": true, 10 | "target": "es5", 11 | "lib": [ 12 | "es2017", 13 | "dom" 14 | ] 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "rulesDirectory": [ 3 | "node_modules/codelyzer" 4 | ], 5 | "rules": { 6 | "arrow-return-shorthand": true, 7 | "callable-types": true, 8 | "class-name": true, 9 | "comment-format": [ 10 | true, 11 | "check-space" 12 | ], 13 | "curly": true, 14 | "deprecation": { 15 | "severity": "warn" 16 | }, 17 | "eofline": true, 18 | "forin": true, 19 | "import-spacing": true, 20 | "indent": [ 21 | true, 22 | "spaces" 23 | ], 24 | "interface-over-type-literal": true, 25 | "label-position": true, 26 | "max-line-length": [ 27 | true, 28 | 140 29 | ], 30 | "member-access": false, 31 | "member-ordering": [ 32 | true, 33 | { 34 | "order": [ 35 | "static-field", 36 | "instance-field", 37 | "static-method", 38 | "instance-method" 39 | ] 40 | } 41 | ], 42 | "no-arg": true, 43 | "no-bitwise": true, 44 | "no-console": [ 45 | true, 46 | "debug", 47 | "info", 48 | "time", 49 | "timeEnd", 50 | "trace" 51 | ], 52 | "no-construct": true, 53 | "no-debugger": true, 54 | "no-duplicate-super": true, 55 | "no-empty": false, 56 | "no-empty-interface": true, 57 | "no-eval": true, 58 | "no-inferrable-types": [ 59 | true, 60 | "ignore-params" 61 | ], 62 | "no-misused-new": true, 63 | "no-non-null-assertion": true, 64 | "no-shadowed-variable": true, 65 | "no-string-literal": false, 66 | "no-string-throw": true, 67 | "no-switch-case-fall-through": true, 68 | "no-trailing-whitespace": true, 69 | "no-unnecessary-initializer": true, 70 | "no-unused-expression": true, 71 | "no-use-before-declare": true, 72 | "no-var-keyword": true, 73 | "object-literal-sort-keys": false, 74 | "one-line": [ 75 | true, 76 | "check-open-brace", 77 | "check-catch", 78 | "check-else", 79 | "check-whitespace" 80 | ], 81 | "prefer-const": true, 82 | "quotemark": [ 83 | true, 84 | "single" 85 | ], 86 | "radix": true, 87 | "semicolon": [ 88 | true, 89 | "always" 90 | ], 91 | "triple-equals": [ 92 | true, 93 | "allow-null-check" 94 | ], 95 | "typedef-whitespace": [ 96 | true, 97 | { 98 | "call-signature": "nospace", 99 | "index-signature": "nospace", 100 | "parameter": "nospace", 101 | "property-declaration": "nospace", 102 | "variable-declaration": "nospace" 103 | } 104 | ], 105 | "unified-signatures": true, 106 | "variable-name": false, 107 | "whitespace": [ 108 | true, 109 | "check-branch", 110 | "check-decl", 111 | "check-operator", 112 | "check-separator", 113 | "check-type" 114 | ], 115 | "directive-selector": [ 116 | true, 117 | "attribute", 118 | "app", 119 | "camelCase" 120 | ], 121 | "component-selector": [ 122 | true, 123 | "element", 124 | "app", 125 | "page", 126 | "kebab-case" 127 | ], 128 | "no-output-on-prefix": true, 129 | "use-input-property-decorator": true, 130 | "use-output-property-decorator": true, 131 | "use-host-property-decorator": true, 132 | "no-input-rename": true, 133 | "no-output-rename": true, 134 | "use-life-cycle-interface": true, 135 | "use-pipe-transform-interface": true, 136 | "directive-class-suffix": true 137 | } 138 | } 139 | --------------------------------------------------------------------------------