├── .bowerrc ├── .gitignore ├── LICENSE ├── README.md ├── bower.json ├── config.xml ├── gulpfile.js ├── hooks └── README.md ├── ionic.config.json ├── ionic.project ├── package.json ├── resources ├── 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 ├── ios │ ├── icon │ │ ├── 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~iphone.png └── splash.png ├── scss └── ionic.app.scss ├── src ├── app │ ├── app.component.ts │ ├── app.html │ ├── app.module.ts │ ├── app.scss │ └── main.ts ├── assets │ └── icon │ │ └── favicon.ico ├── index.html ├── manifest.json ├── pages │ ├── .DS_Store │ ├── home │ │ ├── home.html │ │ ├── home.scss │ │ └── home.ts │ └── otherpage │ │ ├── .DS_Store │ │ ├── otherpage.html │ │ └── otherpage.ts ├── service-worker.js └── theme │ └── variables.scss ├── tsconfig.json ├── tslint.json └── www ├── .gitkeep ├── assets ├── fonts │ ├── ionicons.woff │ ├── ionicons.woff2 │ ├── roboto-bold.woff │ ├── roboto-bold.woff2 │ ├── roboto-light.woff │ ├── roboto-light.woff2 │ ├── roboto-medium.woff │ ├── roboto-medium.woff2 │ ├── roboto-regular.woff │ └── roboto-regular.woff2 └── icon │ └── favicon.ico ├── build ├── main.css ├── main.css.map ├── main.js ├── main.js.map ├── polyfills.js ├── sw-toolbox.js ├── vendor.js └── vendor.js.map ├── index.html ├── manifest.json └── service-worker.js /.bowerrc: -------------------------------------------------------------------------------- 1 | { 2 | "directory": "www/lib" 3 | } 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Specifies intentionally untracked files to ignore when using Git 2 | # http://git-scm.com/docs/gitignore 3 | 4 | node_modules/ 5 | platforms/ 6 | plugins/ 7 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Modified MIT License 2 | 3 | Copyright 2022 OneSignal 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | 1. The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | 2. All copies of substantial portions of the Software may only be used in connection 16 | with services provided by OneSignal. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | THE SOFTWARE. 25 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## OneSignal Ionic 2+ Example 2 | 3 | 1. To build the example first run `ionic cordova platform add android` or `ionic cordova platform add ios`. 4 | 2. Next run `ionic cordova plugin add onesignal-cordova-plugin` 5 | 3. Open `src/app/app.component.ts` and update `"5c9ca215-e7c5-4214-8a45-6f2e1b84c12f"` with your OneSignal App Id. 6 | 4. Build then run the app on your device. 7 | 8 | #### Ionic v1 Example 9 | See our [Ionic v1 branch](https://github.com/OneSignal/OneSignal-Ionic-Example/tree/ionic_v1) if you are still mantaining an older project. 10 | 11 | ### Full Setup Guide 12 | See [OneSignal's Ionic SDK Setup](https://documentation.onesignal.com/docs/ionic-sdk-setup) guide for full instructions on adding to your existing project. 13 | -------------------------------------------------------------------------------- /bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "IonicOneSignalExample", 3 | "private": "true", 4 | "devDependencies": { 5 | "ionic": "driftyco/ionic-bower#1.1.1" 6 | } 7 | } -------------------------------------------------------------------------------- /config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | MyApp 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 | -------------------------------------------------------------------------------- /gulpfile.js: -------------------------------------------------------------------------------- 1 | var gulp = require('gulp'); 2 | var gutil = require('gulp-util'); 3 | var bower = require('bower'); 4 | var concat = require('gulp-concat'); 5 | var sass = require('gulp-sass'); 6 | var minifyCss = require('gulp-minify-css'); 7 | var rename = require('gulp-rename'); 8 | var sh = require('shelljs'); 9 | 10 | var paths = { 11 | sass: ['./scss/**/*.scss'] 12 | }; 13 | 14 | gulp.task('default', ['sass']); 15 | 16 | gulp.task('sass', function(done) { 17 | gulp.src('./scss/ionic.app.scss') 18 | .pipe(sass({ 19 | errLogToConsole: true 20 | })) 21 | .pipe(gulp.dest('./www/css/')) 22 | .pipe(minifyCss({ 23 | keepSpecialComments: 0 24 | })) 25 | .pipe(rename({ extname: '.min.css' })) 26 | .pipe(gulp.dest('./www/css/')) 27 | .on('end', done); 28 | }); 29 | 30 | gulp.task('watch', function() { 31 | gulp.watch(paths.sass, ['sass']); 32 | }); 33 | 34 | gulp.task('install', ['git-check'], function() { 35 | return bower.commands.install() 36 | .on('log', function(data) { 37 | gutil.log('bower', gutil.colors.cyan(data.id), data.message); 38 | }); 39 | }); 40 | 41 | gulp.task('git-check', function(done) { 42 | if (!sh.which('git')) { 43 | console.log( 44 | ' ' + gutil.colors.red('Git is not installed.'), 45 | '\n Git, the version control system, is required to download Ionic.', 46 | '\n Download git here:', gutil.colors.cyan('http://git-scm.com/downloads') + '.', 47 | '\n Once git is installed, run \'' + gutil.colors.cyan('gulp install') + '\' again.' 48 | ); 49 | process.exit(1); 50 | } 51 | done(); 52 | }); 53 | -------------------------------------------------------------------------------- /hooks/README.md: -------------------------------------------------------------------------------- 1 | 21 | # Cordova Hooks 22 | 23 | Cordova Hooks represent special scripts which could be added by application and plugin developers or even by your own build system to customize cordova commands. Hook scripts could be defined by adding them to the special predefined folder (`/hooks`) or via configuration files (`config.xml` and `plugin.xml`) and run serially in the following order: 24 | * Application hooks from `/hooks`; 25 | * Application hooks from `config.xml`; 26 | * Plugin hooks from `plugins/.../plugin.xml`. 27 | 28 | __Remember__: Make your scripts executable. 29 | 30 | __Note__: `.cordova/hooks` directory is also supported for backward compatibility, but we don't recommend using it as it is deprecated. 31 | 32 | ## Supported hook types 33 | The following hook types are supported: 34 | 35 | after_build/ 36 | after_compile/ 37 | after_docs/ 38 | after_emulate/ 39 | after_platform_add/ 40 | after_platform_rm/ 41 | after_platform_ls/ 42 | after_plugin_add/ 43 | after_plugin_ls/ 44 | after_plugin_rm/ 45 | after_plugin_search/ 46 | after_plugin_install/ <-- Plugin hooks defined in plugin.xml are executed exclusively for a plugin being installed 47 | after_prepare/ 48 | after_run/ 49 | after_serve/ 50 | before_build/ 51 | before_compile/ 52 | before_docs/ 53 | before_emulate/ 54 | before_platform_add/ 55 | before_platform_rm/ 56 | before_platform_ls/ 57 | before_plugin_add/ 58 | before_plugin_ls/ 59 | before_plugin_rm/ 60 | before_plugin_search/ 61 | before_plugin_install/ <-- Plugin hooks defined in plugin.xml are executed exclusively for a plugin being installed 62 | before_plugin_uninstall/ <-- Plugin hooks defined in plugin.xml are executed exclusively for a plugin being uninstalled 63 | before_prepare/ 64 | before_run/ 65 | before_serve/ 66 | pre_package/ <-- Windows 8 and Windows Phone only. 67 | 68 | ## Ways to define hooks 69 | ### Via '/hooks' directory 70 | To execute custom action when corresponding hook type is fired, use hook type as a name for a subfolder inside 'hooks' directory and place you script file here, for example: 71 | 72 | # script file will be automatically executed after each build 73 | hooks/after_build/after_build_custom_action.js 74 | 75 | 76 | ### Config.xml 77 | 78 | Hooks can be defined in project's `config.xml` using `` elements, for example: 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | ... 89 | 90 | 91 | 92 | 93 | 94 | 95 | ... 96 | 97 | 98 | ### Plugin hooks (plugin.xml) 99 | 100 | As a plugin developer you can define hook scripts using `` elements in a `plugin.xml` like that: 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | ... 109 | 110 | 111 | `before_plugin_install`, `after_plugin_install`, `before_plugin_uninstall` plugin hooks will be fired exclusively for the plugin being installed/uninstalled. 112 | 113 | ## Script Interface 114 | 115 | ### Javascript 116 | 117 | If you are writing hooks in Javascript you should use the following module definition: 118 | ```javascript 119 | module.exports = function(context) { 120 | ... 121 | } 122 | ``` 123 | 124 | You can make your scipts async using Q: 125 | ```javascript 126 | module.exports = function(context) { 127 | var Q = context.requireCordovaModule('q'); 128 | var deferral = new Q.defer(); 129 | 130 | setTimeout(function(){ 131 | console.log('hook.js>> end'); 132 | deferral.resolve(); 133 | }, 1000); 134 | 135 | return deferral.promise; 136 | } 137 | ``` 138 | 139 | `context` object contains hook type, executed script full path, hook options, command-line arguments passed to Cordova and top-level "cordova" object: 140 | ```json 141 | { 142 | "hook": "before_plugin_install", 143 | "scriptLocation": "c:\\script\\full\\path\\appBeforePluginInstall.js", 144 | "cmdLine": "The\\exact\\command\\cordova\\run\\with arguments", 145 | "opts": { 146 | "projectRoot":"C:\\path\\to\\the\\project", 147 | "cordova": { 148 | "platforms": ["wp8"], 149 | "plugins": ["com.plugin.withhooks"], 150 | "version": "0.21.7-dev" 151 | }, 152 | "plugin": { 153 | "id": "com.plugin.withhooks", 154 | "pluginInfo": { 155 | ... 156 | }, 157 | "platform": "wp8", 158 | "dir": "C:\\path\\to\\the\\project\\plugins\\com.plugin.withhooks" 159 | } 160 | }, 161 | "cordova": {...} 162 | } 163 | 164 | ``` 165 | `context.opts.plugin` object will only be passed to plugin hooks scripts. 166 | 167 | You can also require additional Cordova modules in your script using `context.requireCordovaModule` in the following way: 168 | ```javascript 169 | var Q = context.requireCordovaModule('q'); 170 | ``` 171 | 172 | __Note__: new module loader script interface is used for the `.js` files defined via `config.xml` or `plugin.xml` only. 173 | For compatibility reasons hook files specified via `/hooks` folders are run via Node child_process spawn, see 'Non-javascript' section below. 174 | 175 | ### Non-javascript 176 | 177 | Non-javascript scripts are run via Node child_process spawn from the project's root directory and have the root directory passes as the first argument. All other options are passed to the script using environment variables: 178 | 179 | * CORDOVA_VERSION - The version of the Cordova-CLI. 180 | * CORDOVA_PLATFORMS - Comma separated list of platforms that the command applies to (e.g.: android, ios). 181 | * CORDOVA_PLUGINS - Comma separated list of plugin IDs that the command applies to (e.g.: org.apache.cordova.file, org.apache.cordova.file-transfer) 182 | * CORDOVA_HOOK - Path to the hook that is being executed. 183 | * CORDOVA_CMDLINE - The exact command-line arguments passed to cordova (e.g.: cordova run ios --emulate) 184 | 185 | If a script returns a non-zero exit code, then the parent cordova command will be aborted. 186 | 187 | ## Writing hooks 188 | 189 | We highly recommend writing your hooks using Node.js so that they are 190 | cross-platform. Some good examples are shown here: 191 | 192 | [http://devgirl.org/2013/11/12/three-hooks-your-cordovaphonegap-project-needs/](http://devgirl.org/2013/11/12/three-hooks-your-cordovaphonegap-project-needs/) 193 | 194 | Also, note that even if you are working on Windows, and in case your hook scripts aren't bat files (which is recommended, if you want your scripts to work in non-Windows operating systems) Cordova CLI will expect a shebang line as the first line for it to know the interpreter it needs to use to launch the script. The shebang line should match the following example: 195 | 196 | #!/usr/bin/env [name_of_interpreter_executable] 197 | -------------------------------------------------------------------------------- /ionic.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "OneSignal_Ionic_Example", 3 | "app_id": "", 4 | "type": "ionic-angular", 5 | "integrations": { 6 | "cordova": {} 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /ionic.project: -------------------------------------------------------------------------------- 1 | { 2 | "name": "IonicOneSignalExample", 3 | "app_id": "" 4 | } -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "OneSignal_Ionic_Example", 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": "4.1.3", 16 | "@angular/compiler": "4.1.3", 17 | "@angular/compiler-cli": "4.1.3", 18 | "@angular/core": "4.1.3", 19 | "@angular/forms": "4.1.3", 20 | "@angular/http": "4.1.3", 21 | "@angular/platform-browser": "4.1.3", 22 | "@angular/platform-browser-dynamic": "4.1.3", 23 | "@ionic-native/core": "3.12.1", 24 | "@ionic-native/onesignal": "^4.2.1", 25 | "@ionic-native/splash-screen": "3.12.1", 26 | "@ionic-native/status-bar": "3.12.1", 27 | "@ionic/storage": "2.0.1", 28 | "cordova-android": "^6.2.3", 29 | "cordova-ios": "^4.4.0", 30 | "cordova-plugin-console": "^1.0.5", 31 | "cordova-plugin-device": "^1.1.4", 32 | "cordova-plugin-splashscreen": "^4.0.3", 33 | "cordova-plugin-statusbar": "^2.2.2", 34 | "cordova-plugin-whitelist": "^1.3.1", 35 | "ionic-angular": "3.6.1", 36 | "ionic-plugin-keyboard": "^2.2.1", 37 | "ionicons": "3.0.0", 38 | "onesignal-cordova-plugin": "^2.2.0", 39 | "rxjs": "5.4.0", 40 | "sw-toolbox": "3.6.0", 41 | "zone.js": "0.8.12" 42 | }, 43 | "devDependencies": { 44 | "@ionic/app-scripts": "2.1.4", 45 | "typescript": "2.3.4" 46 | }, 47 | "description": "An Ionic project", 48 | "cordova": { 49 | "plugins": { 50 | "onesignal-cordova-plugin": {}, 51 | "cordova-plugin-console": {}, 52 | "cordova-plugin-device": {}, 53 | "cordova-plugin-splashscreen": {}, 54 | "cordova-plugin-statusbar": {}, 55 | "cordova-plugin-whitelist": {}, 56 | "ionic-plugin-keyboard": {} 57 | }, 58 | "platforms": [ 59 | "android", 60 | "ios" 61 | ] 62 | } 63 | } -------------------------------------------------------------------------------- /resources/android/icon/drawable-hdpi-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneSignalDevelopers/OneSignal-Ionic-Sample/e5bf7b34b073abea53b7ec8529d47f20d4304cd9/resources/android/icon/drawable-hdpi-icon.png -------------------------------------------------------------------------------- /resources/android/icon/drawable-ldpi-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneSignalDevelopers/OneSignal-Ionic-Sample/e5bf7b34b073abea53b7ec8529d47f20d4304cd9/resources/android/icon/drawable-ldpi-icon.png -------------------------------------------------------------------------------- /resources/android/icon/drawable-mdpi-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneSignalDevelopers/OneSignal-Ionic-Sample/e5bf7b34b073abea53b7ec8529d47f20d4304cd9/resources/android/icon/drawable-mdpi-icon.png -------------------------------------------------------------------------------- /resources/android/icon/drawable-xhdpi-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneSignalDevelopers/OneSignal-Ionic-Sample/e5bf7b34b073abea53b7ec8529d47f20d4304cd9/resources/android/icon/drawable-xhdpi-icon.png -------------------------------------------------------------------------------- /resources/android/icon/drawable-xxhdpi-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneSignalDevelopers/OneSignal-Ionic-Sample/e5bf7b34b073abea53b7ec8529d47f20d4304cd9/resources/android/icon/drawable-xxhdpi-icon.png -------------------------------------------------------------------------------- /resources/android/icon/drawable-xxxhdpi-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneSignalDevelopers/OneSignal-Ionic-Sample/e5bf7b34b073abea53b7ec8529d47f20d4304cd9/resources/android/icon/drawable-xxxhdpi-icon.png -------------------------------------------------------------------------------- /resources/android/splash/drawable-land-hdpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneSignalDevelopers/OneSignal-Ionic-Sample/e5bf7b34b073abea53b7ec8529d47f20d4304cd9/resources/android/splash/drawable-land-hdpi-screen.png -------------------------------------------------------------------------------- /resources/android/splash/drawable-land-ldpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneSignalDevelopers/OneSignal-Ionic-Sample/e5bf7b34b073abea53b7ec8529d47f20d4304cd9/resources/android/splash/drawable-land-ldpi-screen.png -------------------------------------------------------------------------------- /resources/android/splash/drawable-land-mdpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneSignalDevelopers/OneSignal-Ionic-Sample/e5bf7b34b073abea53b7ec8529d47f20d4304cd9/resources/android/splash/drawable-land-mdpi-screen.png -------------------------------------------------------------------------------- /resources/android/splash/drawable-land-xhdpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneSignalDevelopers/OneSignal-Ionic-Sample/e5bf7b34b073abea53b7ec8529d47f20d4304cd9/resources/android/splash/drawable-land-xhdpi-screen.png -------------------------------------------------------------------------------- /resources/android/splash/drawable-land-xxhdpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneSignalDevelopers/OneSignal-Ionic-Sample/e5bf7b34b073abea53b7ec8529d47f20d4304cd9/resources/android/splash/drawable-land-xxhdpi-screen.png -------------------------------------------------------------------------------- /resources/android/splash/drawable-land-xxxhdpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneSignalDevelopers/OneSignal-Ionic-Sample/e5bf7b34b073abea53b7ec8529d47f20d4304cd9/resources/android/splash/drawable-land-xxxhdpi-screen.png -------------------------------------------------------------------------------- /resources/android/splash/drawable-port-hdpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneSignalDevelopers/OneSignal-Ionic-Sample/e5bf7b34b073abea53b7ec8529d47f20d4304cd9/resources/android/splash/drawable-port-hdpi-screen.png -------------------------------------------------------------------------------- /resources/android/splash/drawable-port-ldpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneSignalDevelopers/OneSignal-Ionic-Sample/e5bf7b34b073abea53b7ec8529d47f20d4304cd9/resources/android/splash/drawable-port-ldpi-screen.png -------------------------------------------------------------------------------- /resources/android/splash/drawable-port-mdpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneSignalDevelopers/OneSignal-Ionic-Sample/e5bf7b34b073abea53b7ec8529d47f20d4304cd9/resources/android/splash/drawable-port-mdpi-screen.png -------------------------------------------------------------------------------- /resources/android/splash/drawable-port-xhdpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneSignalDevelopers/OneSignal-Ionic-Sample/e5bf7b34b073abea53b7ec8529d47f20d4304cd9/resources/android/splash/drawable-port-xhdpi-screen.png -------------------------------------------------------------------------------- /resources/android/splash/drawable-port-xxhdpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneSignalDevelopers/OneSignal-Ionic-Sample/e5bf7b34b073abea53b7ec8529d47f20d4304cd9/resources/android/splash/drawable-port-xxhdpi-screen.png -------------------------------------------------------------------------------- /resources/android/splash/drawable-port-xxxhdpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneSignalDevelopers/OneSignal-Ionic-Sample/e5bf7b34b073abea53b7ec8529d47f20d4304cd9/resources/android/splash/drawable-port-xxxhdpi-screen.png -------------------------------------------------------------------------------- /resources/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneSignalDevelopers/OneSignal-Ionic-Sample/e5bf7b34b073abea53b7ec8529d47f20d4304cd9/resources/icon.png -------------------------------------------------------------------------------- /resources/ios/icon/icon-40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneSignalDevelopers/OneSignal-Ionic-Sample/e5bf7b34b073abea53b7ec8529d47f20d4304cd9/resources/ios/icon/icon-40.png -------------------------------------------------------------------------------- /resources/ios/icon/icon-40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneSignalDevelopers/OneSignal-Ionic-Sample/e5bf7b34b073abea53b7ec8529d47f20d4304cd9/resources/ios/icon/icon-40@2x.png -------------------------------------------------------------------------------- /resources/ios/icon/icon-40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneSignalDevelopers/OneSignal-Ionic-Sample/e5bf7b34b073abea53b7ec8529d47f20d4304cd9/resources/ios/icon/icon-40@3x.png -------------------------------------------------------------------------------- /resources/ios/icon/icon-50.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneSignalDevelopers/OneSignal-Ionic-Sample/e5bf7b34b073abea53b7ec8529d47f20d4304cd9/resources/ios/icon/icon-50.png -------------------------------------------------------------------------------- /resources/ios/icon/icon-50@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneSignalDevelopers/OneSignal-Ionic-Sample/e5bf7b34b073abea53b7ec8529d47f20d4304cd9/resources/ios/icon/icon-50@2x.png -------------------------------------------------------------------------------- /resources/ios/icon/icon-60.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneSignalDevelopers/OneSignal-Ionic-Sample/e5bf7b34b073abea53b7ec8529d47f20d4304cd9/resources/ios/icon/icon-60.png -------------------------------------------------------------------------------- /resources/ios/icon/icon-60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneSignalDevelopers/OneSignal-Ionic-Sample/e5bf7b34b073abea53b7ec8529d47f20d4304cd9/resources/ios/icon/icon-60@2x.png -------------------------------------------------------------------------------- /resources/ios/icon/icon-60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneSignalDevelopers/OneSignal-Ionic-Sample/e5bf7b34b073abea53b7ec8529d47f20d4304cd9/resources/ios/icon/icon-60@3x.png -------------------------------------------------------------------------------- /resources/ios/icon/icon-72.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneSignalDevelopers/OneSignal-Ionic-Sample/e5bf7b34b073abea53b7ec8529d47f20d4304cd9/resources/ios/icon/icon-72.png -------------------------------------------------------------------------------- /resources/ios/icon/icon-72@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneSignalDevelopers/OneSignal-Ionic-Sample/e5bf7b34b073abea53b7ec8529d47f20d4304cd9/resources/ios/icon/icon-72@2x.png -------------------------------------------------------------------------------- /resources/ios/icon/icon-76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneSignalDevelopers/OneSignal-Ionic-Sample/e5bf7b34b073abea53b7ec8529d47f20d4304cd9/resources/ios/icon/icon-76.png -------------------------------------------------------------------------------- /resources/ios/icon/icon-76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneSignalDevelopers/OneSignal-Ionic-Sample/e5bf7b34b073abea53b7ec8529d47f20d4304cd9/resources/ios/icon/icon-76@2x.png -------------------------------------------------------------------------------- /resources/ios/icon/icon-83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneSignalDevelopers/OneSignal-Ionic-Sample/e5bf7b34b073abea53b7ec8529d47f20d4304cd9/resources/ios/icon/icon-83.5@2x.png -------------------------------------------------------------------------------- /resources/ios/icon/icon-small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneSignalDevelopers/OneSignal-Ionic-Sample/e5bf7b34b073abea53b7ec8529d47f20d4304cd9/resources/ios/icon/icon-small.png -------------------------------------------------------------------------------- /resources/ios/icon/icon-small@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneSignalDevelopers/OneSignal-Ionic-Sample/e5bf7b34b073abea53b7ec8529d47f20d4304cd9/resources/ios/icon/icon-small@2x.png -------------------------------------------------------------------------------- /resources/ios/icon/icon-small@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneSignalDevelopers/OneSignal-Ionic-Sample/e5bf7b34b073abea53b7ec8529d47f20d4304cd9/resources/ios/icon/icon-small@3x.png -------------------------------------------------------------------------------- /resources/ios/icon/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneSignalDevelopers/OneSignal-Ionic-Sample/e5bf7b34b073abea53b7ec8529d47f20d4304cd9/resources/ios/icon/icon.png -------------------------------------------------------------------------------- /resources/ios/icon/icon@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneSignalDevelopers/OneSignal-Ionic-Sample/e5bf7b34b073abea53b7ec8529d47f20d4304cd9/resources/ios/icon/icon@2x.png -------------------------------------------------------------------------------- /resources/ios/splash/Default-568h@2x~iphone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneSignalDevelopers/OneSignal-Ionic-Sample/e5bf7b34b073abea53b7ec8529d47f20d4304cd9/resources/ios/splash/Default-568h@2x~iphone.png -------------------------------------------------------------------------------- /resources/ios/splash/Default-667h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneSignalDevelopers/OneSignal-Ionic-Sample/e5bf7b34b073abea53b7ec8529d47f20d4304cd9/resources/ios/splash/Default-667h.png -------------------------------------------------------------------------------- /resources/ios/splash/Default-736h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneSignalDevelopers/OneSignal-Ionic-Sample/e5bf7b34b073abea53b7ec8529d47f20d4304cd9/resources/ios/splash/Default-736h.png -------------------------------------------------------------------------------- /resources/ios/splash/Default-Landscape-736h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneSignalDevelopers/OneSignal-Ionic-Sample/e5bf7b34b073abea53b7ec8529d47f20d4304cd9/resources/ios/splash/Default-Landscape-736h.png -------------------------------------------------------------------------------- /resources/ios/splash/Default-Landscape@2x~ipad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneSignalDevelopers/OneSignal-Ionic-Sample/e5bf7b34b073abea53b7ec8529d47f20d4304cd9/resources/ios/splash/Default-Landscape@2x~ipad.png -------------------------------------------------------------------------------- /resources/ios/splash/Default-Landscape@~ipadpro.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneSignalDevelopers/OneSignal-Ionic-Sample/e5bf7b34b073abea53b7ec8529d47f20d4304cd9/resources/ios/splash/Default-Landscape@~ipadpro.png -------------------------------------------------------------------------------- /resources/ios/splash/Default-Landscape~ipad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneSignalDevelopers/OneSignal-Ionic-Sample/e5bf7b34b073abea53b7ec8529d47f20d4304cd9/resources/ios/splash/Default-Landscape~ipad.png -------------------------------------------------------------------------------- /resources/ios/splash/Default-Portrait@2x~ipad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneSignalDevelopers/OneSignal-Ionic-Sample/e5bf7b34b073abea53b7ec8529d47f20d4304cd9/resources/ios/splash/Default-Portrait@2x~ipad.png -------------------------------------------------------------------------------- /resources/ios/splash/Default-Portrait@~ipadpro.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneSignalDevelopers/OneSignal-Ionic-Sample/e5bf7b34b073abea53b7ec8529d47f20d4304cd9/resources/ios/splash/Default-Portrait@~ipadpro.png -------------------------------------------------------------------------------- /resources/ios/splash/Default-Portrait~ipad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneSignalDevelopers/OneSignal-Ionic-Sample/e5bf7b34b073abea53b7ec8529d47f20d4304cd9/resources/ios/splash/Default-Portrait~ipad.png -------------------------------------------------------------------------------- /resources/ios/splash/Default@2x~iphone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneSignalDevelopers/OneSignal-Ionic-Sample/e5bf7b34b073abea53b7ec8529d47f20d4304cd9/resources/ios/splash/Default@2x~iphone.png -------------------------------------------------------------------------------- /resources/ios/splash/Default~iphone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneSignalDevelopers/OneSignal-Ionic-Sample/e5bf7b34b073abea53b7ec8529d47f20d4304cd9/resources/ios/splash/Default~iphone.png -------------------------------------------------------------------------------- /resources/splash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneSignalDevelopers/OneSignal-Ionic-Sample/e5bf7b34b073abea53b7ec8529d47f20d4304cd9/resources/splash.png -------------------------------------------------------------------------------- /scss/ionic.app.scss: -------------------------------------------------------------------------------- 1 | /* 2 | To customize the look and feel of Ionic, you can override the variables 3 | in ionic's _variables.scss file. 4 | 5 | For example, you might change some of the default colors: 6 | 7 | $light: #fff !default; 8 | $stable: #f8f8f8 !default; 9 | $positive: #387ef5 !default; 10 | $calm: #11c1f3 !default; 11 | $balanced: #33cd5f !default; 12 | $energized: #ffc900 !default; 13 | $assertive: #ef473a !default; 14 | $royal: #886aea !default; 15 | $dark: #444 !default; 16 | */ 17 | 18 | // The path for our ionicons font files, relative to the built CSS in www/css 19 | $ionicons-font-path: "../lib/ionic/fonts" !default; 20 | 21 | // Include all of Ionic 22 | @import "www/lib/ionic/scss/ionic"; 23 | 24 | -------------------------------------------------------------------------------- /src/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, ViewChild } from '@angular/core'; 2 | import { Nav, Platform } from 'ionic-angular'; 3 | import { StatusBar } from '@ionic-native/status-bar'; 4 | import { SplashScreen } from '@ionic-native/splash-screen'; 5 | 6 | import { HomePage } from '../pages/home/home'; 7 | import { OtherPage } from '../pages/otherpage/otherpage'; 8 | 9 | @Component({ 10 | templateUrl: 'app.html' 11 | }) 12 | export class MyApp { 13 | @ViewChild(Nav) nav: Nav; 14 | rootPage:any = HomePage; 15 | pages: Array<{title: string, component: any}>; 16 | 17 | constructor( 18 | public platform: Platform, 19 | public statusBar: StatusBar, 20 | public splashScreen: SplashScreen 21 | ) { 22 | this.initializeApp(); 23 | this.pages = [ 24 | { title: 'OneSignal Home', component: HomePage }, 25 | { title: 'OtherPage Page', component: OtherPage } 26 | ]; 27 | 28 | } 29 | 30 | initializeApp() { 31 | this.platform.ready().then(() => { 32 | this.statusBar.styleDefault(); 33 | this.splashScreen.hide(); 34 | 35 | 36 | // Optional OneSignal code for iOS to prompt users later 37 | // Set your iOS Settings 38 | var iosSettings = {}; 39 | iosSettings["kOSSettingsKeyAutoPrompt"] = false; // will not prompt users when start app 1st time 40 | iosSettings["kOSSettingsKeyInAppLaunchURL"] = false; // false opens safari with Launch URL 41 | 42 | // OneSignal Code start: 43 | // Enable to debug issues. 44 | // window["plugins"].OneSignal.setLogLevel({logLevel: 4, visualLevel: 4}); 45 | 46 | var notificationOpenedCallback = function(jsonData) { 47 | console.log('notificationOpenedCallback: ' + JSON.stringify(jsonData)); 48 | if (jsonData.notification.payload.additionalData != null) { 49 | console.log("Here we access addtional data"); 50 | if (jsonData.notification.payload.additionalData.openURL != null) { 51 | console.log("Here we access the openURL sent in the notification data"); 52 | 53 | } 54 | } 55 | }; 56 | 57 | window["plugins"].OneSignal 58 | .startInit("5c9ca215-e7c5-4214-8a45-6f2e1b84c12f") 59 | .iOSSettings(iosSettings) // only needed if added Optional OneSignal code for iOS above 60 | .inFocusDisplaying(window["plugins"].OneSignal.OSInFocusDisplayOption.Notification) 61 | .handleNotificationOpened(notificationOpenedCallback) 62 | .endInit(); 63 | 64 | }); 65 | } 66 | 67 | openPage(page) { 68 | this.nav.setRoot(page.component); 69 | } 70 | } 71 | 72 | -------------------------------------------------------------------------------- /src/app/app.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Pages 6 | 7 | 8 | 9 | 10 | 11 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/app/app.module.ts: -------------------------------------------------------------------------------- 1 | import { BrowserModule } from '@angular/platform-browser'; 2 | import { ErrorHandler, NgModule } from '@angular/core'; 3 | import { IonicApp, IonicErrorHandler, IonicModule } from 'ionic-angular'; 4 | import { SplashScreen } from '@ionic-native/splash-screen'; 5 | import { StatusBar } from '@ionic-native/status-bar'; 6 | 7 | import { MyApp } from './app.component'; 8 | import { HomePage } from '../pages/home/home'; 9 | import { OtherPage } from '../pages/otherpage/otherpage'; 10 | 11 | @NgModule({ 12 | declarations: [ 13 | MyApp, 14 | HomePage, 15 | OtherPage 16 | ], 17 | imports: [ 18 | BrowserModule, 19 | IonicModule.forRoot(MyApp) 20 | ], 21 | bootstrap: [IonicApp], 22 | entryComponents: [ 23 | MyApp, 24 | HomePage, 25 | OtherPage 26 | ], 27 | providers: [ 28 | StatusBar, 29 | SplashScreen, 30 | {provide: ErrorHandler, useClass: IonicErrorHandler} 31 | ] 32 | }) 33 | export class AppModule {} 34 | -------------------------------------------------------------------------------- /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/OneSignalDevelopers/OneSignal-Ionic-Sample/e5bf7b34b073abea53b7ec8529d47f20d4304cd9/src/assets/icon/favicon.ico -------------------------------------------------------------------------------- /src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Ionic App 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /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/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneSignalDevelopers/OneSignal-Ionic-Sample/e5bf7b34b073abea53b7ec8529d47f20d4304cd9/src/pages/.DS_Store -------------------------------------------------------------------------------- /src/pages/home/home.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | OneSignal Starter 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 |
-------------------------------------------------------------------------------- /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 | 4 | @Component({ 5 | selector: 'page-home', 6 | templateUrl: 'home.html' 7 | }) 8 | export class HomePage { 9 | 10 | constructor(public navCtrl: NavController) { 11 | } 12 | 13 | // for iOS only and set kOSSettingsKeyAutoPrompt to false in init call 14 | registerForPushNotifications() { 15 | window["plugins"].OneSignal.promptForPushNotificationsWithUserResponse(function(accepted) { 16 | console.log("User accepted notifications: " + accepted); 17 | }); 18 | } 19 | 20 | // add tags to users 21 | sendTags() { 22 | window["plugins"].OneSignal.sendTags({key: "value", another_key: "another value"}); 23 | console.log("tags sent"); 24 | } 25 | 26 | 27 | // get tags and upate one 28 | getAndUpdateTag() { 29 | window["plugins"].OneSignal.getTags(function(tags) { 30 | console.log('Tags Received: ' + JSON.stringify(tags)); 31 | window["plugins"].OneSignal.sendTag("another_key", "another key's value changed"); 32 | }); 33 | } 34 | 35 | // get the OneSignal userId aka playerId 36 | getOneSignalPlayerId() { 37 | window["plugins"].OneSignal.getPermissionSubscriptionState(function(status) { 38 | status.permissionStatus.hasPrompted; 39 | status.permissionStatus.status; 40 | 41 | status.subscriptionStatus.subscribed; 42 | status.subscriptionStatus.userSubscriptionSetting; 43 | status.subscriptionStatus.pushToken; 44 | 45 | //var playerID = status.subscriptionStatus.userId; 46 | console.log(status.subscriptionStatus.userId); 47 | }); 48 | } 49 | 50 | 51 | // prompt user to accept sending location data 52 | promptLocation() { 53 | window["plugins"].OneSignal.promptLocation(); 54 | console.log('location prompted'); 55 | } 56 | 57 | 58 | // send a notification with an image 59 | sendNotificationwithImage() { 60 | window["plugins"].OneSignal.getIds(function(ids) { 61 | var notificationObj = { contents: {en: "message with image"}, 62 | include_player_ids: [ids.userId], 63 | big_picture: "https://cdn.pixabay.com/photo/2017/09/16/16/09/sea-2755908_960_720.jpg", 64 | 65 | ios_attachments: {id1: "https://cdn.pixabay.com/photo/2017/09/16/16/09/sea-2755908_960_720.jpg"} 66 | }; 67 | 68 | window["plugins"].OneSignal.postNotification(notificationObj, 69 | function(successResponse) { 70 | console.log("Notification Post Success:", successResponse); 71 | }, 72 | function (failedResponse) { 73 | console.log("Notification Post Failed: ", failedResponse); 74 | alert("Notification Post Failed:\n" + JSON.stringify(failedResponse)); 75 | } 76 | ); 77 | }); 78 | } 79 | 80 | 81 | // send Notification Action Buttons and Deep Link 82 | sendNotificationWithActionButtonsAndDeepLink() { 83 | window["plugins"].OneSignal.getIds(function(ids) { 84 | var notificationObj = { contents: {en: "Message with Action Buttons and Deep link"}, 85 | include_player_ids: [ids.userId], 86 | data: {data_key: "data_value", openURL: "https://imgur.com/"}, 87 | 88 | buttons: [{"id": "id1", "text": "Deep Link with URL", "icon": "ic_menu_share"}, {"id": "id2", "text": "just button2", "icon": "ic_menu_send"}] 89 | }; 90 | 91 | window["plugins"].OneSignal.postNotification(notificationObj, 92 | function(successResponse) { 93 | console.log("Notification Post Success:", successResponse); 94 | }, 95 | function (failedResponse) { 96 | console.log("Notification Post Failed: ", failedResponse); 97 | alert("Notification Post Failed:\n" + JSON.stringify(failedResponse)); 98 | } 99 | ); 100 | }); 101 | } 102 | 103 | 104 | 105 | } 106 | -------------------------------------------------------------------------------- /src/pages/otherpage/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneSignalDevelopers/OneSignal-Ionic-Sample/e5bf7b34b073abea53b7ec8529d47f20d4304cd9/src/pages/otherpage/.DS_Store -------------------------------------------------------------------------------- /src/pages/otherpage/otherpage.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | OneSignal Starter 7 | 8 | 9 | 10 | 11 | 12 | 13 |

You have deeplinked!

14 | 15 |
16 | -------------------------------------------------------------------------------- /src/pages/otherpage/otherpage.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | import { NavController, NavParams } from 'ionic-angular'; 4 | 5 | 6 | 7 | @Component({ 8 | selector: 'page-otherpage', 9 | templateUrl: 'otherpage.html' 10 | }) 11 | export class OtherPage { 12 | constructor(public navCtrl: NavController, public navParams: NavParams) { 13 | 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/service-worker.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Check out https://googlechrome.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.cacheFirst); 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 | ], 22 | "compileOnSave": false, 23 | "atom": { 24 | "rewriteTsconfig": false 25 | } 26 | } -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /www/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneSignalDevelopers/OneSignal-Ionic-Sample/e5bf7b34b073abea53b7ec8529d47f20d4304cd9/www/.gitkeep -------------------------------------------------------------------------------- /www/assets/fonts/ionicons.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneSignalDevelopers/OneSignal-Ionic-Sample/e5bf7b34b073abea53b7ec8529d47f20d4304cd9/www/assets/fonts/ionicons.woff -------------------------------------------------------------------------------- /www/assets/fonts/ionicons.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneSignalDevelopers/OneSignal-Ionic-Sample/e5bf7b34b073abea53b7ec8529d47f20d4304cd9/www/assets/fonts/ionicons.woff2 -------------------------------------------------------------------------------- /www/assets/fonts/roboto-bold.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneSignalDevelopers/OneSignal-Ionic-Sample/e5bf7b34b073abea53b7ec8529d47f20d4304cd9/www/assets/fonts/roboto-bold.woff -------------------------------------------------------------------------------- /www/assets/fonts/roboto-bold.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneSignalDevelopers/OneSignal-Ionic-Sample/e5bf7b34b073abea53b7ec8529d47f20d4304cd9/www/assets/fonts/roboto-bold.woff2 -------------------------------------------------------------------------------- /www/assets/fonts/roboto-light.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneSignalDevelopers/OneSignal-Ionic-Sample/e5bf7b34b073abea53b7ec8529d47f20d4304cd9/www/assets/fonts/roboto-light.woff -------------------------------------------------------------------------------- /www/assets/fonts/roboto-light.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneSignalDevelopers/OneSignal-Ionic-Sample/e5bf7b34b073abea53b7ec8529d47f20d4304cd9/www/assets/fonts/roboto-light.woff2 -------------------------------------------------------------------------------- /www/assets/fonts/roboto-medium.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneSignalDevelopers/OneSignal-Ionic-Sample/e5bf7b34b073abea53b7ec8529d47f20d4304cd9/www/assets/fonts/roboto-medium.woff -------------------------------------------------------------------------------- /www/assets/fonts/roboto-medium.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneSignalDevelopers/OneSignal-Ionic-Sample/e5bf7b34b073abea53b7ec8529d47f20d4304cd9/www/assets/fonts/roboto-medium.woff2 -------------------------------------------------------------------------------- /www/assets/fonts/roboto-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneSignalDevelopers/OneSignal-Ionic-Sample/e5bf7b34b073abea53b7ec8529d47f20d4304cd9/www/assets/fonts/roboto-regular.woff -------------------------------------------------------------------------------- /www/assets/fonts/roboto-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneSignalDevelopers/OneSignal-Ionic-Sample/e5bf7b34b073abea53b7ec8529d47f20d4304cd9/www/assets/fonts/roboto-regular.woff2 -------------------------------------------------------------------------------- /www/assets/icon/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneSignalDevelopers/OneSignal-Ionic-Sample/e5bf7b34b073abea53b7ec8529d47f20d4304cd9/www/assets/icon/favicon.ico -------------------------------------------------------------------------------- /www/build/main.css.map: -------------------------------------------------------------------------------- 1 | null -------------------------------------------------------------------------------- /www/build/main.js: -------------------------------------------------------------------------------- 1 | webpackJsonp([0],{ 2 | 3 | /***/ 106: 4 | /***/ (function(module, exports) { 5 | 6 | function webpackEmptyAsyncContext(req) { 7 | // Here Promise.resolve().then() is used instead of new Promise() to prevent 8 | // uncatched exception popping up in devtools 9 | return Promise.resolve().then(function() { 10 | throw new Error("Cannot find module '" + req + "'."); 11 | }); 12 | } 13 | webpackEmptyAsyncContext.keys = function() { return []; }; 14 | webpackEmptyAsyncContext.resolve = webpackEmptyAsyncContext; 15 | module.exports = webpackEmptyAsyncContext; 16 | webpackEmptyAsyncContext.id = 106; 17 | 18 | /***/ }), 19 | 20 | /***/ 147: 21 | /***/ (function(module, exports) { 22 | 23 | function webpackEmptyAsyncContext(req) { 24 | // Here Promise.resolve().then() is used instead of new Promise() to prevent 25 | // uncatched exception popping up in devtools 26 | return Promise.resolve().then(function() { 27 | throw new Error("Cannot find module '" + req + "'."); 28 | }); 29 | } 30 | webpackEmptyAsyncContext.keys = function() { return []; }; 31 | webpackEmptyAsyncContext.resolve = webpackEmptyAsyncContext; 32 | module.exports = webpackEmptyAsyncContext; 33 | webpackEmptyAsyncContext.id = 147; 34 | 35 | /***/ }), 36 | 37 | /***/ 191: 38 | /***/ (function(module, __webpack_exports__, __webpack_require__) { 39 | 40 | "use strict"; 41 | /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return HomePage; }); 42 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0); 43 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_ionic_angular__ = __webpack_require__(39); 44 | var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { 45 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; 46 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); 47 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; 48 | return c > 3 && r && Object.defineProperty(target, key, r), r; 49 | }; 50 | var __metadata = (this && this.__metadata) || function (k, v) { 51 | if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); 52 | }; 53 | 54 | 55 | var HomePage = (function () { 56 | function HomePage(navCtrl) { 57 | this.navCtrl = navCtrl; 58 | } 59 | // for iOS only and set kOSSettingsKeyAutoPrompt to false in init call 60 | HomePage.prototype.registerForPushNotifications = function () { 61 | window["plugins"].OneSignal.promptForPushNotificationsWithUserResponse(function (accepted) { 62 | console.log("User accepted notifications: " + accepted); 63 | }); 64 | }; 65 | // add tags to users 66 | HomePage.prototype.sendTags = function () { 67 | window["plugins"].OneSignal.sendTags({ key: "value", another_key: "another value" }); 68 | console.log("tags sent"); 69 | }; 70 | // get tags and upate one 71 | HomePage.prototype.getAndUpdateTag = function () { 72 | window["plugins"].OneSignal.getTags(function (tags) { 73 | console.log('Tags Received: ' + JSON.stringify(tags)); 74 | window["plugins"].OneSignal.sendTag("another_key", "another key's value changed"); 75 | }); 76 | }; 77 | // get the OneSignal userId aka playerId 78 | HomePage.prototype.getOneSignalPlayerId = function () { 79 | window["plugins"].OneSignal.getPermissionSubscriptionState(function (status) { 80 | status.permissionStatus.hasPrompted; 81 | status.permissionStatus.status; 82 | status.subscriptionStatus.subscribed; 83 | status.subscriptionStatus.userSubscriptionSetting; 84 | status.subscriptionStatus.pushToken; 85 | //var playerID = status.subscriptionStatus.userId; 86 | console.log(status.subscriptionStatus.userId); 87 | }); 88 | }; 89 | // prompt user to accept sending location data 90 | HomePage.prototype.promptLocation = function () { 91 | window["plugins"].OneSignal.promptLocation(); 92 | console.log('location prompted'); 93 | }; 94 | // send a notification with an image 95 | HomePage.prototype.sendNotificationwithImage = function () { 96 | window["plugins"].OneSignal.getIds(function (ids) { 97 | var notificationObj = { contents: { en: "message with image" }, 98 | include_player_ids: [ids.userId], 99 | big_picture: "https://cdn.pixabay.com/photo/2017/09/16/16/09/sea-2755908_960_720.jpg", 100 | ios_attachments: { id1: "https://cdn.pixabay.com/photo/2017/09/16/16/09/sea-2755908_960_720.jpg" } 101 | }; 102 | window["plugins"].OneSignal.postNotification(notificationObj, function (successResponse) { 103 | console.log("Notification Post Success:", successResponse); 104 | }, function (failedResponse) { 105 | console.log("Notification Post Failed: ", failedResponse); 106 | alert("Notification Post Failed:\n" + JSON.stringify(failedResponse)); 107 | }); 108 | }); 109 | }; 110 | // send Notification Action Buttons and Deep Link 111 | HomePage.prototype.sendNotificationWithActionButtonsAndDeepLink = function () { 112 | window["plugins"].OneSignal.getIds(function (ids) { 113 | var notificationObj = { contents: { en: "Message with Action Buttons and Deep link" }, 114 | include_player_ids: [ids.userId], 115 | data: { data_key: "data_value", openURL: "https://imgur.com/" }, 116 | buttons: [{ "id": "id1", "text": "Deep Link with URL", "icon": "ic_menu_share" }, { "id": "id2", "text": "just button2", "icon": "ic_menu_send" }] 117 | }; 118 | window["plugins"].OneSignal.postNotification(notificationObj, function (successResponse) { 119 | console.log("Notification Post Success:", successResponse); 120 | }, function (failedResponse) { 121 | console.log("Notification Post Failed: ", failedResponse); 122 | alert("Notification Post Failed:\n" + JSON.stringify(failedResponse)); 123 | }); 124 | }); 125 | }; 126 | return HomePage; 127 | }()); 128 | HomePage = __decorate([ 129 | Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["n" /* Component */])({ 130 | selector: 'page-home',template:/*ion-inline-start:"/Users/JonOneSignal/OneSignal_Ionic_Example/src/pages/home/home.html"*/'\n \n \n OneSignal Starter\n \n\n\n\n\n\n

\n \n

\n

\n \n

\n

\n \n

\n

\n \n

\n

\n \n

\n

\n \n

\n

\n \n

\n\n
'/*ion-inline-end:"/Users/JonOneSignal/OneSignal_Ionic_Example/src/pages/home/home.html"*/ 131 | }), 132 | __metadata("design:paramtypes", [__WEBPACK_IMPORTED_MODULE_1_ionic_angular__["e" /* NavController */]]) 133 | ], HomePage); 134 | 135 | //# sourceMappingURL=home.js.map 136 | 137 | /***/ }), 138 | 139 | /***/ 192: 140 | /***/ (function(module, __webpack_exports__, __webpack_require__) { 141 | 142 | "use strict"; 143 | /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return OtherPage; }); 144 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0); 145 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_ionic_angular__ = __webpack_require__(39); 146 | var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { 147 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; 148 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); 149 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; 150 | return c > 3 && r && Object.defineProperty(target, key, r), r; 151 | }; 152 | var __metadata = (this && this.__metadata) || function (k, v) { 153 | if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); 154 | }; 155 | 156 | 157 | var OtherPage = (function () { 158 | function OtherPage(navCtrl, navParams) { 159 | this.navCtrl = navCtrl; 160 | this.navParams = navParams; 161 | } 162 | return OtherPage; 163 | }()); 164 | OtherPage = __decorate([ 165 | Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["n" /* Component */])({ 166 | selector: 'page-otherpage',template:/*ion-inline-start:"/Users/JonOneSignal/OneSignal_Ionic_Example/src/pages/otherpage/otherpage.html"*/'\n \n \n OneSignal Starter\n \n\n\n\n\n\n

You have deeplinked!

\n\n
\n'/*ion-inline-end:"/Users/JonOneSignal/OneSignal_Ionic_Example/src/pages/otherpage/otherpage.html"*/ 167 | }), 168 | __metadata("design:paramtypes", [__WEBPACK_IMPORTED_MODULE_1_ionic_angular__["e" /* NavController */], __WEBPACK_IMPORTED_MODULE_1_ionic_angular__["f" /* NavParams */]]) 169 | ], OtherPage); 170 | 171 | //# sourceMappingURL=otherpage.js.map 172 | 173 | /***/ }), 174 | 175 | /***/ 193: 176 | /***/ (function(module, __webpack_exports__, __webpack_require__) { 177 | 178 | "use strict"; 179 | Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); 180 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_platform_browser_dynamic__ = __webpack_require__(194); 181 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__app_module__ = __webpack_require__(212); 182 | 183 | 184 | Object(__WEBPACK_IMPORTED_MODULE_0__angular_platform_browser_dynamic__["a" /* platformBrowserDynamic */])().bootstrapModule(__WEBPACK_IMPORTED_MODULE_1__app_module__["a" /* AppModule */]); 185 | //# sourceMappingURL=main.js.map 186 | 187 | /***/ }), 188 | 189 | /***/ 212: 190 | /***/ (function(module, __webpack_exports__, __webpack_require__) { 191 | 192 | "use strict"; 193 | /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return AppModule; }); 194 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_platform_browser__ = __webpack_require__(28); 195 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_core__ = __webpack_require__(0); 196 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_ionic_angular__ = __webpack_require__(39); 197 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__ionic_native_splash_screen__ = __webpack_require__(187); 198 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__ionic_native_status_bar__ = __webpack_require__(190); 199 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__app_component__ = __webpack_require__(261); 200 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__pages_home_home__ = __webpack_require__(191); 201 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__pages_otherpage_otherpage__ = __webpack_require__(192); 202 | var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { 203 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; 204 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); 205 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; 206 | return c > 3 && r && Object.defineProperty(target, key, r), r; 207 | }; 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | var AppModule = (function () { 217 | function AppModule() { 218 | } 219 | return AppModule; 220 | }()); 221 | AppModule = __decorate([ 222 | Object(__WEBPACK_IMPORTED_MODULE_1__angular_core__["L" /* NgModule */])({ 223 | declarations: [ 224 | __WEBPACK_IMPORTED_MODULE_5__app_component__["a" /* MyApp */], 225 | __WEBPACK_IMPORTED_MODULE_6__pages_home_home__["a" /* HomePage */], 226 | __WEBPACK_IMPORTED_MODULE_7__pages_otherpage_otherpage__["a" /* OtherPage */] 227 | ], 228 | imports: [ 229 | __WEBPACK_IMPORTED_MODULE_0__angular_platform_browser__["a" /* BrowserModule */], 230 | __WEBPACK_IMPORTED_MODULE_2_ionic_angular__["c" /* IonicModule */].forRoot(__WEBPACK_IMPORTED_MODULE_5__app_component__["a" /* MyApp */]) 231 | ], 232 | bootstrap: [__WEBPACK_IMPORTED_MODULE_2_ionic_angular__["a" /* IonicApp */]], 233 | entryComponents: [ 234 | __WEBPACK_IMPORTED_MODULE_5__app_component__["a" /* MyApp */], 235 | __WEBPACK_IMPORTED_MODULE_6__pages_home_home__["a" /* HomePage */], 236 | __WEBPACK_IMPORTED_MODULE_7__pages_otherpage_otherpage__["a" /* OtherPage */] 237 | ], 238 | providers: [ 239 | __WEBPACK_IMPORTED_MODULE_4__ionic_native_status_bar__["a" /* StatusBar */], 240 | __WEBPACK_IMPORTED_MODULE_3__ionic_native_splash_screen__["a" /* SplashScreen */], 241 | { provide: __WEBPACK_IMPORTED_MODULE_1__angular_core__["v" /* ErrorHandler */], useClass: __WEBPACK_IMPORTED_MODULE_2_ionic_angular__["b" /* IonicErrorHandler */] } 242 | ] 243 | }) 244 | ], AppModule); 245 | 246 | //# sourceMappingURL=app.module.js.map 247 | 248 | /***/ }), 249 | 250 | /***/ 261: 251 | /***/ (function(module, __webpack_exports__, __webpack_require__) { 252 | 253 | "use strict"; 254 | /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return MyApp; }); 255 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0); 256 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_ionic_angular__ = __webpack_require__(39); 257 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__ionic_native_status_bar__ = __webpack_require__(190); 258 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__ionic_native_splash_screen__ = __webpack_require__(187); 259 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__pages_home_home__ = __webpack_require__(191); 260 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__pages_otherpage_otherpage__ = __webpack_require__(192); 261 | var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { 262 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; 263 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); 264 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; 265 | return c > 3 && r && Object.defineProperty(target, key, r), r; 266 | }; 267 | var __metadata = (this && this.__metadata) || function (k, v) { 268 | if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); 269 | }; 270 | 271 | 272 | 273 | 274 | 275 | 276 | var MyApp = (function () { 277 | function MyApp(platform, statusBar, splashScreen) { 278 | this.platform = platform; 279 | this.statusBar = statusBar; 280 | this.splashScreen = splashScreen; 281 | this.rootPage = __WEBPACK_IMPORTED_MODULE_4__pages_home_home__["a" /* HomePage */]; 282 | this.initializeApp(); 283 | this.pages = [ 284 | { title: 'OneSignal Home', component: __WEBPACK_IMPORTED_MODULE_4__pages_home_home__["a" /* HomePage */] }, 285 | { title: 'OtherPage Page', component: __WEBPACK_IMPORTED_MODULE_5__pages_otherpage_otherpage__["a" /* OtherPage */] } 286 | ]; 287 | } 288 | MyApp.prototype.initializeApp = function () { 289 | var _this = this; 290 | this.platform.ready().then(function () { 291 | _this.statusBar.styleDefault(); 292 | _this.splashScreen.hide(); 293 | // Optional OneSignal code for iOS to prompt users later 294 | // Set your iOS Settings 295 | var iosSettings = {}; 296 | iosSettings["kOSSettingsKeyAutoPrompt"] = false; // will not prompt users when start app 1st time 297 | iosSettings["kOSSettingsKeyInAppLaunchURL"] = false; // false opens safari with Launch URL 298 | // OneSignal Code start: 299 | // Enable to debug issues. 300 | // window["plugins"].OneSignal.setLogLevel({logLevel: 4, visualLevel: 4}); 301 | var notificationOpenedCallback = function (jsonData) { 302 | console.log('notificationOpenedCallback: ' + JSON.stringify(jsonData)); 303 | if (jsonData.notification.payload.additionalData != null) { 304 | console.log("Here we access addtional data"); 305 | if (jsonData.notification.payload.additionalData.openURL != null) { 306 | console.log("Here we access the openURL sent in the notification data"); 307 | } 308 | } 309 | }; 310 | window["plugins"].OneSignal 311 | .startInit("5c9ca215-e7c5-4214-8a45-6f2e1b84c12f", "388536902528") 312 | .iOSSettings(iosSettings) // only needed if added Optional OneSignal code for iOS above 313 | .inFocusDisplaying(window["plugins"].OneSignal.OSInFocusDisplayOption.Notification) 314 | .handleNotificationOpened(notificationOpenedCallback) 315 | .endInit(); 316 | }); 317 | }; 318 | MyApp.prototype.openPage = function (page) { 319 | this.nav.setRoot(page.component); 320 | }; 321 | return MyApp; 322 | }()); 323 | __decorate([ 324 | Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["_13" /* ViewChild */])(__WEBPACK_IMPORTED_MODULE_1_ionic_angular__["d" /* Nav */]), 325 | __metadata("design:type", __WEBPACK_IMPORTED_MODULE_1_ionic_angular__["d" /* Nav */]) 326 | ], MyApp.prototype, "nav", void 0); 327 | MyApp = __decorate([ 328 | Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["n" /* Component */])({template:/*ion-inline-start:"/Users/JonOneSignal/OneSignal_Ionic_Example/src/app/app.html"*/'\n\n \n \n Pages\n \n \n\n \n \n \n \n \n\n\n\n\n'/*ion-inline-end:"/Users/JonOneSignal/OneSignal_Ionic_Example/src/app/app.html"*/ 329 | }), 330 | __metadata("design:paramtypes", [__WEBPACK_IMPORTED_MODULE_1_ionic_angular__["g" /* Platform */], 331 | __WEBPACK_IMPORTED_MODULE_2__ionic_native_status_bar__["a" /* StatusBar */], 332 | __WEBPACK_IMPORTED_MODULE_3__ionic_native_splash_screen__["a" /* SplashScreen */]]) 333 | ], MyApp); 334 | 335 | //# sourceMappingURL=app.component.js.map 336 | 337 | /***/ }) 338 | 339 | },[193]); 340 | //# sourceMappingURL=main.js.map -------------------------------------------------------------------------------- /www/build/main.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["../../node_modules/@angular/core/@angular lazy","../../src lazy","../../src/pages/home/home.ts","../../src/pages/otherpage/otherpage.ts","../../src/app/main.ts","../../src/app/app.module.ts","../../src/app/app.component.ts"],"names":[],"mappings":";;;;;AAAA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA,4CAA4C,WAAW;AACvD;AACA;AACA,kC;;;;;;;ACVA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA,4CAA4C,WAAW;AACvD;AACA;AACA,kC;;;;;;;;;;;;;;;;;;;;ACV0C;AACI;AAM9C,IAAa,QAAQ;IAEpB,kBAAmB,OAAsB;QAAtB,YAAO,GAAP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req) {\n\t// Here Promise.resolve().then() is used instead of new Promise() to prevent\n\t// uncatched exception popping up in devtools\n\treturn Promise.resolve().then(function() {\n\t\tthrow new Error(\"Cannot find module '\" + req + \"'.\");\n\t});\n}\nwebpackEmptyAsyncContext.keys = function() { return []; };\nwebpackEmptyAsyncContext.resolve = webpackEmptyAsyncContext;\nmodule.exports = webpackEmptyAsyncContext;\nwebpackEmptyAsyncContext.id = 106;\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/@angular/core/@angular lazy\n// module id = 106\n// module chunks = 0","function webpackEmptyAsyncContext(req) {\n\t// Here Promise.resolve().then() is used instead of new Promise() to prevent\n\t// uncatched exception popping up in devtools\n\treturn Promise.resolve().then(function() {\n\t\tthrow new Error(\"Cannot find module '\" + req + \"'.\");\n\t});\n}\nwebpackEmptyAsyncContext.keys = function() { return []; };\nwebpackEmptyAsyncContext.resolve = webpackEmptyAsyncContext;\nmodule.exports = webpackEmptyAsyncContext;\nwebpackEmptyAsyncContext.id = 147;\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src lazy\n// module id = 147\n// module chunks = 0","import { Component } from '@angular/core';\nimport { NavController } from 'ionic-angular';\n\n@Component({\n selector: 'page-home',\n templateUrl: 'home.html'\n})\nexport class HomePage {\n\n\tconstructor(public navCtrl: NavController) {\n \t}\n\n \t// for iOS only and set kOSSettingsKeyAutoPrompt to false in init call\n \tregisterForPushNotifications() {\n \t\twindow[\"plugins\"].OneSignal.promptForPushNotificationsWithUserResponse(function(accepted) {\n \t\t\tconsole.log(\"User accepted notifications: \" + accepted);\n\t\t});\n \t}\n\n \t// add tags to users\n \tsendTags() {\n \t\twindow[\"plugins\"].OneSignal.sendTags({key: \"value\", another_key: \"another value\"});\n \t\tconsole.log(\"tags sent\");\n \t}\n\n\n \t// get tags and upate one\n \tgetAndUpdateTag() {\n \t\twindow[\"plugins\"].OneSignal.getTags(function(tags) {\n \t\t\tconsole.log('Tags Received: ' + JSON.stringify(tags));\n \t\t\twindow[\"plugins\"].OneSignal.sendTag(\"another_key\", \"another key's value changed\");\n\t\t});\n \t}\n\n \t// get the OneSignal userId aka playerId\n \tgetOneSignalPlayerId() {\n \t\twindow[\"plugins\"].OneSignal.getPermissionSubscriptionState(function(status) {\n \t\t\tstatus.permissionStatus.hasPrompted;\n \t\t\tstatus.permissionStatus.status;\n\n \t\t\tstatus.subscriptionStatus.subscribed;\n \t\t\tstatus.subscriptionStatus.userSubscriptionSetting;\n \t\t\tstatus.subscriptionStatus.pushToken;\n\n \t\t\t//var playerID = status.subscriptionStatus.userId;\n \t\t\tconsole.log(status.subscriptionStatus.userId);\n\t\t});\n \t}\n\n\n \t// prompt user to accept sending location data\n \tpromptLocation() {\n \t\twindow[\"plugins\"].OneSignal.promptLocation();\n \t\tconsole.log('location prompted');\n \t}\n\n\n \t// send a notification with an image\n \tsendNotificationwithImage() {\n \t\twindow[\"plugins\"].OneSignal.getIds(function(ids) {\n \t\t\tvar notificationObj = { contents: {en: \"message with image\"},\n include_player_ids: [ids.userId],\n big_picture: \"https://cdn.pixabay.com/photo/2017/09/16/16/09/sea-2755908_960_720.jpg\",\n \n ios_attachments: {id1: \"https://cdn.pixabay.com/photo/2017/09/16/16/09/sea-2755908_960_720.jpg\"}\n };\n \n \t\t\twindow[\"plugins\"].OneSignal.postNotification(notificationObj,\n \t\t\tfunction(successResponse) {\n \t\t\t\tconsole.log(\"Notification Post Success:\", successResponse);\n \t\t\t},\n \t\t\tfunction (failedResponse) {\n \t\t\t\tconsole.log(\"Notification Post Failed: \", failedResponse);\n \t\t\t\talert(\"Notification Post Failed:\\n\" + JSON.stringify(failedResponse));\n \t\t\t}\n \t\t\t);\n\t\t});\n \t}\n\n\n \t// send Notification Action Buttons and Deep Link\n \tsendNotificationWithActionButtonsAndDeepLink() {\n \t\twindow[\"plugins\"].OneSignal.getIds(function(ids) {\n \t\t\tvar notificationObj = { contents: {en: \"Message with Action Buttons and Deep link\"},\n include_player_ids: [ids.userId],\n data: {data_key: \"data_value\", openURL: \"https://imgur.com/\"},\n\n buttons: [{\"id\": \"id1\", \"text\": \"Deep Link with URL\", \"icon\": \"ic_menu_share\"}, {\"id\": \"id2\", \"text\": \"just button2\", \"icon\": \"ic_menu_send\"}]\n };\n \n \t\t\twindow[\"plugins\"].OneSignal.postNotification(notificationObj,\n \t\t\tfunction(successResponse) {\n \t\t\t\tconsole.log(\"Notification Post Success:\", successResponse);\n \t\t\t},\n \t\t\tfunction (failedResponse) {\n \t\t\t\tconsole.log(\"Notification Post Failed: \", failedResponse);\n \t\t\t\talert(\"Notification Post Failed:\\n\" + JSON.stringify(failedResponse));\n \t\t\t}\n \t\t\t);\n\t\t});\n \t}\n\n\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/pages/home/home.ts","import { Component } from '@angular/core';\n\nimport { NavController, NavParams } from 'ionic-angular';\n\n\n\n@Component({\n selector: 'page-otherpage',\n templateUrl: 'otherpage.html'\n})\nexport class OtherPage {\n constructor(public navCtrl: NavController, public navParams: NavParams) {\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/pages/otherpage/otherpage.ts","import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';\n\nimport { AppModule } from './app.module';\n\nplatformBrowserDynamic().bootstrapModule(AppModule);\n\n\n\n// WEBPACK FOOTER //\n// ./src/app/main.ts","import { BrowserModule } from '@angular/platform-browser';\nimport { ErrorHandler, NgModule } from '@angular/core';\nimport { IonicApp, IonicErrorHandler, IonicModule } from 'ionic-angular';\nimport { SplashScreen } from '@ionic-native/splash-screen';\nimport { StatusBar } from '@ionic-native/status-bar';\n\nimport { MyApp } from './app.component';\nimport { HomePage } from '../pages/home/home';\nimport { OtherPage } from '../pages/otherpage/otherpage';\n\n@NgModule({\n declarations: [\n MyApp,\n HomePage,\n OtherPage\n ],\n imports: [\n BrowserModule,\n IonicModule.forRoot(MyApp)\n ],\n bootstrap: [IonicApp],\n entryComponents: [\n MyApp,\n HomePage,\n OtherPage\n ],\n providers: [\n StatusBar,\n SplashScreen,\n {provide: ErrorHandler, useClass: IonicErrorHandler}\n ]\n})\nexport class AppModule {}\n\n\n\n// WEBPACK FOOTER //\n// ./src/app/app.module.ts","import { Component, ViewChild } from '@angular/core';\nimport { Nav, Platform } from 'ionic-angular';\nimport { StatusBar } from '@ionic-native/status-bar';\nimport { SplashScreen } from '@ionic-native/splash-screen';\n\nimport { HomePage } from '../pages/home/home';\nimport { OtherPage } from '../pages/otherpage/otherpage';\n\n@Component({\n templateUrl: 'app.html'\n})\nexport class MyApp {\n @ViewChild(Nav) nav: Nav;\n rootPage:any = HomePage;\n pages: Array<{title: string, component: any}>;\n\n constructor(\n public platform: Platform, \n public statusBar: StatusBar, \n public splashScreen: SplashScreen\n ) {\n this.initializeApp();\n this.pages = [\n { title: 'OneSignal Home', component: HomePage },\n { title: 'OtherPage Page', component: OtherPage }\n ];\n\n }\n\n initializeApp() {\n this.platform.ready().then(() => {\n this.statusBar.styleDefault();\n this.splashScreen.hide();\n\n\n // Optional OneSignal code for iOS to prompt users later\n // Set your iOS Settings\n var iosSettings = {};\n iosSettings[\"kOSSettingsKeyAutoPrompt\"] = false; // will not prompt users when start app 1st time\n iosSettings[\"kOSSettingsKeyInAppLaunchURL\"] = false; // false opens safari with Launch URL\n\n // OneSignal Code start:\n // Enable to debug issues.\n // window[\"plugins\"].OneSignal.setLogLevel({logLevel: 4, visualLevel: 4});\n\n var notificationOpenedCallback = function(jsonData) {\n console.log('notificationOpenedCallback: ' + JSON.stringify(jsonData));\n if (jsonData.notification.payload.additionalData != null) {\n console.log(\"Here we access addtional data\");\n if (jsonData.notification.payload.additionalData.openURL != null) {\n console.log(\"Here we access the openURL sent in the notification data\");\n\n }\n }\n };\n\n window[\"plugins\"].OneSignal\n .startInit(\"5c9ca215-e7c5-4214-8a45-6f2e1b84c12f\", \"388536902528\")\n .iOSSettings(iosSettings) // only needed if added Optional OneSignal code for iOS above\n .inFocusDisplaying(window[\"plugins\"].OneSignal.OSInFocusDisplayOption.Notification)\n .handleNotificationOpened(notificationOpenedCallback)\n .endInit();\n \n });\n }\n\n openPage(page) {\n this.nav.setRoot(page.component);\n }\n}\n\n\n\n\n// WEBPACK FOOTER //\n// ./src/app/app.component.ts"],"sourceRoot":""} -------------------------------------------------------------------------------- /www/build/polyfills.js: -------------------------------------------------------------------------------- 1 | !function(t){"use strict";function e(t,e){return e={exports:{}},t(e,e.exports),e.exports}function n(t){return isFinite(t=+t)&&0!=t?t<0?-n(-t):Math.log(t+Math.sqrt(t*t+1)):t}function r(t,e){var n,o,i=arguments.length<3?t:arguments[2];return d(t)===i?t[e]:(n=fn.f(t,e))?M(n,"value")?n.value:void 0!==n.get?n.get.call(i):void 0:p(o=mt(t))?r(o,e,i):void 0}function o(t,e,n){var r,i,a=arguments.length<4?t:arguments[3],u=fn.f(d(t),e);if(!u){if(p(i=mt(t)))return o(i,e,n,a);u=E(0)}return M(u,"value")?!(!1===u.writable||!p(a))&&(r=fn.f(a,e)||E(0),r.value=n,T.f(a,e,r),!0):void 0!==u.set&&(u.set.call(a,n),!0)}var i=Math.ceil,a=Math.floor,u=function(t){return isNaN(t=+t)?0:(t>0?a:i)(t)},c=function(t){if(void 0==t)throw TypeError("Can't call method on "+t);return t},s=function(t){return function(e,n){var r,o,i=String(c(e)),a=u(n),s=i.length;return a<0||a>=s?t?"":void 0:(r=i.charCodeAt(a),r<55296||r>56319||a+1===s||(o=i.charCodeAt(a+1))<56320||o>57343?t?i.charAt(a):r:t?i.slice(a,a+2):o-56320+(r-55296<<10)+65536)}},f="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},l=e(function(t){var e=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=e)}),h=e(function(t){var e=t.exports={version:"2.4.0"};"number"==typeof __e&&(__e=e)}),p=function(t){return"object"==typeof t?null!==t:"function"==typeof t},d=function(t){if(!p(t))throw TypeError(t+" is not an object!");return t},v=function(t){try{return!!t()}catch(t){return!0}},g=!v(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}),y=l.document,m=p(y)&&p(y.createElement),b=function(t){return m?y.createElement(t):{}},k=!g&&!v(function(){return 7!=Object.defineProperty(b("div"),"a",{get:function(){return 7}}).a}),w=function(t,e){if(!p(t))return t;var n,r;if(e&&"function"==typeof(n=t.toString)&&!p(r=n.call(t)))return r;if("function"==typeof(n=t.valueOf)&&!p(r=n.call(t)))return r;if(!e&&"function"==typeof(n=t.toString)&&!p(r=n.call(t)))return r;throw TypeError("Can't convert object to primitive value")},_=Object.defineProperty,S=g?Object.defineProperty:function(t,e,n){if(d(t),e=w(e,!0),d(n),k)try{return _(t,e,n)}catch(t){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(t[e]=n.value),t},T={f:S},E=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},O=g?function(t,e,n){return T.f(t,e,E(1,n))}:function(t,e,n){return t[e]=n,t},F={}.hasOwnProperty,M=function(t,e){return F.call(t,e)},P=0,j=Math.random(),I=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++P+j).toString(36))},A=e(function(t){var e=I("src"),n=Function.toString,r=(""+n).split("toString");h.inspectSource=function(t){return n.call(t)},(t.exports=function(t,n,o,i){var a="function"==typeof o;a&&(M(o,"name")||O(o,"name",n)),t[n]!==o&&(a&&(M(o,e)||O(o,e,t[n]?""+t[n]:r.join(String(n)))),t===l?t[n]=o:i?t[n]?t[n]=o:O(t,n,o):(delete t[n],O(t,n,o)))})(Function.prototype,"toString",function(){return"function"==typeof this&&this[e]||n.call(this)})}),x=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t},D=function(t,e,n){if(x(t),void 0===e)return t;switch(n){case 1:return function(n){return t.call(e,n)};case 2:return function(n,r){return t.call(e,n,r)};case 3:return function(n,r,o){return t.call(e,n,r,o)}}return function(){return t.apply(e,arguments)}},C=function(t,e,n){var r,o,i,a,u=t&C.F,c=t&C.G,s=t&C.S,f=t&C.P,p=t&C.B,d=c?l:s?l[e]||(l[e]={}):(l[e]||{}).prototype,v=c?h:h[e]||(h[e]={}),g=v.prototype||(v.prototype={});c&&(n=e);for(r in n)o=!u&&d&&void 0!==d[r],i=(o?d:n)[r],a=p&&o?D(i,l):f&&"function"==typeof i?D(Function.call,i):i,d&&A(d,r,i,t&C.U),v[r]!=i&&O(v,r,a),f&&g[r]!=i&&(g[r]=i)};l.core=h,C.F=1,C.G=2,C.S=4,C.P=8,C.B=16,C.W=32,C.U=64,C.R=128;var N=C,R={},z={}.toString,Z=function(t){return z.call(t).slice(8,-1)},L=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==Z(t)?t.split(""):Object(t)},W=function(t){return L(c(t))},B=Math.min,H=function(t){return t>0?B(u(t),9007199254740991):0},U=Math.max,q=Math.min,V=function(t,e){return t=u(t),t<0?U(t+e,0):q(t,e)},X=function(t){return function(e,n,r){var o,i=W(e),a=H(i.length),u=V(r,a);if(t&&n!=n){for(;a>u;)if((o=i[u++])!=o)return!0}else for(;a>u;u++)if((t||u in i)&&i[u]===n)return t||u||0;return!t&&-1}},G=l["__core-js_shared__"]||(l["__core-js_shared__"]={}),K=function(t){return G[t]||(G[t]={})},Y=K("keys"),J=function(t){return Y[t]||(Y[t]=I(t))},Q=X(!1),$=J("IE_PROTO"),tt=function(t,e){var n,r=W(t),o=0,i=[];for(n in r)n!=$&&M(r,n)&&i.push(n);for(;e.length>o;)M(r,n=e[o++])&&(~Q(i,n)||i.push(n));return i},et="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(","),nt=Object.keys||function(t){return tt(t,et)},rt=g?Object.defineProperties:function(t,e){d(t);for(var n,r=nt(e),o=r.length,i=0;o>i;)T.f(t,n=r[i++],e[n]);return t},ot=l.document&&document.documentElement,it=J("IE_PROTO"),at=function(){},ut=function(){var t,e=b("iframe"),n=et.length;for(e.style.display="none",ot.appendChild(e),e.src="javascript:",t=e.contentWindow.document,t.open(),t.write(" 7 | 8 | Ionic App 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /www/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 | } -------------------------------------------------------------------------------- /www/service-worker.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Check out https://googlechrome.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.cacheFirst); 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 | --------------------------------------------------------------------------------