├── .editorconfig ├── .firebaserc ├── .gitignore ├── README.md ├── config.xml ├── firebase.json ├── functions ├── lib │ ├── index.js │ └── index.js.map ├── package-lock.json ├── package.json ├── src │ └── 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.component.ts │ ├── app.html │ ├── app.module.ts │ ├── app.scss │ └── main.ts ├── assets │ ├── icon │ │ └── favicon.ico │ └── imgs │ │ └── logo.png ├── index.html ├── manifest.json ├── pages │ ├── about │ │ ├── about.html │ │ ├── about.scss │ │ └── about.ts │ ├── contact │ │ ├── contact.html │ │ ├── contact.scss │ │ └── contact.ts │ ├── home │ │ ├── home.html │ │ ├── home.scss │ │ └── home.ts │ └── tabs │ │ ├── tabs.html │ │ └── tabs.ts ├── providers │ └── fcm │ │ └── fcm.ts ├── service-worker.js └── theme │ └── variables.scss ├── tsconfig.json └── tslint.json /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig helps developers define and maintain consistent coding styles between different editors and IDEs 2 | # editorconfig.org 3 | 4 | root = true 5 | 6 | [*] 7 | indent_style = space 8 | indent_size = 2 9 | 10 | # We recommend you to keep these unchanged 11 | end_of_line = lf 12 | charset = utf-8 13 | trim_trailing_whitespace = true 14 | insert_final_newline = true 15 | 16 | [*.md] 17 | trim_trailing_whitespace = false -------------------------------------------------------------------------------- /.firebaserc: -------------------------------------------------------------------------------- 1 | { 2 | "projects": { 3 | "default": "firestarter-96e46" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Specifies intentionally untracked files to ignore when using Git 2 | # http://git-scm.com/docs/gitignore 3 | 4 | google-services.json 5 | GoogleService-Info.plist 6 | 7 | *~ 8 | *.sw[mnpcod] 9 | *.log 10 | *.tmp 11 | *.tmp.* 12 | log.txt 13 | *.sublime-project 14 | *.sublime-workspace 15 | .vscode/ 16 | npm-debug.log* 17 | 18 | .idea/ 19 | .sourcemaps/ 20 | .sass-cache/ 21 | .tmp/ 22 | .versions/ 23 | coverage/ 24 | dist/ 25 | node_modules/ 26 | tmp/ 27 | temp/ 28 | hooks/ 29 | platforms/ 30 | plugins/ 31 | plugins/android.json 32 | plugins/ios.json 33 | www/ 34 | $RECYCLE.BIN/ 35 | 36 | .DS_Store 37 | Thumbs.db 38 | UserInterfaceState.xcuserstate 39 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## Firebase Cloud Messaging + Ionic Native 2 | 3 | Watch the [screencast](https://angularfirebase.com/lessons/). -------------------------------------------------------------------------------- /config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | fcmDemo 4 | An awesome Ionic/Cordova 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 | -------------------------------------------------------------------------------- /firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "functions": { 3 | "predeploy": "npm --prefix functions run build" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /functions/lib/index.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 | admin.initializeApp(functions.config().firebase); 14 | exports.newSubscriberNotification = functions.firestore 15 | .document('subscribers/{subscriptionId}') 16 | .onCreate((event) => __awaiter(this, void 0, void 0, function* () { 17 | const data = event.data.data(); 18 | const userId = data.userId; 19 | const subscriber = data.subscriberId; 20 | // Notification content 21 | const payload = { 22 | notification: { 23 | title: 'New Subscriber', 24 | body: `${subscriber} is following your content!`, 25 | icon: 'https://goo.gl/Fz9nrQ' 26 | } 27 | }; 28 | // ref to the parent document 29 | const db = admin.firestore(); 30 | const devicesRef = db.collection('devices').where('userId', '==', userId); 31 | // get users tokens and send notifications 32 | const devices = yield devicesRef.get(); 33 | const promises = []; 34 | devices.forEach(result => { 35 | const token = result.data().token; 36 | promises.push(admin.messaging().sendToDevice(token, payload)); 37 | }); 38 | return Promise.all(promises); 39 | // return devicesRef.get() 40 | // .then(snapshot => snapshot.data() ) 41 | // .then(user => { 42 | // const tokens = user.fcmTokens ? Object.keys(user.fcmTokens) : [] 43 | // if (!tokens.length) { 44 | // throw new Error('User does not have any tokens!') 45 | // } 46 | // return admin.messaging().sendToDevice(tokens, payload) 47 | // }) 48 | // .catch(err => console.log(err) ) 49 | })); 50 | //# sourceMappingURL=index.js.map -------------------------------------------------------------------------------- /functions/lib/index.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,gDAAgD;AAEhD,wCAAwC;AACxC,KAAK,CAAC,aAAa,CAAC,SAAS,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,CAAC;AAGjD,OAAO,CAAC,yBAAyB,GAAG,SAAS,CAAC,SAAS;KAClD,QAAQ,CAAC,8BAA8B,CAAC;KACxC,QAAQ,CAAC,CAAM,KAAK,EAAC,EAAE;IAExB,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;IAE/B,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAA;IAC1B,MAAM,UAAU,GAAG,IAAI,CAAC,YAAY,CAAA;IAEpC,uBAAuB;IACvB,MAAM,OAAO,GAAG;QACZ,YAAY,EAAE;YACV,KAAK,EAAE,gBAAgB;YACvB,IAAI,EAAE,GAAG,UAAU,6BAA6B;YAChD,IAAI,EAAE,uBAAuB;SAChC;KACJ,CAAA;IAED,6BAA6B;IAC7B,MAAM,EAAE,GAAG,KAAK,CAAC,SAAS,EAAE,CAAA;IAC5B,MAAM,UAAU,GAAG,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,KAAK,CAAC,QAAQ,EAAE,IAAI,EAAE,MAAM,CAAC,CAAA;IAGzE,0CAA0C;IAE1C,MAAM,OAAO,GAAG,MAAM,UAAU,CAAC,GAAG,EAAE,CAAA;IAEtC,MAAM,QAAQ,GAAG,EAAE,CAAA;IAEnB,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;QACrB,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC;QAEnC,QAAQ,CAAC,IAAI,CAAE,KAAK,CAAC,SAAS,EAAE,CAAC,YAAY,CAAC,KAAK,EAAE,OAAO,CAAC,CAAE,CAAA;IAClE,CAAC,CAAC,CAAA;IAEF,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;IAG5B,0BAA0B;IAO1B,0CAA0C;IAC1C,sBAAsB;IAEtB,2EAA2E;IAE3E,gCAAgC;IAChC,+DAA+D;IAC/D,YAAY;IAEZ,iEAAiE;IACjE,SAAS;IACT,uCAAuC;AAC3C,CAAC,CAAA,CAAC,CAAC"} -------------------------------------------------------------------------------- /functions/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "functions", 3 | "scripts": { 4 | "build": "./node_modules/.bin/tslint -p tslint.json && ./node_modules/.bin/tsc", 5 | "serve": "npm run build && firebase serve --only functions", 6 | "shell": "npm run build && firebase experimental:functions:shell", 7 | "start": "npm run shell", 8 | "deploy": "firebase deploy --only functions", 9 | "logs": "firebase functions:log" 10 | }, 11 | "main": "lib/index.js", 12 | "dependencies": { 13 | "firebase-admin": "~5.4.2", 14 | "firebase-functions": "^0.7.1" 15 | }, 16 | "devDependencies": { 17 | "tslint": "^5.8.0", 18 | "typescript": "^2.5.3" 19 | }, 20 | "private": true 21 | } 22 | -------------------------------------------------------------------------------- /functions/src/index.ts: -------------------------------------------------------------------------------- 1 | import * as functions from 'firebase-functions'; 2 | 3 | import * as admin from 'firebase-admin'; 4 | admin.initializeApp(functions.config().firebase); 5 | 6 | 7 | exports.newSubscriberNotification = functions.firestore 8 | .document('subscribers/{subscriptionId}') 9 | .onCreate(async event => { 10 | 11 | const data = event.data.data(); 12 | 13 | const userId = data.userId 14 | const subscriber = data.subscriberId 15 | 16 | // Notification content 17 | const payload = { 18 | notification: { 19 | title: 'New Subscriber', 20 | body: `${subscriber} is following your content!`, 21 | icon: 'https://goo.gl/Fz9nrQ' 22 | } 23 | } 24 | 25 | // ref to the parent document 26 | const db = admin.firestore() 27 | const devicesRef = db.collection('devices').where('userId', '==', userId) 28 | 29 | 30 | // get users tokens and send notifications 31 | 32 | const devices = await devicesRef.get() 33 | 34 | const tokens = [] 35 | 36 | devices.forEach(result => { 37 | const token = result.data().token; 38 | 39 | tokens.push( token ) 40 | }) 41 | 42 | return admin.messaging().sendToDevice(tokens, payload) 43 | 44 | }); -------------------------------------------------------------------------------- /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 | }, 10 | "compileOnSave": true, 11 | "include": [ 12 | "src" 13 | ] 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 | // Makes sure result of typeof is compared to correct string values. 75 | "typeof-compare": true, 76 | 77 | // Disallow duplicate imports in the same file. 78 | "no-duplicate-imports": true, 79 | 80 | 81 | // -- Strong Warnings -- 82 | // These rules should almost never be needed, but may be included due to legacy code. 83 | // They are left as a warning to avoid frustration with blocked deploys when the developer 84 | // understand the warning and wants to deploy anyway. 85 | 86 | // Warn when an empty interface is defined. These are generally not useful. 87 | "no-empty-interface": {"severity": "warning"}, 88 | 89 | // Warn when an import will have side effects. 90 | "no-import-side-effect": {"severity": "warning"}, 91 | 92 | // Warn when variables are defined with var. Var has subtle meaning that can lead to bugs. Strongly prefer const for 93 | // most values and let for values that will change. 94 | "no-var-keyword": {"severity": "warning"}, 95 | 96 | // Prefer === and !== over == and !=. The latter operators support overloads that are often accidental. 97 | "triple-equals": {"severity": "warning"}, 98 | 99 | // Warn when using deprecated APIs. 100 | "deprecation": {"severity": "warning"}, 101 | 102 | // -- Light Warnigns -- 103 | // These rules are intended to help developers use better style. Simpler code has fewer bugs. These would be "info" 104 | // if TSLint supported such a level. 105 | 106 | // prefer for( ... of ... ) to an index loop when the index is only used to fetch an object from an array. 107 | // (Even better: check out utils like .map if transforming an array!) 108 | "prefer-for-of": {"severity": "warning"}, 109 | 110 | // Warns if function overloads could be unified into a single function with optional or rest parameters. 111 | "unified-signatures": {"severity": "warning"}, 112 | 113 | // Warns if code has an import or variable that is unused. 114 | "no-unused-variable": {"severity": "warning"}, 115 | 116 | // Prefer const for values that will not change. This better documents code. 117 | "prefer-const": {"severity": "warning"}, 118 | 119 | // Multi-line object liiterals and function calls should have a trailing comma. This helps avoid merge conflicts. 120 | "trailing-comma": {"severity": "warning"} 121 | }, 122 | 123 | "defaultSeverity": "error" 124 | } 125 | -------------------------------------------------------------------------------- /ionic.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "fcmDemo", 3 | "app_id": "d8aeb335", 4 | "type": "ionic-angular", 5 | "integrations": { 6 | "cordova": {} 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "fcmDemo", 3 | "version": "0.0.1", 4 | "author": "Ionic Framework", 5 | "homepage": "http://ionicframework.com/", 6 | "private": true, 7 | "scripts": { 8 | "clean": "ionic-app-scripts clean", 9 | "build": "ionic-app-scripts build", 10 | "lint": "ionic-app-scripts lint", 11 | "ionic:build": "ionic-app-scripts build", 12 | "ionic:serve": "ionic-app-scripts serve" 13 | }, 14 | "dependencies": { 15 | "@angular/common": "5.0.3", 16 | "@angular/compiler": "5.0.3", 17 | "@angular/compiler-cli": "5.0.3", 18 | "@angular/core": "5.0.3", 19 | "@angular/forms": "5.0.3", 20 | "@angular/http": "5.0.3", 21 | "@angular/platform-browser": "5.0.3", 22 | "@angular/platform-browser-dynamic": "5.0.3", 23 | "@ionic-native/core": "4.4.0", 24 | "@ionic-native/firebase": "^4.5.3", 25 | "@ionic-native/splash-screen": "4.4.0", 26 | "@ionic-native/status-bar": "4.4.0", 27 | "@ionic/pro": "1.0.20", 28 | "@ionic/storage": "2.1.3", 29 | "angularfire2": "^5.0.0-rc.6", 30 | "cordova-android": "6.3.0", 31 | "cordova-ios": "4.5.4", 32 | "cordova-plugin-device": "^2.0.1", 33 | "cordova-plugin-firebase": "^0.1.25", 34 | "cordova-plugin-ionic-keyboard": "^2.0.5", 35 | "cordova-plugin-ionic-webview": "^1.1.16", 36 | "cordova-plugin-splashscreen": "^5.0.2", 37 | "cordova-plugin-whitelist": "^1.3.3", 38 | "firebase": "^4.11.0", 39 | "ionic-angular": "3.9.2", 40 | "ionicons": "3.0.0", 41 | "rxjs": "5.5.2", 42 | "sw-toolbox": "3.6.0", 43 | "zone.js": "0.8.18" 44 | }, 45 | "devDependencies": { 46 | "@ionic/app-scripts": "3.1.8", 47 | "typescript": "2.4.2" 48 | }, 49 | "description": "An Ionic project", 50 | "cordova": { 51 | "plugins": { 52 | "cordova-plugin-whitelist": {}, 53 | "cordova-plugin-device": {}, 54 | "cordova-plugin-splashscreen": {}, 55 | "cordova-plugin-ionic-webview": {}, 56 | "cordova-plugin-ionic-keyboard": {}, 57 | "cordova-plugin-firebase": {} 58 | }, 59 | "platforms": [ 60 | "android", 61 | "ios" 62 | ] 63 | } 64 | } -------------------------------------------------------------------------------- /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/AngularFirebase/93-fcm-ionic-demo/ea9cc7bb984b38ad7db367ce68c5ba55ee796cfa/resources/android/icon/drawable-hdpi-icon.png -------------------------------------------------------------------------------- /resources/android/icon/drawable-ldpi-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AngularFirebase/93-fcm-ionic-demo/ea9cc7bb984b38ad7db367ce68c5ba55ee796cfa/resources/android/icon/drawable-ldpi-icon.png -------------------------------------------------------------------------------- /resources/android/icon/drawable-mdpi-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AngularFirebase/93-fcm-ionic-demo/ea9cc7bb984b38ad7db367ce68c5ba55ee796cfa/resources/android/icon/drawable-mdpi-icon.png -------------------------------------------------------------------------------- /resources/android/icon/drawable-xhdpi-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AngularFirebase/93-fcm-ionic-demo/ea9cc7bb984b38ad7db367ce68c5ba55ee796cfa/resources/android/icon/drawable-xhdpi-icon.png -------------------------------------------------------------------------------- /resources/android/icon/drawable-xxhdpi-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AngularFirebase/93-fcm-ionic-demo/ea9cc7bb984b38ad7db367ce68c5ba55ee796cfa/resources/android/icon/drawable-xxhdpi-icon.png -------------------------------------------------------------------------------- /resources/android/icon/drawable-xxxhdpi-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AngularFirebase/93-fcm-ionic-demo/ea9cc7bb984b38ad7db367ce68c5ba55ee796cfa/resources/android/icon/drawable-xxxhdpi-icon.png -------------------------------------------------------------------------------- /resources/android/splash/drawable-land-hdpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AngularFirebase/93-fcm-ionic-demo/ea9cc7bb984b38ad7db367ce68c5ba55ee796cfa/resources/android/splash/drawable-land-hdpi-screen.png -------------------------------------------------------------------------------- /resources/android/splash/drawable-land-ldpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AngularFirebase/93-fcm-ionic-demo/ea9cc7bb984b38ad7db367ce68c5ba55ee796cfa/resources/android/splash/drawable-land-ldpi-screen.png -------------------------------------------------------------------------------- /resources/android/splash/drawable-land-mdpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AngularFirebase/93-fcm-ionic-demo/ea9cc7bb984b38ad7db367ce68c5ba55ee796cfa/resources/android/splash/drawable-land-mdpi-screen.png -------------------------------------------------------------------------------- /resources/android/splash/drawable-land-xhdpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AngularFirebase/93-fcm-ionic-demo/ea9cc7bb984b38ad7db367ce68c5ba55ee796cfa/resources/android/splash/drawable-land-xhdpi-screen.png -------------------------------------------------------------------------------- /resources/android/splash/drawable-land-xxhdpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AngularFirebase/93-fcm-ionic-demo/ea9cc7bb984b38ad7db367ce68c5ba55ee796cfa/resources/android/splash/drawable-land-xxhdpi-screen.png -------------------------------------------------------------------------------- /resources/android/splash/drawable-land-xxxhdpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AngularFirebase/93-fcm-ionic-demo/ea9cc7bb984b38ad7db367ce68c5ba55ee796cfa/resources/android/splash/drawable-land-xxxhdpi-screen.png -------------------------------------------------------------------------------- /resources/android/splash/drawable-port-hdpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AngularFirebase/93-fcm-ionic-demo/ea9cc7bb984b38ad7db367ce68c5ba55ee796cfa/resources/android/splash/drawable-port-hdpi-screen.png -------------------------------------------------------------------------------- /resources/android/splash/drawable-port-ldpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AngularFirebase/93-fcm-ionic-demo/ea9cc7bb984b38ad7db367ce68c5ba55ee796cfa/resources/android/splash/drawable-port-ldpi-screen.png -------------------------------------------------------------------------------- /resources/android/splash/drawable-port-mdpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AngularFirebase/93-fcm-ionic-demo/ea9cc7bb984b38ad7db367ce68c5ba55ee796cfa/resources/android/splash/drawable-port-mdpi-screen.png -------------------------------------------------------------------------------- /resources/android/splash/drawable-port-xhdpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AngularFirebase/93-fcm-ionic-demo/ea9cc7bb984b38ad7db367ce68c5ba55ee796cfa/resources/android/splash/drawable-port-xhdpi-screen.png -------------------------------------------------------------------------------- /resources/android/splash/drawable-port-xxhdpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AngularFirebase/93-fcm-ionic-demo/ea9cc7bb984b38ad7db367ce68c5ba55ee796cfa/resources/android/splash/drawable-port-xxhdpi-screen.png -------------------------------------------------------------------------------- /resources/android/splash/drawable-port-xxxhdpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AngularFirebase/93-fcm-ionic-demo/ea9cc7bb984b38ad7db367ce68c5ba55ee796cfa/resources/android/splash/drawable-port-xxxhdpi-screen.png -------------------------------------------------------------------------------- /resources/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AngularFirebase/93-fcm-ionic-demo/ea9cc7bb984b38ad7db367ce68c5ba55ee796cfa/resources/icon.png -------------------------------------------------------------------------------- /resources/icon.png.md5: -------------------------------------------------------------------------------- 1 | 3f1bbdf1aefcb5ce7b60770ce907c68f -------------------------------------------------------------------------------- /resources/ios/icon/icon-1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AngularFirebase/93-fcm-ionic-demo/ea9cc7bb984b38ad7db367ce68c5ba55ee796cfa/resources/ios/icon/icon-1024.png -------------------------------------------------------------------------------- /resources/ios/icon/icon-40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AngularFirebase/93-fcm-ionic-demo/ea9cc7bb984b38ad7db367ce68c5ba55ee796cfa/resources/ios/icon/icon-40.png -------------------------------------------------------------------------------- /resources/ios/icon/icon-40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AngularFirebase/93-fcm-ionic-demo/ea9cc7bb984b38ad7db367ce68c5ba55ee796cfa/resources/ios/icon/icon-40@2x.png -------------------------------------------------------------------------------- /resources/ios/icon/icon-40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AngularFirebase/93-fcm-ionic-demo/ea9cc7bb984b38ad7db367ce68c5ba55ee796cfa/resources/ios/icon/icon-40@3x.png -------------------------------------------------------------------------------- /resources/ios/icon/icon-50.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AngularFirebase/93-fcm-ionic-demo/ea9cc7bb984b38ad7db367ce68c5ba55ee796cfa/resources/ios/icon/icon-50.png -------------------------------------------------------------------------------- /resources/ios/icon/icon-50@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AngularFirebase/93-fcm-ionic-demo/ea9cc7bb984b38ad7db367ce68c5ba55ee796cfa/resources/ios/icon/icon-50@2x.png -------------------------------------------------------------------------------- /resources/ios/icon/icon-60.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AngularFirebase/93-fcm-ionic-demo/ea9cc7bb984b38ad7db367ce68c5ba55ee796cfa/resources/ios/icon/icon-60.png -------------------------------------------------------------------------------- /resources/ios/icon/icon-60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AngularFirebase/93-fcm-ionic-demo/ea9cc7bb984b38ad7db367ce68c5ba55ee796cfa/resources/ios/icon/icon-60@2x.png -------------------------------------------------------------------------------- /resources/ios/icon/icon-60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AngularFirebase/93-fcm-ionic-demo/ea9cc7bb984b38ad7db367ce68c5ba55ee796cfa/resources/ios/icon/icon-60@3x.png -------------------------------------------------------------------------------- /resources/ios/icon/icon-72.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AngularFirebase/93-fcm-ionic-demo/ea9cc7bb984b38ad7db367ce68c5ba55ee796cfa/resources/ios/icon/icon-72.png -------------------------------------------------------------------------------- /resources/ios/icon/icon-72@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AngularFirebase/93-fcm-ionic-demo/ea9cc7bb984b38ad7db367ce68c5ba55ee796cfa/resources/ios/icon/icon-72@2x.png -------------------------------------------------------------------------------- /resources/ios/icon/icon-76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AngularFirebase/93-fcm-ionic-demo/ea9cc7bb984b38ad7db367ce68c5ba55ee796cfa/resources/ios/icon/icon-76.png -------------------------------------------------------------------------------- /resources/ios/icon/icon-76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AngularFirebase/93-fcm-ionic-demo/ea9cc7bb984b38ad7db367ce68c5ba55ee796cfa/resources/ios/icon/icon-76@2x.png -------------------------------------------------------------------------------- /resources/ios/icon/icon-83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AngularFirebase/93-fcm-ionic-demo/ea9cc7bb984b38ad7db367ce68c5ba55ee796cfa/resources/ios/icon/icon-83.5@2x.png -------------------------------------------------------------------------------- /resources/ios/icon/icon-small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AngularFirebase/93-fcm-ionic-demo/ea9cc7bb984b38ad7db367ce68c5ba55ee796cfa/resources/ios/icon/icon-small.png -------------------------------------------------------------------------------- /resources/ios/icon/icon-small@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AngularFirebase/93-fcm-ionic-demo/ea9cc7bb984b38ad7db367ce68c5ba55ee796cfa/resources/ios/icon/icon-small@2x.png -------------------------------------------------------------------------------- /resources/ios/icon/icon-small@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AngularFirebase/93-fcm-ionic-demo/ea9cc7bb984b38ad7db367ce68c5ba55ee796cfa/resources/ios/icon/icon-small@3x.png -------------------------------------------------------------------------------- /resources/ios/icon/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AngularFirebase/93-fcm-ionic-demo/ea9cc7bb984b38ad7db367ce68c5ba55ee796cfa/resources/ios/icon/icon.png -------------------------------------------------------------------------------- /resources/ios/icon/icon@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AngularFirebase/93-fcm-ionic-demo/ea9cc7bb984b38ad7db367ce68c5ba55ee796cfa/resources/ios/icon/icon@2x.png -------------------------------------------------------------------------------- /resources/ios/splash/Default-568h@2x~iphone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AngularFirebase/93-fcm-ionic-demo/ea9cc7bb984b38ad7db367ce68c5ba55ee796cfa/resources/ios/splash/Default-568h@2x~iphone.png -------------------------------------------------------------------------------- /resources/ios/splash/Default-667h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AngularFirebase/93-fcm-ionic-demo/ea9cc7bb984b38ad7db367ce68c5ba55ee796cfa/resources/ios/splash/Default-667h.png -------------------------------------------------------------------------------- /resources/ios/splash/Default-736h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AngularFirebase/93-fcm-ionic-demo/ea9cc7bb984b38ad7db367ce68c5ba55ee796cfa/resources/ios/splash/Default-736h.png -------------------------------------------------------------------------------- /resources/ios/splash/Default-Landscape-736h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AngularFirebase/93-fcm-ionic-demo/ea9cc7bb984b38ad7db367ce68c5ba55ee796cfa/resources/ios/splash/Default-Landscape-736h.png -------------------------------------------------------------------------------- /resources/ios/splash/Default-Landscape@2x~ipad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AngularFirebase/93-fcm-ionic-demo/ea9cc7bb984b38ad7db367ce68c5ba55ee796cfa/resources/ios/splash/Default-Landscape@2x~ipad.png -------------------------------------------------------------------------------- /resources/ios/splash/Default-Landscape@~ipadpro.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AngularFirebase/93-fcm-ionic-demo/ea9cc7bb984b38ad7db367ce68c5ba55ee796cfa/resources/ios/splash/Default-Landscape@~ipadpro.png -------------------------------------------------------------------------------- /resources/ios/splash/Default-Landscape~ipad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AngularFirebase/93-fcm-ionic-demo/ea9cc7bb984b38ad7db367ce68c5ba55ee796cfa/resources/ios/splash/Default-Landscape~ipad.png -------------------------------------------------------------------------------- /resources/ios/splash/Default-Portrait@2x~ipad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AngularFirebase/93-fcm-ionic-demo/ea9cc7bb984b38ad7db367ce68c5ba55ee796cfa/resources/ios/splash/Default-Portrait@2x~ipad.png -------------------------------------------------------------------------------- /resources/ios/splash/Default-Portrait@~ipadpro.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AngularFirebase/93-fcm-ionic-demo/ea9cc7bb984b38ad7db367ce68c5ba55ee796cfa/resources/ios/splash/Default-Portrait@~ipadpro.png -------------------------------------------------------------------------------- /resources/ios/splash/Default-Portrait~ipad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AngularFirebase/93-fcm-ionic-demo/ea9cc7bb984b38ad7db367ce68c5ba55ee796cfa/resources/ios/splash/Default-Portrait~ipad.png -------------------------------------------------------------------------------- /resources/ios/splash/Default@2x~iphone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AngularFirebase/93-fcm-ionic-demo/ea9cc7bb984b38ad7db367ce68c5ba55ee796cfa/resources/ios/splash/Default@2x~iphone.png -------------------------------------------------------------------------------- /resources/ios/splash/Default@2x~universal~anyany.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AngularFirebase/93-fcm-ionic-demo/ea9cc7bb984b38ad7db367ce68c5ba55ee796cfa/resources/ios/splash/Default@2x~universal~anyany.png -------------------------------------------------------------------------------- /resources/ios/splash/Default~iphone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AngularFirebase/93-fcm-ionic-demo/ea9cc7bb984b38ad7db367ce68c5ba55ee796cfa/resources/ios/splash/Default~iphone.png -------------------------------------------------------------------------------- /resources/splash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AngularFirebase/93-fcm-ionic-demo/ea9cc7bb984b38ad7db367ce68c5ba55ee796cfa/resources/splash.png -------------------------------------------------------------------------------- /resources/splash.png.md5: -------------------------------------------------------------------------------- 1 | 2412a8324a656ec5993eb50b3b293c69 -------------------------------------------------------------------------------- /src/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | import { Platform } from 'ionic-angular'; 3 | import { StatusBar } from '@ionic-native/status-bar'; 4 | import { SplashScreen } from '@ionic-native/splash-screen'; 5 | import { TabsPage } from '../pages/tabs/tabs'; 6 | 7 | 8 | 9 | @Component({ 10 | templateUrl: 'app.html' 11 | }) 12 | export class MyApp { 13 | rootPage:any = TabsPage; 14 | 15 | constructor(platform: Platform, statusBar: StatusBar, splashScreen: SplashScreen) { 16 | platform.ready().then(() => { 17 | // Okay, so the platform is ready and our plugins are available. 18 | // Here you can do any higher level native things you might need. 19 | statusBar.styleDefault(); 20 | splashScreen.hide(); 21 | }); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/app/app.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/app/app.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule, ErrorHandler } from '@angular/core'; 2 | import { BrowserModule } from '@angular/platform-browser'; 3 | import { IonicApp, IonicModule, IonicErrorHandler } from 'ionic-angular'; 4 | import { MyApp } from './app.component'; 5 | 6 | import { AboutPage } from '../pages/about/about'; 7 | import { ContactPage } from '../pages/contact/contact'; 8 | import { HomePage } from '../pages/home/home'; 9 | import { TabsPage } from '../pages/tabs/tabs'; 10 | 11 | import { StatusBar } from '@ionic-native/status-bar'; 12 | import { SplashScreen } from '@ionic-native/splash-screen'; 13 | 14 | 15 | import { AngularFireModule } from 'angularfire2'; 16 | import { AngularFirestoreModule } from 'angularfire2/firestore'; 17 | import { AngularFireStorageModule } from 'angularfire2/storage'; 18 | import { AngularFireAuthModule } from 'angularfire2/auth'; 19 | 20 | const firebase = { 21 | // your firebase web config 22 | } 23 | 24 | import { Firebase } from '@ionic-native/firebase'; 25 | import { FcmProvider } from '../providers/fcm/fcm'; 26 | 27 | @NgModule({ 28 | declarations: [ 29 | MyApp, 30 | AboutPage, 31 | ContactPage, 32 | HomePage, 33 | TabsPage 34 | ], 35 | imports: [ 36 | BrowserModule, 37 | IonicModule.forRoot(MyApp), 38 | AngularFireModule.initializeApp(firebase), 39 | AngularFirestoreModule, 40 | ], 41 | bootstrap: [IonicApp], 42 | entryComponents: [ 43 | MyApp, 44 | AboutPage, 45 | ContactPage, 46 | HomePage, 47 | TabsPage 48 | ], 49 | providers: [ 50 | StatusBar, 51 | SplashScreen, 52 | Firebase, 53 | {provide: ErrorHandler, useClass: IonicErrorHandler}, 54 | FcmProvider, 55 | 56 | ] 57 | }) 58 | export class AppModule {} 59 | -------------------------------------------------------------------------------- /src/app/app.scss: -------------------------------------------------------------------------------- 1 | // http://ionicframework.com/docs/theming/ 2 | 3 | 4 | // App Global Sass 5 | // -------------------------------------------------- 6 | // Put style rules here that you want to apply globally. These 7 | // styles are for the entire app and not just one component. 8 | // Additionally, this file can be also used as an entry point 9 | // to import other Sass files to be included in the output CSS. 10 | // 11 | // Shared Sass variables, which can be used to adjust Ionic's 12 | // default Sass variables, belong in "theme/variables.scss". 13 | // 14 | // To declare rules for a specific mode, create a child rule 15 | // for the .md, .ios, or .wp mode classes. The mode class is 16 | // automatically applied to the element in the app. 17 | -------------------------------------------------------------------------------- /src/app/main.ts: -------------------------------------------------------------------------------- 1 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 2 | 3 | import { AppModule } from './app.module'; 4 | 5 | platformBrowserDynamic().bootstrapModule(AppModule); 6 | -------------------------------------------------------------------------------- /src/assets/icon/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AngularFirebase/93-fcm-ionic-demo/ea9cc7bb984b38ad7db367ce68c5ba55ee796cfa/src/assets/icon/favicon.ico -------------------------------------------------------------------------------- /src/assets/imgs/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AngularFirebase/93-fcm-ionic-demo/ea9cc7bb984b38ad7db367ce68c5ba55ee796cfa/src/assets/imgs/logo.png -------------------------------------------------------------------------------- /src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Ionic App 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /src/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Ionic", 3 | "short_name": "Ionic", 4 | "start_url": "index.html", 5 | "display": "standalone", 6 | "icons": [{ 7 | "src": "assets/imgs/logo.png", 8 | "sizes": "512x512", 9 | "type": "image/png" 10 | }], 11 | "background_color": "#4e8ef7", 12 | "theme_color": "#4e8ef7" 13 | } -------------------------------------------------------------------------------- /src/pages/about/about.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | About 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/pages/about/about.scss: -------------------------------------------------------------------------------- 1 | page-about { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /src/pages/about/about.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | import { NavController } from 'ionic-angular'; 3 | 4 | @Component({ 5 | selector: 'page-about', 6 | templateUrl: 'about.html' 7 | }) 8 | export class AboutPage { 9 | 10 | constructor(public navCtrl: NavController) { 11 | 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /src/pages/contact/contact.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Contact 5 | 6 | 7 | 8 | 9 | 10 | 11 | Follow us on Twitter 12 | 13 | 14 | @ionicframework 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/pages/contact/contact.scss: -------------------------------------------------------------------------------- 1 | page-contact { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /src/pages/contact/contact.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | import { NavController } from 'ionic-angular'; 3 | 4 | @Component({ 5 | selector: 'page-contact', 6 | templateUrl: 'contact.html' 7 | }) 8 | export class ContactPage { 9 | 10 | constructor(public navCtrl: NavController) { 11 | 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /src/pages/home/home.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Home 4 | 5 | 6 | 7 | 8 |

Welcome to Ionic!

9 |

10 | This starter project comes with simple tabs-based layout for apps 11 | that are going to primarily use a Tabbed UI. 12 |

13 |

14 | Take a look at the src/pages/ directory to add or change tabs, 15 | update any existing page or create new pages. 16 |

17 | 18 |
19 | -------------------------------------------------------------------------------- /src/pages/home/home.scss: -------------------------------------------------------------------------------- 1 | page-home { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /src/pages/home/home.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | import { NavController } from 'ionic-angular'; 3 | import { FcmProvider } from '../../providers/fcm/fcm'; 4 | 5 | import { ToastController } from 'ionic-angular'; 6 | import { Subject } from 'rxjs/Subject'; 7 | import { tap } from 'rxjs/operators'; 8 | 9 | @Component({ 10 | selector: 'page-home', 11 | templateUrl: 'home.html' 12 | }) 13 | export class HomePage { 14 | 15 | constructor(public fcm: FcmProvider, public toastCtrl: ToastController) {} 16 | 17 | ionViewDidLoad(){ 18 | 19 | // Get a FCM token 20 | this.fcm.getToken() 21 | 22 | this.fcm.listenToNotifications().pipe( 23 | tap(msg => { 24 | const toast = this.toastCtrl.create({ 25 | message: msg.body, 26 | duration: 3000 27 | }); 28 | toast.present(); 29 | }) 30 | ) 31 | .subscribe() 32 | } 33 | 34 | 35 | 36 | } 37 | -------------------------------------------------------------------------------- /src/pages/tabs/tabs.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/pages/tabs/tabs.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | import { AboutPage } from '../about/about'; 4 | import { ContactPage } from '../contact/contact'; 5 | import { HomePage } from '../home/home'; 6 | 7 | @Component({ 8 | templateUrl: 'tabs.html' 9 | }) 10 | export class TabsPage { 11 | 12 | tab1Root = HomePage; 13 | tab2Root = AboutPage; 14 | tab3Root = ContactPage; 15 | 16 | constructor() { 17 | 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/providers/fcm/fcm.ts: -------------------------------------------------------------------------------- 1 | import { HttpClient } from '@angular/common/http'; 2 | import { Injectable } from '@angular/core'; 3 | import { Firebase } from '@ionic-native/firebase'; 4 | import { Platform } from 'ionic-angular'; 5 | import { AngularFirestore } from 'angularfire2/firestore'; 6 | 7 | 8 | @Injectable() 9 | export class FcmProvider { 10 | 11 | constructor( 12 | public firebaseNative: Firebase, 13 | public afs: AngularFirestore, 14 | private platform: Platform 15 | ) {} 16 | 17 | async getToken() { 18 | 19 | let token; 20 | 21 | if (this.platform.is('android')) { 22 | 23 | token = await this.firebaseNative.getToken() 24 | } 25 | 26 | if (this.platform.is('ios')) { 27 | token = await this.firebaseNative.getToken(); 28 | const perm = await this.firebaseNative.grantPermission(); 29 | } 30 | 31 | // Is not cordova == web PWA 32 | if (!this.platform.is('cordova')) { 33 | // TODO add PWA support with angularfire2 34 | } 35 | 36 | return this.saveTokenToFirestore(token) 37 | } 38 | 39 | private saveTokenToFirestore(token) { 40 | if (!token) return; 41 | const devicesRef = this.afs.collection('devices') 42 | 43 | const docData = { 44 | token, 45 | userId: 'testUser', 46 | } 47 | 48 | return devicesRef.doc(token).set(docData) 49 | } 50 | 51 | listenToNotifications() { 52 | return this.firebaseNative.onNotificationOpen() 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /src/service-worker.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Check out https://googlechromelabs.github.io/sw-toolbox/ for 3 | * more info on how to use sw-toolbox to custom configure your service worker. 4 | */ 5 | 6 | 7 | 'use strict'; 8 | importScripts('./build/sw-toolbox.js'); 9 | 10 | self.toolbox.options.cache = { 11 | name: 'ionic-cache' 12 | }; 13 | 14 | // pre-cache our key assets 15 | self.toolbox.precache( 16 | [ 17 | './build/main.js', 18 | './build/vendor.js', 19 | './build/main.css', 20 | './build/polyfills.js', 21 | 'index.html', 22 | 'manifest.json' 23 | ] 24 | ); 25 | 26 | // dynamically cache any other local assets 27 | self.toolbox.router.any('/*', self.toolbox.fastest); 28 | 29 | // for any other requests go to the network, cache, 30 | // and then only use that cached resource if your user goes offline 31 | self.toolbox.router.default = self.toolbox.networkFirst; 32 | -------------------------------------------------------------------------------- /src/theme/variables.scss: -------------------------------------------------------------------------------- 1 | // Ionic Variables and Theming. For more info, please see: 2 | // http://ionicframework.com/docs/theming/ 3 | 4 | // Font path is used to include ionicons, 5 | // roboto, and noto sans fonts 6 | $font-path: "../assets/fonts"; 7 | 8 | 9 | // The app direction is used to include 10 | // rtl styles in your app. For more info, please see: 11 | // http://ionicframework.com/docs/theming/rtl-support/ 12 | $app-direction: ltr; 13 | 14 | 15 | @import "ionic.globals"; 16 | 17 | 18 | // Shared Variables 19 | // -------------------------------------------------- 20 | // To customize the look and feel of this app, you can override 21 | // the Sass variables found in Ionic's source scss files. 22 | // To view all the possible Ionic variables, see: 23 | // http://ionicframework.com/docs/theming/overriding-ionic-variables/ 24 | 25 | 26 | 27 | 28 | // Named Color Variables 29 | // -------------------------------------------------- 30 | // Named colors makes it easy to reuse colors on various components. 31 | // It's highly recommended to change the default colors 32 | // to match your app's branding. Ionic uses a Sass map of 33 | // colors so you can add, rename and remove colors as needed. 34 | // The "primary" color is the only required color in the map. 35 | 36 | $colors: ( 37 | primary: #488aff, 38 | secondary: #32db64, 39 | danger: #f53d3d, 40 | light: #f4f4f4, 41 | dark: #222 42 | ); 43 | 44 | 45 | // App iOS Variables 46 | // -------------------------------------------------- 47 | // iOS only Sass variables can go here 48 | 49 | 50 | 51 | 52 | // App Material Design Variables 53 | // -------------------------------------------------- 54 | // Material Design only Sass variables can go here 55 | 56 | 57 | 58 | 59 | // App Windows Variables 60 | // -------------------------------------------------- 61 | // Windows only Sass variables can go here 62 | 63 | 64 | 65 | 66 | // App Theme 67 | // -------------------------------------------------- 68 | // Ionic apps can have different themes applied, which can 69 | // then be future customized. This import comes last 70 | // so that the above variables are used and Ionic's 71 | // default are overridden. 72 | 73 | @import "ionic.theme.default"; 74 | 75 | 76 | // Ionicons 77 | // -------------------------------------------------- 78 | // The premium icon font for Ionic. For more info, please see: 79 | // http://ionicframework.com/docs/ionicons/ 80 | 81 | @import "ionic.ionicons"; 82 | 83 | 84 | // Fonts 85 | // -------------------------------------------------- 86 | 87 | @import "roboto"; 88 | @import "noto-sans"; 89 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "allowSyntheticDefaultImports": true, 4 | "declaration": false, 5 | "emitDecoratorMetadata": true, 6 | "experimentalDecorators": true, 7 | "lib": [ 8 | "dom", 9 | "es2015" 10 | ], 11 | "module": "es2015", 12 | "moduleResolution": "node", 13 | "sourceMap": true, 14 | "target": "es5" 15 | }, 16 | "include": [ 17 | "src/**/*.ts" 18 | ], 19 | "exclude": [ 20 | "node_modules", 21 | "src/**/*.spec.ts", 22 | "src/**/__tests__/*.ts" 23 | ], 24 | "compileOnSave": false, 25 | "atom": { 26 | "rewriteTsconfig": false 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "no-duplicate-variable": true, 4 | "no-unused-variable": [ 5 | true 6 | ] 7 | }, 8 | "rulesDirectory": [ 9 | "node_modules/tslint-eslint-rules/dist/rules" 10 | ] 11 | } 12 | --------------------------------------------------------------------------------