├── .gitignore
├── .travis.yml
├── LICENSE
├── README.md
├── demo
├── app
│ ├── App_Resources
│ │ ├── Android
│ │ │ ├── app.gradle
│ │ │ └── src
│ │ │ │ └── main
│ │ │ │ ├── AndroidManifest.xml
│ │ │ │ └── res
│ │ │ │ ├── drawable-hdpi
│ │ │ │ ├── background.png
│ │ │ │ ├── icon.png
│ │ │ │ └── logo.png
│ │ │ │ ├── drawable-ldpi
│ │ │ │ ├── background.png
│ │ │ │ ├── icon.png
│ │ │ │ └── logo.png
│ │ │ │ ├── drawable-mdpi
│ │ │ │ ├── background.png
│ │ │ │ ├── icon.png
│ │ │ │ └── logo.png
│ │ │ │ ├── drawable-nodpi
│ │ │ │ ├── add.png
│ │ │ │ ├── beer.png
│ │ │ │ ├── eye.png
│ │ │ │ └── splash_screen.xml
│ │ │ │ ├── drawable-xhdpi
│ │ │ │ ├── background.png
│ │ │ │ ├── icon.png
│ │ │ │ └── logo.png
│ │ │ │ ├── drawable-xxhdpi
│ │ │ │ ├── background.png
│ │ │ │ ├── icon.png
│ │ │ │ └── logo.png
│ │ │ │ ├── drawable-xxxhdpi
│ │ │ │ ├── background.png
│ │ │ │ ├── icon.png
│ │ │ │ └── logo.png
│ │ │ │ ├── values-v21
│ │ │ │ ├── colors.xml
│ │ │ │ └── styles.xml
│ │ │ │ ├── values
│ │ │ │ ├── colors.xml
│ │ │ │ ├── strings.xml
│ │ │ │ └── styles.xml
│ │ │ │ └── xml
│ │ │ │ └── shortcuts.xml
│ │ └── iOS
│ │ │ ├── Assets.xcassets
│ │ │ ├── AppIcon.appiconset
│ │ │ │ ├── Contents.json
│ │ │ │ ├── icon-29.png
│ │ │ │ ├── icon-29@2x.png
│ │ │ │ ├── icon-29@3x.png
│ │ │ │ ├── icon-40.png
│ │ │ │ ├── icon-40@2x.png
│ │ │ │ ├── icon-40@3x.png
│ │ │ │ ├── icon-50.png
│ │ │ │ ├── icon-50@2x.png
│ │ │ │ ├── icon-57.png
│ │ │ │ ├── icon-57@2x.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
│ │ │ ├── Contents.json
│ │ │ ├── LaunchImage.launchimage
│ │ │ │ ├── Contents.json
│ │ │ │ ├── Default-568h@2x.png
│ │ │ │ ├── Default-667h@2x.png
│ │ │ │ ├── Default-736h@3x.png
│ │ │ │ ├── Default-Landscape.png
│ │ │ │ ├── Default-Landscape@2x.png
│ │ │ │ ├── Default-Landscape@3x.png
│ │ │ │ ├── Default-Portrait.png
│ │ │ │ ├── Default-Portrait@2x.png
│ │ │ │ ├── Default.png
│ │ │ │ └── Default@2x.png
│ │ │ ├── LaunchScreen.AspectFill.imageset
│ │ │ │ ├── Contents.json
│ │ │ │ ├── LaunchScreen-AspectFill.png
│ │ │ │ └── LaunchScreen-AspectFill@2x.png
│ │ │ └── LaunchScreen.Center.imageset
│ │ │ │ ├── Contents.json
│ │ │ │ ├── LaunchScreen-Center.png
│ │ │ │ └── LaunchScreen-Center@2x.png
│ │ │ ├── Info.plist
│ │ │ ├── LaunchScreen.storyboard
│ │ │ ├── Podfile
│ │ │ ├── beer.png
│ │ │ ├── build.xcconfig
│ │ │ └── eye.png
│ ├── app-root.xml
│ ├── app.css
│ ├── app.ts
│ ├── beer-page.ts
│ ├── beer-page.xml
│ ├── bundle-config.ts
│ ├── main-page.ts
│ ├── main-page.xml
│ ├── main-view-model.ts
│ ├── res
│ │ ├── cheers_to_beers.jpg
│ │ └── telerik-logo.png
│ └── tests
│ │ └── tests.js
├── karma.conf.js
├── nativescript.config.ts
├── package-lock.json
├── package.json
└── tsconfig.json
├── media
├── Android.png
└── iOS.png
├── publish
├── pack.sh
├── package.json
└── publish.sh
├── src
├── .npmignore
├── app-shortcuts.android.ts
├── app-shortcuts.common.ts
├── app-shortcuts.ios.ts
├── index.d.ts
├── package-lock.json
├── package.json
├── references.d.ts
└── tsconfig.json
└── tslint.json
/.gitignore:
--------------------------------------------------------------------------------
1 | .idea
2 | .vscode
3 | .DS_Store
4 | *.js
5 | *.log
6 | *.map
7 | *.tgz
8 | !src/angular/*.js
9 | !demo/karma.conf.js
10 | !demo/app/tests/*.js
11 | demo/*.d.ts
12 | src/*.d.ts
13 | !src/index.d.ts
14 | !src/references.d.ts
15 | demo/lib
16 | demo/platforms
17 | node_modules
18 | demo/hooks/
19 | publish/package/
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | matrix:
2 | include:
3 | - stage: "Lint"
4 | language: node_js
5 | os: linux
6 | node_js: "10"
7 | script: cd src && npm run ci.tslint
8 | - stage: "WebPack, Build"
9 | os: osx
10 | env:
11 | - WebPack="iOS"
12 | osx_image: xcode10.2
13 | language: node_js
14 | node_js: "10"
15 | jdk: oraclejdk8
16 | before_script: pod repo update
17 | script: cd demo && npm run build.plugin && npm i && tns build ios --bundle --env.uglify
18 | - language: android
19 | env:
20 | - BuildAndroid="28"
21 | os: linux
22 | dist: trusty
23 | jdk: oraclejdk8
24 | before_install: nvm install 10
25 | script:
26 | - cd src && npm i && npm run tsc && cd ../demo && tns build android
27 | - os: osx
28 | osx_image: xcode10.2
29 | language: node_js
30 | node_js: "10"
31 | jdk: oraclejdk8
32 | before_script: pod repo update
33 | script:
34 | - cd src && npm i && npm run tsc && cd ../demo && tns build ios
35 |
36 | android:
37 | components:
38 | - tools
39 | - platform-tools
40 | - build-tools-28.0.3
41 | - android-28
42 | - extra-android-m2repository
43 | - sys-img-armeabi-v7a-android-21
44 |
45 | before_install:
46 | - sudo pip install --upgrade pip
47 | - sudo pip install six
48 |
49 | install:
50 | - echo no | npm install -g nativescript
51 | - tns usage-reporting disable
52 | - tns error-reporting disable
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy of
4 | this software and associated documentation files (the "Software"), to deal in
5 | the Software without restriction, including without limitation the rights to
6 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
7 | the Software, and to permit persons to whom the Software is furnished to do so,
8 | subject to the following conditions:
9 |
10 | The above copyright notice and this permission notice shall be included in all
11 | copies or substantial portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
15 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
16 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # NativeScript Icon Shortcuts plugin
2 |
3 | [![Build Status][build-status]][build-url]
4 | [![NPM version][npm-image]][npm-url]
5 | [![Downloads][downloads-image]][npm-url]
6 | [![Twitter Follow][twitter-image]][twitter-url]
7 |
8 | [build-status]:https://travis-ci.org/EddyVerbruggen/nativescript-app-shortcuts.svg?branch=master
9 | [build-url]:https://travis-ci.org/EddyVerbruggen/nativescript-app-shortcuts
10 | [npm-image]:http://img.shields.io/npm/v/nativescript-app-shortcuts.svg
11 | [npm-url]:https://npmjs.org/package/nativescript-app-shortcuts
12 | [downloads-image]:http://img.shields.io/npm/dm/nativescript-app-shortcuts.svg
13 | [twitter-image]:https://img.shields.io/twitter/follow/eddyverbruggen.svg?style=social&label=Follow%20me
14 | [twitter-url]:https://twitter.com/eddyverbruggen
15 |
16 |
17 |
18 | ### Supported platforms
19 | * iPhone 6s / 6s Plus or newer, running iOS 9 or newer.
20 | * Android 7.1 (API level 25) or newer.
21 |
22 | ## Installation
23 | From the command prompt go to your app's root folder and execute:
24 |
25 | NativesScript 7.x
26 | ```
27 | tns plugin add nativescript-app-shortcuts
28 | ```
29 |
30 | NativesScript 6.x
31 | ```
32 | tns plugin add nativescript-app-shortcuts@2.2.0
33 | ```
34 |
35 | ## Demo app (XML & TypeScript)
36 | Want to dive in quickly? Check out [the demo app](demo)! Otherwise, continue reading.
37 |
38 | ## Demo app (Angular)
39 | This plugin is part of the [plugin showcase app](https://github.com/EddyVerbruggen/nativescript-pluginshowcase/tree/master/app/appicon) I built using Angular.
40 |
41 | ## API
42 |
43 | ### `available`
44 | Check whether or not the device is capable.
45 | Android devices will also report `false`, so you can use this cross platform.
46 |
47 | ##### JavaScript
48 | ```js
49 | // require the plugin
50 | var AppShortcuts = require("nativescript-app-shortcuts").AppShortcuts;
51 |
52 | // instantiate the plugin
53 | var appShortcuts = new AppShortcuts();
54 |
55 | appShortcuts.available().then(
56 | function(available) {
57 | if (available) {
58 | console.log("This device supports app shortcuts");
59 | } else {
60 | console.log("No app shortcuts capability, ask the user to upgrade :)");
61 | }
62 | }
63 | );
64 | ```
65 |
66 | ##### TypeScript
67 | ```typescript
68 | // require the plugin
69 | import { AppShortcuts } from "nativescript-app-shortcuts";
70 |
71 | // instantiate the plugin
72 | let appShortcuts = new AppShortcuts();
73 |
74 | appShortcuts.available().then(available => {
75 | if (available) {
76 | console.log("This device supports app shortcuts");
77 | } else {
78 | console.log("No app shortcuts capability, ask the user to upgrade :)");
79 | }
80 | });
81 | ```
82 |
83 | ### `configureQuickActions`
84 | When your app is running you can add those fancy Quick Actions to the Home Screen icon. You can configure up to four icons and they are 'cached' by iOS until you pass in a new set of icons. So you don't need to do this every time your app loads, but it can't really hurt of course.
85 |
86 | The `type` param (see the code sample below) is the most convenient way to relate the icon to the event you'll receive when the action was used to launch your app. So make sure it's unique amongst your icons.
87 |
88 | There are two types of icons currently supported: `iconType` and `iconTemplate`.
89 |
90 | #### iconType (iOS)
91 | A value from a [fixed list of icons which have been provided by Apple](https://developer.apple.com/ios/human-interface-guidelines/icons-and-images/system-icons/#home-screen-quick-action-icons) and look great (click the value in the 'API' column to look up the Objective-C name, and look at the sample below how to use them).
92 |
93 | #### iconTemplate
94 | Can be used to provide your own icon. It must be a valid name of an icon template in your Assets catalog. NativeScript allows you to add the icon to the `app/App_Resources/` folder. If you add a file called `beer.png` then reference it as `beer`. More on these images below when we discuss static actions.
95 |
96 | Ignored on iOS, if `iconType` is set as well.
97 |
98 | ##### TypeScript
99 | ```typescript
100 | import { AppShortcuts } from "nativescript-app-shortcuts";
101 | import { isIOS } from "tns-core-modules/platform";
102 |
103 | let appShortcuts = new AppShortcuts();
104 |
105 | appShortcuts.configureQuickActions([
106 | {
107 | type: "capturePhoto",
108 | title: "Snag a pic",
109 | subtitle: "You have 23 snags left", // iOS only
110 | iconType: isIOS ? UIApplicationShortcutIconType.CapturePhoto : null,
111 | iconTemplate: "eye" // ignored by iOS, if iconType is set as well
112 | },
113 | {
114 | type: "beer",
115 | title: "Beer-tastic!",
116 | subtitle: "Check in & share", // iOS only
117 | iconTemplate: "beer"
118 | }
119 | ]).then(() => {
120 | alert("Added 2 actions, close the app and apply pressure to the app icon to check it out!");
121 | }, (errorMessage) => {
122 | alert(errorMessage);
123 | });
124 | ```
125 |
126 | ## Capturing the Action
127 | When a home icon is pressed, your app launches. You probably want to perform different actions based on the home icon action
128 | that was picked (like routing to a different page), so you need a way to capture the event.
129 |
130 | ### NativeScript with XML
131 | In a non-Angular NativeScript app we need to extend `app.js` or `app.ts` and import the plugin,
132 | then call the `setQuickActionCallback` function. So in case of `app.ts` change it from something like this:
133 |
134 | ```typescript
135 | import * as application from "tns-core-modules/application";
136 | application.start({ moduleName: "main-page" });
137 | ```
138 |
139 | To this:
140 |
141 | ```typescript
142 | import * as application from "tns-core-modules/application";
143 |
144 | // import the plugin
145 | import { AppShortcuts } from "nativescript-app-shortcuts";
146 |
147 | // instantiate it and call setQuickActionCallback
148 | new AppShortcuts().setQuickActionCallback(shortcutItem => {
149 | console.log(`The app was launched by shortcut type '${shortcutItem.type}'`);
150 |
151 | // this is where you handle any specific case for the shortcut
152 | if (shortcutItem.type === "beer") {
153 | // this is an example of 'deeplinking' through a shortcut
154 | let frames = require("ui/frame");
155 | // on Android we need a little delay
156 | setTimeout(() => {
157 | frames.topmost().navigate("beer-page");
158 | });
159 | } else {
160 | // .. any other shortcut handling
161 | }
162 | });
163 |
164 | application.start({ moduleName: "main-page" });
165 | ```
166 |
167 | ### NativeScript with Angular
168 | If you're using Angular, the best place to add the handler is in `app.module.ts`,
169 | and use `NgZone` to help Angular knowing about the route change you're performing:
170 |
171 | ```typescript
172 | import { NgZone } from "@angular/core";
173 | import { isIOS } from "tns-core-modules/platform";
174 | import { RouterExtensions } from "nativescript-angular";
175 | import { AppShortcuts } from "nativescript-app-shortcuts";
176 |
177 | export class AppModule {
178 | constructor(private routerExtensions: RouterExtensions,
179 | private zone: NgZone) {
180 |
181 | new AppShortcuts().setQuickActionCallback(shortcutItem => {
182 | console.log(`The app was launched by shortcut type '${shortcutItem.type}'`);
183 |
184 | // this is where you handle any specific case for the shortcut, based on its type
185 | if (shortcutItem.type === "page1") {
186 | this.deeplink("/page1");
187 | } else if (shortcutItem.type === "page2") {
188 | this.deeplink("/page2");
189 | }
190 | });
191 | }
192 |
193 | private deeplink(to: string): void {
194 | this.zone.run(() => {
195 | this.routerExtensions.navigate([to], {
196 | animated: false
197 | });
198 | });
199 | }
200 | }
201 | ```
202 |
203 | ## Configuring Static Actions
204 | With `configureQuickActions` you can configure dynamic actions,
205 | but what if you want actions to be available immediately after the app as installed from the store?
206 |
207 | ### iOS
208 | You need to manually edit the `.plist`.
209 | Fortunately NativeScript allows you to change this file through `app/App_Resources/iOS/Info.plist`. Anything added there is added to the final `.plist` during a build.
210 |
211 | Note that dynamic actions will never replace static actions, so if you have two static actions you can add up to two dynamic ones. Any more will be ignored.
212 |
213 | Here's an example which you can paste anywhere in the `.plist` file:
214 |
215 | ```xml
216 | UIApplicationShortcutItems
217 |
218 |
219 | UIApplicationShortcutItemIconFile
220 | Eye
221 | UIApplicationShortcutItemTitle
222 | Eye from plist
223 | UIApplicationShortcutItemSubtitle
224 | Awesome subtitle
225 | UIApplicationShortcutItemType
226 | eyefromplist
227 |
228 |
229 | UIApplicationShortcutItemIconType
230 | UIApplicationShortcutIconTypeCompose
231 | UIApplicationShortcutItemTitle
232 | Compose
233 | UIApplicationShortcutItemType
234 | compose
235 |
236 |
237 | ```
238 |
239 | #### UIApplicationShortcutItemIconFile
240 |
241 | The second action above uses the built-in `UIApplicationShortcutIconTypeCompose` icon, but the first one uses a custom icon: `Eye`. This expects the file `app/App_Resources/iOS/Eye.png`. According to Apple's docs this needs to be a single color, transparent, square, `35x35` icon - but that size will look pixelated on retina devices so go ahead and use a `70x70` or `105x105` icon if you please.
242 |
243 | #### UIApplicationShortcutItemTitle / UIApplicationShortcutItemSubtitle
244 |
245 | You can guess what those do, right? Only the title is mandatory.
246 |
247 | #### UIApplicationShortcutItemType
248 |
249 | This is the same as the `type` param of `configureQuickActions`, so it's what you'll receive in the callback you may have configured in `app.js` / `app.ts` as `payload.type`. Just do something cool with that info (like routing to a specific page and loading some content).
250 |
251 | ### Android
252 | Open `app/App_Resources/Android/AndroidManifest.xml` and add:
253 |
254 | ```xml
255 |
256 |
258 |
259 | ```
260 |
261 | Add the file you referenced in `AndroidManifest.xml`: `/app/App_Resources/Android/xml/shortcuts.xml` and add:
262 |
263 | ```xml
264 |
265 |
272 |
276 |
277 |
278 |
279 | ```
280 |
281 | A few notes:
282 | - This adds 1 static `shortcut` to your app (you can add more if you like).
283 | - Make sure the `action` has the `shortcut.type.` prefix. The value behind the prefix is the equivalent of the iOS `UIApplicationShortcutItemType`.
284 | - The `targetPackage` needs to be your app id.
285 | - The `targetClass` needs to be the `activity` class as mentioned in `AndroidManifest.xml`, which is `com.tns.NativeScriptApplication` by default.
286 |
--------------------------------------------------------------------------------
/demo/app/App_Resources/Android/app.gradle:
--------------------------------------------------------------------------------
1 | // Add your native dependencies here:
2 |
3 | // Uncomment to add recyclerview-v7 dependency
4 | //dependencies {
5 | // compile 'com.android.support:recyclerview-v7:+'
6 | //}
7 |
8 | android {
9 | defaultConfig {
10 | generatedDensities = []
11 | applicationId = "org.nativescript.plugindemo.appshortcuts"
12 | }
13 | aaptOptions {
14 | additionalParameters "--no-version-vectors"
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/demo/app/App_Resources/Android/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
12 |
13 |
16 |
17 |
18 |
19 |
20 |
21 |
27 |
28 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
43 |
44 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/demo/app/App_Resources/Android/src/main/res/drawable-hdpi/background.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-app-shortcuts/fbed9a0251c6c00c7a9e353490b055d0d9fb7efb/demo/app/App_Resources/Android/src/main/res/drawable-hdpi/background.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/Android/src/main/res/drawable-hdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-app-shortcuts/fbed9a0251c6c00c7a9e353490b055d0d9fb7efb/demo/app/App_Resources/Android/src/main/res/drawable-hdpi/icon.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/Android/src/main/res/drawable-hdpi/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-app-shortcuts/fbed9a0251c6c00c7a9e353490b055d0d9fb7efb/demo/app/App_Resources/Android/src/main/res/drawable-hdpi/logo.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/Android/src/main/res/drawable-ldpi/background.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-app-shortcuts/fbed9a0251c6c00c7a9e353490b055d0d9fb7efb/demo/app/App_Resources/Android/src/main/res/drawable-ldpi/background.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/Android/src/main/res/drawable-ldpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-app-shortcuts/fbed9a0251c6c00c7a9e353490b055d0d9fb7efb/demo/app/App_Resources/Android/src/main/res/drawable-ldpi/icon.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/Android/src/main/res/drawable-ldpi/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-app-shortcuts/fbed9a0251c6c00c7a9e353490b055d0d9fb7efb/demo/app/App_Resources/Android/src/main/res/drawable-ldpi/logo.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/Android/src/main/res/drawable-mdpi/background.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-app-shortcuts/fbed9a0251c6c00c7a9e353490b055d0d9fb7efb/demo/app/App_Resources/Android/src/main/res/drawable-mdpi/background.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/Android/src/main/res/drawable-mdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-app-shortcuts/fbed9a0251c6c00c7a9e353490b055d0d9fb7efb/demo/app/App_Resources/Android/src/main/res/drawable-mdpi/icon.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/Android/src/main/res/drawable-mdpi/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-app-shortcuts/fbed9a0251c6c00c7a9e353490b055d0d9fb7efb/demo/app/App_Resources/Android/src/main/res/drawable-mdpi/logo.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/Android/src/main/res/drawable-nodpi/add.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-app-shortcuts/fbed9a0251c6c00c7a9e353490b055d0d9fb7efb/demo/app/App_Resources/Android/src/main/res/drawable-nodpi/add.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/Android/src/main/res/drawable-nodpi/beer.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-app-shortcuts/fbed9a0251c6c00c7a9e353490b055d0d9fb7efb/demo/app/App_Resources/Android/src/main/res/drawable-nodpi/beer.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/Android/src/main/res/drawable-nodpi/eye.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-app-shortcuts/fbed9a0251c6c00c7a9e353490b055d0d9fb7efb/demo/app/App_Resources/Android/src/main/res/drawable-nodpi/eye.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/Android/src/main/res/drawable-nodpi/splash_screen.xml:
--------------------------------------------------------------------------------
1 |
2 | -
3 |
4 |
5 | -
6 |
7 |
8 |
--------------------------------------------------------------------------------
/demo/app/App_Resources/Android/src/main/res/drawable-xhdpi/background.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-app-shortcuts/fbed9a0251c6c00c7a9e353490b055d0d9fb7efb/demo/app/App_Resources/Android/src/main/res/drawable-xhdpi/background.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/Android/src/main/res/drawable-xhdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-app-shortcuts/fbed9a0251c6c00c7a9e353490b055d0d9fb7efb/demo/app/App_Resources/Android/src/main/res/drawable-xhdpi/icon.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/Android/src/main/res/drawable-xhdpi/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-app-shortcuts/fbed9a0251c6c00c7a9e353490b055d0d9fb7efb/demo/app/App_Resources/Android/src/main/res/drawable-xhdpi/logo.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/Android/src/main/res/drawable-xxhdpi/background.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-app-shortcuts/fbed9a0251c6c00c7a9e353490b055d0d9fb7efb/demo/app/App_Resources/Android/src/main/res/drawable-xxhdpi/background.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/Android/src/main/res/drawable-xxhdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-app-shortcuts/fbed9a0251c6c00c7a9e353490b055d0d9fb7efb/demo/app/App_Resources/Android/src/main/res/drawable-xxhdpi/icon.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/Android/src/main/res/drawable-xxhdpi/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-app-shortcuts/fbed9a0251c6c00c7a9e353490b055d0d9fb7efb/demo/app/App_Resources/Android/src/main/res/drawable-xxhdpi/logo.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/Android/src/main/res/drawable-xxxhdpi/background.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-app-shortcuts/fbed9a0251c6c00c7a9e353490b055d0d9fb7efb/demo/app/App_Resources/Android/src/main/res/drawable-xxxhdpi/background.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/Android/src/main/res/drawable-xxxhdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-app-shortcuts/fbed9a0251c6c00c7a9e353490b055d0d9fb7efb/demo/app/App_Resources/Android/src/main/res/drawable-xxxhdpi/icon.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/Android/src/main/res/drawable-xxxhdpi/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-app-shortcuts/fbed9a0251c6c00c7a9e353490b055d0d9fb7efb/demo/app/App_Resources/Android/src/main/res/drawable-xxxhdpi/logo.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/Android/src/main/res/values-v21/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3d5afe
4 |
--------------------------------------------------------------------------------
/demo/app/App_Resources/Android/src/main/res/values-v21/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
9 |
10 |
11 |
14 |
15 |
16 |
19 |
20 |
23 |
--------------------------------------------------------------------------------
/demo/app/App_Resources/Android/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #F5F5F5
4 | #757575
5 | #33B5E5
6 | #272734
7 |
--------------------------------------------------------------------------------
/demo/app/App_Resources/Android/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Shortcut demo
3 | Shortcut demo
4 |
5 | Add
6 | Add stuff
7 | Adding disabled
8 |
--------------------------------------------------------------------------------
/demo/app/App_Resources/Android/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
18 |
19 |
21 |
22 |
23 |
31 |
32 |
34 |
35 |
36 |
42 |
43 |
45 |
46 |
--------------------------------------------------------------------------------
/demo/app/App_Resources/Android/src/main/res/xml/shortcuts.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "size" : "29x29",
5 | "idiom" : "iphone",
6 | "filename" : "icon-29.png",
7 | "scale" : "1x"
8 | },
9 | {
10 | "size" : "29x29",
11 | "idiom" : "iphone",
12 | "filename" : "icon-29@2x.png",
13 | "scale" : "2x"
14 | },
15 | {
16 | "size" : "29x29",
17 | "idiom" : "iphone",
18 | "filename" : "icon-29@3x.png",
19 | "scale" : "3x"
20 | },
21 | {
22 | "size" : "40x40",
23 | "idiom" : "iphone",
24 | "filename" : "icon-40@2x.png",
25 | "scale" : "2x"
26 | },
27 | {
28 | "size" : "40x40",
29 | "idiom" : "iphone",
30 | "filename" : "icon-40@3x.png",
31 | "scale" : "3x"
32 | },
33 | {
34 | "size" : "57x57",
35 | "idiom" : "iphone",
36 | "filename" : "icon-57.png",
37 | "scale" : "1x"
38 | },
39 | {
40 | "size" : "57x57",
41 | "idiom" : "iphone",
42 | "filename" : "icon-57@2x.png",
43 | "scale" : "2x"
44 | },
45 | {
46 | "size" : "60x60",
47 | "idiom" : "iphone",
48 | "filename" : "icon-60@2x.png",
49 | "scale" : "2x"
50 | },
51 | {
52 | "size" : "60x60",
53 | "idiom" : "iphone",
54 | "filename" : "icon-60@3x.png",
55 | "scale" : "3x"
56 | },
57 | {
58 | "size" : "29x29",
59 | "idiom" : "ipad",
60 | "filename" : "icon-29.png",
61 | "scale" : "1x"
62 | },
63 | {
64 | "size" : "29x29",
65 | "idiom" : "ipad",
66 | "filename" : "icon-29@2x.png",
67 | "scale" : "2x"
68 | },
69 | {
70 | "size" : "40x40",
71 | "idiom" : "ipad",
72 | "filename" : "icon-40.png",
73 | "scale" : "1x"
74 | },
75 | {
76 | "size" : "40x40",
77 | "idiom" : "ipad",
78 | "filename" : "icon-40@2x.png",
79 | "scale" : "2x"
80 | },
81 | {
82 | "size" : "50x50",
83 | "idiom" : "ipad",
84 | "filename" : "icon-50.png",
85 | "scale" : "1x"
86 | },
87 | {
88 | "size" : "50x50",
89 | "idiom" : "ipad",
90 | "filename" : "icon-50@2x.png",
91 | "scale" : "2x"
92 | },
93 | {
94 | "size" : "72x72",
95 | "idiom" : "ipad",
96 | "filename" : "icon-72.png",
97 | "scale" : "1x"
98 | },
99 | {
100 | "size" : "72x72",
101 | "idiom" : "ipad",
102 | "filename" : "icon-72@2x.png",
103 | "scale" : "2x"
104 | },
105 | {
106 | "size" : "76x76",
107 | "idiom" : "ipad",
108 | "filename" : "icon-76.png",
109 | "scale" : "1x"
110 | },
111 | {
112 | "size" : "76x76",
113 | "idiom" : "ipad",
114 | "filename" : "icon-76@2x.png",
115 | "scale" : "2x"
116 | },
117 | {
118 | "size" : "83.5x83.5",
119 | "idiom" : "ipad",
120 | "filename" : "icon-83.5@2x.png",
121 | "scale" : "2x"
122 | }
123 | ],
124 | "info" : {
125 | "version" : 1,
126 | "author" : "xcode"
127 | }
128 | }
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-app-shortcuts/fbed9a0251c6c00c7a9e353490b055d0d9fb7efb/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-app-shortcuts/fbed9a0251c6c00c7a9e353490b055d0d9fb7efb/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@2x.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-app-shortcuts/fbed9a0251c6c00c7a9e353490b055d0d9fb7efb/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@3x.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-app-shortcuts/fbed9a0251c6c00c7a9e353490b055d0d9fb7efb/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-app-shortcuts/fbed9a0251c6c00c7a9e353490b055d0d9fb7efb/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@2x.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-app-shortcuts/fbed9a0251c6c00c7a9e353490b055d0d9fb7efb/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@3x.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-50.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-app-shortcuts/fbed9a0251c6c00c7a9e353490b055d0d9fb7efb/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-50.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-50@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-app-shortcuts/fbed9a0251c6c00c7a9e353490b055d0d9fb7efb/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-50@2x.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-57.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-app-shortcuts/fbed9a0251c6c00c7a9e353490b055d0d9fb7efb/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-57.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-57@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-app-shortcuts/fbed9a0251c6c00c7a9e353490b055d0d9fb7efb/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-57@2x.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-app-shortcuts/fbed9a0251c6c00c7a9e353490b055d0d9fb7efb/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@2x.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-app-shortcuts/fbed9a0251c6c00c7a9e353490b055d0d9fb7efb/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@3x.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-72.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-app-shortcuts/fbed9a0251c6c00c7a9e353490b055d0d9fb7efb/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-72.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-72@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-app-shortcuts/fbed9a0251c6c00c7a9e353490b055d0d9fb7efb/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-72@2x.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-app-shortcuts/fbed9a0251c6c00c7a9e353490b055d0d9fb7efb/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-app-shortcuts/fbed9a0251c6c00c7a9e353490b055d0d9fb7efb/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76@2x.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-83.5@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-app-shortcuts/fbed9a0251c6c00c7a9e353490b055d0d9fb7efb/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-83.5@2x.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "extent" : "full-screen",
5 | "idiom" : "iphone",
6 | "subtype" : "736h",
7 | "filename" : "Default-736h@3x.png",
8 | "minimum-system-version" : "8.0",
9 | "orientation" : "portrait",
10 | "scale" : "3x"
11 | },
12 | {
13 | "extent" : "full-screen",
14 | "idiom" : "iphone",
15 | "subtype" : "736h",
16 | "filename" : "Default-Landscape@3x.png",
17 | "minimum-system-version" : "8.0",
18 | "orientation" : "landscape",
19 | "scale" : "3x"
20 | },
21 | {
22 | "extent" : "full-screen",
23 | "idiom" : "iphone",
24 | "subtype" : "667h",
25 | "filename" : "Default-667h@2x.png",
26 | "minimum-system-version" : "8.0",
27 | "orientation" : "portrait",
28 | "scale" : "2x"
29 | },
30 | {
31 | "orientation" : "portrait",
32 | "idiom" : "iphone",
33 | "filename" : "Default@2x.png",
34 | "extent" : "full-screen",
35 | "minimum-system-version" : "7.0",
36 | "scale" : "2x"
37 | },
38 | {
39 | "extent" : "full-screen",
40 | "idiom" : "iphone",
41 | "subtype" : "retina4",
42 | "filename" : "Default-568h@2x.png",
43 | "minimum-system-version" : "7.0",
44 | "orientation" : "portrait",
45 | "scale" : "2x"
46 | },
47 | {
48 | "orientation" : "portrait",
49 | "idiom" : "ipad",
50 | "filename" : "Default-Portrait.png",
51 | "extent" : "full-screen",
52 | "minimum-system-version" : "7.0",
53 | "scale" : "1x"
54 | },
55 | {
56 | "orientation" : "landscape",
57 | "idiom" : "ipad",
58 | "filename" : "Default-Landscape.png",
59 | "extent" : "full-screen",
60 | "minimum-system-version" : "7.0",
61 | "scale" : "1x"
62 | },
63 | {
64 | "orientation" : "portrait",
65 | "idiom" : "ipad",
66 | "filename" : "Default-Portrait@2x.png",
67 | "extent" : "full-screen",
68 | "minimum-system-version" : "7.0",
69 | "scale" : "2x"
70 | },
71 | {
72 | "orientation" : "landscape",
73 | "idiom" : "ipad",
74 | "filename" : "Default-Landscape@2x.png",
75 | "extent" : "full-screen",
76 | "minimum-system-version" : "7.0",
77 | "scale" : "2x"
78 | },
79 | {
80 | "orientation" : "portrait",
81 | "idiom" : "iphone",
82 | "filename" : "Default.png",
83 | "extent" : "full-screen",
84 | "scale" : "1x"
85 | },
86 | {
87 | "orientation" : "portrait",
88 | "idiom" : "iphone",
89 | "filename" : "Default@2x.png",
90 | "extent" : "full-screen",
91 | "scale" : "2x"
92 | },
93 | {
94 | "orientation" : "portrait",
95 | "idiom" : "iphone",
96 | "filename" : "Default-568h@2x.png",
97 | "extent" : "full-screen",
98 | "subtype" : "retina4",
99 | "scale" : "2x"
100 | },
101 | {
102 | "orientation" : "portrait",
103 | "idiom" : "ipad",
104 | "extent" : "to-status-bar",
105 | "scale" : "1x"
106 | },
107 | {
108 | "orientation" : "portrait",
109 | "idiom" : "ipad",
110 | "filename" : "Default-Portrait.png",
111 | "extent" : "full-screen",
112 | "scale" : "1x"
113 | },
114 | {
115 | "orientation" : "landscape",
116 | "idiom" : "ipad",
117 | "extent" : "to-status-bar",
118 | "scale" : "1x"
119 | },
120 | {
121 | "orientation" : "landscape",
122 | "idiom" : "ipad",
123 | "filename" : "Default-Landscape.png",
124 | "extent" : "full-screen",
125 | "scale" : "1x"
126 | },
127 | {
128 | "orientation" : "portrait",
129 | "idiom" : "ipad",
130 | "extent" : "to-status-bar",
131 | "scale" : "2x"
132 | },
133 | {
134 | "orientation" : "portrait",
135 | "idiom" : "ipad",
136 | "filename" : "Default-Portrait@2x.png",
137 | "extent" : "full-screen",
138 | "scale" : "2x"
139 | },
140 | {
141 | "orientation" : "landscape",
142 | "idiom" : "ipad",
143 | "extent" : "to-status-bar",
144 | "scale" : "2x"
145 | },
146 | {
147 | "orientation" : "landscape",
148 | "idiom" : "ipad",
149 | "filename" : "Default-Landscape@2x.png",
150 | "extent" : "full-screen",
151 | "scale" : "2x"
152 | }
153 | ],
154 | "info" : {
155 | "version" : 1,
156 | "author" : "xcode"
157 | }
158 | }
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-568h@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-app-shortcuts/fbed9a0251c6c00c7a9e353490b055d0d9fb7efb/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-568h@2x.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-667h@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-app-shortcuts/fbed9a0251c6c00c7a9e353490b055d0d9fb7efb/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-667h@2x.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-736h@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-app-shortcuts/fbed9a0251c6c00c7a9e353490b055d0d9fb7efb/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-736h@3x.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-app-shortcuts/fbed9a0251c6c00c7a9e353490b055d0d9fb7efb/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-app-shortcuts/fbed9a0251c6c00c7a9e353490b055d0d9fb7efb/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape@2x.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-app-shortcuts/fbed9a0251c6c00c7a9e353490b055d0d9fb7efb/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape@3x.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-app-shortcuts/fbed9a0251c6c00c7a9e353490b055d0d9fb7efb/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-app-shortcuts/fbed9a0251c6c00c7a9e353490b055d0d9fb7efb/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait@2x.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-app-shortcuts/fbed9a0251c6c00c7a9e353490b055d0d9fb7efb/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-app-shortcuts/fbed9a0251c6c00c7a9e353490b055d0d9fb7efb/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default@2x.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "LaunchScreen-AspectFill.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "filename" : "LaunchScreen-AspectFill@2x.png",
11 | "scale" : "2x"
12 | },
13 | {
14 | "idiom" : "universal",
15 | "scale" : "3x"
16 | }
17 | ],
18 | "info" : {
19 | "version" : 1,
20 | "author" : "xcode"
21 | }
22 | }
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-app-shortcuts/fbed9a0251c6c00c7a9e353490b055d0d9fb7efb/demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-app-shortcuts/fbed9a0251c6c00c7a9e353490b055d0d9fb7efb/demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill@2x.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "LaunchScreen-Center.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "filename" : "LaunchScreen-Center@2x.png",
11 | "scale" : "2x"
12 | },
13 | {
14 | "idiom" : "universal",
15 | "scale" : "3x"
16 | }
17 | ],
18 | "info" : {
19 | "version" : 1,
20 | "author" : "xcode"
21 | }
22 | }
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-app-shortcuts/fbed9a0251c6c00c7a9e353490b055d0d9fb7efb/demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-app-shortcuts/fbed9a0251c6c00c7a9e353490b055d0d9fb7efb/demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center@2x.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleDisplayName
8 | 3D Touch
9 | CFBundleExecutable
10 | ${EXECUTABLE_NAME}
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | 3D Touch
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1.0
23 | LSRequiresIPhoneOS
24 |
25 | UILaunchStoryboardName
26 | LaunchScreen
27 | UIRequiresFullScreen
28 |
29 | UIRequiredDeviceCapabilities
30 |
31 | armv7
32 |
33 | UISupportedInterfaceOrientations
34 |
35 | UIInterfaceOrientationPortrait
36 | UIInterfaceOrientationLandscapeLeft
37 | UIInterfaceOrientationLandscapeRight
38 |
39 | UISupportedInterfaceOrientations~ipad
40 |
41 | UIInterfaceOrientationPortrait
42 | UIInterfaceOrientationPortraitUpsideDown
43 | UIInterfaceOrientationLandscapeLeft
44 | UIInterfaceOrientationLandscapeRight
45 |
46 | UIApplicationShortcutItems
47 |
48 |
49 | UIApplicationShortcutItemIconType
50 | UIApplicationShortcutIconTypeCompose
51 | UIApplicationShortcutItemTitle
52 | Compose
53 | UIApplicationShortcutItemType
54 | compose
55 |
56 |
57 | UIApplicationShortcutItemIconFile
58 | eye
59 | UIApplicationShortcutItemTitle
60 | Eye C U
61 | UIApplicationShortcutItemSubtitle
62 | I'm a static action
63 | UIApplicationShortcutItemType
64 | eyefromplist
65 |
66 |
67 |
68 |
69 |
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
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 |
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Podfile:
--------------------------------------------------------------------------------
1 | post_install do |installer|
2 | installer.pods_project.targets.each do |target|
3 | target.build_configurations.each do |config|
4 | config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
5 | end
6 | end
7 | end
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/beer.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-app-shortcuts/fbed9a0251c6c00c7a9e353490b055d0d9fb7efb/demo/app/App_Resources/iOS/beer.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/build.xcconfig:
--------------------------------------------------------------------------------
1 | // You can add custom settings here
2 | // for example you can uncomment the following line to force distribution code signing
3 | // CODE_SIGN_IDENTITY = iPhone Distribution
4 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
5 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
6 | VERIFY_WORKSPACE = YES;
7 | VALIDATE_WORKSPACE = YES;
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/eye.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-app-shortcuts/fbed9a0251c6c00c7a9e353490b055d0d9fb7efb/demo/app/App_Resources/iOS/eye.png
--------------------------------------------------------------------------------
/demo/app/app-root.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/demo/app/app.css:
--------------------------------------------------------------------------------
1 | page {
2 | background-color: #F4F4F4;
3 | }
4 |
5 | .tab-content {
6 | color: #808080;
7 | padding: 20;
8 | }
9 |
10 | .title {
11 | font-size: 20;
12 | margin: 0 0 10 0;
13 | color: #3c3c3c;
14 | }
15 |
16 | .subtitle {
17 | font-size: 14;
18 | margin: 14 0 6 18;
19 | color: #3c3c3c;
20 | }
21 |
22 | .message {
23 | font-size: 14;
24 | color: #284848;
25 | margin: 8 0 8 18;
26 | }
27 |
28 | label {
29 | font-size: 14;
30 | }
31 |
32 | button {
33 | background-color: #6494AA;
34 | padding: 8 12;
35 | margin: 4 10;
36 | font-size: 13;
37 | border-radius: 4;
38 | }
39 |
40 | .button {
41 | color: #ffffff;
42 | }
43 |
44 | .button-positive {
45 | background-color: #90A959;
46 | }
47 |
48 | .button-available {
49 | background-color: #E0A458;
50 | }
51 |
52 | .button-company {
53 | background-color: #A63D40;
54 | }
--------------------------------------------------------------------------------
/demo/app/app.ts:
--------------------------------------------------------------------------------
1 | import { Application, Frame } from "@nativescript/core";
2 | import { AppShortcuts } from "nativescript-app-shortcuts";
3 |
4 | // .. and set a callback handler as well
5 | new AppShortcuts().setQuickActionCallback(shortcutItem => {
6 | console.log(`The app was launched by shortcut type '${shortcutItem.type}'`);
7 |
8 | // this is where you handle any specific case for the shortcut
9 | if (shortcutItem.type === "beer") {
10 | setTimeout(() => {
11 | Frame.getFrameById("appRootFrame") // see app-root.xml
12 | .navigate("beer-page");
13 | });
14 | } else {
15 | // .. any other shortcut handling
16 | }
17 | });
18 |
19 | Application.run({moduleName: "app-root"});
20 |
--------------------------------------------------------------------------------
/demo/app/beer-page.ts:
--------------------------------------------------------------------------------
1 | import { EventData } from "@nativescript/core";
2 |
3 | // Event handler for Page "loaded" event attached in beer-page.xml
4 | export function pageLoaded(args: EventData) {
5 | console.log("--- beers page loaded!");
6 | }
--------------------------------------------------------------------------------
/demo/app/beer-page.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/demo/app/bundle-config.ts:
--------------------------------------------------------------------------------
1 | if ((global).TNS_WEBPACK) {
2 | require("tns-core-modules/bundle-entry-points");
3 |
4 | global.registerModule("main-page", () => require("./main-page"));
5 | }
6 |
--------------------------------------------------------------------------------
/demo/app/main-page.ts:
--------------------------------------------------------------------------------
1 | import { EventData, Page } from "@nativescript/core";
2 | import { HelloWorldModel } from "./main-view-model";
3 |
4 | // Event handler for Page "loaded" event attached in main-page.xml
5 | export function pageLoaded(args: EventData) {
6 | // Get the event sender
7 | let page = args.object;
8 | page.bindingContext = new HelloWorldModel();
9 | }
--------------------------------------------------------------------------------
/demo/app/main-page.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
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 |
--------------------------------------------------------------------------------
/demo/app/main-view-model.ts:
--------------------------------------------------------------------------------
1 | import { Observable, isIOS } from "@nativescript/core";
2 | import { AppShortcuts } from "nativescript-app-shortcuts";
3 |
4 | declare const UIApplicationShortcutIconType;
5 |
6 | export class HelloWorldModel extends Observable {
7 | private appShortcuts: AppShortcuts;
8 |
9 | constructor() {
10 | super();
11 | this.appShortcuts = new AppShortcuts();
12 | }
13 |
14 | public isAvailable() {
15 | this.appShortcuts.available().then((avail) => {
16 | alert("Available? " + avail);
17 | });
18 | }
19 |
20 | public configure1QuickAction() {
21 | this.appShortcuts.configureQuickActions([
22 | {
23 | type: "capturePhoto", // optional, but can be used in the onHomeIconPressed callback
24 | title: "Snag a pic", // mandatory
25 | subtitle: "You have 18 snags left", // optional
26 | iconType: isIOS ? UIApplicationShortcutIconType.UIApplicationShortcutIconTypeCapturePhoto : null,
27 | iconTemplate: "eye" // refers to an image in app/App_Resources
28 | }
29 | ]).then(() => {
30 | alert("Added 1 action, close the app and apply pressure to the app icon to check it out!");
31 | }, (errorMessage) => {
32 | alert(errorMessage);
33 | });
34 | }
35 |
36 | public configure2QuickActions() {
37 | this.appShortcuts.configureQuickActions([
38 | {
39 | type: "capturePhoto", // optional, but can be used in the onHomeIconPressed callback
40 | title: "Snag a pic", // mandatory
41 | subtitle: "You have 8 snags left", // optional
42 | iconType: isIOS ? UIApplicationShortcutIconType.UIApplicationShortcutIconTypeCapturePhoto : null,
43 | iconTemplate: "eye" // refers to an image in app/App_Resources
44 | },
45 | {
46 | type: "beer",
47 | title: "Beer-tastic!",
48 | subtitle: "Check in & share", // optional
49 | iconTemplate: "beer" // refers to an image in app/App_Resources
50 | }
51 | ]).then(() => {
52 | alert("Added 2 actions, close the app and apply pressure to the app icon to check it out!");
53 | }, (errorMessage) => {
54 | alert(errorMessage);
55 | });
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/demo/app/res/cheers_to_beers.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-app-shortcuts/fbed9a0251c6c00c7a9e353490b055d0d9fb7efb/demo/app/res/cheers_to_beers.jpg
--------------------------------------------------------------------------------
/demo/app/res/telerik-logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-app-shortcuts/fbed9a0251c6c00c7a9e353490b055d0d9fb7efb/demo/app/res/telerik-logo.png
--------------------------------------------------------------------------------
/demo/app/tests/tests.js:
--------------------------------------------------------------------------------
1 | var AppShortcuts = require("nativescript-app-shortcuts").AppShortcuts;
2 | var appShortcuts = new AppShortcuts();
3 |
4 | describe("available", function () {
5 | it("exists", function () {
6 | expect(appShortcuts.available).toBeDefined();
7 | });
8 |
9 | it("returns a promise", function () {
10 | expect(appShortcuts.available()).toEqual(jasmine.any(Promise));
11 | });
12 | });
13 |
14 | describe("configureQuickActions", function () {
15 | it("exists", function () {
16 | expect(appShortcuts.configureQuickActions).toBeDefined();
17 | });
18 |
19 | it("returns a promise", function () {
20 | expect(appShortcuts.configureQuickActions()).toEqual(jasmine.any(Promise));
21 | });
22 | });
23 |
24 | describe("configureQuickActions", function () {
25 | it("exists", function () {
26 | expect(appShortcuts.setQuickActionCallback).toBeDefined();
27 | });
28 |
29 | it("returns a promise", function () {
30 | expect(appShortcuts.setQuickActionCallback()).toEqual(undefined);
31 | });
32 | });
33 |
--------------------------------------------------------------------------------
/demo/karma.conf.js:
--------------------------------------------------------------------------------
1 | module.exports = function (config) {
2 | const options = {
3 |
4 | // base path that will be used to resolve all patterns (eg. files, exclude)
5 | basePath: '',
6 |
7 |
8 | // frameworks to use
9 | // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
10 | frameworks: ['jasmine'],
11 |
12 |
13 | // list of files / patterns to load in the browser
14 | files: [
15 | 'app/tests/**/*.ts',
16 | 'app/tests/**/*.js'
17 | ],
18 |
19 |
20 | // list of files to exclude
21 | exclude: [
22 | ],
23 |
24 |
25 | // preprocess matching files before serving them to the browser
26 | // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
27 | preprocessors: {
28 | },
29 |
30 |
31 | // test results reporter to use
32 | // possible values: 'dots', 'progress'
33 | // available reporters: https://npmjs.org/browse/keyword/karma-reporter
34 | reporters: ['progress'],
35 |
36 |
37 | // web server port
38 | port: 9876,
39 |
40 |
41 | // enable / disable colors in the output (reporters and logs)
42 | colors: true,
43 |
44 |
45 | // level of logging
46 | // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
47 | logLevel: config.LOG_INFO,
48 |
49 |
50 | // enable / disable watching file and executing tests whenever any file changes
51 | autoWatch: true,
52 |
53 |
54 | // start these browsers
55 | // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
56 | browsers: [],
57 |
58 | customLaunchers: {
59 | android: {
60 | base: 'NS',
61 | platform: 'android'
62 | },
63 | ios: {
64 | base: 'NS',
65 | platform: 'ios'
66 | },
67 | ios_simulator: {
68 | base: 'NS',
69 | platform: 'ios',
70 | arguments: ['--emulator']
71 | }
72 | },
73 |
74 | // Continuous Integration mode
75 | // if true, Karma captures browsers, runs the tests and exits
76 | singleRun: false
77 | };
78 |
79 | setWebpackPreprocessor(config, options);
80 | setWebpack(config, options);
81 |
82 | config.set(options);
83 | }
84 |
85 | function setWebpackPreprocessor(config, options) {
86 | if (config && config.bundle) {
87 | if (!options.preprocessors) {
88 | options.preprocessors = {};
89 | }
90 |
91 | options.files.forEach(file => {
92 | if (!options.preprocessors[file]) {
93 | options.preprocessors[file] = [];
94 | }
95 | options.preprocessors[file].push('webpack');
96 | });
97 | }
98 | }
99 |
100 | function setWebpack(config, options) {
101 | if (config && config.bundle) {
102 | const env = {};
103 | env[config.platform] = true;
104 | env.sourceMap = config.debugBrk;
105 | env.appPath = config.appPath;
106 | options.webpack = require('./webpack.config')(env);
107 | delete options.webpack.entry;
108 | delete options.webpack.output.libraryTarget;
109 | const invalidPluginsForUnitTesting = ["GenerateBundleStarterPlugin", "GenerateNativeScriptEntryPointsPlugin"];
110 | options.webpack.plugins = options.webpack.plugins.filter(p => !invalidPluginsForUnitTesting.includes(p.constructor.name));
111 | }
112 | }
113 |
--------------------------------------------------------------------------------
/demo/nativescript.config.ts:
--------------------------------------------------------------------------------
1 | import { NativeScriptConfig } from '@nativescript/core';
2 |
3 | export default {
4 | id: 'org.nativescript.plugindemo.appshortcuts',
5 | appResourcesPath: 'app/App_Resources',
6 | android: {
7 | v8Flags: '--expose_gc',
8 | markingMode: 'none',
9 | },
10 | appPath: 'app',
11 | } as NativeScriptConfig;
12 |
--------------------------------------------------------------------------------
/demo/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "dependencies": {
3 | "@nativescript/core": "7.0.0",
4 | "@nativescript/unit-test-runner": "^1.0.2",
5 | "@nativescript/webpack": "3.0.0",
6 | "nativescript-app-shortcuts": "file:../src",
7 | "nativescript-theme-core": "~1.0.6",
8 | "nativescript-unit-test-runner": "0.7.0"
9 | },
10 | "devDependencies": {
11 | "@nativescript/android": "7.0.1",
12 | "@nativescript/ios": "7.0.0",
13 | "@types/jasmine": "3.6.2",
14 | "karma": "5.2.3",
15 | "karma-jasmine": "4.0.1",
16 | "karma-nativescript-launcher": "0.4.0",
17 | "karma-webpack": "3.0.5",
18 | "typescript": "3.9.7"
19 | },
20 | "scripts": {
21 | "build.plugin": "cd ../src && npm run build"
22 | },
23 | "main": "app.js"
24 | }
25 |
--------------------------------------------------------------------------------
/demo/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "module": "esnext",
4 | "target": "es2017",
5 | "experimentalDecorators": true,
6 | "emitDecoratorMetadata": true,
7 | "noEmitHelpers": true,
8 | "noEmitOnError": true,
9 | "lib": [
10 | "es2017",
11 | "es6",
12 | "dom"
13 | ],
14 | "baseUrl": ".",
15 | "paths": {
16 | "~/*": [
17 | "app/*"
18 | ],
19 | "*": [
20 | "./node_modules/*"
21 | ]
22 | },
23 | "moduleResolution": "node",
24 | "removeComments": false
25 | },
26 | "exclude": [
27 | "node_modules",
28 | "platforms"
29 | ]
30 | }
--------------------------------------------------------------------------------
/media/Android.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-app-shortcuts/fbed9a0251c6c00c7a9e353490b055d0d9fb7efb/media/Android.png
--------------------------------------------------------------------------------
/media/iOS.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-app-shortcuts/fbed9a0251c6c00c7a9e353490b055d0d9fb7efb/media/iOS.png
--------------------------------------------------------------------------------
/publish/pack.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | SOURCE_DIR=../src;
4 | TO_SOURCE_DIR=src;
5 | PACK_DIR=package;
6 | ROOT_DIR=..;
7 | PUBLISH=--publish
8 |
9 | install(){
10 | npm i
11 | }
12 |
13 | pack() {
14 |
15 | echo 'Clearing /src and /package...'
16 | node_modules/.bin/rimraf "$TO_SOURCE_DIR"
17 | node_modules/.bin/rimraf "$PACK_DIR"
18 |
19 | # copy src
20 | echo 'Copying src...'
21 | node_modules/.bin/ncp "$SOURCE_DIR" "$TO_SOURCE_DIR"
22 |
23 | # copy README & LICENSE to src
24 | echo 'Copying README and LICENSE to /src...'
25 | node_modules/.bin/ncp "$ROOT_DIR"/LICENSE "$TO_SOURCE_DIR"/LICENSE
26 | node_modules/.bin/ncp "$ROOT_DIR"/README.md "$TO_SOURCE_DIR"/README.md
27 |
28 | # compile package and copy files required by npm
29 | echo 'Building /src...'
30 | cd "$TO_SOURCE_DIR"
31 | node_modules/.bin/tsc
32 | cd ..
33 |
34 | echo 'Creating package...'
35 | # create package dir
36 | mkdir "$PACK_DIR"
37 |
38 | # create the package
39 | cd "$PACK_DIR"
40 | npm pack ../"$TO_SOURCE_DIR"
41 |
42 | # delete source directory used to create the package
43 | cd ..
44 | node_modules/.bin/rimraf "$TO_SOURCE_DIR"
45 | }
46 |
47 | install && pack
--------------------------------------------------------------------------------
/publish/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "nativescript-publish",
3 | "version": "1.0.0",
4 | "description": "Publish helper",
5 | "devDependencies": {
6 | "ncp": "^2.0.0",
7 | "rimraf": "^2.5.0"
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/publish/publish.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | PACK_DIR=package;
4 |
5 | publish() {
6 | cd $PACK_DIR
7 | echo 'Publishing to npm...'
8 | npm publish *.tgz
9 | }
10 |
11 | ./pack.sh && publish
--------------------------------------------------------------------------------
/src/.npmignore:
--------------------------------------------------------------------------------
1 | *.map
2 | *.ts
3 | !*.d.ts
4 | tsconfig.json
5 | references.d.ts
--------------------------------------------------------------------------------
/src/app-shortcuts.android.ts:
--------------------------------------------------------------------------------
1 | import { AppShortcutsAPI, LaunchQuickAction, QuickAction } from "./app-shortcuts.common";
2 | import { Application, Utils } from "@nativescript/core";
3 |
4 | declare const android: any;
5 |
6 | let quickActionCallback: (data: LaunchQuickAction) => void = null;
7 | let lastQuickAction: any = null;
8 |
9 | const SHORTCUT_PREFIX = "shortcut.type.";
10 |
11 | (() => {
12 | const iconHandler = args => {
13 | if (!args || !args.android || !args.android.getAction) {
14 | return;
15 | }
16 |
17 | const launchAction = args.android.getAction();
18 |
19 | const isShortcutAction = launchAction && launchAction.indexOf(SHORTCUT_PREFIX) > -1;
20 | if (isShortcutAction) {
21 | // "clear" the intent
22 | args.android.setAction("");
23 |
24 | const quickAction = {
25 | type: launchAction.substring(SHORTCUT_PREFIX.length)
26 | };
27 | if (quickActionCallback) {
28 | quickActionCallback(quickAction);
29 | } else {
30 | lastQuickAction = quickAction;
31 | }
32 | }
33 | };
34 |
35 | Application.on("launch", (args) => iconHandler(args));
36 | })();
37 |
38 | export class AppShortcuts implements AppShortcutsAPI {
39 |
40 | private supported(): boolean {
41 | return android.os.Build.VERSION.SDK_INT >= 25; // Android 7.1+
42 | }
43 |
44 | available(): Promise {
45 | return new Promise((resolve, reject) => {
46 | resolve(this.supported());
47 | });
48 | }
49 |
50 | configureQuickActions(actions: Array): Promise {
51 | return new Promise((resolve, reject) => {
52 | try {
53 | if (!this.supported()) {
54 | reject("Not supported on this API level. Requires minimum of API level 25 (Android 7.1).");
55 | return;
56 | }
57 |
58 | const shortcuts = new java.util.ArrayList();
59 |
60 | actions.map((action, i) => {
61 | const intent = new android.content.Intent(Application.android.context, Application.android.foregroundActivity.getClass());
62 | intent.setAction(SHORTCUT_PREFIX + action.type);
63 |
64 | const shortcutBuilder = new android.content.pm.ShortcutInfo.Builder(Application.android.context, `id${i}`)
65 | .setShortLabel(action.title)
66 | .setLongLabel(action.title) // TODO add property some day
67 | .setIntent(intent);
68 |
69 | if (action.iconTemplate) {
70 | let res = Utils.ad.getApplicationContext().getResources();
71 | let identifier = res.getIdentifier(action.iconTemplate, "drawable", Utils.ad.getApplication().getPackageName());
72 | if (identifier === 0) {
73 | console.log(`No icon found for this device density for icon '${action.iconTemplate}'. Falling back to the default icon.`);
74 | } else {
75 | shortcutBuilder.setIcon(android.graphics.drawable.Icon.createWithResource(Application.android.context, identifier));
76 | }
77 | }
78 | shortcuts.add(shortcutBuilder.build());
79 | });
80 |
81 | const shortcutManager = Application.android.context.getSystemService(android.content.pm.ShortcutManager.class);
82 | shortcutManager.setDynamicShortcuts(shortcuts);
83 | resolve();
84 | } catch (e) {
85 | reject(e);
86 | }
87 | });
88 | }
89 |
90 | setQuickActionCallback(callback: (data: LaunchQuickAction) => void): void {
91 | quickActionCallback = callback;
92 | if (lastQuickAction !== null) {
93 | quickActionCallback(lastQuickAction);
94 | lastQuickAction = null;
95 | }
96 | }
97 | }
--------------------------------------------------------------------------------
/src/app-shortcuts.common.ts:
--------------------------------------------------------------------------------
1 | export interface QuickAction {
2 | /**
3 | * Can be used in the onHomeIconPressed callback
4 | */
5 | type: string;
6 |
7 | /**
8 | * The largest text that's displayed for the action
9 | */
10 | title: string;
11 |
12 | /**
13 | * Smaller text, shown below the 'title'.
14 | * iOS only.
15 | */
16 | subtitle?: string;
17 |
18 | /**
19 | * One of the built-in iOS icons, like UIApplicationShortcutIconType.UIApplicationShortcutIconTypeCapturePhoto,
20 | * full list here (Objective-C): https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIApplicationShortcutIcon_Class/#//apple_ref/c/tdef/UIApplicationShortcutIconType
21 | * iOS only.
22 | */
23 | iconType?: any /* UIApplicationShortcutIconType */;
24 |
25 | /**
26 | * A custom image, resolves to app/App_Resources/iOS/(.png),
27 | * use a transparent black and white png of 70*70 or 105*105 for easiest setup.
28 | * Will be ignored if (on iOS) an iconType is also set.
29 | */
30 | iconTemplate?: string;
31 | }
32 |
33 | export interface LaunchQuickAction {
34 | /**
35 | * The type you previously passed in as QuickAction.type.
36 | */
37 | type?: string;
38 |
39 | /**
40 | * The text you previously passed in as QuickAction.title.
41 | * iOS only.
42 | */
43 | localizedTitle?: string;
44 | }
45 |
46 | export interface AppShortcutsAPI {
47 | available(): Promise;
48 | configureQuickActions(actions: Array): Promise;
49 | setQuickActionCallback(callback: (data: LaunchQuickAction) => void): void;
50 | }
--------------------------------------------------------------------------------
/src/app-shortcuts.ios.ts:
--------------------------------------------------------------------------------
1 | import { Application, Utils } from "@nativescript/core";
2 | import { AppShortcutsAPI, LaunchQuickAction, QuickAction } from "./app-shortcuts.common";
3 |
4 | const iOSApplication = Application.ios;
5 | const iOSUtils = Utils.ios;
6 |
7 | let quickActionCallback: (data: LaunchQuickAction) => void = null;
8 | let lastQuickAction: any = null;
9 |
10 | const callback = (application, shortcutItem, completionHandler) => {
11 | if (quickActionCallback !== null) {
12 | quickActionCallback(shortcutItem);
13 | } else {
14 | lastQuickAction = shortcutItem;
15 | }
16 | };
17 |
18 | @NativeClass()
19 | class AppShortcutsUIApplicationDelegate extends UIResponder implements UIApplicationDelegate {
20 | public static ObjCProtocols = [UIApplicationDelegate];
21 |
22 | applicationPerformActionForShortcutItemCompletionHandler(application: UIApplication, shortcutItem: UIApplicationShortcutItem, completionHandler: (p1: boolean) => void): void {
23 | callback(application, shortcutItem, completionHandler);
24 | }
25 | }
26 |
27 | (() => {
28 | if (iOSApplication.delegate !== undefined) {
29 | // Play nice with other plugins by not completely ignoring anything already added to the appdelegate
30 | iOSApplication.delegate.prototype.applicationPerformActionForShortcutItemCompletionHandler = callback;
31 | } else {
32 | iOSApplication.delegate = AppShortcutsUIApplicationDelegate;
33 | }
34 | })();
35 |
36 | export class AppShortcuts implements AppShortcutsAPI {
37 | // caching for efficiency
38 | private availability = null;
39 |
40 | public available(): Promise {
41 | return new Promise((resolve, reject) => {
42 |
43 | if (this.availability !== null) {
44 | resolve(this.availability);
45 | return;
46 | }
47 |
48 | // With iOS 13 probably any iOS device supports this feature, because 3D Touch is no longer required
49 | if (iOSUtils.MajorVersion >= 13) {
50 | resolve(true);
51 | return;
52 | }
53 |
54 | // iOS 9 added 3D Touch capability
55 | if (iOSUtils.MajorVersion >= 9) {
56 | // .. but not all devices running iOS 9 support it
57 | if (iOSApplication.nativeApp.keyWindow === null) {
58 | // (especially) in Angular apps, this might run too soon. Wrapping it in a timeout solves that issue.
59 | setTimeout(() => {
60 | this.availability = UIForceTouchCapability.Available === iOSApplication.nativeApp.keyWindow.rootViewController.traitCollection.forceTouchCapability;
61 | resolve(this.availability);
62 | });
63 | } else {
64 | this.availability = UIForceTouchCapability.Available === iOSApplication.nativeApp.keyWindow.rootViewController.traitCollection.forceTouchCapability;
65 | resolve(this.availability);
66 | }
67 | } else {
68 | this.availability = false;
69 | resolve(this.availability);
70 | }
71 | });
72 | }
73 |
74 | public setQuickActionCallback(callback: (data: LaunchQuickAction) => void) {
75 | quickActionCallback = callback;
76 | if (lastQuickAction !== null) {
77 | quickActionCallback(lastQuickAction);
78 | lastQuickAction = null;
79 | }
80 | }
81 |
82 | public configureQuickActions(actions: Array): Promise {
83 | return new Promise((resolve, reject) => {
84 | this.available().then(avail => {
85 | if (!avail) {
86 | reject("3D Touch not available");
87 | return;
88 | }
89 |
90 | const items = [];
91 |
92 | actions.map(action => {
93 | let uiApplicationShortcutIcon = null;
94 |
95 | if (action.iconType) {
96 | uiApplicationShortcutIcon = UIApplicationShortcutIcon.iconWithType(action.iconType);
97 | } else if (action.iconTemplate) {
98 | uiApplicationShortcutIcon = UIApplicationShortcutIcon.iconWithTemplateImageName(action.iconTemplate);
99 | }
100 |
101 | items.push(
102 | UIApplicationShortcutItem.alloc().initWithTypeLocalizedTitleLocalizedSubtitleIconUserInfo(
103 | action.type,
104 | action.title,
105 | action.subtitle,
106 | uiApplicationShortcutIcon,
107 | null));
108 | });
109 |
110 | iOSApplication.nativeApp.shortcutItems = items;
111 |
112 | resolve();
113 | });
114 | });
115 | }
116 | }
117 |
--------------------------------------------------------------------------------
/src/index.d.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * iOS and Android apis should match.
3 | * It doesn't matter if you export `.ios` or `.android`, either one but only one.
4 | */
5 | export * from "./app-shortcuts.ios";
6 |
7 | // Export any shared classes, constants, etc.
8 | export * from "./app-shortcuts.common";
--------------------------------------------------------------------------------
/src/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "nativescript-app-shortcuts",
3 | "version": "3.0.0",
4 | "description": "Add shortcut actions to your app icon.",
5 | "main": "app-shortcuts",
6 | "scripts": {
7 | "ts.patch": "ts-patch install",
8 | "tsc": "tsc -skipLibCheck",
9 | "build": "ns clean && npm i && npm run ts.patch && npm run tsc",
10 | "demo.ios": "npm run build && cd ../demo && ns run ios",
11 | "demo.android": "npm run preparedemo && cd ../demo && ns run android",
12 | "test": "npm run tslint && npm run tslint.demo && cd ../demo && ns build ios && ns build android",
13 | "test.ios": "cd ../demo && ns platform remove ios && ns test ios --emulator",
14 | "test.ios.device": "cd ../demo && ns platform remove ios && ns test ios",
15 | "test.android": "cd ../demo && ns platform remove android && ns test android",
16 | "preparedemo": "npm run build && cd ../demo && ns clean && ns install",
17 | "setup": "npm run build && cd ../demo && npm i",
18 | "setupandinstall": "npm i && cd ../demo && npm i && cd ../src && npm run build && cd ../demo && ns plugin add ../src && cd ../src",
19 | "tslint": "cd .. && tslint \"**/*.ts\" --config tslint.json --exclude '**/node_modules/**' --exclude '**/tns_modules/**' --exclude '**/typings/**' --exclude '**/platforms/**'",
20 | "tslint.demo": "tslint --config '../tslint.json' '../demo/app/*.ts' --exclude '**/node_modules/**'",
21 | "ci.tslint": "npm i && tslint '**/*.ts' --config '../tslint.json' --exclude '**/node_modules/**' --exclude '**/typings/**'",
22 | "prepublishOnly": "npm run build",
23 | "development.setup": "npm run setup && npm link && cd ../demo && npm link nativescript-app-shortcuts && cd ../src"
24 | },
25 | "repository": {
26 | "type": "git",
27 | "url": "https://github.com/EddyVerbruggen/nativescript-app-shortcuts.git"
28 | },
29 | "keywords": [
30 | "NativeScript",
31 | "ecosystem:nativescript",
32 | "iOS",
33 | "Android",
34 | "3DTouch",
35 | "3D Touch",
36 | "App Shortcuts",
37 | "Shortcut",
38 | "Force Touch",
39 | "Quick Actions"
40 | ],
41 | "author": {
42 | "name": "Eddy Verbruggen",
43 | "email": "eddyverbruggen@gmail.com"
44 | },
45 | "license": "MIT",
46 | "bugs": {
47 | "url": "https://github.com/EddyVerbruggen/nativescript-app-shortcuts/issues"
48 | },
49 | "homepage": "https://github.com/EddyVerbruggen/nativescript-app-shortcuts",
50 | "readmeFilename": "README.md",
51 | "devDependencies": {
52 | "@nativescript/core": "~7.0.13",
53 | "@nativescript/android": "^7.0.0",
54 | "@nativescript/ios": "^7.0.6",
55 | "@nativescript/types": "~7.0.4",
56 | "@nativescript/webpack": "~3.0.5",
57 | "ts-patch": "^1.3.1",
58 | "tslint": "^5.0.0",
59 | "typescript": "~3.9.0"
60 | },
61 | "dependencies": {
62 | "ts-node": "^9.1.1"
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/src/references.d.ts:
--------------------------------------------------------------------------------
1 | ///
--------------------------------------------------------------------------------
/src/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "ES2017",
4 | "module": "esnext",
5 | "moduleResolution": "node",
6 | "declaration": true,
7 | "removeComments": true,
8 | "noLib": false,
9 | "emitDecoratorMetadata": true,
10 | "experimentalDecorators": true,
11 | "lib": [
12 | "ES2017",
13 | "es6",
14 | "dom"
15 | ],
16 | "sourceMap": true,
17 | "pretty": true,
18 | "allowUnreachableCode": false,
19 | "allowUnusedLabels": false,
20 | "noEmitHelpers": true,
21 | "noEmitOnError": false,
22 | "noImplicitAny": false,
23 | "noImplicitReturns": true,
24 | "noImplicitUseStrict": false,
25 | "noFallthroughCasesInSwitch": true,
26 | "typeRoots": [
27 | "./node_modules/@types",
28 | "./node_modules"
29 | ],
30 | "types": [
31 | ],
32 | "plugins": [{
33 | "transform": "@nativescript/webpack/transformers/ns-transform-native-classes",
34 | "type": "raw"
35 | }]
36 | },
37 | "exclude": [
38 | "demo",
39 | "node_modules"
40 | ],
41 | "compileOnSave": false
42 | }
43 |
--------------------------------------------------------------------------------
/tslint.json:
--------------------------------------------------------------------------------
1 | {
2 | "rules": {
3 | "class-name": true,
4 | "comment-format": [
5 | true,
6 | "check-space"
7 | ],
8 | "indent": [
9 | true,
10 | "spaces"
11 | ],
12 | "no-duplicate-variable": true,
13 | "no-eval": true,
14 | "no-internal-module": true,
15 | "no-trailing-whitespace": true,
16 | "no-var-keyword": true,
17 | "one-line": [
18 | true,
19 | "check-open-brace",
20 | "check-whitespace"
21 | ],
22 | "quotemark": [
23 | false,
24 | "double"
25 | ],
26 | "semicolon": [
27 | true,
28 | "always"
29 | ],
30 | "triple-equals": [
31 | true,
32 | "allow-null-check"
33 | ],
34 | "typedef-whitespace": [
35 | true,
36 | {
37 | "call-signature": "nospace",
38 | "index-signature": "nospace",
39 | "parameter": "nospace",
40 | "property-declaration": "nospace",
41 | "variable-declaration": "nospace"
42 | }
43 | ],
44 | "variable-name": [
45 | true,
46 | "ban-keywords"
47 | ],
48 | "whitespace": [
49 | true,
50 | "check-branch",
51 | "check-decl",
52 | "check-operator",
53 | "check-separator",
54 | "check-type"
55 | ]
56 | }
57 | }
--------------------------------------------------------------------------------