├── .all-contributorsrc ├── .gitignore ├── .npmignore ├── README.md ├── demo └── angular │ ├── .browserslistrc │ ├── .editorconfig │ ├── .gitignore │ ├── .gradle │ ├── 6.5 │ │ ├── executionHistory │ │ │ └── executionHistory.lock │ │ ├── fileChanges │ │ │ └── last-build.bin │ │ ├── fileHashes │ │ │ └── fileHashes.lock │ │ └── gc.properties │ ├── buildOutputCleanup │ │ ├── buildOutputCleanup.lock │ │ └── cache.properties │ ├── checksums │ │ └── checksums.lock │ └── vcs-1 │ │ └── gc.properties │ ├── android │ ├── .gitignore │ ├── app │ │ ├── .gitignore │ │ ├── build.gradle │ │ ├── capacitor.build.gradle │ │ ├── proguard-rules.pro │ │ └── src │ │ │ ├── androidTest │ │ │ └── java │ │ │ │ └── com │ │ │ │ └── getcapacitor │ │ │ │ └── myapp │ │ │ │ └── ExampleInstrumentedTest.java │ │ │ ├── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── assets │ │ │ │ ├── capacitor.config.json │ │ │ │ └── capacitor.plugins.json │ │ │ ├── java │ │ │ │ └── io │ │ │ │ │ └── ionic │ │ │ │ │ └── starter │ │ │ │ │ └── MainActivity.java │ │ │ └── res │ │ │ │ ├── drawable-land-hdpi │ │ │ │ └── splash.png │ │ │ │ ├── drawable-land-mdpi │ │ │ │ └── splash.png │ │ │ │ ├── drawable-land-xhdpi │ │ │ │ └── splash.png │ │ │ │ ├── drawable-land-xxhdpi │ │ │ │ └── splash.png │ │ │ │ ├── drawable-land-xxxhdpi │ │ │ │ └── splash.png │ │ │ │ ├── drawable-port-hdpi │ │ │ │ └── splash.png │ │ │ │ ├── drawable-port-mdpi │ │ │ │ └── splash.png │ │ │ │ ├── drawable-port-xhdpi │ │ │ │ └── splash.png │ │ │ │ ├── drawable-port-xxhdpi │ │ │ │ └── splash.png │ │ │ │ ├── drawable-port-xxxhdpi │ │ │ │ └── splash.png │ │ │ │ ├── drawable-v24 │ │ │ │ └── ic_launcher_foreground.xml │ │ │ │ ├── drawable │ │ │ │ ├── ic_launcher_background.xml │ │ │ │ └── splash.png │ │ │ │ ├── layout │ │ │ │ └── activity_main.xml │ │ │ │ ├── mipmap-anydpi-v26 │ │ │ │ ├── ic_launcher.xml │ │ │ │ └── ic_launcher_round.xml │ │ │ │ ├── mipmap-hdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ ├── ic_launcher_foreground.png │ │ │ │ └── ic_launcher_round.png │ │ │ │ ├── mipmap-mdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ ├── ic_launcher_foreground.png │ │ │ │ └── ic_launcher_round.png │ │ │ │ ├── mipmap-xhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ ├── ic_launcher_foreground.png │ │ │ │ └── ic_launcher_round.png │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ ├── ic_launcher_foreground.png │ │ │ │ └── ic_launcher_round.png │ │ │ │ ├── mipmap-xxxhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ ├── ic_launcher_foreground.png │ │ │ │ └── ic_launcher_round.png │ │ │ │ ├── values │ │ │ │ ├── ic_launcher_background.xml │ │ │ │ ├── strings.xml │ │ │ │ └── styles.xml │ │ │ │ └── xml │ │ │ │ ├── config.xml │ │ │ │ └── file_paths.xml │ │ │ └── test │ │ │ └── java │ │ │ └── com │ │ │ └── getcapacitor │ │ │ └── myapp │ │ │ └── ExampleUnitTest.java │ ├── build.gradle │ ├── capacitor.settings.gradle │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── gradlew │ ├── gradlew.bat │ ├── nativescript.build.gradle │ ├── nativescript.buildscript.gradle │ ├── settings.gradle │ └── variables.gradle │ ├── angular.json │ ├── capacitor.config.json │ ├── e2e │ ├── protractor.conf.js │ ├── src │ │ ├── app.e2e-spec.ts │ │ └── app.po.ts │ └── tsconfig.json │ ├── ionic.config.json │ ├── ios │ ├── .gitignore │ └── App │ │ ├── App.xcodeproj │ │ ├── project.pbxproj │ │ └── project.xcworkspace │ │ │ └── contents.xcworkspacedata │ │ ├── App.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ │ ├── App │ │ ├── AppDelegate.swift │ │ ├── Assets.xcassets │ │ │ ├── AppIcon.appiconset │ │ │ │ ├── AppIcon-20x20@1x.png │ │ │ │ ├── AppIcon-20x20@2x-1.png │ │ │ │ ├── AppIcon-20x20@2x.png │ │ │ │ ├── AppIcon-20x20@3x.png │ │ │ │ ├── AppIcon-29x29@1x.png │ │ │ │ ├── AppIcon-29x29@2x-1.png │ │ │ │ ├── AppIcon-29x29@2x.png │ │ │ │ ├── AppIcon-29x29@3x.png │ │ │ │ ├── AppIcon-40x40@1x.png │ │ │ │ ├── AppIcon-40x40@2x-1.png │ │ │ │ ├── AppIcon-40x40@2x.png │ │ │ │ ├── AppIcon-40x40@3x.png │ │ │ │ ├── AppIcon-512@2x.png │ │ │ │ ├── AppIcon-60x60@2x.png │ │ │ │ ├── AppIcon-60x60@3x.png │ │ │ │ ├── AppIcon-76x76@1x.png │ │ │ │ ├── AppIcon-76x76@2x.png │ │ │ │ ├── AppIcon-83.5x83.5@2x.png │ │ │ │ └── Contents.json │ │ │ ├── Contents.json │ │ │ └── Splash.imageset │ │ │ │ ├── Contents.json │ │ │ │ ├── splash-2732x2732-1.png │ │ │ │ ├── splash-2732x2732-2.png │ │ │ │ └── splash-2732x2732.png │ │ ├── Base.lproj │ │ │ ├── LaunchScreen.storyboard │ │ │ └── Main.storyboard │ │ ├── Info.plist │ │ ├── capacitor.config.json │ │ └── config.xml │ │ └── Podfile │ ├── karma.conf.js │ ├── package-lock.json │ ├── package.json │ ├── src │ ├── app │ │ ├── app-routing.module.ts │ │ ├── app.component.html │ │ ├── app.component.scss │ │ ├── app.component.spec.ts │ │ ├── app.component.ts │ │ ├── app.module.ts │ │ ├── explore-container │ │ │ ├── explore-container.component.html │ │ │ ├── explore-container.component.scss │ │ │ ├── explore-container.component.spec.ts │ │ │ ├── explore-container.component.ts │ │ │ └── explore-container.module.ts │ │ ├── tab1 │ │ │ ├── tab1-routing.module.ts │ │ │ ├── tab1.module.ts │ │ │ ├── tab1.page.html │ │ │ ├── tab1.page.scss │ │ │ ├── tab1.page.spec.ts │ │ │ └── tab1.page.ts │ │ ├── tab2 │ │ │ ├── tab2-routing.module.ts │ │ │ ├── tab2.module.ts │ │ │ ├── tab2.page.html │ │ │ ├── tab2.page.scss │ │ │ ├── tab2.page.spec.ts │ │ │ └── tab2.page.ts │ │ ├── tab3 │ │ │ ├── tab3-routing.module.ts │ │ │ ├── tab3.module.ts │ │ │ ├── tab3.page.html │ │ │ ├── tab3.page.scss │ │ │ ├── tab3.page.spec.ts │ │ │ └── tab3.page.ts │ │ └── tabs │ │ │ ├── tabs-routing.module.ts │ │ │ ├── tabs.module.ts │ │ │ ├── tabs.page.html │ │ │ ├── tabs.page.scss │ │ │ ├── tabs.page.spec.ts │ │ │ └── tabs.page.ts │ ├── assets │ │ ├── icon │ │ │ └── favicon.png │ │ └── shapes.svg │ ├── environments │ │ ├── environment.prod.ts │ │ └── environment.ts │ ├── global.scss │ ├── index.html │ ├── main.ts │ ├── native-custom.d.ts │ ├── nativescript │ │ ├── examples │ │ │ ├── modal.ts │ │ │ └── simple.ts │ │ ├── index.ts │ │ ├── package.json │ │ ├── references.d.ts │ │ └── tsconfig.json │ ├── polyfills.ts │ ├── test.ts │ ├── theme │ │ └── variables.scss │ └── zone-flags.ts │ ├── tsconfig.app.json │ ├── tsconfig.json │ ├── tsconfig.spec.json │ └── tslint.json ├── package-lock.json ├── package.json ├── references.d.ts ├── src ├── index.ts ├── interfaces.ts └── plugins │ ├── brightness.ts │ └── rate-my-app.ts └── tsconfig.json /.all-contributorsrc: -------------------------------------------------------------------------------- 1 | { 2 | "files": [ 3 | "README.md" 4 | ], 5 | "imageSize": 100, 6 | "commit": false, 7 | "contributors": [ 8 | { 9 | "login": "SergeyMell", 10 | "name": "Sergey Mell", 11 | "avatar_url": "https://avatars.githubusercontent.com/u/12133261?v=4", 12 | "profile": "https://agilie.com", 13 | "contributions": [ 14 | "code" 15 | ] 16 | } 17 | ], 18 | "contributorsPerLine": 7, 19 | "projectName": "capacitor-plugins", 20 | "projectOwner": "nativescript-community", 21 | "repoType": "github", 22 | "repoHost": "https://github.com", 23 | "skipCi": true 24 | } 25 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | nativescript 3 | src/native-custom.d.ts 4 | 5 | # NativeScript 6 | android/app/gradle-helpers 7 | android/app/src/debug/java/com/tns 8 | android/app/src/debug/res/layout/error_activity.xml 9 | android/app/src/debug/res/layout/exception_tab.xml 10 | android/app/src/debug/res/layout/logcat_tab.xml 11 | android/app/src/main/assets/internal 12 | android/app/src/main/assets/metadata 13 | android/app/src/main/java/com/tns 14 | android/build-tools 15 | ios/App/internal 16 | ios/App/NativeScript* 17 | ios/App/TNSWidgets* 18 | ios/App/.build* 19 | src/nativescript/node_modules 20 | src/nativescript/package-lock.json 21 | 22 | # IDEs 23 | .idea/ 24 | .DS_Store 25 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | .idea 2 | demo/ 3 | node_modules 4 | nativescript 5 | src/native-custom.d.ts 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![npm version](https://badge.fury.io/js/%40nativescript-community%2Fcapacitor-plugins.svg)](https://badge.fury.io/js/%40nativescript-community%2Fcapacitor-plugins) 2 | 3 | [![All Contributors](https://img.shields.io/badge/all_contributors-1-orange.svg?style=flat-square)](#contributors-) 4 | 5 | 6 | # @nativescript-community/capacitor-plugins 7 | 8 | __✅ This repository is test repository, and not release @nativescript-community/capacitor-plugins now.__ 9 | 10 | ## 👊 Try this project 11 | 12 | Please clone, and npm link in your local. 13 | 14 | ```bash 15 | % git clone git@github.com:nativescript-community/capacitor-plugins.git 16 | % cd capacitor-plugins && npm install 17 | % npm link 18 | ``` 19 | 20 | ## 📱 Install in your Capacitor Project 21 | 22 | ### PreInstall in your project 23 | ``` 24 | % npm install @capacitor/cli@next --save-dev 25 | % npm install @capacitor/core@next --save 26 | % npm install @nativescript/capacitor 27 | ``` 28 | 29 | ### Install 30 | 31 | ```bash 32 | % npm install --save @nativescript-community/capacitor-plugins 33 | ``` 34 | 35 | ### Change your project 36 | 37 | #### 1. Add `src/nativescript/index.ts` 38 | 39 | Add the following code: 40 | 41 | ```diff 42 | import '@nativescript/capacitor/bridge'; 43 | + import * as Plugins from '@nativescript-community/capacitor-plugins'; 44 | 45 | + native = Object.assign(native, Plugins); 46 | ... 47 | ``` 48 | 49 | [Example demo is here.](https://github.com/nativescript-community/capacitor-plugins/blob/main/demo/angular/src/nativescript/index.ts) 50 | 51 | ### 2. Change `src/native-custom.d.ts` 52 | 53 | Replace the following code: 54 | 55 | ```diff 56 | + import type { pluginsGlobal } from '@nativescript-community/capacitor-plugins/src/interfaces'; 57 | 58 | declare module '@nativescript/capacitor' { 59 | export interface customNativeAPI extends nativeCustom {} 60 | } 61 | 62 | /** 63 | * Define your own custom strongly typed native helpers here. 64 | */ 65 | - export interface nativeCustom { 66 | + export interface nativeCustom extends pluginsGlobal { 67 | ``` 68 | 69 | [Example demo is here.](https://github.com/nativescript-community/capacitor-plugins/blob/main/demo/angular/src/native-custom.d.ts) 70 | 71 | ## Usage 72 | [Usage Example demo is here.](https://github.com/nativescript-community/capacitor-plugins/blob/main/demo/angular/src/app/tab1/tab1.page.ts). 73 | 74 | 75 | ### 1. brightness(value: number) 76 | You can change device brightness (1〜10). This is official example code. 77 | 78 | ```ts 79 | import { native } from '@nativescript/capacitor'; 80 | 81 | native.brightness(1); 82 | ``` 83 | ### 2. rateMyApp() 84 | You can allow users to rate the app from inside the application. 85 | 86 | #### iOS 87 | No additional configurations are required for iOS. 88 | However, for now it supports iOS version 10.3 and later. 89 | 90 | #### Android 91 | Before start using this function add next lines to the dependencies 92 | section of your `android/app/build.gradle` 93 | 94 | ```gradle 95 | implementation "androidx.appcompat:appcompat:1.2.0" 96 | implementation 'com.google.android.play:core:1.10.0' 97 | ``` 98 | You can read more about how to import Google Play Core Library 99 | into your project [here](https://developer.android.com/guide/playcore?authuser=1#java-kotlin) 100 | 101 | In-app reviews only work on Android devices (phones and tablets) running Android 5.0 (API level 21) 102 | or higher that have the Google Play Store installed and on Chrome OS devices that have the Google Play Store installed. 103 | 104 | Important: your app should be published for at least internal testing. 105 | Read more about it in [this SO answer](https://stackoverflow.com/questions/63286540/play-core-in-app-review-api-not-showing-the-review-activity) 106 | 107 | #### Usage 108 | ```ts 109 | import { native } from '@nativescript/capacitor'; 110 | native.rateMyApp(); 111 | ``` 112 | 113 | ### Demo Code 114 | You can check Native Console Log. This is official example code. 115 | ```ts 116 | import { native } from '@nativescript/capacitor'; 117 | 118 | native.dreamBig(); 119 | ``` 120 | 121 | And Launch Native Modal View. This is official example code. 122 | 123 | ```ts 124 | import { native } from '@nativescript/capacitor'; 125 | 126 | native.openNativeModalView(); 127 | ``` 128 | 129 | ## Option 130 | 131 | ### If you want use some plugin only: 132 | You should select plugin and import. 133 | 134 | `src/nativescript/index.ts`: 135 | 136 | ```ts 137 | import { brightness } from '@nativescript-community/capacitor-plugins'; 138 | native = Object.assign(native, { 139 | brightness, 140 | }); 141 | ``` 142 | 143 | `src/native-custom.d.ts`: 144 | 145 | ```ts 146 | import type { IBrightness } from '@nativescript-community/capacitor-plugins/src/interfaces'; 147 | export interface nativeCustom extends IBrightness { 148 | dreamBig: () => NativeProperty; 149 | openNativeModalView: () => void; 150 | } 151 | ``` 152 | 153 | ## Contributors ✨ 154 | 155 | Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)): 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 |

Sergey Mell

💻
164 | 165 | 166 | 167 | 168 | 169 | -------------------------------------------------------------------------------- /demo/angular/.browserslistrc: -------------------------------------------------------------------------------- 1 | # This file is used by the build system to adjust CSS and JS output to support the specified browsers below. 2 | # For additional information regarding the format and rule options, please see: 3 | # https://github.com/browserslist/browserslist#queries 4 | 5 | # For the full list of supported browsers by the Angular framework, please see: 6 | # https://angular.io/guide/browser-support 7 | 8 | # You can see what browsers were selected by your queries by running: 9 | # npx browserslist 10 | 11 | last 1 Chrome version 12 | last 1 Firefox version 13 | last 2 Edge major versions 14 | last 2 Safari major versions 15 | last 2 iOS major versions 16 | Firefox ESR 17 | not IE 11 # Angular supports IE 11 only as an opt-in. To opt-in, remove the 'not' prefix on this line. 18 | -------------------------------------------------------------------------------- /demo/angular/.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see https://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | indent_style = space 7 | indent_size = 2 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.ts] 12 | quote_type = single 13 | 14 | [*.md] 15 | max_line_length = off 16 | trim_trailing_whitespace = false 17 | -------------------------------------------------------------------------------- /demo/angular/.gitignore: -------------------------------------------------------------------------------- 1 | # Specifies intentionally untracked files to ignore when using Git 2 | # http://git-scm.com/docs/gitignore 3 | 4 | *~ 5 | *.sw[mnpcod] 6 | .tmp 7 | *.tmp 8 | *.tmp.* 9 | *.sublime-project 10 | *.sublime-workspace 11 | .DS_Store 12 | Thumbs.db 13 | UserInterfaceState.xcuserstate 14 | $RECYCLE.BIN/ 15 | 16 | *.log 17 | log.txt 18 | npm-debug.log* 19 | 20 | /.idea 21 | /.ionic 22 | /.sass-cache 23 | /.sourcemaps 24 | /.versions 25 | /.vscode 26 | /coverage 27 | /dist 28 | /node_modules 29 | /platforms 30 | /plugins 31 | /www 32 | 33 | /src/nativescript/node_modules 34 | 35 | 36 | # NativeScript 37 | android/app/gradle-helpers 38 | android/app/src/debug/java/com/tns 39 | android/app/src/debug/res/layout/error_activity.xml 40 | android/app/src/debug/res/layout/exception_tab.xml 41 | android/app/src/debug/res/layout/logcat_tab.xml 42 | android/app/src/main/assets/internal 43 | android/app/src/main/assets/metadata 44 | android/app/src/main/java/com/tns 45 | android/build-tools 46 | ios/App/internal 47 | ios/App/NativeScript* 48 | ios/App/TNSWidgets* 49 | ios/App/.build* 50 | src/nativescript/node_modules 51 | src/nativescript/package-lock.json 52 | -------------------------------------------------------------------------------- /demo/angular/.gradle/6.5/executionHistory/executionHistory.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nativescript-community/capacitor-plugins/66c93c0d253f481c29b11142680e8126cb5dd878/demo/angular/.gradle/6.5/executionHistory/executionHistory.lock -------------------------------------------------------------------------------- /demo/angular/.gradle/6.5/fileChanges/last-build.bin: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /demo/angular/.gradle/6.5/fileHashes/fileHashes.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nativescript-community/capacitor-plugins/66c93c0d253f481c29b11142680e8126cb5dd878/demo/angular/.gradle/6.5/fileHashes/fileHashes.lock -------------------------------------------------------------------------------- /demo/angular/.gradle/6.5/gc.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nativescript-community/capacitor-plugins/66c93c0d253f481c29b11142680e8126cb5dd878/demo/angular/.gradle/6.5/gc.properties -------------------------------------------------------------------------------- /demo/angular/.gradle/buildOutputCleanup/buildOutputCleanup.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nativescript-community/capacitor-plugins/66c93c0d253f481c29b11142680e8126cb5dd878/demo/angular/.gradle/buildOutputCleanup/buildOutputCleanup.lock -------------------------------------------------------------------------------- /demo/angular/.gradle/buildOutputCleanup/cache.properties: -------------------------------------------------------------------------------- 1 | #Sun Mar 14 20:03:30 JST 2021 2 | gradle.version=6.5 3 | -------------------------------------------------------------------------------- /demo/angular/.gradle/checksums/checksums.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nativescript-community/capacitor-plugins/66c93c0d253f481c29b11142680e8126cb5dd878/demo/angular/.gradle/checksums/checksums.lock -------------------------------------------------------------------------------- /demo/angular/.gradle/vcs-1/gc.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nativescript-community/capacitor-plugins/66c93c0d253f481c29b11142680e8126cb5dd878/demo/angular/.gradle/vcs-1/gc.properties -------------------------------------------------------------------------------- /demo/angular/android/.gitignore: -------------------------------------------------------------------------------- 1 | # Using Android gitignore template: https://github.com/github/gitignore/blob/HEAD/Android.gitignore 2 | 3 | # Built application files 4 | *.apk 5 | *.aar 6 | *.ap_ 7 | *.aab 8 | 9 | # Files for the ART/Dalvik VM 10 | *.dex 11 | 12 | # Java class files 13 | *.class 14 | 15 | # Generated files 16 | bin/ 17 | gen/ 18 | out/ 19 | # Uncomment the following line in case you need and you don't have the release build type files in your app 20 | # release/ 21 | 22 | # Gradle files 23 | .gradle/ 24 | build/ 25 | 26 | # Local configuration file (sdk path, etc) 27 | local.properties 28 | 29 | # Proguard folder generated by Eclipse 30 | proguard/ 31 | 32 | # Log Files 33 | *.log 34 | 35 | # Android Studio Navigation editor temp files 36 | .navigation/ 37 | 38 | # Android Studio captures folder 39 | captures/ 40 | 41 | # IntelliJ 42 | *.iml 43 | .idea/workspace.xml 44 | .idea/tasks.xml 45 | .idea/gradle.xml 46 | .idea/assetWizardSettings.xml 47 | .idea/dictionaries 48 | .idea/libraries 49 | # Android Studio 3 in .gitignore file. 50 | .idea/caches 51 | .idea/modules.xml 52 | # Comment next line if keeping position of elements in Navigation Editor is relevant for you 53 | .idea/navEditor.xml 54 | 55 | # Keystore files 56 | # Uncomment the following lines if you do not want to check your keystore files in. 57 | #*.jks 58 | #*.keystore 59 | 60 | # External native build folder generated in Android Studio 2.2 and later 61 | .externalNativeBuild 62 | .cxx/ 63 | 64 | # Google Services (e.g. APIs or Firebase) 65 | # google-services.json 66 | 67 | # Freeline 68 | freeline.py 69 | freeline/ 70 | freeline_project_description.json 71 | 72 | # fastlane 73 | fastlane/report.xml 74 | fastlane/Preview.html 75 | fastlane/screenshots 76 | fastlane/test_output 77 | fastlane/readme.md 78 | 79 | # Version control 80 | vcs.xml 81 | 82 | # lint 83 | lint/intermediates/ 84 | lint/generated/ 85 | lint/outputs/ 86 | lint/tmp/ 87 | # lint/reports/ 88 | 89 | # Android Profiling 90 | *.hprof 91 | 92 | # Cordova plugins for Capacitor 93 | capacitor-cordova-android-plugins 94 | 95 | # Copied web assets 96 | app/src/main/assets/public 97 | -------------------------------------------------------------------------------- /demo/angular/android/app/.gitignore: -------------------------------------------------------------------------------- 1 | /build/* 2 | !/build/.npmkeep 3 | -------------------------------------------------------------------------------- /demo/angular/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion rootProject.ext.compileSdkVersion 5 | defaultConfig { 6 | applicationId "io.ionic.starter" 7 | minSdkVersion rootProject.ext.minSdkVersion 8 | targetSdkVersion rootProject.ext.targetSdkVersion 9 | versionCode 1 10 | versionName "1.0" 11 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 12 | aaptOptions { 13 | // Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps. 14 | // Default: https://android.googlesource.com/platform/frameworks/base/+/282e181b58cf72b6ca770dc7ca5f91f135444502/tools/aapt/AaptAssets.cpp#61 15 | ignoreAssetsPattern '!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~' 16 | } 17 | } 18 | buildTypes { 19 | release { 20 | minifyEnabled false 21 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 22 | } 23 | } 24 | } 25 | 26 | repositories { 27 | flatDir{ 28 | dirs '../capacitor-cordova-android-plugins/src/main/libs', 'libs' 29 | } 30 | } 31 | 32 | dependencies { 33 | implementation fileTree(include: ['*.jar'], dir: 'libs') 34 | implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion" 35 | implementation project(':capacitor-android') 36 | testImplementation "junit:junit:$junitVersion" 37 | androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion" 38 | androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion" 39 | implementation project(':capacitor-cordova-android-plugins') 40 | 41 | // Android review dependencies 42 | implementation "androidx.appcompat:appcompat:1.2.0" 43 | implementation 'com.google.android.play:core:1.10.0' 44 | } 45 | 46 | apply from: 'capacitor.build.gradle' 47 | 48 | try { 49 | def servicesJSON = file('google-services.json') 50 | if (servicesJSON.text) { 51 | apply plugin: 'com.google.gms.google-services' 52 | } 53 | } catch(Exception e) { 54 | logger.warn("google-services.json not found, google-services plugin not applied. Push Notifications won't work") 55 | } 56 | 57 | apply from: '../nativescript.build.gradle' -------------------------------------------------------------------------------- /demo/angular/android/app/capacitor.build.gradle: -------------------------------------------------------------------------------- 1 | // DO NOT EDIT THIS FILE! IT IS GENERATED EACH TIME "capacitor update" IS RUN 2 | 3 | android { 4 | compileOptions { 5 | sourceCompatibility JavaVersion.VERSION_1_8 6 | targetCompatibility JavaVersion.VERSION_1_8 7 | } 8 | } 9 | 10 | apply from: "../capacitor-cordova-android-plugins/cordova.variables.gradle" 11 | dependencies { 12 | implementation project(':nativescript-capacitor') 13 | 14 | } 15 | 16 | 17 | if (hasProperty('postBuildExtras')) { 18 | postBuildExtras() 19 | } 20 | -------------------------------------------------------------------------------- /demo/angular/android/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /demo/angular/android/app/src/androidTest/java/com/getcapacitor/myapp/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.getcapacitor.myapp; 2 | 3 | import static org.junit.Assert.*; 4 | 5 | import android.content.Context; 6 | import androidx.test.ext.junit.runners.AndroidJUnit4; 7 | import androidx.test.platform.app.InstrumentationRegistry; 8 | import org.junit.Test; 9 | import org.junit.runner.RunWith; 10 | 11 | /** 12 | * Instrumented test, which will execute on an Android device. 13 | * 14 | * @see Testing documentation 15 | */ 16 | @RunWith(AndroidJUnit4.class) 17 | public class ExampleInstrumentedTest { 18 | 19 | @Test 20 | public void useAppContext() throws Exception { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); 23 | 24 | assertEquals("com.getcapacitor.app", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /demo/angular/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /demo/angular/android/app/src/main/assets/capacitor.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "appId": "io.ionic.starter", 3 | "appName": "angular", 4 | "bundledWebRuntime": false, 5 | "npmClient": "npm", 6 | "webDir": "www", 7 | "plugins": { 8 | "SplashScreen": { 9 | "launchShowDuration": 0 10 | } 11 | }, 12 | "cordova": {} 13 | } 14 | -------------------------------------------------------------------------------- /demo/angular/android/app/src/main/assets/capacitor.plugins.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "pkg": "@nativescript/capacitor", 4 | "classpath": "org.nativescript.capacitor.NativeScriptCapPlugin" 5 | } 6 | ] 7 | -------------------------------------------------------------------------------- /demo/angular/android/app/src/main/java/io/ionic/starter/MainActivity.java: -------------------------------------------------------------------------------- 1 | package io.ionic.starter; 2 | 3 | import com.getcapacitor.BridgeActivity; 4 | 5 | public class MainActivity extends BridgeActivity {} 6 | -------------------------------------------------------------------------------- /demo/angular/android/app/src/main/res/drawable-land-hdpi/splash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nativescript-community/capacitor-plugins/66c93c0d253f481c29b11142680e8126cb5dd878/demo/angular/android/app/src/main/res/drawable-land-hdpi/splash.png -------------------------------------------------------------------------------- /demo/angular/android/app/src/main/res/drawable-land-mdpi/splash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nativescript-community/capacitor-plugins/66c93c0d253f481c29b11142680e8126cb5dd878/demo/angular/android/app/src/main/res/drawable-land-mdpi/splash.png -------------------------------------------------------------------------------- /demo/angular/android/app/src/main/res/drawable-land-xhdpi/splash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nativescript-community/capacitor-plugins/66c93c0d253f481c29b11142680e8126cb5dd878/demo/angular/android/app/src/main/res/drawable-land-xhdpi/splash.png -------------------------------------------------------------------------------- /demo/angular/android/app/src/main/res/drawable-land-xxhdpi/splash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nativescript-community/capacitor-plugins/66c93c0d253f481c29b11142680e8126cb5dd878/demo/angular/android/app/src/main/res/drawable-land-xxhdpi/splash.png -------------------------------------------------------------------------------- /demo/angular/android/app/src/main/res/drawable-land-xxxhdpi/splash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nativescript-community/capacitor-plugins/66c93c0d253f481c29b11142680e8126cb5dd878/demo/angular/android/app/src/main/res/drawable-land-xxxhdpi/splash.png -------------------------------------------------------------------------------- /demo/angular/android/app/src/main/res/drawable-port-hdpi/splash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nativescript-community/capacitor-plugins/66c93c0d253f481c29b11142680e8126cb5dd878/demo/angular/android/app/src/main/res/drawable-port-hdpi/splash.png -------------------------------------------------------------------------------- /demo/angular/android/app/src/main/res/drawable-port-mdpi/splash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nativescript-community/capacitor-plugins/66c93c0d253f481c29b11142680e8126cb5dd878/demo/angular/android/app/src/main/res/drawable-port-mdpi/splash.png -------------------------------------------------------------------------------- /demo/angular/android/app/src/main/res/drawable-port-xhdpi/splash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nativescript-community/capacitor-plugins/66c93c0d253f481c29b11142680e8126cb5dd878/demo/angular/android/app/src/main/res/drawable-port-xhdpi/splash.png -------------------------------------------------------------------------------- /demo/angular/android/app/src/main/res/drawable-port-xxhdpi/splash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nativescript-community/capacitor-plugins/66c93c0d253f481c29b11142680e8126cb5dd878/demo/angular/android/app/src/main/res/drawable-port-xxhdpi/splash.png -------------------------------------------------------------------------------- /demo/angular/android/app/src/main/res/drawable-port-xxxhdpi/splash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nativescript-community/capacitor-plugins/66c93c0d253f481c29b11142680e8126cb5dd878/demo/angular/android/app/src/main/res/drawable-port-xxxhdpi/splash.png -------------------------------------------------------------------------------- /demo/angular/android/app/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 12 | 13 | 19 | 22 | 25 | 26 | 27 | 28 | 34 | 35 | -------------------------------------------------------------------------------- /demo/angular/android/app/src/main/res/drawable/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 10 | 15 | 20 | 25 | 30 | 35 | 40 | 45 | 50 | 55 | 60 | 65 | 70 | 75 | 80 | 85 | 90 | 95 | 100 | 105 | 110 | 115 | 120 | 125 | 130 | 135 | 140 | 145 | 150 | 155 | 160 | 165 | 170 | 171 | -------------------------------------------------------------------------------- /demo/angular/android/app/src/main/res/drawable/splash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nativescript-community/capacitor-plugins/66c93c0d253f481c29b11142680e8126cb5dd878/demo/angular/android/app/src/main/res/drawable/splash.png -------------------------------------------------------------------------------- /demo/angular/android/app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 12 | 13 | -------------------------------------------------------------------------------- /demo/angular/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /demo/angular/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /demo/angular/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nativescript-community/capacitor-plugins/66c93c0d253f481c29b11142680e8126cb5dd878/demo/angular/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /demo/angular/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nativescript-community/capacitor-plugins/66c93c0d253f481c29b11142680e8126cb5dd878/demo/angular/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /demo/angular/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nativescript-community/capacitor-plugins/66c93c0d253f481c29b11142680e8126cb5dd878/demo/angular/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /demo/angular/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nativescript-community/capacitor-plugins/66c93c0d253f481c29b11142680e8126cb5dd878/demo/angular/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /demo/angular/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nativescript-community/capacitor-plugins/66c93c0d253f481c29b11142680e8126cb5dd878/demo/angular/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /demo/angular/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nativescript-community/capacitor-plugins/66c93c0d253f481c29b11142680e8126cb5dd878/demo/angular/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /demo/angular/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nativescript-community/capacitor-plugins/66c93c0d253f481c29b11142680e8126cb5dd878/demo/angular/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /demo/angular/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nativescript-community/capacitor-plugins/66c93c0d253f481c29b11142680e8126cb5dd878/demo/angular/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /demo/angular/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nativescript-community/capacitor-plugins/66c93c0d253f481c29b11142680e8126cb5dd878/demo/angular/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /demo/angular/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nativescript-community/capacitor-plugins/66c93c0d253f481c29b11142680e8126cb5dd878/demo/angular/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /demo/angular/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nativescript-community/capacitor-plugins/66c93c0d253f481c29b11142680e8126cb5dd878/demo/angular/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /demo/angular/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nativescript-community/capacitor-plugins/66c93c0d253f481c29b11142680e8126cb5dd878/demo/angular/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /demo/angular/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nativescript-community/capacitor-plugins/66c93c0d253f481c29b11142680e8126cb5dd878/demo/angular/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /demo/angular/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nativescript-community/capacitor-plugins/66c93c0d253f481c29b11142680e8126cb5dd878/demo/angular/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /demo/angular/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nativescript-community/capacitor-plugins/66c93c0d253f481c29b11142680e8126cb5dd878/demo/angular/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /demo/angular/android/app/src/main/res/values/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #FFFFFF 4 | -------------------------------------------------------------------------------- /demo/angular/android/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | angular 4 | angular 5 | io.ionic.starter 6 | io.ionic.starter 7 | 8 | -------------------------------------------------------------------------------- /demo/angular/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 11 | 12 | 17 | 18 | 19 | 22 | -------------------------------------------------------------------------------- /demo/angular/android/app/src/main/res/xml/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /demo/angular/android/app/src/main/res/xml/file_paths.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /demo/angular/android/app/src/test/java/com/getcapacitor/myapp/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.getcapacitor.myapp; 2 | 3 | import static org.junit.Assert.*; 4 | 5 | import org.junit.Test; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | 14 | @Test 15 | public void addition_isCorrect() throws Exception { 16 | assertEquals(4, 2 + 2); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /demo/angular/android/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | 5 | repositories { 6 | google() 7 | jcenter() 8 | } 9 | dependencies { 10 | apply from: 'nativescript.buildscript.gradle' 11 | def computeKotlinVersion = { -> project.hasProperty("kotlinVersion") ? kotlinVersion : "1.4.21"} 12 | def kotlinVersion = computeKotlinVersion() 13 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion" 14 | 15 | classpath 'com.android.tools.build:gradle:4.1.2' 16 | classpath 'com.google.gms:google-services:4.3.3' 17 | 18 | // NOTE: Do not place your application dependencies here; they belong 19 | // in the individual module build.gradle files 20 | } 21 | } 22 | 23 | apply from: "variables.gradle" 24 | 25 | allprojects { 26 | repositories { 27 | google() 28 | jcenter() 29 | } 30 | } 31 | 32 | task clean(type: Delete) { 33 | delete rootProject.buildDir 34 | } 35 | -------------------------------------------------------------------------------- /demo/angular/android/capacitor.settings.gradle: -------------------------------------------------------------------------------- 1 | // DO NOT EDIT THIS FILE! IT IS GENERATED EACH TIME "capacitor update" IS RUN 2 | include ':capacitor-android' 3 | project(':capacitor-android').projectDir = new File('../node_modules/@capacitor/android/capacitor') 4 | 5 | include ':nativescript-capacitor' 6 | project(':nativescript-capacitor').projectDir = new File('../node_modules/@nativescript/capacitor/android') 7 | -------------------------------------------------------------------------------- /demo/angular/android/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | org.gradle.jvmargs=-Xmx1536m 13 | 14 | # When configured, Gradle will run in incubating parallel mode. 15 | # This option should only be used with decoupled projects. More details, visit 16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 17 | # org.gradle.parallel=true 18 | 19 | # AndroidX package structure to make it clearer which packages are bundled with the 20 | # Android operating system, and which are packaged with your app's APK 21 | # https://developer.android.com/topic/libraries/support-library/androidx-rn 22 | android.useAndroidX=true 23 | # Automatically convert third-party libraries to use AndroidX 24 | android.enableJetifier=true 25 | -------------------------------------------------------------------------------- /demo/angular/android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nativescript-community/capacitor-plugins/66c93c0d253f481c29b11142680e8126cb5dd878/demo/angular/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /demo/angular/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /demo/angular/android/gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # 4 | # Copyright 2015 the original author or authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # https://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | ############################################################################## 20 | ## 21 | ## Gradle start up script for UN*X 22 | ## 23 | ############################################################################## 24 | 25 | # Attempt to set APP_HOME 26 | # Resolve links: $0 may be a link 27 | PRG="$0" 28 | # Need this for relative symlinks. 29 | while [ -h "$PRG" ] ; do 30 | ls=`ls -ld "$PRG"` 31 | link=`expr "$ls" : '.*-> \(.*\)$'` 32 | if expr "$link" : '/.*' > /dev/null; then 33 | PRG="$link" 34 | else 35 | PRG=`dirname "$PRG"`"/$link" 36 | fi 37 | done 38 | SAVED="`pwd`" 39 | cd "`dirname \"$PRG\"`/" >/dev/null 40 | APP_HOME="`pwd -P`" 41 | cd "$SAVED" >/dev/null 42 | 43 | APP_NAME="Gradle" 44 | APP_BASE_NAME=`basename "$0"` 45 | 46 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 47 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 48 | 49 | # Use the maximum available, or set MAX_FD != -1 to use that value. 50 | MAX_FD="maximum" 51 | 52 | warn () { 53 | echo "$*" 54 | } 55 | 56 | die () { 57 | echo 58 | echo "$*" 59 | echo 60 | exit 1 61 | } 62 | 63 | # OS specific support (must be 'true' or 'false'). 64 | cygwin=false 65 | msys=false 66 | darwin=false 67 | nonstop=false 68 | case "`uname`" in 69 | CYGWIN* ) 70 | cygwin=true 71 | ;; 72 | Darwin* ) 73 | darwin=true 74 | ;; 75 | MINGW* ) 76 | msys=true 77 | ;; 78 | NONSTOP* ) 79 | nonstop=true 80 | ;; 81 | esac 82 | 83 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 84 | 85 | 86 | # Determine the Java command to use to start the JVM. 87 | if [ -n "$JAVA_HOME" ] ; then 88 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 89 | # IBM's JDK on AIX uses strange locations for the executables 90 | JAVACMD="$JAVA_HOME/jre/sh/java" 91 | else 92 | JAVACMD="$JAVA_HOME/bin/java" 93 | fi 94 | if [ ! -x "$JAVACMD" ] ; then 95 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 96 | 97 | Please set the JAVA_HOME variable in your environment to match the 98 | location of your Java installation." 99 | fi 100 | else 101 | JAVACMD="java" 102 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 103 | 104 | Please set the JAVA_HOME variable in your environment to match the 105 | location of your Java installation." 106 | fi 107 | 108 | # Increase the maximum file descriptors if we can. 109 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 110 | MAX_FD_LIMIT=`ulimit -H -n` 111 | if [ $? -eq 0 ] ; then 112 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 113 | MAX_FD="$MAX_FD_LIMIT" 114 | fi 115 | ulimit -n $MAX_FD 116 | if [ $? -ne 0 ] ; then 117 | warn "Could not set maximum file descriptor limit: $MAX_FD" 118 | fi 119 | else 120 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 121 | fi 122 | fi 123 | 124 | # For Darwin, add options to specify how the application appears in the dock 125 | if $darwin; then 126 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 127 | fi 128 | 129 | # For Cygwin or MSYS, switch paths to Windows format before running java 130 | if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then 131 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 132 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 133 | 134 | JAVACMD=`cygpath --unix "$JAVACMD"` 135 | 136 | # We build the pattern for arguments to be converted via cygpath 137 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 138 | SEP="" 139 | for dir in $ROOTDIRSRAW ; do 140 | ROOTDIRS="$ROOTDIRS$SEP$dir" 141 | SEP="|" 142 | done 143 | OURCYGPATTERN="(^($ROOTDIRS))" 144 | # Add a user-defined pattern to the cygpath arguments 145 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 146 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 147 | fi 148 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 149 | i=0 150 | for arg in "$@" ; do 151 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 152 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 153 | 154 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 155 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 156 | else 157 | eval `echo args$i`="\"$arg\"" 158 | fi 159 | i=`expr $i + 1` 160 | done 161 | case $i in 162 | 0) set -- ;; 163 | 1) set -- "$args0" ;; 164 | 2) set -- "$args0" "$args1" ;; 165 | 3) set -- "$args0" "$args1" "$args2" ;; 166 | 4) set -- "$args0" "$args1" "$args2" "$args3" ;; 167 | 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 168 | 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 169 | 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 170 | 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 171 | 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 172 | esac 173 | fi 174 | 175 | # Escape application args 176 | save () { 177 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 178 | echo " " 179 | } 180 | APP_ARGS=`save "$@"` 181 | 182 | # Collect all arguments for the java command, following the shell quoting and substitution rules 183 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 184 | 185 | exec "$JAVACMD" "$@" 186 | -------------------------------------------------------------------------------- /demo/angular/android/gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 34 | 35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 37 | 38 | @rem Find java.exe 39 | if defined JAVA_HOME goto findJavaFromJavaHome 40 | 41 | set JAVA_EXE=java.exe 42 | %JAVA_EXE% -version >NUL 2>&1 43 | if "%ERRORLEVEL%" == "0" goto init 44 | 45 | echo. 46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 47 | echo. 48 | echo Please set the JAVA_HOME variable in your environment to match the 49 | echo location of your Java installation. 50 | 51 | goto fail 52 | 53 | :findJavaFromJavaHome 54 | set JAVA_HOME=%JAVA_HOME:"=% 55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 56 | 57 | if exist "%JAVA_EXE%" goto init 58 | 59 | echo. 60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 61 | echo. 62 | echo Please set the JAVA_HOME variable in your environment to match the 63 | echo location of your Java installation. 64 | 65 | goto fail 66 | 67 | :init 68 | @rem Get command-line arguments, handling Windows variants 69 | 70 | if not "%OS%" == "Windows_NT" goto win9xME_args 71 | 72 | :win9xME_args 73 | @rem Slurp the command line arguments. 74 | set CMD_LINE_ARGS= 75 | set _SKIP=2 76 | 77 | :win9xME_args_slurp 78 | if "x%~1" == "x" goto execute 79 | 80 | set CMD_LINE_ARGS=%* 81 | 82 | :execute 83 | @rem Setup the command line 84 | 85 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 86 | 87 | 88 | @rem Execute Gradle 89 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 90 | 91 | :end 92 | @rem End local scope for the variables with windows NT shell 93 | if "%ERRORLEVEL%"=="0" goto mainEnd 94 | 95 | :fail 96 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 97 | rem the _cmd.exe /c_ return code! 98 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 99 | exit /b 1 100 | 101 | :mainEnd 102 | if "%OS%"=="Windows_NT" endlocal 103 | 104 | :omega 105 | -------------------------------------------------------------------------------- /demo/angular/android/nativescript.build.gradle: -------------------------------------------------------------------------------- 1 | import groovy.io.FileType 2 | import org.gradle.api.internal.artifacts.dependencies.DefaultProjectDependency 3 | import org.gradle.internal.logging.text.StyledTextOutputFactory 4 | 5 | import javax.inject.Inject 6 | import java.nio.file.Files 7 | import java.nio.file.Paths 8 | import java.nio.file.StandardCopyOption 9 | import java.security.MessageDigest 10 | 11 | import static org.gradle.internal.logging.text.StyledTextOutput.Style 12 | 13 | apply plugin: "com.android.application" 14 | apply from: "gradle-helpers/BuildToolTask.gradle" 15 | apply from: "gradle-helpers/CustomExecutionLogger.gradle" 16 | apply from: "gradle-helpers/AnalyticsCollector.gradle" 17 | 18 | def enableKotlin = (project.hasProperty("useKotlin") && project.useKotlin == "true") 19 | 20 | if (enableKotlin) { 21 | apply plugin: 'kotlin-android' 22 | apply plugin: 'kotlin-parcelize' 23 | } 24 | 25 | def onlyX86 = project.hasProperty("onlyX86") 26 | if (onlyX86) { 27 | outLogger.withStyle(Style.Info).println "OnlyX86 build triggered." 28 | } 29 | 30 | //common 31 | def BUILD_TOOLS_PATH = "$rootDir/build-tools" 32 | def PASSED_TYPINGS_PATH = System.getenv("TNS_TYPESCRIPT_DECLARATIONS_PATH") 33 | def TYPINGS_PATH = "$BUILD_TOOLS_PATH/typings" 34 | if (PASSED_TYPINGS_PATH != null) { 35 | TYPINGS_PATH = PASSED_TYPINGS_PATH 36 | } 37 | 38 | def PACKAGE_JSON = "package.json" 39 | 40 | //static binding generator 41 | def SBG_JAVA_DEPENDENCIES = "sbg-java-dependencies.txt" 42 | def SBG_INPUT_FILE = "sbg-input-file.txt" 43 | def SBG_OUTPUT_FILE = "sbg-output-file.txt" 44 | def SBG_JS_PARSED_FILES = "sbg-js-parsed-files.txt" 45 | def SBG_BINDINGS_NAME = "sbg-bindings.txt" 46 | def SBG_INTERFACE_NAMES = "sbg-interface-names.txt" 47 | def INPUT_JS_DIR = "$projectDir/src/main/assets/public/nativescript" 48 | def OUTPUT_JAVA_DIR = "$projectDir/src/main/java" 49 | 50 | //metadata generator 51 | def MDG_OUTPUT_DIR = "mdg-output-dir.txt" 52 | def MDG_JAVA_DEPENDENCIES = "mdg-java-dependencies.txt" 53 | def METADATA_OUT_PATH = "$projectDir/src/main/assets/metadata" 54 | 55 | // paths to jar libraries 56 | def pluginsJarLibraries = new LinkedList() 57 | def allJarLibraries = new LinkedList() 58 | 59 | def computeKotlinVersion = { -> project.hasProperty("kotlinVersion") ? kotlinVersion : "1.3.41" } 60 | def computeCompileSdkVersion = { -> project.hasProperty("compileSdk") ? compileSdk : 29 } 61 | def computeTargetSdkVersion = { -> project.hasProperty("targetSdk") ? targetSdk : 29 } 62 | def computeBuildToolsVersion = { -> 63 | project.hasProperty("buildToolsVersion") ? buildToolsVersion : "29.0.2" 64 | } 65 | 66 | def enableAnalytics = (project.hasProperty("gatherAnalyticsData") && project.gatherAnalyticsData == "true") 67 | def enableVerboseMDG = project.gradle.startParameter.logLevel.name() == 'DEBUG' 68 | def analyticsFilePath = "$rootDir/analytics/build-statistics.json" 69 | def analyticsCollector = project.ext.AnalyticsCollector.withOutputPath(analyticsFilePath) 70 | if (enableAnalytics) { 71 | analyticsCollector.markUseKotlinPropertyInApp(enableKotlin) 72 | analyticsCollector.writeAnalyticsFile() 73 | } 74 | 75 | project.ext.selectedBuildType = project.hasProperty("release") ? "release" : "debug" 76 | 77 | buildscript { 78 | def initialize = { -> 79 | 80 | project.ext.extractedDependenciesDir = "${project.buildDir}/exploded-dependencies" 81 | project.ext.aarDependenciesDir = "${project.buildDir}/aar-dependencies" 82 | project.ext.cleanupAllJarsTimestamp = "${project.buildDir}/cleanupAllJars.timestamp" 83 | project.ext.extractAllJarsTimestamp = "${project.buildDir}/extractAllJars.timestamp" 84 | project.ext.PLATFORMS_ANDROID = "android" 85 | project.ext.USER_PROJECT_ROOT = "$rootDir/.." 86 | project.ext.outLogger = services.get(StyledTextOutputFactory).create("colouredOutputLogger") 87 | } 88 | 89 | initialize() 90 | } 91 | //////////////////////////////////////////////////////////////////////////////////// 92 | ///////////////////////////// CONFIGURATIONS /////////////////////////////////////// 93 | //////////////////////////////////////////////////////////////////////////////////// 94 | 95 | 96 | android { 97 | 98 | if (enableKotlin) { 99 | kotlinOptions { 100 | jvmTarget = '1.8' 101 | } 102 | } 103 | 104 | compileSdkVersion computeCompileSdkVersion() 105 | buildToolsVersion computeBuildToolsVersion() 106 | 107 | defaultConfig { 108 | def manifest = new XmlSlurper().parse(file(android.sourceSets.main.manifest.srcFile)) 109 | def minSdkVer = manifest."uses-sdk"."@android:minSdkVersion".text() ?: 21 110 | minSdkVersion minSdkVer 111 | targetSdkVersion computeTargetSdkVersion() 112 | ndk { 113 | if (onlyX86) { 114 | abiFilters 'x86' 115 | } else { 116 | abiFilters 'x86', 'x86_64', 'armeabi-v7a', 'arm64-v8a' 117 | } 118 | } 119 | dexOptions { 120 | jumboMode = true 121 | } 122 | } 123 | 124 | compileOptions { 125 | sourceCompatibility JavaVersion.VERSION_1_8 126 | targetCompatibility JavaVersion.VERSION_1_8 127 | } 128 | 129 | sourceSets.main { 130 | jniLibs.srcDirs = ["$projectDir/libs/jni", "$projectDir/snapshot-build/build/ndk-build/libs"] 131 | } 132 | 133 | // packagingOptions { 134 | // exclude 'META-INF/androidx.fragment_fragment.version' 135 | // } 136 | 137 | signingConfigs { 138 | release { 139 | if (project.hasProperty("release")) { 140 | if (project.hasProperty("ksPath") && 141 | project.hasProperty("ksPassword") && 142 | project.hasProperty("alias") && 143 | project.hasProperty("password")) { 144 | 145 | storeFile file(ksPath) 146 | storePassword ksPassword 147 | keyAlias alias 148 | keyPassword password 149 | } 150 | } 151 | } 152 | } 153 | buildTypes { 154 | release { 155 | signingConfig signingConfigs.release 156 | } 157 | } 158 | 159 | def initializeMergedAssetsOutputPath = { -> 160 | android.applicationVariants.all { variant -> 161 | if (variant.buildType.name == project.selectedBuildType) { 162 | def task 163 | if (variant.metaClass.respondsTo(variant, "getMergeAssetsProvider")) { 164 | def provider = variant.getMergeAssetsProvider() 165 | task = provider.get(); 166 | } else { 167 | // fallback for older android gradle plugin versions 168 | task = variant.getMergeAssets() 169 | } 170 | for (File file : task.getOutputs().getFiles()) { 171 | if (!file.getPath().contains("${File.separator}incremental${File.separator}")) { 172 | project.ext.mergedAssetsOutputPath = file.getPath() 173 | break; 174 | } 175 | } 176 | } 177 | } 178 | } 179 | 180 | initializeMergedAssetsOutputPath() 181 | } 182 | 183 | repositories { 184 | google() 185 | mavenCentral() 186 | flatDir{ 187 | dirs 'libs/runtime-libs' 188 | } 189 | } 190 | 191 | dependencies { 192 | implementation "androidx.multidex:multidex:2.0.1" 193 | implementation "org.apache.commons:commons-io:1.3.2" 194 | def androidXMaterialVersion = "1.1.0" 195 | if (project.hasProperty("androidxMaterialVersion")) { 196 | androidXMaterialVersion = androidxMaterialVersion 197 | } 198 | 199 | implementation "com.google.android.material:material:$androidXMaterialVersion" 200 | 201 | def useV8Symbols = false 202 | 203 | def runtime = "nativescript-optimized-with-inspector" 204 | 205 | if (project.gradle.startParameter.taskNames.any { it.toLowerCase().contains('release') }) { 206 | runtime = "nativescript-optimized" 207 | } 208 | 209 | if (useV8Symbols) { 210 | runtime = "nativescript-regular" 211 | } 212 | 213 | outLogger.withStyle(Style.SuccessHeader).println "\t + adding nativescript runtime package dependency: $runtime" 214 | project.dependencies.add("implementation", [name: runtime, ext: "aar"]) 215 | 216 | def kotlinVersion = computeKotlinVersion() 217 | if (enableKotlin) { 218 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlinVersion" 219 | } 220 | } 221 | 222 | //////////////////////////////////////////////////////////////////////////////////// 223 | ///////////////////////////// CONFIGURATION PHASE ////////////////////////////////// 224 | //////////////////////////////////////////////////////////////////////////////////// 225 | 226 | if (failOnCompilationWarningsEnabled()) { 227 | tasks.withType(JavaCompile) { 228 | options.compilerArgs << '-Xlint:all' << "-Werror" 229 | options.deprecation = true 230 | } 231 | } 232 | 233 | tasks.whenTaskAdded({ org.gradle.api.DefaultTask currentTask -> 234 | if (currentTask =~ /generate.+BuildConfig/) { 235 | currentTask.finalizedBy(extractAllJars) 236 | extractAllJars.finalizedBy(collectAllJars) 237 | } 238 | if (currentTask =~ /compile.+JavaWithJavac/) { 239 | currentTask.dependsOn(runSbg) 240 | currentTask.finalizedBy(buildMetadata) 241 | } 242 | if (currentTask =~ /merge.*Assets/) { 243 | currentTask.shouldRunAfter(buildMetadata) 244 | } 245 | if (currentTask =~ /assemble.*Debug/ || currentTask =~ /assemble.*Release/) { 246 | 247 | } 248 | }) 249 | 250 | //////////////////////////////////////////////////////////////////////////////////// 251 | ///////////////////////////// EXECUTUION PHASE ///////////////////////////////////// 252 | //////////////////////////////////////////////////////////////////////////////////// 253 | 254 | task runSbg(type: BuildToolTask) { 255 | dependsOn "collectAllJars" 256 | if (!findProject(':static-binding-generator').is(null)) { 257 | dependsOn ':static-binding-generator:jar' 258 | } 259 | 260 | outputs.dir("$OUTPUT_JAVA_DIR/com/tns/gen") 261 | inputs.dir(INPUT_JS_DIR) 262 | inputs.dir(extractedDependenciesDir) 263 | 264 | workingDir "$BUILD_TOOLS_PATH" 265 | main "-jar" 266 | 267 | def paramz = new ArrayList() 268 | paramz.add("static-binding-generator.jar") 269 | 270 | if (failOnCompilationWarningsEnabled()) { 271 | paramz.add("-show-deprecation-warnings") 272 | } 273 | 274 | setOutputs outLogger 275 | 276 | 277 | args paramz 278 | 279 | doFirst { 280 | new File("$OUTPUT_JAVA_DIR/com/tns/gen").deleteDir() 281 | } 282 | } 283 | 284 | def failOnCompilationWarningsEnabled() { 285 | return project.hasProperty("failOnCompilationWarnings") && (failOnCompilationWarnings || failOnCompilationWarnings.toBoolean()) 286 | } 287 | 288 | def explodeAar(File compileDependency, File outputDir) { 289 | logger.info("explodeAar: Extracting ${compileDependency.path} -> ${outputDir.path}") 290 | 291 | if (compileDependency.name.endsWith(".aar")) { 292 | java.util.jar.JarFile jar = new java.util.jar.JarFile(compileDependency) 293 | Enumeration enumEntries = jar.entries() 294 | while (enumEntries.hasMoreElements()) { 295 | java.util.jar.JarEntry file = (java.util.jar.JarEntry) enumEntries.nextElement() 296 | if (file.name.endsWith(".jar")) { 297 | def targetFile = new File(outputDir, file.name) 298 | InputStream inputStream = jar.getInputStream(file) 299 | new File(targetFile.parent).mkdirs() 300 | Files.copy(inputStream, targetFile.toPath(), StandardCopyOption.REPLACE_EXISTING) 301 | } 302 | if (file.isDirectory()) { 303 | continue 304 | } 305 | } 306 | jar.close() 307 | } else if (compileDependency.name.endsWith(".jar")) { 308 | copy { 309 | from compileDependency.absolutePath 310 | into outputDir 311 | } 312 | } 313 | } 314 | 315 | def md5(String string) { 316 | MessageDigest digest = MessageDigest.getInstance("MD5") 317 | digest.update(string.bytes) 318 | return new BigInteger(1, digest.digest()).toString(16).padLeft(32, '0') 319 | } 320 | 321 | class WorkerTask extends DefaultTask { 322 | @Inject 323 | WorkerExecutor getWorkerExecutor() { 324 | throw new UnsupportedOperationException() 325 | } 326 | } 327 | 328 | class EmptyRunnable implements Runnable { 329 | void run() { 330 | } 331 | } 332 | 333 | def getMergedAssetsOutputPath() { 334 | if (!project.hasProperty("mergedAssetsOutputPath")) { 335 | // mergedAssetsOutputPath not found fallback to the default value for android gradle plugin 3.5.1 336 | project.ext.mergedAssetsOutputPath = "$projectDir/build/intermediates/merged_assets/" + project.selectedBuildType + "/out" 337 | } 338 | return project.ext.mergedAssetsOutputPath 339 | } 340 | 341 | // Discover all jars and dynamically create tasks for the extraction of each of them 342 | project.ext.allJars = [] 343 | afterEvaluate { project -> 344 | def buildType = project.selectedBuildType == "release" ? "Release" : "Debug" 345 | def jars = [] 346 | def artifactType = Attribute.of('artifactType', String) 347 | configurations.all { config -> 348 | if (config.name.toLowerCase().endsWith("${buildType}RuntimeClasspath".toLowerCase())) { 349 | config.incoming.artifactView { 350 | attributes { 351 | it.attribute(artifactType, 'jar') 352 | } 353 | }.artifacts.each { 354 | processJar(it.file, jars) 355 | } 356 | 357 | def projectDependencies = config.getAllDependencies().withType(ProjectDependency) 358 | def moduleDependencies = config.getAllDependencies().withType(ModuleDependency) 359 | 360 | moduleDependencies.forEach { 361 | if(it instanceof DefaultProjectDependency){ 362 | return 363 | } 364 | def file = project.getConfigurations().detachedConfiguration(it) 365 | 366 | file.forEach { 367 | if (it.exists()) { 368 | if (it.path.endsWith(".jar")) { 369 | processJar(it, jars) 370 | }else if (it.path.endsWith(".aar")) { 371 | def destDir = md5(it.path) 372 | def outputDir = new File(Paths.get(aarDependenciesDir, destDir).normalize().toString()) 373 | explodeAar(it, outputDir) 374 | outputDir.eachFileRecurse { 375 | if (it.name.endsWith(".jar")) { 376 | processJar(it, jars) 377 | } 378 | } 379 | } 380 | } else { 381 | outLogger.withStyle(Style.Info).println "WARNING: Folder ${it.path} does not exists, the dependent project's classes won't be included in the metadata" 382 | } 383 | } 384 | 385 | } 386 | // def dependentProjects = projectDependencies*.dependency 387 | projectDependencies.forEach { 388 | it = it.getDependencyProject() 389 | 390 | // if there's a project dependency search for its result jar file in the build/intermediates/runtime_library_classes folder 391 | // this is the output folder in gradle 5.1.1, but it can be changed in the future versions of gradle 392 | def jarDir = new File("${it.getBuildDir()}/intermediates/runtime_library_classes/${buildType.toLowerCase()}") 393 | 394 | // gradle 6.5 395 | if (!jarDir.exists()) { 396 | jarDir = new File("${it.getBuildDir()}/intermediates/runtime_library_classes_jar/${buildType.toLowerCase()}") 397 | } 398 | if (jarDir.exists()) { 399 | jarDir.eachFileRecurse(FileType.FILES) { file -> 400 | if (file.path.endsWith(".jar")) { 401 | processJar(file, jars) 402 | } 403 | } 404 | } else { 405 | outLogger.withStyle(Style.Info).println "WARNING: Folder ${jarDir.path} does not exists, the dependent project's classes won't be included in the metadata" 406 | } 407 | } 408 | } 409 | } 410 | } 411 | 412 | 413 | def processJar(File jar, jars) { 414 | if (!jars.contains(jar)) { 415 | jars.add(jar) 416 | def destDir = md5(jar.path) 417 | def outputDir = new File(Paths.get(extractedDependenciesDir, destDir).normalize().toString()) 418 | 419 | def taskName = "extract_${jar.name}_to_${destDir}" 420 | logger.debug("Creating dynamic task ${taskName}") 421 | 422 | // Add discovered jars as dependencies of cleanupAllJars. 423 | // This is crucial for cloud builds because they are different 424 | // on each incremental build (as each time the gradle user home 425 | // directory is a randomly generated string) 426 | cleanupAllJars.inputs.files jar 427 | 428 | task "${taskName}"(type: WorkerTask) { 429 | dependsOn cleanupAllJars 430 | extractAllJars.dependsOn it 431 | 432 | // This dependency seems redundant but probably due to some Gradle issue with workers, 433 | // without it `runSbg` sporadically starts before all extraction tasks have finished and 434 | // fails due to missing JARs 435 | runSbg.dependsOn it 436 | 437 | inputs.files jar 438 | outputs.dir outputDir 439 | 440 | doLast { 441 | // Running in parallel no longer seems to bring any benefit. 442 | // It mattered only when we were extracting JARs from AARs. 443 | // To try it simply remove the following comments. 444 | // workerExecutor.submit(EmptyRunnable.class) { 445 | explodeAar(jar, outputDir) 446 | // } 447 | } 448 | } 449 | project.ext.allJars.add([file: jar, outputDir: outputDir]) 450 | } 451 | } 452 | 453 | task cleanupAllJars { 454 | // We depend on the list of libs directories that might contain aar or jar files 455 | // and on the list of all discovered jars 456 | outputs.files cleanupAllJarsTimestamp 457 | 458 | doLast { 459 | def allDests = project.ext.allJars*.outputDir*.name 460 | def dir = new File(extractedDependenciesDir) 461 | if (dir.exists()) { 462 | dir.eachDir { 463 | // An old directory which is no longer a dependency (e.g. orphaned by a deleted plugin) 464 | if (!allDests.contains(it.name)) { 465 | logger.info("Task cleanupAllJars: Deleting orphaned ${it.path}") 466 | // 467 | org.apache.commons.io.FileUtils.deleteDirectory(it) 468 | } 469 | } 470 | } 471 | new File(cleanupAllJarsTimestamp).write "" 472 | } 473 | } 474 | 475 | 476 | // Placeholder task which depends on all dynamically generated extraction tasks 477 | task extractAllJars { 478 | dependsOn cleanupAllJars 479 | 480 | outputs.files extractAllJarsTimestamp 481 | 482 | doLast { 483 | new File(cleanupAllJarsTimestamp).write "" 484 | } 485 | } 486 | 487 | task collectAllJars { 488 | dependsOn extractAllJars 489 | description "gathers all paths to jar dependencies before building metadata with them" 490 | 491 | def sdkPath = android.sdkDirectory.getAbsolutePath() 492 | def androidJar = sdkPath + "/platforms/" + android.compileSdkVersion + "/android.jar" 493 | 494 | doFirst { 495 | def allJarPaths = new LinkedList() 496 | allJarPaths.add(androidJar) 497 | allJarPaths.addAll(pluginsJarLibraries) 498 | def ft = fileTree(dir: extractedDependenciesDir, include: "**/*.jar") 499 | ft.each { currentJarFile -> 500 | allJarPaths.add(currentJarFile.getAbsolutePath()) 501 | } 502 | 503 | new File("$BUILD_TOOLS_PATH/$SBG_JAVA_DEPENDENCIES").withWriter { out -> 504 | allJarPaths.each { out.println it } 505 | } 506 | new File("$BUILD_TOOLS_PATH/$MDG_JAVA_DEPENDENCIES").withWriter { out -> 507 | allJarPaths.each { 508 | if (it.endsWith(".jar")) { 509 | out.println it 510 | } 511 | } 512 | } 513 | 514 | new File("$BUILD_TOOLS_PATH/$SBG_INPUT_FILE").withWriter { out -> 515 | out.println INPUT_JS_DIR 516 | } 517 | new File("$BUILD_TOOLS_PATH/$SBG_OUTPUT_FILE").withWriter { out -> 518 | out.println OUTPUT_JAVA_DIR 519 | } 520 | 521 | allJarLibraries.addAll(allJarPaths) 522 | } 523 | } 524 | 525 | task copyMetadataFilters(type: Copy) { 526 | from "$rootDir/whitelist.mdg", "$rootDir/blacklist.mdg" 527 | into "$BUILD_TOOLS_PATH" 528 | } 529 | 530 | task copyMetadata { 531 | doLast { 532 | copy { 533 | from "$projectDir/src/main/assets/metadata" 534 | into getMergedAssetsOutputPath() + "/metadata" 535 | } 536 | } 537 | } 538 | 539 | task buildMetadata(type: BuildToolTask) { 540 | if (!findProject(':android-metadata-generator').is(null)) { 541 | dependsOn ':android-metadata-generator:jar' 542 | } 543 | 544 | dependsOn copyMetadataFilters 545 | 546 | // As some external gradle plugins can reorder the execution order of the tasks it may happen that buildMetadata is executed after merge{Debug/Release}Assets 547 | // in that case the metadata won't be included in the result apk and it will crash, so to avoid this we are adding the copyMetadata task which will manually copy 548 | // the metadata files in the merge assets folder and they will be added to the result apk 549 | 550 | // The next line is added to avoid adding another copyData implementation from the firebase plugin - https://github.com/EddyVerbruggen/nativescript-plugin-firebase/blob/3943bb9147f43c41599e801d026378eba93d3f3a/publish/scripts/installer.js#L1105 551 | //buildMetadata.finalizedBy(copyMetadata) 552 | finalizedBy copyMetadata 553 | 554 | description "builds metadata with provided jar dependencies" 555 | 556 | inputs.files("$MDG_JAVA_DEPENDENCIES") 557 | 558 | // make MDG aware of whitelist.mdg and blacklist.mdg files 559 | inputs.files(project.fileTree(dir: "$rootDir", include: "**/*.mdg")) 560 | 561 | def classesDir = "$buildDir/intermediates/javac" 562 | inputs.dir(classesDir) 563 | 564 | def kotlinClassesDir = "$buildDir/tmp/kotlin-classes" 565 | if (file(kotlinClassesDir).exists()) { 566 | inputs.dir(kotlinClassesDir) 567 | } 568 | 569 | outputs.files("$METADATA_OUT_PATH/treeNodeStream.dat", "$METADATA_OUT_PATH/treeStringsStream.dat", "$METADATA_OUT_PATH/treeValueStream.dat") 570 | 571 | workingDir "$BUILD_TOOLS_PATH" 572 | main "-jar" 573 | 574 | doFirst { 575 | // get compiled classes to pass to metadata generator 576 | // these need to be called after the classes have compiled 577 | assert file(classesDir).exists() 578 | 579 | new File(getMergedAssetsOutputPath() + "/metadata").deleteDir() 580 | 581 | def classesSubDirs = new File(classesDir).listFiles() 582 | def selectedBuildType = project.ext.selectedBuildType 583 | 584 | def generatedClasses = new LinkedList() 585 | for (File subDir : classesSubDirs) { 586 | if (subDir.getName().equals(selectedBuildType)) { 587 | generatedClasses.add(subDir.getAbsolutePath()) 588 | } 589 | } 590 | 591 | if (file(kotlinClassesDir).exists()) { 592 | def kotlinClassesSubDirs = new File(kotlinClassesDir).listFiles() 593 | for (File subDir : kotlinClassesSubDirs) { 594 | if (subDir.getName() == selectedBuildType) { 595 | generatedClasses.add(subDir.getAbsolutePath()) 596 | } 597 | } 598 | } 599 | 600 | new File("$BUILD_TOOLS_PATH/$MDG_OUTPUT_DIR").withWriter { out -> 601 | out.println "$METADATA_OUT_PATH" 602 | } 603 | 604 | new File("$BUILD_TOOLS_PATH/$MDG_JAVA_DEPENDENCIES").withWriterAppend { out -> 605 | generatedClasses.each { out.println it } 606 | } 607 | 608 | setOutputs outLogger 609 | 610 | def paramz = new ArrayList() 611 | paramz.add("android-metadata-generator.jar") 612 | 613 | if (enableAnalytics) { 614 | paramz.add("analyticsFilePath=$analyticsFilePath") 615 | } 616 | 617 | if (enableVerboseMDG) { 618 | paramz.add("verbose") 619 | } 620 | 621 | args paramz.toArray() 622 | } 623 | } 624 | 625 | task generateTypescriptDefinitions(type: BuildToolTask) { 626 | if (!findProject(':dts-generator').is(null)) { 627 | dependsOn ':dts-generator:jar' 628 | } 629 | 630 | def paramz = new ArrayList() 631 | def includeDirs = ["com.android.support", "/platforms/" + android.compileSdkVersion] 632 | 633 | workingDir "$BUILD_TOOLS_PATH" 634 | main "-jar" 635 | 636 | doFirst { 637 | delete "$TYPINGS_PATH" 638 | 639 | paramz.add("dts-generator.jar") 640 | paramz.add("-input") 641 | 642 | for (String jarPath : allJarLibraries) { 643 | // don't generate typings for runtime jars and classes 644 | if (shouldIncludeDirForTypings(jarPath, includeDirs)) { 645 | paramz.add(jarPath) 646 | } 647 | } 648 | 649 | paramz.add("-output") 650 | paramz.add("$TYPINGS_PATH") 651 | 652 | new File("$TYPINGS_PATH").mkdirs() 653 | 654 | logger.info("Task generateTypescriptDefinitions: Call dts-generator.jar with arguments: " + paramz.toString().replaceAll(',', '')) 655 | outLogger.withStyle(Style.SuccessHeader).println "Task generateTypescriptDefinitions: Call dts-generator.jar with arguments: " + paramz.toString().replaceAll(',', '') 656 | 657 | setOutputs outLogger 658 | 659 | args paramz.toArray() 660 | } 661 | } 662 | 663 | generateTypescriptDefinitions.onlyIf { 664 | (project.hasProperty("generateTypings") && Boolean.parseBoolean(project.generateTypings)) || PASSED_TYPINGS_PATH != null 665 | } 666 | 667 | collectAllJars.finalizedBy(generateTypescriptDefinitions) 668 | 669 | static def shouldIncludeDirForTypings(path, includeDirs) { 670 | for (String p : includeDirs) { 671 | if (path.indexOf(p) > -1) { 672 | return true 673 | } 674 | } 675 | 676 | return false 677 | } 678 | 679 | task copyTypings { 680 | doLast { 681 | outLogger.withStyle(Style.Info).println "Copied generated typings to application root level. Make sure to import android.d.ts in reference.d.ts" 682 | 683 | copy { 684 | from "$TYPINGS_PATH" 685 | into "$USER_PROJECT_ROOT" 686 | } 687 | } 688 | } 689 | 690 | copyTypings.onlyIf { generateTypescriptDefinitions.didWork } 691 | generateTypescriptDefinitions.finalizedBy(copyTypings) 692 | 693 | 694 | //////////////////////////////////////////////////////////////////////////////////// 695 | ////////////////////////////// OPTIONAL TASKS ////////////////////////////////////// 696 | //////////////////////////////////////////////////////////////////////////////////// 697 | 698 | //////// custom clean /////////// 699 | task cleanSbg(type: Delete) { 700 | delete "$BUILD_TOOLS_PATH/$SBG_JS_PARSED_FILES", 701 | "$BUILD_TOOLS_PATH/$SBG_JAVA_DEPENDENCIES", 702 | "$BUILD_TOOLS_PATH/$SBG_INTERFACE_NAMES", 703 | "$BUILD_TOOLS_PATH/$SBG_BINDINGS_NAME", 704 | "$BUILD_TOOLS_PATH/$SBG_INPUT_FILE", 705 | "$BUILD_TOOLS_PATH/$SBG_OUTPUT_FILE", 706 | "$OUTPUT_JAVA_DIR/com/tns/gen" 707 | } 708 | 709 | task cleanMdg(type: Delete) { 710 | delete "$BUILD_TOOLS_PATH/$MDG_OUTPUT_DIR", 711 | "$BUILD_TOOLS_PATH/whitelist.mdg", 712 | "$BUILD_TOOLS_PATH/blacklist.mdg", 713 | "$BUILD_TOOLS_PATH/$MDG_JAVA_DEPENDENCIES", 714 | "$METADATA_OUT_PATH" 715 | } 716 | 717 | cleanSbg.dependsOn(cleanMdg) 718 | clean.dependsOn(cleanSbg) 719 | -------------------------------------------------------------------------------- /demo/angular/android/nativescript.buildscript.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | mavenCentral() 4 | } 5 | dependencies { 6 | classpath group: 'commons-io', name: 'commons-io', version: '2.8.0' 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /demo/angular/android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | include ':capacitor-cordova-android-plugins' 3 | project(':capacitor-cordova-android-plugins').projectDir = new File('./capacitor-cordova-android-plugins/') 4 | 5 | apply from: 'capacitor.settings.gradle' -------------------------------------------------------------------------------- /demo/angular/android/variables.gradle: -------------------------------------------------------------------------------- 1 | ext { 2 | minSdkVersion = 21 3 | compileSdkVersion = 30 4 | targetSdkVersion = 30 5 | androidxActivityVersion = '1.2.0-rc01' 6 | androidxAppCompatVersion = '1.2.0' 7 | androidxCoordinatorLayoutVersion = '1.1.0' 8 | androidxCoreVersion = '1.3.2' 9 | androidxFragmentVersion = '1.3.0-rc01' 10 | junitVersion = '4.13.1' 11 | androidxJunitVersion = '1.1.2' 12 | androidxEspressoCoreVersion = '3.3.0' 13 | cordovaAndroidVersion = '7.0.0' 14 | } -------------------------------------------------------------------------------- /demo/angular/angular.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "./node_modules/@angular/cli/lib/config/schema.json", 3 | "version": 1, 4 | "defaultProject": "app", 5 | "newProjectRoot": "projects", 6 | "projects": { 7 | "app": { 8 | "root": "", 9 | "sourceRoot": "src", 10 | "projectType": "application", 11 | "prefix": "app", 12 | "schematics": {}, 13 | "architect": { 14 | "build": { 15 | "builder": "@angular-devkit/build-angular:browser", 16 | "options": { 17 | "outputPath": "www", 18 | "index": "src/index.html", 19 | "main": "src/main.ts", 20 | "polyfills": "src/polyfills.ts", 21 | "tsConfig": "tsconfig.app.json", 22 | "assets": [ 23 | { 24 | "glob": "**/*", 25 | "input": "src/assets", 26 | "output": "assets" 27 | }, 28 | { 29 | "glob": "**/*.svg", 30 | "input": "node_modules/ionicons/dist/ionicons/svg", 31 | "output": "./svg" 32 | } 33 | ], 34 | "styles": ["src/theme/variables.scss", "src/global.scss"], 35 | "scripts": [] 36 | }, 37 | "configurations": { 38 | "production": { 39 | "fileReplacements": [ 40 | { 41 | "replace": "src/environments/environment.ts", 42 | "with": "src/environments/environment.prod.ts" 43 | } 44 | ], 45 | "optimization": true, 46 | "outputHashing": "all", 47 | "sourceMap": false, 48 | "namedChunks": false, 49 | "aot": true, 50 | "extractLicenses": true, 51 | "vendorChunk": false, 52 | "buildOptimizer": true, 53 | "budgets": [ 54 | { 55 | "type": "initial", 56 | "maximumWarning": "2mb", 57 | "maximumError": "5mb" 58 | } 59 | ] 60 | }, 61 | "ci": { 62 | "progress": false 63 | } 64 | } 65 | }, 66 | "serve": { 67 | "builder": "@angular-devkit/build-angular:dev-server", 68 | "options": { 69 | "browserTarget": "app:build" 70 | }, 71 | "configurations": { 72 | "production": { 73 | "browserTarget": "app:build:production" 74 | }, 75 | "ci": { 76 | "progress": false 77 | } 78 | } 79 | }, 80 | "extract-i18n": { 81 | "builder": "@angular-devkit/build-angular:extract-i18n", 82 | "options": { 83 | "browserTarget": "app:build" 84 | } 85 | }, 86 | "test": { 87 | "builder": "@angular-devkit/build-angular:karma", 88 | "options": { 89 | "main": "src/test.ts", 90 | "polyfills": "src/polyfills.ts", 91 | "tsConfig": "tsconfig.spec.json", 92 | "karmaConfig": "karma.conf.js", 93 | "styles": [], 94 | "scripts": [], 95 | "assets": [ 96 | { 97 | "glob": "favicon.ico", 98 | "input": "src/", 99 | "output": "/" 100 | }, 101 | { 102 | "glob": "**/*", 103 | "input": "src/assets", 104 | "output": "/assets" 105 | } 106 | ] 107 | }, 108 | "configurations": { 109 | "ci": { 110 | "progress": false, 111 | "watch": false 112 | } 113 | } 114 | }, 115 | "lint": { 116 | "builder": "@angular-devkit/build-angular:tslint", 117 | "options": { 118 | "tsConfig": [ 119 | "tsconfig.app.json", 120 | "tsconfig.spec.json", 121 | "e2e/tsconfig.json" 122 | ], 123 | "exclude": ["**/node_modules/**"] 124 | } 125 | }, 126 | "e2e": { 127 | "builder": "@angular-devkit/build-angular:protractor", 128 | "options": { 129 | "protractorConfig": "e2e/protractor.conf.js", 130 | "devServerTarget": "app:serve" 131 | }, 132 | "configurations": { 133 | "production": { 134 | "devServerTarget": "app:serve:production" 135 | }, 136 | "ci": { 137 | "devServerTarget": "app:serve:ci" 138 | } 139 | } 140 | }, 141 | "ionic-cordova-build": { 142 | "builder": "@ionic/angular-toolkit:cordova-build", 143 | "options": { 144 | "browserTarget": "app:build" 145 | }, 146 | "configurations": { 147 | "production": { 148 | "browserTarget": "app:build:production" 149 | } 150 | } 151 | }, 152 | "ionic-cordova-serve": { 153 | "builder": "@ionic/angular-toolkit:cordova-serve", 154 | "options": { 155 | "cordovaBuildTarget": "app:ionic-cordova-build", 156 | "devServerTarget": "app:serve" 157 | }, 158 | "configurations": { 159 | "production": { 160 | "cordovaBuildTarget": "app:ionic-cordova-build:production", 161 | "devServerTarget": "app:serve:production" 162 | } 163 | } 164 | } 165 | } 166 | } 167 | }, 168 | "cli": { 169 | "analytics": "3984a7f9-73ad-4259-86c0-c08b0f16320b", 170 | "defaultCollection": "@ionic/angular-toolkit" 171 | }, 172 | "schematics": { 173 | "@ionic/angular-toolkit:component": { 174 | "styleext": "scss" 175 | }, 176 | "@ionic/angular-toolkit:page": { 177 | "styleext": "scss" 178 | } 179 | } 180 | } 181 | -------------------------------------------------------------------------------- /demo/angular/capacitor.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "appId": "io.ionic.starter", 3 | "appName": "angular", 4 | "bundledWebRuntime": false, 5 | "npmClient": "npm", 6 | "webDir": "www", 7 | "plugins": { 8 | "SplashScreen": { 9 | "launchShowDuration": 0 10 | } 11 | }, 12 | "cordova": {} 13 | } 14 | -------------------------------------------------------------------------------- /demo/angular/e2e/protractor.conf.js: -------------------------------------------------------------------------------- 1 | // @ts-check 2 | // Protractor configuration file, see link for more information 3 | // https://github.com/angular/protractor/blob/master/lib/config.ts 4 | 5 | const { SpecReporter, StacktraceOption } = require('jasmine-spec-reporter'); 6 | 7 | /** 8 | * @type { import("protractor").Config } 9 | */ 10 | exports.config = { 11 | allScriptsTimeout: 11000, 12 | specs: [ 13 | './src/**/*.e2e-spec.ts' 14 | ], 15 | capabilities: { 16 | browserName: 'chrome' 17 | }, 18 | directConnect: true, 19 | SELENIUM_PROMISE_MANAGER: false, 20 | baseUrl: 'http://localhost:4200/', 21 | framework: 'jasmine', 22 | jasmineNodeOpts: { 23 | showColors: true, 24 | defaultTimeoutInterval: 30000, 25 | print: function() {} 26 | }, 27 | onPrepare() { 28 | require('ts-node').register({ 29 | project: require('path').join(__dirname, './tsconfig.json') 30 | }); 31 | jasmine.getEnv().addReporter(new SpecReporter({ 32 | spec: { 33 | displayStacktrace: StacktraceOption.PRETTY 34 | } 35 | })); 36 | } 37 | }; 38 | -------------------------------------------------------------------------------- /demo/angular/e2e/src/app.e2e-spec.ts: -------------------------------------------------------------------------------- 1 | import { AppPage } from './app.po'; 2 | 3 | describe('new App', () => { 4 | let page: AppPage; 5 | 6 | beforeEach(() => { 7 | page = new AppPage(); 8 | }); 9 | 10 | it('should display welcome message', () => { 11 | page.navigateTo(); 12 | expect(page.getPageTitle()).toContain('Tab 1'); 13 | }); 14 | }); 15 | -------------------------------------------------------------------------------- /demo/angular/e2e/src/app.po.ts: -------------------------------------------------------------------------------- 1 | import { browser, by, element } from 'protractor'; 2 | 3 | export class AppPage { 4 | navigateTo() { 5 | return browser.get('/'); 6 | } 7 | 8 | getPageTitle() { 9 | return element(by.css('ion-title')).getText(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /demo/angular/e2e/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/e2e", 5 | "module": "commonjs", 6 | "target": "es2018", 7 | "types": [ 8 | "jasmine", 9 | "node" 10 | ] 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /demo/angular/ionic.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "angular", 3 | "integrations": { 4 | "capacitor": {} 5 | }, 6 | "type": "angular" 7 | } 8 | -------------------------------------------------------------------------------- /demo/angular/ios/.gitignore: -------------------------------------------------------------------------------- 1 | App/build 2 | App/Pods 3 | App/Podfile.lock 4 | App/App/public 5 | DerivedData 6 | xcuserdata 7 | 8 | # Cordova plugins for Capacitor 9 | capacitor-cordova-ios-plugins 10 | -------------------------------------------------------------------------------- /demo/angular/ios/App/App.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 48; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 2FAD9763203C412B000D30F8 /* config.xml in Resources */ = {isa = PBXBuildFile; fileRef = 2FAD9762203C412B000D30F8 /* config.xml */; }; 11 | 50379B232058CBB4000EE86E /* capacitor.config.json in Resources */ = {isa = PBXBuildFile; fileRef = 50379B222058CBB4000EE86E /* capacitor.config.json */; }; 12 | 504EC3081FED79650016851F /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 504EC3071FED79650016851F /* AppDelegate.swift */; }; 13 | 504EC30D1FED79650016851F /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 504EC30B1FED79650016851F /* Main.storyboard */; }; 14 | 504EC30F1FED79650016851F /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 504EC30E1FED79650016851F /* Assets.xcassets */; }; 15 | 504EC3121FED79650016851F /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 504EC3101FED79650016851F /* LaunchScreen.storyboard */; }; 16 | 50B271D11FEDC1A000F3C39B /* public in Resources */ = {isa = PBXBuildFile; fileRef = 50B271D01FEDC1A000F3C39B /* public */; }; 17 | A084ECDBA7D38E1E42DFC39D /* Pods_App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AF277DCFFFF123FFC6DF26C7 /* Pods_App.framework */; }; 18 | B6E360F4439A4677AFBC9511 /* NativeScript.xcframework in Resources */ = {isa = PBXBuildFile; fileRef = DA6D0A7E9E6D48098D4E24C6 /* NativeScript.xcframework */; }; 19 | 6C9F7094DA604A8CBA690FF2 /* NativeScript.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = DA6D0A7E9E6D48098D4E24C6 /* NativeScript.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; 20 | 4CB9158724F84BF6BD361BB2 /* TNSWidgets.xcframework in Resources */ = {isa = PBXBuildFile; fileRef = DDE16EF6AA254AAA960CB05D /* TNSWidgets.xcframework */; }; 21 | A0D6615620A4447B8357158A /* TNSWidgets.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = DDE16EF6AA254AAA960CB05D /* TNSWidgets.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; 22 | 14128BCAA0E24F389AEB4013 /* Runtime.m in Sources */ = {isa = PBXBuildFile; fileRef = DDF2CD81A132444B9A481A7B /* Runtime.m */; }; 23 | /* End PBXBuildFile section */ 24 | 25 | /* Begin PBXFileReference section */ 26 | 2FAD9762203C412B000D30F8 /* config.xml */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = config.xml; sourceTree = ""; }; 27 | 50379B222058CBB4000EE86E /* capacitor.config.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = capacitor.config.json; sourceTree = ""; }; 28 | 504EC3041FED79650016851F /* App.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = App.app; sourceTree = BUILT_PRODUCTS_DIR; }; 29 | 504EC3071FED79650016851F /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 30 | 504EC30C1FED79650016851F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 31 | 504EC30E1FED79650016851F /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 32 | 504EC3111FED79650016851F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 33 | 504EC3131FED79650016851F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 34 | 50B271D01FEDC1A000F3C39B /* public */ = {isa = PBXFileReference; lastKnownFileType = folder; path = public; sourceTree = ""; }; 35 | AF277DCFFFF123FFC6DF26C7 /* Pods_App.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_App.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 36 | AF51FD2D460BCFE21FA515B2 /* Pods-App.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-App.release.xcconfig"; path = "Pods/Target Support Files/Pods-App/Pods-App.release.xcconfig"; sourceTree = ""; }; 37 | FC68EB0AF532CFC21C3344DD /* Pods-App.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-App.debug.xcconfig"; path = "Pods/Target Support Files/Pods-App/Pods-App.debug.xcconfig"; sourceTree = ""; }; 38 | DA6D0A7E9E6D48098D4E24C6 /* NativeScript.xcframework */ = {isa = PBXFileReference; name = NativeScript.xcframework; path = NativeScript.xcframework; sourceTree = ""; fileEncoding = undefined; lastKnownFileType = unknown; explicitFileType = undefined; includeInIndex = 0; }; 39 | DDE16EF6AA254AAA960CB05D /* TNSWidgets.xcframework */ = {isa = PBXFileReference; name = TNSWidgets.xcframework; path = TNSWidgets.xcframework; sourceTree = ""; fileEncoding = undefined; lastKnownFileType = unknown; explicitFileType = undefined; includeInIndex = 0; }; 40 | 7A9277CA911F43CFAAE692F9 /* App-Bridging-Header.h */ = {isa = PBXFileReference; name = "App-Bridging-Header.h"; path = "NativeScript/App-Bridging-Header.h"; sourceTree = ""; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; explicitFileType = undefined; includeInIndex = 0; }; 41 | 22BF6AAEE46842228B447ECC /* Runtime.h */ = {isa = PBXFileReference; name = Runtime.h; path = "NativeScript/Runtime.h"; sourceTree = ""; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; explicitFileType = undefined; includeInIndex = 0; }; 42 | DDF2CD81A132444B9A481A7B /* Runtime.m */ = {isa = PBXFileReference; name = Runtime.m; path = "NativeScript/Runtime.m"; sourceTree = ""; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; explicitFileType = undefined; includeInIndex = 0; }; 43 | /* End PBXFileReference section */ 44 | 45 | /* Begin PBXFrameworksBuildPhase section */ 46 | 504EC3011FED79650016851F /* Frameworks */ = { 47 | isa = PBXFrameworksBuildPhase; 48 | buildActionMask = 2147483647; 49 | files = ( 50 | A084ECDBA7D38E1E42DFC39D /* Pods_App.framework in Frameworks */, 51 | B6E360F4439A4677AFBC9511 /* NativeScript.xcframework in Resources */, 52 | 4CB9158724F84BF6BD361BB2 /* TNSWidgets.xcframework in Resources */, 53 | ); 54 | runOnlyForDeploymentPostprocessing = 0; 55 | }; 56 | /* End PBXFrameworksBuildPhase section */ 57 | 58 | /* Begin PBXGroup section */ 59 | 27E2DDA53C4D2A4D1A88CE4A /* Frameworks */ = { 60 | isa = PBXGroup; 61 | children = ( 62 | AF277DCFFFF123FFC6DF26C7 /* Pods_App.framework */, 63 | DA6D0A7E9E6D48098D4E24C6 /* NativeScript.xcframework */, 64 | DDE16EF6AA254AAA960CB05D /* TNSWidgets.xcframework */, 65 | ); 66 | name = Frameworks; 67 | sourceTree = ""; 68 | }; 69 | 504EC2FB1FED79650016851F = { 70 | isa = PBXGroup; 71 | children = ( 72 | 504EC3061FED79650016851F /* App */, 73 | 504EC3051FED79650016851F /* Products */, 74 | 7F8756D8B27F46E3366F6CEA /* Pods */, 75 | 27E2DDA53C4D2A4D1A88CE4A /* Frameworks */, 76 | 95102AF7F58C4E4F9C5A2E63 /* NativeScript */, 77 | ); 78 | sourceTree = ""; 79 | }; 80 | 504EC3051FED79650016851F /* Products */ = { 81 | isa = PBXGroup; 82 | children = ( 83 | 504EC3041FED79650016851F /* App.app */, 84 | ); 85 | name = Products; 86 | sourceTree = ""; 87 | }; 88 | 504EC3061FED79650016851F /* App */ = { 89 | isa = PBXGroup; 90 | children = ( 91 | 50379B222058CBB4000EE86E /* capacitor.config.json */, 92 | 504EC3071FED79650016851F /* AppDelegate.swift */, 93 | 504EC30B1FED79650016851F /* Main.storyboard */, 94 | 504EC30E1FED79650016851F /* Assets.xcassets */, 95 | 504EC3101FED79650016851F /* LaunchScreen.storyboard */, 96 | 504EC3131FED79650016851F /* Info.plist */, 97 | 2FAD9762203C412B000D30F8 /* config.xml */, 98 | 50B271D01FEDC1A000F3C39B /* public */, 99 | ); 100 | path = App; 101 | sourceTree = ""; 102 | }; 103 | 7F8756D8B27F46E3366F6CEA /* Pods */ = { 104 | isa = PBXGroup; 105 | children = ( 106 | FC68EB0AF532CFC21C3344DD /* Pods-App.debug.xcconfig */, 107 | AF51FD2D460BCFE21FA515B2 /* Pods-App.release.xcconfig */, 108 | ); 109 | name = Pods; 110 | sourceTree = ""; 111 | }; 112 | 95102AF7F58C4E4F9C5A2E63 /* NativeScript */ = { 113 | isa = PBXGroup; 114 | children = ( 115 | 7A9277CA911F43CFAAE692F9 /* App-Bridging-Header.h */, 116 | 22BF6AAEE46842228B447ECC /* Runtime.h */, 117 | DDF2CD81A132444B9A481A7B /* Runtime.m */, 118 | ); 119 | name = NativeScript; 120 | sourceTree = ""; 121 | }; 122 | /* End PBXGroup section */ 123 | 124 | /* Begin PBXNativeTarget section */ 125 | 504EC3031FED79650016851F /* App */ = { 126 | isa = PBXNativeTarget; 127 | buildConfigurationList = 504EC3161FED79650016851F /* Build configuration list for PBXNativeTarget "App" */; 128 | buildPhases = ( 129 | 6634F4EFEBD30273BCE97C65 /* [CP] Check Pods Manifest.lock */, 130 | 8E7BFED388D34F4AB12464E8 /* PreBuild */, 131 | 504EC3001FED79650016851F /* Sources */, 132 | 8714B896D9264D51958E8307 /* PreLink */, 133 | 504EC3011FED79650016851F /* Frameworks */, 134 | 504EC3021FED79650016851F /* Resources */, 135 | 9592DBEFFC6D2A0C8D5DEB22 /* [CP] Embed Pods Frameworks */, 136 | F1B3168E389A4AE197949B58 /* Embed Frameworks */, 137 | ); 138 | buildRules = ( 139 | ); 140 | dependencies = ( 141 | ); 142 | name = App; 143 | productName = App; 144 | productReference = 504EC3041FED79650016851F /* App.app */; 145 | productType = "com.apple.product-type.application"; 146 | }; 147 | /* End PBXNativeTarget section */ 148 | 149 | /* Begin PBXProject section */ 150 | 504EC2FC1FED79650016851F /* Project object */ = { 151 | isa = PBXProject; 152 | attributes = { 153 | LastSwiftUpdateCheck = 920; 154 | LastUpgradeCheck = 920; 155 | TargetAttributes = { 156 | 504EC3031FED79650016851F = { 157 | CreatedOnToolsVersion = 9.2; 158 | LastSwiftMigration = 1100; 159 | ProvisioningStyle = Automatic; 160 | }; 161 | }; 162 | }; 163 | buildConfigurationList = 504EC2FF1FED79650016851F /* Build configuration list for PBXProject "App" */; 164 | compatibilityVersion = "Xcode 8.0"; 165 | developmentRegion = en; 166 | hasScannedForEncodings = 0; 167 | knownRegions = ( 168 | en, 169 | Base, 170 | ); 171 | mainGroup = 504EC2FB1FED79650016851F; 172 | productRefGroup = 504EC3051FED79650016851F /* Products */; 173 | projectDirPath = ""; 174 | projectRoot = ""; 175 | targets = ( 176 | 504EC3031FED79650016851F /* App */, 177 | ); 178 | }; 179 | /* End PBXProject section */ 180 | 181 | /* Begin PBXResourcesBuildPhase section */ 182 | 504EC3021FED79650016851F /* Resources */ = { 183 | isa = PBXResourcesBuildPhase; 184 | buildActionMask = 2147483647; 185 | files = ( 186 | 504EC3121FED79650016851F /* LaunchScreen.storyboard in Resources */, 187 | 50B271D11FEDC1A000F3C39B /* public in Resources */, 188 | 504EC30F1FED79650016851F /* Assets.xcassets in Resources */, 189 | 50379B232058CBB4000EE86E /* capacitor.config.json in Resources */, 190 | 504EC30D1FED79650016851F /* Main.storyboard in Resources */, 191 | 2FAD9763203C412B000D30F8 /* config.xml in Resources */, 192 | ); 193 | runOnlyForDeploymentPostprocessing = 0; 194 | }; 195 | /* End PBXResourcesBuildPhase section */ 196 | 197 | /* Begin PBXShellScriptBuildPhase section */ 198 | 6634F4EFEBD30273BCE97C65 /* [CP] Check Pods Manifest.lock */ = { 199 | isa = PBXShellScriptBuildPhase; 200 | buildActionMask = 2147483647; 201 | files = ( 202 | ); 203 | inputPaths = ( 204 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 205 | "${PODS_ROOT}/Manifest.lock", 206 | ); 207 | name = "[CP] Check Pods Manifest.lock"; 208 | outputPaths = ( 209 | "$(DERIVED_FILE_DIR)/Pods-App-checkManifestLockResult.txt", 210 | ); 211 | runOnlyForDeploymentPostprocessing = 0; 212 | shellPath = /bin/sh; 213 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; 214 | showEnvVarsInLog = 0; 215 | }; 216 | 9592DBEFFC6D2A0C8D5DEB22 /* [CP] Embed Pods Frameworks */ = { 217 | isa = PBXShellScriptBuildPhase; 218 | buildActionMask = 2147483647; 219 | files = ( 220 | ); 221 | inputPaths = ( 222 | ); 223 | name = "[CP] Embed Pods Frameworks"; 224 | outputPaths = ( 225 | ); 226 | runOnlyForDeploymentPostprocessing = 0; 227 | shellPath = /bin/sh; 228 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-App/Pods-App-frameworks.sh\"\n"; 229 | showEnvVarsInLog = 0; 230 | }; 231 | 7CA8B0BA90CF45238004831F /* PreBuild */ = { 232 | isa = PBXShellScriptBuildPhase; 233 | buildActionMask = 2147483647; 234 | files = ( 235 | ); 236 | runOnlyForDeploymentPostprocessing = 0; 237 | name = "PreBuild"; 238 | inputPaths = ( 239 | ); 240 | outputPaths = ( 241 | ); 242 | shellPath = /bin/sh; 243 | shellScript = "\"${SRCROOT}/internal/nativescript-pre-build\""; 244 | }; 245 | B17F19192E144CCE894808AC /* PreLink */ = { 246 | isa = PBXShellScriptBuildPhase; 247 | buildActionMask = 2147483647; 248 | files = ( 249 | ); 250 | runOnlyForDeploymentPostprocessing = 0; 251 | name = "PreLink"; 252 | inputPaths = ( 253 | ); 254 | outputPaths = ( 255 | ); 256 | shellPath = /bin/sh; 257 | shellScript = "\"${SRCROOT}/internal/nativescript-pre-link\""; 258 | }; 259 | 8E7BFED388D34F4AB12464E8 /* PreBuild */ = { 260 | isa = PBXShellScriptBuildPhase; 261 | buildActionMask = 2147483647; 262 | files = ( 263 | ); 264 | runOnlyForDeploymentPostprocessing = 0; 265 | name = "PreBuild"; 266 | inputPaths = ( 267 | ); 268 | outputPaths = ( 269 | ); 270 | shellPath = /bin/sh; 271 | shellScript = "\"${SRCROOT}/internal/nativescript-pre-build\""; 272 | }; 273 | 8714B896D9264D51958E8307 /* PreLink */ = { 274 | isa = PBXShellScriptBuildPhase; 275 | buildActionMask = 2147483647; 276 | files = ( 277 | ); 278 | runOnlyForDeploymentPostprocessing = 0; 279 | name = "PreLink"; 280 | inputPaths = ( 281 | ); 282 | outputPaths = ( 283 | ); 284 | shellPath = /bin/sh; 285 | shellScript = "\"${SRCROOT}/internal/nativescript-pre-link\""; 286 | }; 287 | /* End PBXShellScriptBuildPhase section */ 288 | 289 | /* Begin PBXSourcesBuildPhase section */ 290 | 504EC3001FED79650016851F /* Sources */ = { 291 | isa = PBXSourcesBuildPhase; 292 | buildActionMask = 2147483647; 293 | files = ( 294 | 504EC3081FED79650016851F /* AppDelegate.swift in Sources */, 295 | 14128BCAA0E24F389AEB4013 /* Runtime.m in Sources */, 296 | ); 297 | runOnlyForDeploymentPostprocessing = 0; 298 | }; 299 | /* End PBXSourcesBuildPhase section */ 300 | 301 | /* Begin PBXVariantGroup section */ 302 | 504EC30B1FED79650016851F /* Main.storyboard */ = { 303 | isa = PBXVariantGroup; 304 | children = ( 305 | 504EC30C1FED79650016851F /* Base */, 306 | ); 307 | name = Main.storyboard; 308 | sourceTree = ""; 309 | }; 310 | 504EC3101FED79650016851F /* LaunchScreen.storyboard */ = { 311 | isa = PBXVariantGroup; 312 | children = ( 313 | 504EC3111FED79650016851F /* Base */, 314 | ); 315 | name = LaunchScreen.storyboard; 316 | sourceTree = ""; 317 | }; 318 | /* End PBXVariantGroup section */ 319 | 320 | /* Begin XCBuildConfiguration section */ 321 | 504EC3141FED79650016851F /* Debug */ = { 322 | isa = XCBuildConfiguration; 323 | buildSettings = { 324 | ALWAYS_SEARCH_USER_PATHS = NO; 325 | CLANG_ANALYZER_NONNULL = YES; 326 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 327 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 328 | CLANG_CXX_LIBRARY = "libc++"; 329 | CLANG_ENABLE_MODULES = NO; 330 | CLANG_ENABLE_OBJC_ARC = YES; 331 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 332 | CLANG_WARN_BOOL_CONVERSION = YES; 333 | CLANG_WARN_COMMA = YES; 334 | CLANG_WARN_CONSTANT_CONVERSION = YES; 335 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 336 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 337 | CLANG_WARN_EMPTY_BODY = YES; 338 | CLANG_WARN_ENUM_CONVERSION = YES; 339 | CLANG_WARN_INFINITE_RECURSION = YES; 340 | CLANG_WARN_INT_CONVERSION = YES; 341 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 342 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 343 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 344 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 345 | CLANG_WARN_STRICT_PROTOTYPES = YES; 346 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 347 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 348 | CLANG_WARN_UNREACHABLE_CODE = YES; 349 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 350 | CODE_SIGN_IDENTITY = "iPhone Developer"; 351 | COPY_PHASE_STRIP = NO; 352 | DEBUG_INFORMATION_FORMAT = dwarf; 353 | ENABLE_STRICT_OBJC_MSGSEND = YES; 354 | ENABLE_TESTABILITY = YES; 355 | GCC_C_LANGUAGE_STANDARD = gnu11; 356 | GCC_DYNAMIC_NO_PIC = NO; 357 | GCC_NO_COMMON_BLOCKS = YES; 358 | GCC_OPTIMIZATION_LEVEL = 0; 359 | GCC_PREPROCESSOR_DEFINITIONS = ( 360 | "DEBUG=1", 361 | "$(inherited)", 362 | ); 363 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 364 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 365 | GCC_WARN_UNDECLARED_SELECTOR = YES; 366 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 367 | GCC_WARN_UNUSED_FUNCTION = YES; 368 | GCC_WARN_UNUSED_VARIABLE = YES; 369 | IPHONEOS_DEPLOYMENT_TARGET = 12.0; 370 | MTL_ENABLE_DEBUG_INFO = YES; 371 | ONLY_ACTIVE_ARCH = YES; 372 | SDKROOT = iphoneos; 373 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 374 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 375 | ENABLE_BITCODE = NO; 376 | SWIFT_OBJC_BRIDGING_HEADER = "$(SRCROOT)/NativeScript/App-Bridging-Header.h"; 377 | OTHER_LDFLAGS = ( 378 | "$(inherited)", 379 | "-framework", 380 | "\"Capacitor\"", 381 | "-framework", 382 | "\"Cordova\"", 383 | "-framework", 384 | "\"WebKit\"", 385 | "$(inherited)", 386 | "-ObjC", 387 | "-sectcreate", 388 | __DATA, 389 | __TNSMetadata, 390 | "\"$(CONFIGURATION_BUILD_DIR)/metadata-$(CURRENT_ARCH).bin\"", 391 | "-framework", 392 | NativeScript, 393 | "-F\"$(SRCROOT)/internal\"", 394 | "-licucore", 395 | "-lz", 396 | "-lc++", 397 | "-framework", 398 | Foundation, 399 | "-framework", 400 | UIKit, 401 | "-framework", 402 | CoreGraphics, 403 | "-framework", 404 | MobileCoreServices, 405 | "-framework", 406 | Security, 407 | ); 408 | LD = "$SRCROOT/internal/nsld.sh"; 409 | LDPLUSPLUS = "$SRCROOT/internal/nsld.sh"; 410 | }; 411 | name = Debug; 412 | }; 413 | 504EC3151FED79650016851F /* Release */ = { 414 | isa = XCBuildConfiguration; 415 | buildSettings = { 416 | ALWAYS_SEARCH_USER_PATHS = NO; 417 | CLANG_ANALYZER_NONNULL = YES; 418 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 419 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 420 | CLANG_CXX_LIBRARY = "libc++"; 421 | CLANG_ENABLE_MODULES = NO; 422 | CLANG_ENABLE_OBJC_ARC = YES; 423 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 424 | CLANG_WARN_BOOL_CONVERSION = YES; 425 | CLANG_WARN_COMMA = YES; 426 | CLANG_WARN_CONSTANT_CONVERSION = YES; 427 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 428 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 429 | CLANG_WARN_EMPTY_BODY = YES; 430 | CLANG_WARN_ENUM_CONVERSION = YES; 431 | CLANG_WARN_INFINITE_RECURSION = YES; 432 | CLANG_WARN_INT_CONVERSION = YES; 433 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 434 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 435 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 436 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 437 | CLANG_WARN_STRICT_PROTOTYPES = YES; 438 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 439 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 440 | CLANG_WARN_UNREACHABLE_CODE = YES; 441 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 442 | CODE_SIGN_IDENTITY = "iPhone Developer"; 443 | COPY_PHASE_STRIP = NO; 444 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 445 | ENABLE_NS_ASSERTIONS = NO; 446 | ENABLE_STRICT_OBJC_MSGSEND = YES; 447 | GCC_C_LANGUAGE_STANDARD = gnu11; 448 | GCC_NO_COMMON_BLOCKS = YES; 449 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 450 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 451 | GCC_WARN_UNDECLARED_SELECTOR = YES; 452 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 453 | GCC_WARN_UNUSED_FUNCTION = YES; 454 | GCC_WARN_UNUSED_VARIABLE = YES; 455 | IPHONEOS_DEPLOYMENT_TARGET = 12.0; 456 | MTL_ENABLE_DEBUG_INFO = NO; 457 | SDKROOT = iphoneos; 458 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 459 | VALIDATE_PRODUCT = YES; 460 | ENABLE_BITCODE = NO; 461 | SWIFT_OBJC_BRIDGING_HEADER = "$(SRCROOT)/NativeScript/App-Bridging-Header.h"; 462 | OTHER_LDFLAGS = ( 463 | "$(inherited)", 464 | "-framework", 465 | "\"Capacitor\"", 466 | "-framework", 467 | "\"Cordova\"", 468 | "-framework", 469 | "\"WebKit\"", 470 | "$(inherited)", 471 | "-ObjC", 472 | "-sectcreate", 473 | __DATA, 474 | __TNSMetadata, 475 | "\"$(CONFIGURATION_BUILD_DIR)/metadata-$(CURRENT_ARCH).bin\"", 476 | "-framework", 477 | NativeScript, 478 | "-F\"$(SRCROOT)/internal\"", 479 | "-licucore", 480 | "-lz", 481 | "-lc++", 482 | "-framework", 483 | Foundation, 484 | "-framework", 485 | UIKit, 486 | "-framework", 487 | CoreGraphics, 488 | "-framework", 489 | MobileCoreServices, 490 | "-framework", 491 | Security, 492 | ); 493 | LD = "$SRCROOT/internal/nsld.sh"; 494 | LDPLUSPLUS = "$SRCROOT/internal/nsld.sh"; 495 | }; 496 | name = Release; 497 | }; 498 | 504EC3171FED79650016851F /* Debug */ = { 499 | isa = XCBuildConfiguration; 500 | baseConfigurationReference = FC68EB0AF532CFC21C3344DD /* Pods-App.debug.xcconfig */; 501 | buildSettings = { 502 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 503 | CODE_SIGN_STYLE = Automatic; 504 | DEVELOPMENT_TEAM = P7E2DJ2G49; 505 | INFOPLIST_FILE = App/Info.plist; 506 | IPHONEOS_DEPLOYMENT_TARGET = 12.0; 507 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 508 | OTHER_SWIFT_FLAGS = "$(inherited) \"-D\" \"COCOAPODS\" \"-DDEBUG\""; 509 | PRODUCT_BUNDLE_IDENTIFIER = io.ionic.starter; 510 | PRODUCT_NAME = "$(TARGET_NAME)"; 511 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 512 | SWIFT_VERSION = 5.0; 513 | TARGETED_DEVICE_FAMILY = "1,2"; 514 | FRAMEWORK_SEARCH_PATHS = ( 515 | "$(inherited)", 516 | "\".\"", 517 | ); 518 | HEADER_SEARCH_PATHS = ( 519 | "$(inherited)", 520 | "\"$(SRCROOT)/$(SRCROOT)/NativeScript\"", 521 | "\"$(SRCROOT)/$(SRCROOT)/NativeScript\"", 522 | "\"$(SRCROOT)/$(SRCROOT)/NativeScript\"", 523 | ); 524 | ENABLE_BITCODE = NO; 525 | CLANG_ENABLE_MODULES = NO; 526 | SWIFT_OBJC_BRIDGING_HEADER = "$(SRCROOT)/NativeScript/App-Bridging-Header.h"; 527 | OTHER_LDFLAGS = ( 528 | "$(inherited)", 529 | "-framework", 530 | "\"Capacitor\"", 531 | "-framework", 532 | "\"Cordova\"", 533 | "-framework", 534 | "\"WebKit\"", 535 | "$(inherited)", 536 | "-ObjC", 537 | "-sectcreate", 538 | __DATA, 539 | __TNSMetadata, 540 | "\"$(CONFIGURATION_BUILD_DIR)/metadata-$(CURRENT_ARCH).bin\"", 541 | "-framework", 542 | NativeScript, 543 | "-F\"$(SRCROOT)/internal\"", 544 | "-licucore", 545 | "-lz", 546 | "-lc++", 547 | "-framework", 548 | Foundation, 549 | "-framework", 550 | UIKit, 551 | "-framework", 552 | CoreGraphics, 553 | "-framework", 554 | MobileCoreServices, 555 | "-framework", 556 | Security, 557 | ); 558 | LD = "$SRCROOT/internal/nsld.sh"; 559 | LDPLUSPLUS = "$SRCROOT/internal/nsld.sh"; 560 | }; 561 | name = Debug; 562 | }; 563 | 504EC3181FED79650016851F /* Release */ = { 564 | isa = XCBuildConfiguration; 565 | baseConfigurationReference = AF51FD2D460BCFE21FA515B2 /* Pods-App.release.xcconfig */; 566 | buildSettings = { 567 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 568 | CODE_SIGN_STYLE = Automatic; 569 | DEVELOPMENT_TEAM = P7E2DJ2G49; 570 | INFOPLIST_FILE = App/Info.plist; 571 | IPHONEOS_DEPLOYMENT_TARGET = 12.0; 572 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 573 | PRODUCT_BUNDLE_IDENTIFIER = io.ionic.starter; 574 | PRODUCT_NAME = "$(TARGET_NAME)"; 575 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = ""; 576 | SWIFT_VERSION = 5.0; 577 | TARGETED_DEVICE_FAMILY = "1,2"; 578 | FRAMEWORK_SEARCH_PATHS = ( 579 | "$(inherited)", 580 | "\".\"", 581 | ); 582 | HEADER_SEARCH_PATHS = ( 583 | "$(inherited)", 584 | "\"$(SRCROOT)/$(SRCROOT)/NativeScript\"", 585 | "\"$(SRCROOT)/$(SRCROOT)/NativeScript\"", 586 | "\"$(SRCROOT)/$(SRCROOT)/NativeScript\"", 587 | ); 588 | ENABLE_BITCODE = NO; 589 | CLANG_ENABLE_MODULES = NO; 590 | SWIFT_OBJC_BRIDGING_HEADER = "$(SRCROOT)/NativeScript/App-Bridging-Header.h"; 591 | OTHER_LDFLAGS = ( 592 | "$(inherited)", 593 | "-framework", 594 | "\"Capacitor\"", 595 | "-framework", 596 | "\"Cordova\"", 597 | "-framework", 598 | "\"WebKit\"", 599 | "$(inherited)", 600 | "-ObjC", 601 | "-sectcreate", 602 | __DATA, 603 | __TNSMetadata, 604 | "\"$(CONFIGURATION_BUILD_DIR)/metadata-$(CURRENT_ARCH).bin\"", 605 | "-framework", 606 | NativeScript, 607 | "-F\"$(SRCROOT)/internal\"", 608 | "-licucore", 609 | "-lz", 610 | "-lc++", 611 | "-framework", 612 | Foundation, 613 | "-framework", 614 | UIKit, 615 | "-framework", 616 | CoreGraphics, 617 | "-framework", 618 | MobileCoreServices, 619 | "-framework", 620 | Security, 621 | ); 622 | LD = "$SRCROOT/internal/nsld.sh"; 623 | LDPLUSPLUS = "$SRCROOT/internal/nsld.sh"; 624 | }; 625 | name = Release; 626 | }; 627 | /* End XCBuildConfiguration section */ 628 | 629 | /* Begin XCConfigurationList section */ 630 | 504EC2FF1FED79650016851F /* Build configuration list for PBXProject "App" */ = { 631 | isa = XCConfigurationList; 632 | buildConfigurations = ( 633 | 504EC3141FED79650016851F /* Debug */, 634 | 504EC3151FED79650016851F /* Release */, 635 | ); 636 | defaultConfigurationIsVisible = 0; 637 | defaultConfigurationName = Release; 638 | }; 639 | 504EC3161FED79650016851F /* Build configuration list for PBXNativeTarget "App" */ = { 640 | isa = XCConfigurationList; 641 | buildConfigurations = ( 642 | 504EC3171FED79650016851F /* Debug */, 643 | 504EC3181FED79650016851F /* Release */, 644 | ); 645 | defaultConfigurationIsVisible = 0; 646 | defaultConfigurationName = Release; 647 | }; 648 | /* End XCConfigurationList section */ 649 | 650 | /* Begin PBXCopyFilesBuildPhase section */ 651 | 85094874DAC1489898CD34C3 /* Embed Frameworks */ = { 652 | isa = PBXCopyFilesBuildPhase; 653 | buildActionMask = 2147483647; 654 | files = ( 655 | 19BA1843794748CC93AF9BD6 /* NativeScript.xcframework in Embed Frameworks */, 656 | 3E786DCDC81742488DB998AA /* TNSWidgets.xcframework in Embed Frameworks */, 657 | ); 658 | runOnlyForDeploymentPostprocessing = 0; 659 | name = "Embed Frameworks"; 660 | dstPath = ""; 661 | dstSubfolderSpec = 10; 662 | }; 663 | F1B3168E389A4AE197949B58 /* Embed Frameworks */ = { 664 | isa = PBXCopyFilesBuildPhase; 665 | buildActionMask = 2147483647; 666 | files = ( 667 | 6C9F7094DA604A8CBA690FF2 /* NativeScript.xcframework in Embed Frameworks */, 668 | A0D6615620A4447B8357158A /* TNSWidgets.xcframework in Embed Frameworks */, 669 | ); 670 | runOnlyForDeploymentPostprocessing = 0; 671 | name = "Embed Frameworks"; 672 | dstPath = ""; 673 | dstSubfolderSpec = 10; 674 | }; 675 | /* End PBXCopyFilesBuildPhase section */ 676 | }; 677 | rootObject = 504EC2FC1FED79650016851F /* Project object */; 678 | } 679 | -------------------------------------------------------------------------------- /demo/angular/ios/App/App.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /demo/angular/ios/App/App.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /demo/angular/ios/App/App.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /demo/angular/ios/App/App/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | import Capacitor 3 | 4 | @UIApplicationMain 5 | class AppDelegate: UIResponder, UIApplicationDelegate { 6 | 7 | var window: UIWindow? 8 | var runtime: TNSRuntime? 9 | 10 | 11 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 12 | // NativeScript init 13 | let pointer = runtimeMeta() 14 | TNSRuntime.initializeMetadata(pointer) 15 | self.runtime = TNSRuntime.init(applicationPath: Bundle.main.bundlePath) 16 | self.runtime?.executeModule("../public/nativescript/index.js") 17 | 18 | 19 | 20 | 21 | 22 | // Override point for customization after application launch. 23 | return true 24 | } 25 | 26 | func applicationWillResignActive(_ application: UIApplication) { 27 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 28 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 29 | } 30 | 31 | func applicationDidEnterBackground(_ application: UIApplication) { 32 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 33 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 34 | } 35 | 36 | func applicationWillEnterForeground(_ application: UIApplication) { 37 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 38 | } 39 | 40 | func applicationDidBecomeActive(_ application: UIApplication) { 41 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 42 | } 43 | 44 | func applicationWillTerminate(_ application: UIApplication) { 45 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 46 | } 47 | 48 | func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool { 49 | // Called when the app was launched with a url. Feel free to add additional processing here, 50 | // but if you want the App API to support tracking app url opens, make sure to keep this call 51 | return ApplicationDelegateProxy.shared.application(app, open: url, options: options) 52 | } 53 | 54 | func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool { 55 | // Called when the app was launched with an activity, including Universal Links. 56 | // Feel free to add additional processing here, but if you want the App API to support 57 | // tracking app url opens, make sure to keep this call 58 | return ApplicationDelegateProxy.shared.application(application, continue: userActivity, restorationHandler: restorationHandler) 59 | } 60 | 61 | override func touchesBegan(_ touches: Set, with event: UIEvent?) { 62 | super.touchesBegan(touches, with: event) 63 | 64 | let statusBarRect = UIApplication.shared.statusBarFrame 65 | guard let touchPoint = event?.allTouches?.first?.location(in: self.window) else { return } 66 | 67 | if statusBarRect.contains(touchPoint) { 68 | NotificationCenter.default.post(name: .capacitorStatusBarTapped, object: nil) 69 | } 70 | } 71 | 72 | } 73 | -------------------------------------------------------------------------------- /demo/angular/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nativescript-community/capacitor-plugins/66c93c0d253f481c29b11142680e8126cb5dd878/demo/angular/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-20x20@1x.png -------------------------------------------------------------------------------- /demo/angular/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-20x20@2x-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nativescript-community/capacitor-plugins/66c93c0d253f481c29b11142680e8126cb5dd878/demo/angular/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-20x20@2x-1.png -------------------------------------------------------------------------------- /demo/angular/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nativescript-community/capacitor-plugins/66c93c0d253f481c29b11142680e8126cb5dd878/demo/angular/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-20x20@2x.png -------------------------------------------------------------------------------- /demo/angular/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nativescript-community/capacitor-plugins/66c93c0d253f481c29b11142680e8126cb5dd878/demo/angular/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-20x20@3x.png -------------------------------------------------------------------------------- /demo/angular/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nativescript-community/capacitor-plugins/66c93c0d253f481c29b11142680e8126cb5dd878/demo/angular/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-29x29@1x.png -------------------------------------------------------------------------------- /demo/angular/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-29x29@2x-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nativescript-community/capacitor-plugins/66c93c0d253f481c29b11142680e8126cb5dd878/demo/angular/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-29x29@2x-1.png -------------------------------------------------------------------------------- /demo/angular/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nativescript-community/capacitor-plugins/66c93c0d253f481c29b11142680e8126cb5dd878/demo/angular/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-29x29@2x.png -------------------------------------------------------------------------------- /demo/angular/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nativescript-community/capacitor-plugins/66c93c0d253f481c29b11142680e8126cb5dd878/demo/angular/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-29x29@3x.png -------------------------------------------------------------------------------- /demo/angular/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nativescript-community/capacitor-plugins/66c93c0d253f481c29b11142680e8126cb5dd878/demo/angular/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-40x40@1x.png -------------------------------------------------------------------------------- /demo/angular/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-40x40@2x-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nativescript-community/capacitor-plugins/66c93c0d253f481c29b11142680e8126cb5dd878/demo/angular/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-40x40@2x-1.png -------------------------------------------------------------------------------- /demo/angular/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nativescript-community/capacitor-plugins/66c93c0d253f481c29b11142680e8126cb5dd878/demo/angular/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-40x40@2x.png -------------------------------------------------------------------------------- /demo/angular/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nativescript-community/capacitor-plugins/66c93c0d253f481c29b11142680e8126cb5dd878/demo/angular/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-40x40@3x.png -------------------------------------------------------------------------------- /demo/angular/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-512@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nativescript-community/capacitor-plugins/66c93c0d253f481c29b11142680e8126cb5dd878/demo/angular/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-512@2x.png -------------------------------------------------------------------------------- /demo/angular/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nativescript-community/capacitor-plugins/66c93c0d253f481c29b11142680e8126cb5dd878/demo/angular/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-60x60@2x.png -------------------------------------------------------------------------------- /demo/angular/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nativescript-community/capacitor-plugins/66c93c0d253f481c29b11142680e8126cb5dd878/demo/angular/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-60x60@3x.png -------------------------------------------------------------------------------- /demo/angular/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nativescript-community/capacitor-plugins/66c93c0d253f481c29b11142680e8126cb5dd878/demo/angular/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-76x76@1x.png -------------------------------------------------------------------------------- /demo/angular/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nativescript-community/capacitor-plugins/66c93c0d253f481c29b11142680e8126cb5dd878/demo/angular/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-76x76@2x.png -------------------------------------------------------------------------------- /demo/angular/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nativescript-community/capacitor-plugins/66c93c0d253f481c29b11142680e8126cb5dd878/demo/angular/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-83.5x83.5@2x.png -------------------------------------------------------------------------------- /demo/angular/ios/App/App/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "20x20", 5 | "idiom" : "iphone", 6 | "filename" : "AppIcon-20x20@2x.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "20x20", 11 | "idiom" : "iphone", 12 | "filename" : "AppIcon-20x20@3x.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "AppIcon-29x29@2x-1.png", 19 | "scale" : "2x" 20 | }, 21 | { 22 | "size" : "29x29", 23 | "idiom" : "iphone", 24 | "filename" : "AppIcon-29x29@3x.png", 25 | "scale" : "3x" 26 | }, 27 | { 28 | "size" : "40x40", 29 | "idiom" : "iphone", 30 | "filename" : "AppIcon-40x40@2x.png", 31 | "scale" : "2x" 32 | }, 33 | { 34 | "size" : "40x40", 35 | "idiom" : "iphone", 36 | "filename" : "AppIcon-40x40@3x.png", 37 | "scale" : "3x" 38 | }, 39 | { 40 | "size" : "60x60", 41 | "idiom" : "iphone", 42 | "filename" : "AppIcon-60x60@2x.png", 43 | "scale" : "2x" 44 | }, 45 | { 46 | "size" : "60x60", 47 | "idiom" : "iphone", 48 | "filename" : "AppIcon-60x60@3x.png", 49 | "scale" : "3x" 50 | }, 51 | { 52 | "size" : "20x20", 53 | "idiom" : "ipad", 54 | "filename" : "AppIcon-20x20@1x.png", 55 | "scale" : "1x" 56 | }, 57 | { 58 | "size" : "20x20", 59 | "idiom" : "ipad", 60 | "filename" : "AppIcon-20x20@2x-1.png", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "size" : "29x29", 65 | "idiom" : "ipad", 66 | "filename" : "AppIcon-29x29@1x.png", 67 | "scale" : "1x" 68 | }, 69 | { 70 | "size" : "29x29", 71 | "idiom" : "ipad", 72 | "filename" : "AppIcon-29x29@2x.png", 73 | "scale" : "2x" 74 | }, 75 | { 76 | "size" : "40x40", 77 | "idiom" : "ipad", 78 | "filename" : "AppIcon-40x40@1x.png", 79 | "scale" : "1x" 80 | }, 81 | { 82 | "size" : "40x40", 83 | "idiom" : "ipad", 84 | "filename" : "AppIcon-40x40@2x-1.png", 85 | "scale" : "2x" 86 | }, 87 | { 88 | "size" : "76x76", 89 | "idiom" : "ipad", 90 | "filename" : "AppIcon-76x76@1x.png", 91 | "scale" : "1x" 92 | }, 93 | { 94 | "size" : "76x76", 95 | "idiom" : "ipad", 96 | "filename" : "AppIcon-76x76@2x.png", 97 | "scale" : "2x" 98 | }, 99 | { 100 | "size" : "83.5x83.5", 101 | "idiom" : "ipad", 102 | "filename" : "AppIcon-83.5x83.5@2x.png", 103 | "scale" : "2x" 104 | }, 105 | { 106 | "size" : "1024x1024", 107 | "idiom" : "ios-marketing", 108 | "filename" : "AppIcon-512@2x.png", 109 | "scale" : "1x" 110 | } 111 | ], 112 | "info" : { 113 | "version" : 1, 114 | "author" : "xcode" 115 | } 116 | } -------------------------------------------------------------------------------- /demo/angular/ios/App/App/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /demo/angular/ios/App/App/Assets.xcassets/Splash.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "splash-2732x2732-2.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "splash-2732x2732-1.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "splash-2732x2732.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /demo/angular/ios/App/App/Assets.xcassets/Splash.imageset/splash-2732x2732-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nativescript-community/capacitor-plugins/66c93c0d253f481c29b11142680e8126cb5dd878/demo/angular/ios/App/App/Assets.xcassets/Splash.imageset/splash-2732x2732-1.png -------------------------------------------------------------------------------- /demo/angular/ios/App/App/Assets.xcassets/Splash.imageset/splash-2732x2732-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nativescript-community/capacitor-plugins/66c93c0d253f481c29b11142680e8126cb5dd878/demo/angular/ios/App/App/Assets.xcassets/Splash.imageset/splash-2732x2732-2.png -------------------------------------------------------------------------------- /demo/angular/ios/App/App/Assets.xcassets/Splash.imageset/splash-2732x2732.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nativescript-community/capacitor-plugins/66c93c0d253f481c29b11142680e8126cb5dd878/demo/angular/ios/App/App/Assets.xcassets/Splash.imageset/splash-2732x2732.png -------------------------------------------------------------------------------- /demo/angular/ios/App/App/Base.lproj/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 | -------------------------------------------------------------------------------- /demo/angular/ios/App/App/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /demo/angular/ios/App/App/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | angular 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | NSAppTransportSecurity 26 | 27 | NSAllowsArbitraryLoads 28 | 29 | 30 | UILaunchStoryboardName 31 | LaunchScreen 32 | UIMainStoryboardFile 33 | Main 34 | UIRequiredDeviceCapabilities 35 | 36 | armv7 37 | 38 | UISupportedInterfaceOrientations 39 | 40 | UIInterfaceOrientationPortrait 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | UISupportedInterfaceOrientations~ipad 45 | 46 | UIInterfaceOrientationPortrait 47 | UIInterfaceOrientationPortraitUpsideDown 48 | UIInterfaceOrientationLandscapeLeft 49 | UIInterfaceOrientationLandscapeRight 50 | 51 | UIViewControllerBasedStatusBarAppearance 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /demo/angular/ios/App/App/capacitor.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "appId": "io.ionic.starter", 3 | "appName": "angular", 4 | "bundledWebRuntime": false, 5 | "npmClient": "npm", 6 | "webDir": "www", 7 | "plugins": { 8 | "SplashScreen": { 9 | "launchShowDuration": 0 10 | } 11 | }, 12 | "cordova": {} 13 | } 14 | -------------------------------------------------------------------------------- /demo/angular/ios/App/App/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /demo/angular/ios/App/Podfile: -------------------------------------------------------------------------------- 1 | platform :ios, '12.0' 2 | use_frameworks! 3 | 4 | # workaround to avoid Xcode caching of Pods that requires 5 | # Product -> Clean Build Folder after new Cordova plugins installed 6 | # Requires CocoaPods 1.6 or newer 7 | install! 'cocoapods', :disable_input_output_paths => true 8 | 9 | def capacitor_pods 10 | pod 'Capacitor', :path => '../../node_modules/@capacitor/ios' 11 | pod 'CapacitorCordova', :path => '../../node_modules/@capacitor/ios' 12 | pod 'NativescriptCapacitor', :path => '../../node_modules/@nativescript/capacitor' 13 | end 14 | 15 | target 'App' do 16 | capacitor_pods 17 | # Add your Pods here 18 | end 19 | -------------------------------------------------------------------------------- /demo/angular/karma.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration file, see link for more information 2 | // https://karma-runner.github.io/1.0/config/configuration-file.html 3 | 4 | module.exports = function (config) { 5 | config.set({ 6 | basePath: '', 7 | frameworks: ['jasmine', '@angular-devkit/build-angular'], 8 | plugins: [ 9 | require('karma-jasmine'), 10 | require('karma-chrome-launcher'), 11 | require('karma-jasmine-html-reporter'), 12 | require('karma-coverage'), 13 | require('@angular-devkit/build-angular/plugins/karma') 14 | ], 15 | client: { 16 | jasmine: { 17 | // you can add configuration options for Jasmine here 18 | // the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html 19 | // for example, you can disable the random execution with `random: false` 20 | // or set a specific seed with `seed: 4321` 21 | }, 22 | clearContext: false // leave Jasmine Spec Runner output visible in browser 23 | }, 24 | jasmineHtmlReporter: { 25 | suppressAll: true // removes the duplicated traces 26 | }, 27 | coverageReporter: { 28 | dir: require('path').join(__dirname, './coverage/ngv'), 29 | subdir: '.', 30 | reporters: [ 31 | { type: 'html' }, 32 | { type: 'text-summary' } 33 | ] 34 | }, 35 | reporters: ['progress', 'kjhtml'], 36 | port: 9876, 37 | colors: true, 38 | logLevel: config.LOG_INFO, 39 | autoWatch: true, 40 | browsers: ['Chrome'], 41 | singleRun: false, 42 | restartOnFileChange: true 43 | }); 44 | }; 45 | -------------------------------------------------------------------------------- /demo/angular/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "angular", 3 | "version": "0.0.1", 4 | "author": "Ionic Framework", 5 | "homepage": "https://ionicframework.com/", 6 | "scripts": { 7 | "ng": "ng", 8 | "start": "ng serve", 9 | "build": "ng build", 10 | "test": "ng test", 11 | "lint": "ng lint", 12 | "e2e": "ng e2e", 13 | "build:nativescript": "build-nativescript", 14 | "build:mobile": "npm-run-all build build:nativescript && cap copy" 15 | }, 16 | "private": true, 17 | "dependencies": { 18 | "@angular/common": "~11.2.0", 19 | "@angular/core": "~11.2.0", 20 | "@angular/forms": "~11.2.0", 21 | "@angular/platform-browser": "~11.2.0", 22 | "@angular/platform-browser-dynamic": "~11.2.0", 23 | "@angular/router": "~11.2.0", 24 | "@capacitor/android": "next", 25 | "@capacitor/core": "next", 26 | "@capacitor/ios": "next", 27 | "@ionic/angular": "^5.5.2", 28 | "@nativescript-community/capacitor-plugins": "../..", 29 | "@nativescript/capacitor": "^1.0.0-beta.0", 30 | "rxjs": "~6.6.0", 31 | "tslib": "^2.0.0", 32 | "zone.js": "~0.10.2" 33 | }, 34 | "devDependencies": { 35 | "@angular-devkit/build-angular": "~0.1101.4", 36 | "@angular/cli": "~11.1.4", 37 | "@angular/compiler": "~11.2.0", 38 | "@angular/compiler-cli": "~11.2.0", 39 | "@angular/language-service": "~11.2.0", 40 | "@capacitor/cli": "next", 41 | "@ionic/angular-toolkit": "^3.1.0", 42 | "@types/jasmine": "~3.6.0", 43 | "@types/jasminewd2": "~2.0.3", 44 | "@types/node": "^12.11.1", 45 | "codelyzer": "^6.0.0", 46 | "jasmine-core": "~3.6.0", 47 | "jasmine-spec-reporter": "~5.0.0", 48 | "karma": "~5.2.0", 49 | "karma-chrome-launcher": "~3.1.0", 50 | "karma-coverage": "~2.0.3", 51 | "karma-coverage-istanbul-reporter": "~3.0.2", 52 | "karma-jasmine": "~4.0.0", 53 | "karma-jasmine-html-reporter": "^1.5.0", 54 | "protractor": "~7.0.0", 55 | "ts-node": "~8.3.0", 56 | "tslint": "~6.1.0", 57 | "typescript": "~4.0.2" 58 | }, 59 | "description": "An Ionic project" 60 | } 61 | -------------------------------------------------------------------------------- /demo/angular/src/app/app-routing.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { PreloadAllModules, RouterModule, Routes } from '@angular/router'; 3 | 4 | const routes: Routes = [ 5 | { 6 | path: '', 7 | loadChildren: () => import('./tabs/tabs.module').then(m => m.TabsPageModule) 8 | } 9 | ]; 10 | @NgModule({ 11 | imports: [ 12 | RouterModule.forRoot(routes, { preloadingStrategy: PreloadAllModules }) 13 | ], 14 | exports: [RouterModule] 15 | }) 16 | export class AppRoutingModule {} 17 | -------------------------------------------------------------------------------- /demo/angular/src/app/app.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /demo/angular/src/app/app.component.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nativescript-community/capacitor-plugins/66c93c0d253f481c29b11142680e8126cb5dd878/demo/angular/src/app/app.component.scss -------------------------------------------------------------------------------- /demo/angular/src/app/app.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; 2 | import { TestBed, waitForAsync } from '@angular/core/testing'; 3 | 4 | import { AppComponent } from './app.component'; 5 | 6 | describe('AppComponent', () => { 7 | 8 | beforeEach(waitForAsync(() => { 9 | 10 | TestBed.configureTestingModule({ 11 | declarations: [AppComponent], 12 | schemas: [CUSTOM_ELEMENTS_SCHEMA], 13 | }).compileComponents(); 14 | })); 15 | 16 | it('should create the app', () => { 17 | const fixture = TestBed.createComponent(AppComponent); 18 | const app = fixture.debugElement.componentInstance; 19 | expect(app).toBeTruthy(); 20 | }); 21 | // TODO: add more tests! 22 | 23 | }); 24 | -------------------------------------------------------------------------------- /demo/angular/src/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-root', 5 | templateUrl: 'app.component.html', 6 | styleUrls: ['app.component.scss'], 7 | }) 8 | export class AppComponent { 9 | constructor() {} 10 | } 11 | -------------------------------------------------------------------------------- /demo/angular/src/app/app.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { BrowserModule } from '@angular/platform-browser'; 3 | import { RouteReuseStrategy } from '@angular/router'; 4 | 5 | import { IonicModule, IonicRouteStrategy } from '@ionic/angular'; 6 | 7 | import { AppRoutingModule } from './app-routing.module'; 8 | import { AppComponent } from './app.component'; 9 | 10 | @NgModule({ 11 | declarations: [AppComponent], 12 | entryComponents: [], 13 | imports: [BrowserModule, IonicModule.forRoot(), AppRoutingModule], 14 | providers: [{ provide: RouteReuseStrategy, useClass: IonicRouteStrategy }], 15 | bootstrap: [AppComponent], 16 | }) 17 | export class AppModule {} 18 | -------------------------------------------------------------------------------- /demo/angular/src/app/explore-container/explore-container.component.html: -------------------------------------------------------------------------------- 1 |
2 | {{ name }} 3 |

Explore UI Components

4 |
-------------------------------------------------------------------------------- /demo/angular/src/app/explore-container/explore-container.component.scss: -------------------------------------------------------------------------------- 1 | #container { 2 | text-align: center; 3 | 4 | position: absolute; 5 | left: 0; 6 | right: 0; 7 | top: 50%; 8 | transform: translateY(-50%); 9 | } 10 | 11 | #container strong { 12 | font-size: 20px; 13 | line-height: 26px; 14 | } 15 | 16 | #container p { 17 | font-size: 16px; 18 | line-height: 22px; 19 | 20 | color: #8c8c8c; 21 | 22 | margin: 0; 23 | } 24 | 25 | #container a { 26 | text-decoration: none; 27 | } -------------------------------------------------------------------------------- /demo/angular/src/app/explore-container/explore-container.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; 2 | import { IonicModule } from '@ionic/angular'; 3 | 4 | import { ExploreContainerComponent } from './explore-container.component'; 5 | 6 | describe('ExploreContainerComponent', () => { 7 | let component: ExploreContainerComponent; 8 | let fixture: ComponentFixture; 9 | 10 | beforeEach(waitForAsync(() => { 11 | TestBed.configureTestingModule({ 12 | declarations: [ ExploreContainerComponent ], 13 | imports: [IonicModule.forRoot()] 14 | }).compileComponents(); 15 | 16 | fixture = TestBed.createComponent(ExploreContainerComponent); 17 | component = fixture.componentInstance; 18 | fixture.detectChanges(); 19 | })); 20 | 21 | it('should create', () => { 22 | expect(component).toBeTruthy(); 23 | }); 24 | }); 25 | -------------------------------------------------------------------------------- /demo/angular/src/app/explore-container/explore-container.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit, Input } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-explore-container', 5 | templateUrl: './explore-container.component.html', 6 | styleUrls: ['./explore-container.component.scss'], 7 | }) 8 | export class ExploreContainerComponent implements OnInit { 9 | @Input() name: string; 10 | 11 | constructor() { } 12 | 13 | ngOnInit() {} 14 | 15 | } 16 | -------------------------------------------------------------------------------- /demo/angular/src/app/explore-container/explore-container.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { CommonModule } from '@angular/common'; 3 | import { FormsModule } from '@angular/forms'; 4 | 5 | import { IonicModule } from '@ionic/angular'; 6 | 7 | import { ExploreContainerComponent } from './explore-container.component'; 8 | 9 | @NgModule({ 10 | imports: [ CommonModule, FormsModule, IonicModule], 11 | declarations: [ExploreContainerComponent], 12 | exports: [ExploreContainerComponent] 13 | }) 14 | export class ExploreContainerComponentModule {} 15 | -------------------------------------------------------------------------------- /demo/angular/src/app/tab1/tab1-routing.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { RouterModule, Routes } from '@angular/router'; 3 | import { Tab1Page } from './tab1.page'; 4 | 5 | const routes: Routes = [ 6 | { 7 | path: '', 8 | component: Tab1Page, 9 | } 10 | ]; 11 | 12 | @NgModule({ 13 | imports: [RouterModule.forChild(routes)], 14 | exports: [RouterModule] 15 | }) 16 | export class Tab1PageRoutingModule {} 17 | -------------------------------------------------------------------------------- /demo/angular/src/app/tab1/tab1.module.ts: -------------------------------------------------------------------------------- 1 | import { IonicModule } from '@ionic/angular'; 2 | import { NgModule } from '@angular/core'; 3 | import { CommonModule } from '@angular/common'; 4 | import { FormsModule } from '@angular/forms'; 5 | import { Tab1Page } from './tab1.page'; 6 | import { ExploreContainerComponentModule } from '../explore-container/explore-container.module'; 7 | 8 | import { Tab1PageRoutingModule } from './tab1-routing.module'; 9 | 10 | @NgModule({ 11 | imports: [ 12 | IonicModule, 13 | CommonModule, 14 | FormsModule, 15 | ExploreContainerComponentModule, 16 | Tab1PageRoutingModule 17 | ], 18 | declarations: [Tab1Page] 19 | }) 20 | export class Tab1PageModule {} 21 | -------------------------------------------------------------------------------- /demo/angular/src/app/tab1/tab1.page.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Tab 1 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | Tab 1 13 | 14 | 15 | 16 |
17 | openNativeModalView 18 | dreamBig 19 | Change Brightness 20 | Call Rate App Dialog 21 |
22 | 23 | 24 |
25 | -------------------------------------------------------------------------------- /demo/angular/src/app/tab1/tab1.page.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nativescript-community/capacitor-plugins/66c93c0d253f481c29b11142680e8126cb5dd878/demo/angular/src/app/tab1/tab1.page.scss -------------------------------------------------------------------------------- /demo/angular/src/app/tab1/tab1.page.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; 2 | import { IonicModule } from '@ionic/angular'; 3 | import { ExploreContainerComponentModule } from '../explore-container/explore-container.module'; 4 | 5 | import { Tab1Page } from './tab1.page'; 6 | 7 | describe('Tab1Page', () => { 8 | let component: Tab1Page; 9 | let fixture: ComponentFixture; 10 | 11 | beforeEach(waitForAsync(() => { 12 | TestBed.configureTestingModule({ 13 | declarations: [Tab1Page], 14 | imports: [IonicModule.forRoot(), ExploreContainerComponentModule] 15 | }).compileComponents(); 16 | 17 | fixture = TestBed.createComponent(Tab1Page); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | })); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /demo/angular/src/app/tab1/tab1.page.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | import { native } from '@nativescript/capacitor'; 3 | 4 | @Component({ 5 | selector: 'app-tab1', 6 | templateUrl: 'tab1.page.html', 7 | styleUrls: ['tab1.page.scss'] 8 | }) 9 | export class Tab1Page { 10 | 11 | constructor() {} 12 | 13 | launchModal() { 14 | native.openNativeModalView(); // Open native modal 15 | } 16 | 17 | dreamBig() { 18 | native.dreamBig(); 19 | } 20 | 21 | changeBrightness() { 22 | native.brightness(1); // Open native modal 23 | } 24 | 25 | rateMyApp() { 26 | native.rateMyApp(); // Open rate my app dialog 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /demo/angular/src/app/tab2/tab2-routing.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { RouterModule, Routes } from '@angular/router'; 3 | import { Tab2Page } from './tab2.page'; 4 | 5 | const routes: Routes = [ 6 | { 7 | path: '', 8 | component: Tab2Page, 9 | } 10 | ]; 11 | 12 | @NgModule({ 13 | imports: [RouterModule.forChild(routes)], 14 | exports: [RouterModule] 15 | }) 16 | export class Tab2PageRoutingModule {} 17 | -------------------------------------------------------------------------------- /demo/angular/src/app/tab2/tab2.module.ts: -------------------------------------------------------------------------------- 1 | import { IonicModule } from '@ionic/angular'; 2 | import { RouterModule } from '@angular/router'; 3 | import { NgModule } from '@angular/core'; 4 | import { CommonModule } from '@angular/common'; 5 | import { FormsModule } from '@angular/forms'; 6 | import { Tab2Page } from './tab2.page'; 7 | import { ExploreContainerComponentModule } from '../explore-container/explore-container.module'; 8 | 9 | import { Tab2PageRoutingModule } from './tab2-routing.module'; 10 | 11 | @NgModule({ 12 | imports: [ 13 | IonicModule, 14 | CommonModule, 15 | FormsModule, 16 | ExploreContainerComponentModule, 17 | Tab2PageRoutingModule 18 | ], 19 | declarations: [Tab2Page] 20 | }) 21 | export class Tab2PageModule {} 22 | -------------------------------------------------------------------------------- /demo/angular/src/app/tab2/tab2.page.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Tab 2 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | Tab 2 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /demo/angular/src/app/tab2/tab2.page.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nativescript-community/capacitor-plugins/66c93c0d253f481c29b11142680e8126cb5dd878/demo/angular/src/app/tab2/tab2.page.scss -------------------------------------------------------------------------------- /demo/angular/src/app/tab2/tab2.page.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; 2 | import { IonicModule } from '@ionic/angular'; 3 | import { ExploreContainerComponentModule } from '../explore-container/explore-container.module'; 4 | 5 | import { Tab2Page } from './tab2.page'; 6 | 7 | describe('Tab2Page', () => { 8 | let component: Tab2Page; 9 | let fixture: ComponentFixture; 10 | 11 | beforeEach(waitForAsync(() => { 12 | TestBed.configureTestingModule({ 13 | declarations: [Tab2Page], 14 | imports: [IonicModule.forRoot(), ExploreContainerComponentModule] 15 | }).compileComponents(); 16 | 17 | fixture = TestBed.createComponent(Tab2Page); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | })); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /demo/angular/src/app/tab2/tab2.page.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-tab2', 5 | templateUrl: 'tab2.page.html', 6 | styleUrls: ['tab2.page.scss'] 7 | }) 8 | export class Tab2Page { 9 | 10 | constructor() {} 11 | 12 | } 13 | -------------------------------------------------------------------------------- /demo/angular/src/app/tab3/tab3-routing.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { RouterModule, Routes } from '@angular/router'; 3 | import { Tab3Page } from './tab3.page'; 4 | 5 | const routes: Routes = [ 6 | { 7 | path: '', 8 | component: Tab3Page, 9 | } 10 | ]; 11 | 12 | @NgModule({ 13 | imports: [RouterModule.forChild(routes)], 14 | exports: [RouterModule] 15 | }) 16 | export class Tab3PageRoutingModule {} 17 | -------------------------------------------------------------------------------- /demo/angular/src/app/tab3/tab3.module.ts: -------------------------------------------------------------------------------- 1 | import { IonicModule } from '@ionic/angular'; 2 | import { RouterModule } from '@angular/router'; 3 | import { NgModule } from '@angular/core'; 4 | import { CommonModule } from '@angular/common'; 5 | import { FormsModule } from '@angular/forms'; 6 | import { Tab3Page } from './tab3.page'; 7 | import { ExploreContainerComponentModule } from '../explore-container/explore-container.module'; 8 | 9 | import { Tab3PageRoutingModule } from './tab3-routing.module'; 10 | 11 | @NgModule({ 12 | imports: [ 13 | IonicModule, 14 | CommonModule, 15 | FormsModule, 16 | ExploreContainerComponentModule, 17 | RouterModule.forChild([{ path: '', component: Tab3Page }]), 18 | Tab3PageRoutingModule, 19 | ], 20 | declarations: [Tab3Page] 21 | }) 22 | export class Tab3PageModule {} 23 | -------------------------------------------------------------------------------- /demo/angular/src/app/tab3/tab3.page.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Tab 3 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | Tab 3 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /demo/angular/src/app/tab3/tab3.page.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nativescript-community/capacitor-plugins/66c93c0d253f481c29b11142680e8126cb5dd878/demo/angular/src/app/tab3/tab3.page.scss -------------------------------------------------------------------------------- /demo/angular/src/app/tab3/tab3.page.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; 2 | import { IonicModule } from '@ionic/angular'; 3 | import { ExploreContainerComponentModule } from '../explore-container/explore-container.module'; 4 | 5 | import { Tab3Page } from './tab3.page'; 6 | 7 | describe('Tab3Page', () => { 8 | let component: Tab3Page; 9 | let fixture: ComponentFixture; 10 | 11 | beforeEach(waitForAsync(() => { 12 | TestBed.configureTestingModule({ 13 | declarations: [Tab3Page], 14 | imports: [IonicModule.forRoot(), ExploreContainerComponentModule] 15 | }).compileComponents(); 16 | 17 | fixture = TestBed.createComponent(Tab3Page); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | })); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /demo/angular/src/app/tab3/tab3.page.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-tab3', 5 | templateUrl: 'tab3.page.html', 6 | styleUrls: ['tab3.page.scss'] 7 | }) 8 | export class Tab3Page { 9 | 10 | constructor() {} 11 | 12 | } 13 | -------------------------------------------------------------------------------- /demo/angular/src/app/tabs/tabs-routing.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { RouterModule, Routes } from '@angular/router'; 3 | import { TabsPage } from './tabs.page'; 4 | 5 | const routes: Routes = [ 6 | { 7 | path: 'tabs', 8 | component: TabsPage, 9 | children: [ 10 | { 11 | path: 'tab1', 12 | loadChildren: () => import('../tab1/tab1.module').then(m => m.Tab1PageModule) 13 | }, 14 | { 15 | path: 'tab2', 16 | loadChildren: () => import('../tab2/tab2.module').then(m => m.Tab2PageModule) 17 | }, 18 | { 19 | path: 'tab3', 20 | loadChildren: () => import('../tab3/tab3.module').then(m => m.Tab3PageModule) 21 | }, 22 | { 23 | path: '', 24 | redirectTo: '/tabs/tab1', 25 | pathMatch: 'full' 26 | } 27 | ] 28 | }, 29 | { 30 | path: '', 31 | redirectTo: '/tabs/tab1', 32 | pathMatch: 'full' 33 | } 34 | ]; 35 | 36 | @NgModule({ 37 | imports: [RouterModule.forChild(routes)], 38 | }) 39 | export class TabsPageRoutingModule {} 40 | -------------------------------------------------------------------------------- /demo/angular/src/app/tabs/tabs.module.ts: -------------------------------------------------------------------------------- 1 | import { IonicModule } from '@ionic/angular'; 2 | import { NgModule } from '@angular/core'; 3 | import { CommonModule } from '@angular/common'; 4 | import { FormsModule } from '@angular/forms'; 5 | 6 | import { TabsPageRoutingModule } from './tabs-routing.module'; 7 | 8 | import { TabsPage } from './tabs.page'; 9 | 10 | @NgModule({ 11 | imports: [ 12 | IonicModule, 13 | CommonModule, 14 | FormsModule, 15 | TabsPageRoutingModule 16 | ], 17 | declarations: [TabsPage] 18 | }) 19 | export class TabsPageModule {} 20 | -------------------------------------------------------------------------------- /demo/angular/src/app/tabs/tabs.page.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Tab 1 7 | 8 | 9 | 10 | 11 | Tab 2 12 | 13 | 14 | 15 | 16 | Tab 3 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /demo/angular/src/app/tabs/tabs.page.scss: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /demo/angular/src/app/tabs/tabs.page.spec.ts: -------------------------------------------------------------------------------- 1 | import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; 2 | import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; 3 | 4 | import { TabsPage } from './tabs.page'; 5 | 6 | describe('TabsPage', () => { 7 | let component: TabsPage; 8 | let fixture: ComponentFixture; 9 | 10 | beforeEach(waitForAsync(() => { 11 | TestBed.configureTestingModule({ 12 | declarations: [TabsPage], 13 | schemas: [CUSTOM_ELEMENTS_SCHEMA], 14 | }).compileComponents(); 15 | })); 16 | 17 | beforeEach(() => { 18 | fixture = TestBed.createComponent(TabsPage); 19 | component = fixture.componentInstance; 20 | fixture.detectChanges(); 21 | }); 22 | 23 | it('should create', () => { 24 | expect(component).toBeTruthy(); 25 | }); 26 | }); 27 | -------------------------------------------------------------------------------- /demo/angular/src/app/tabs/tabs.page.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-tabs', 5 | templateUrl: 'tabs.page.html', 6 | styleUrls: ['tabs.page.scss'] 7 | }) 8 | export class TabsPage { 9 | 10 | constructor() {} 11 | 12 | } 13 | -------------------------------------------------------------------------------- /demo/angular/src/assets/icon/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nativescript-community/capacitor-plugins/66c93c0d253f481c29b11142680e8126cb5dd878/demo/angular/src/assets/icon/favicon.png -------------------------------------------------------------------------------- /demo/angular/src/assets/shapes.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /demo/angular/src/environments/environment.prod.ts: -------------------------------------------------------------------------------- 1 | export const environment = { 2 | production: true 3 | }; 4 | -------------------------------------------------------------------------------- /demo/angular/src/environments/environment.ts: -------------------------------------------------------------------------------- 1 | // This file can be replaced during build by using the `fileReplacements` array. 2 | // `ng build --prod` replaces `environment.ts` with `environment.prod.ts`. 3 | // The list of file replacements can be found in `angular.json`. 4 | 5 | export const environment = { 6 | production: false 7 | }; 8 | 9 | /* 10 | * For easier debugging in development mode, you can import the following file 11 | * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`. 12 | * 13 | * This import should be commented out in production mode because it will have a negative impact 14 | * on performance if an error is thrown. 15 | */ 16 | // import 'zone.js/dist/zone-error'; // Included with Angular CLI. 17 | -------------------------------------------------------------------------------- /demo/angular/src/global.scss: -------------------------------------------------------------------------------- 1 | /* 2 | * App Global CSS 3 | * ---------------------------------------------------------------------------- 4 | * Put style rules here that you want to apply globally. These styles are for 5 | * the entire app and not just one component. Additionally, this file can be 6 | * used as an entry point to import other CSS/Sass files to be included in the 7 | * output CSS. 8 | * For more information on global stylesheets, visit the documentation: 9 | * https://ionicframework.com/docs/layout/global-stylesheets 10 | */ 11 | 12 | /* Core CSS required for Ionic components to work properly */ 13 | @import "~@ionic/angular/css/core.css"; 14 | 15 | /* Basic CSS for apps built with Ionic */ 16 | @import "~@ionic/angular/css/normalize.css"; 17 | @import "~@ionic/angular/css/structure.css"; 18 | @import "~@ionic/angular/css/typography.css"; 19 | @import '~@ionic/angular/css/display.css'; 20 | 21 | /* Optional CSS utils that can be commented out */ 22 | @import "~@ionic/angular/css/padding.css"; 23 | @import "~@ionic/angular/css/float-elements.css"; 24 | @import "~@ionic/angular/css/text-alignment.css"; 25 | @import "~@ionic/angular/css/text-transformation.css"; 26 | @import "~@ionic/angular/css/flex-utils.css"; 27 | -------------------------------------------------------------------------------- /demo/angular/src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Ionic App 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /demo/angular/src/main.ts: -------------------------------------------------------------------------------- 1 | import { enableProdMode } from '@angular/core'; 2 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 3 | 4 | import { AppModule } from './app/app.module'; 5 | import { environment } from './environments/environment'; 6 | 7 | if (environment.production) { 8 | enableProdMode(); 9 | } 10 | 11 | platformBrowserDynamic().bootstrapModule(AppModule) 12 | .catch(err => console.log(err)); 13 | -------------------------------------------------------------------------------- /demo/angular/src/native-custom.d.ts: -------------------------------------------------------------------------------- 1 | import type { NativeProperty } from '@nativescript/capacitor'; 2 | import type { pluginsGlobal } from '@nativescript-community/capacitor-plugins/src/interfaces'; 3 | 4 | declare module '@nativescript/capacitor' { 5 | export interface customNativeAPI extends nativeCustom {} 6 | } 7 | 8 | /** 9 | * Define your own custom strongly typed native helpers here. 10 | */ 11 | export interface nativeCustom extends pluginsGlobal { 12 | dreamBig: () => NativeProperty; 13 | openNativeModalView: () => void; 14 | } 15 | 16 | -------------------------------------------------------------------------------- /demo/angular/src/nativescript/examples/modal.ts: -------------------------------------------------------------------------------- 1 | import { 2 | iosRootViewController, 3 | androidCreateDialog, 4 | } from '@nativescript/capacitor/bridge'; 5 | 6 | /** 7 | * Try calling from Ionic with: 8 | * 9 | * import { native } from '@nativescript/capacitor'; 10 | * 11 | * native.openNativeModalView(); 12 | * 13 | * Reference: 14 | * iOS: https://developer.apple.com/library/archive/featuredarticles/ViewControllerPGforiPhoneOS/index.html 15 | * Android: https://developer.android.com/reference/android/widget/LinearLayout 16 | */ 17 | 18 | native.openNativeModalView = () => { 19 | if (native.isAndroid) { 20 | androidCreateDialog(() => { 21 | const activity = native.androidCapacitorActivity; 22 | 23 | const layout = new android.widget.LinearLayout(activity); 24 | layout.setGravity(android.view.Gravity.CENTER); 25 | layout.setOrientation(android.widget.LinearLayout.VERTICAL); 26 | 27 | const btn = new android.widget.Button(activity); 28 | btn.setText('Ionic'); 29 | layout.addView(btn); 30 | 31 | const btn1 = new android.widget.Button(activity); 32 | btn1.setText('Capacitor'); 33 | layout.addView(btn1); 34 | 35 | return layout; 36 | }); 37 | } else { 38 | const vc = UIViewController.alloc().init(); 39 | vc.view.backgroundColor = UIColor.blueColor; 40 | const label = UILabel.alloc().initWithFrame( 41 | CGRectMake(0, 30, UIScreen.mainScreen.bounds.size.width, 50), 42 | ); 43 | label.text = `Well this is fun.`; 44 | label.textColor = UIColor.orangeColor; 45 | label.textAlignment = NSTextAlignment.Center; 46 | label.font = UIFont.systemFontOfSize(35); 47 | vc.view.addSubview(label); 48 | iosRootViewController().presentModalViewControllerAnimated(vc, true); 49 | } 50 | }; 51 | -------------------------------------------------------------------------------- /demo/angular/src/nativescript/examples/simple.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Try calling from Ionic with: 3 | * 4 | * import { native } from '@nativescript/capacitor'; 5 | * 6 | * native.dreamBig().value.then(v => console.log(v)); 7 | * 8 | * Reference: 9 | * iOS: https://developer.apple.com/documentation/foundation/nsstring 10 | * Android: https://developer.android.com/reference/java/lang/String 11 | */ 12 | 13 | native.dreamBig = () => { 14 | const message = 'Dream big!'; 15 | if (native.isAndroid) { 16 | return new java.lang.String(message); 17 | } else { 18 | return NSString.alloc().initWithString(message); 19 | } 20 | }; 21 | -------------------------------------------------------------------------------- /demo/angular/src/nativescript/index.ts: -------------------------------------------------------------------------------- 1 | import '@nativescript/capacitor/bridge'; 2 | import * as Plugins from '@nativescript-community/capacitor-plugins'; 3 | 4 | native = Object.assign(native, Plugins); 5 | 6 | /** 7 | * **** **** 8 | * ****** **** 9 | * ******** **** 10 | * ****** ***** ****** NativeScript 11 | * **** ******** 12 | * **** ****** 13 | * **** **** 14 | * 15 | * 🧠 Learn more: 👉 https://capacitor.nativescript.org/getting-started.html 16 | */ 17 | 18 | // Example A: direct native calls 19 | const hello = `👋 🎉 ~ NativeScript Team`; 20 | if (native.isAndroid) { 21 | console.log(new java.lang.String(`Hello Android ${hello}`)); 22 | } else { 23 | console.log(NSString.alloc().initWithString(`Hello iOS ${hello}`)); 24 | } 25 | 26 | /** 27 | * In addition to calling platform iOS and Android api's directly, 28 | * you can write your own additional helpers here. 29 | */ 30 | 31 | // Example B: simpler helper returning a value 32 | import './examples/simple'; 33 | 34 | // Example C: opening a native modal 35 | import './examples/modal'; 36 | -------------------------------------------------------------------------------- /demo/angular/src/nativescript/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "nativescript", 3 | "dependencies": { 4 | "@nativescript/core": "7.3.0-rc.0", 5 | "@nativescript/types": "7.3.0-rc.0" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /demo/angular/src/nativescript/references.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | /// 4 | 5 | import type { nativeCustom } from '../native-custom'; 6 | 7 | declare global { 8 | var androidCapacitorActivity: android.app.Activity; 9 | var native: NodeJS.Global & typeof globalThis & nativeCustom; 10 | } 11 | 12 | 13 | -------------------------------------------------------------------------------- /demo/angular/src/nativescript/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": false, 3 | "compilerOptions": { 4 | "rootDir": ".", 5 | "baseUrl": "./", 6 | "outDir": "../../www/nativescript", 7 | "sourceMap": false, 8 | "declaration": false, 9 | "downlevelIteration": true, 10 | "experimentalDecorators": true, 11 | "module": "commonjs", 12 | "moduleResolution": "node", 13 | "importHelpers": true, 14 | "target": "es2015", 15 | "lib": [ 16 | "es2018", 17 | "dom" 18 | ] 19 | }, 20 | "files": [ 21 | "references.d.ts", 22 | "index.ts" 23 | ] 24 | } -------------------------------------------------------------------------------- /demo/angular/src/polyfills.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file includes polyfills needed by Angular and is loaded before the app. 3 | * You can add your own extra polyfills to this file. 4 | * 5 | * This file is divided into 2 sections: 6 | * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers. 7 | * 2. Application imports. Files imported after ZoneJS that should be loaded before your main 8 | * file. 9 | * 10 | * The current setup is for so-called "evergreen" browsers; the last versions of browsers that 11 | * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera), 12 | * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile. 13 | * 14 | * Learn more in https://angular.io/guide/browser-support 15 | */ 16 | 17 | /*************************************************************************************************** 18 | * BROWSER POLYFILLS 19 | */ 20 | 21 | /** IE11 requires the following for NgClass support on SVG elements */ 22 | // import 'classlist.js'; // Run `npm install --save classlist.js`. 23 | 24 | /** 25 | * Web Animations `@angular/platform-browser/animations` 26 | * Only required if AnimationBuilder is used within the application and using IE/Edge or Safari. 27 | * Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0). 28 | */ 29 | // import 'web-animations-js'; // Run `npm install --save web-animations-js`. 30 | 31 | /** 32 | * By default, zone.js will patch all possible macroTask and DomEvents 33 | * user can disable parts of macroTask/DomEvents patch by setting following flags 34 | * because those flags need to be set before `zone.js` being loaded, and webpack 35 | * will put import in the top of bundle, so user need to create a separate file 36 | * in this directory (for example: zone-flags.ts), and put the following flags 37 | * into that file, and then add the following code before importing zone.js. 38 | * import './zone-flags'; 39 | * 40 | * The flags allowed in zone-flags.ts are listed here. 41 | * 42 | * The following flags will work for all browsers. 43 | * 44 | * (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame 45 | * (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick 46 | * (window as any).__zone_symbol__UNPATCHED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames 47 | * 48 | * in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js 49 | * with the following flag, it will bypass `zone.js` patch for IE/Edge 50 | * 51 | * (window as any).__Zone_enable_cross_context_check = true; 52 | * 53 | */ 54 | 55 | import './zone-flags'; 56 | 57 | /*************************************************************************************************** 58 | * Zone JS is required by default for Angular itself. 59 | */ 60 | import 'zone.js/dist/zone'; // Included with Angular CLI. 61 | 62 | 63 | /*************************************************************************************************** 64 | * APPLICATION IMPORTS 65 | */ 66 | -------------------------------------------------------------------------------- /demo/angular/src/test.ts: -------------------------------------------------------------------------------- 1 | // This file is required by karma.conf.js and loads recursively all the .spec and framework files 2 | 3 | import 'zone.js/dist/zone-testing'; 4 | import { getTestBed } from '@angular/core/testing'; 5 | import { 6 | BrowserDynamicTestingModule, 7 | platformBrowserDynamicTesting 8 | } from '@angular/platform-browser-dynamic/testing'; 9 | 10 | declare const require: { 11 | context(path: string, deep?: boolean, filter?: RegExp): { 12 | keys(): string[]; 13 | (id: string): T; 14 | }; 15 | }; 16 | 17 | // First, initialize the Angular testing environment. 18 | getTestBed().initTestEnvironment( 19 | BrowserDynamicTestingModule, 20 | platformBrowserDynamicTesting() 21 | ); 22 | // Then we find all the tests. 23 | const context = require.context('./', true, /\.spec\.ts$/); 24 | // And load the modules. 25 | context.keys().map(context); 26 | -------------------------------------------------------------------------------- /demo/angular/src/theme/variables.scss: -------------------------------------------------------------------------------- 1 | // Ionic Variables and Theming. For more info, please see: 2 | // http://ionicframework.com/docs/theming/ 3 | 4 | /** Ionic CSS Variables **/ 5 | :root { 6 | /** primary **/ 7 | --ion-color-primary: #3880ff; 8 | --ion-color-primary-rgb: 56, 128, 255; 9 | --ion-color-primary-contrast: #ffffff; 10 | --ion-color-primary-contrast-rgb: 255, 255, 255; 11 | --ion-color-primary-shade: #3171e0; 12 | --ion-color-primary-tint: #4c8dff; 13 | 14 | /** secondary **/ 15 | --ion-color-secondary: #3dc2ff; 16 | --ion-color-secondary-rgb: 61, 194, 255; 17 | --ion-color-secondary-contrast: #ffffff; 18 | --ion-color-secondary-contrast-rgb: 255, 255, 255; 19 | --ion-color-secondary-shade: #36abe0; 20 | --ion-color-secondary-tint: #50c8ff; 21 | 22 | /** tertiary **/ 23 | --ion-color-tertiary: #5260ff; 24 | --ion-color-tertiary-rgb: 82, 96, 255; 25 | --ion-color-tertiary-contrast: #ffffff; 26 | --ion-color-tertiary-contrast-rgb: 255, 255, 255; 27 | --ion-color-tertiary-shade: #4854e0; 28 | --ion-color-tertiary-tint: #6370ff; 29 | 30 | /** success **/ 31 | --ion-color-success: #2dd36f; 32 | --ion-color-success-rgb: 45, 211, 111; 33 | --ion-color-success-contrast: #ffffff; 34 | --ion-color-success-contrast-rgb: 255, 255, 255; 35 | --ion-color-success-shade: #28ba62; 36 | --ion-color-success-tint: #42d77d; 37 | 38 | /** warning **/ 39 | --ion-color-warning: #ffc409; 40 | --ion-color-warning-rgb: 255, 196, 9; 41 | --ion-color-warning-contrast: #000000; 42 | --ion-color-warning-contrast-rgb: 0, 0, 0; 43 | --ion-color-warning-shade: #e0ac08; 44 | --ion-color-warning-tint: #ffca22; 45 | 46 | /** danger **/ 47 | --ion-color-danger: #eb445a; 48 | --ion-color-danger-rgb: 235, 68, 90; 49 | --ion-color-danger-contrast: #ffffff; 50 | --ion-color-danger-contrast-rgb: 255, 255, 255; 51 | --ion-color-danger-shade: #cf3c4f; 52 | --ion-color-danger-tint: #ed576b; 53 | 54 | /** dark **/ 55 | --ion-color-dark: #222428; 56 | --ion-color-dark-rgb: 34, 36, 40; 57 | --ion-color-dark-contrast: #ffffff; 58 | --ion-color-dark-contrast-rgb: 255, 255, 255; 59 | --ion-color-dark-shade: #1e2023; 60 | --ion-color-dark-tint: #383a3e; 61 | 62 | /** medium **/ 63 | --ion-color-medium: #92949c; 64 | --ion-color-medium-rgb: 146, 148, 156; 65 | --ion-color-medium-contrast: #ffffff; 66 | --ion-color-medium-contrast-rgb: 255, 255, 255; 67 | --ion-color-medium-shade: #808289; 68 | --ion-color-medium-tint: #9d9fa6; 69 | 70 | /** light **/ 71 | --ion-color-light: #f4f5f8; 72 | --ion-color-light-rgb: 244, 245, 248; 73 | --ion-color-light-contrast: #000000; 74 | --ion-color-light-contrast-rgb: 0, 0, 0; 75 | --ion-color-light-shade: #d7d8da; 76 | --ion-color-light-tint: #f5f6f9; 77 | } 78 | 79 | @media (prefers-color-scheme: dark) { 80 | /* 81 | * Dark Colors 82 | * ------------------------------------------- 83 | */ 84 | 85 | body { 86 | --ion-color-primary: #428cff; 87 | --ion-color-primary-rgb: 66,140,255; 88 | --ion-color-primary-contrast: #ffffff; 89 | --ion-color-primary-contrast-rgb: 255,255,255; 90 | --ion-color-primary-shade: #3a7be0; 91 | --ion-color-primary-tint: #5598ff; 92 | 93 | --ion-color-secondary: #50c8ff; 94 | --ion-color-secondary-rgb: 80,200,255; 95 | --ion-color-secondary-contrast: #ffffff; 96 | --ion-color-secondary-contrast-rgb: 255,255,255; 97 | --ion-color-secondary-shade: #46b0e0; 98 | --ion-color-secondary-tint: #62ceff; 99 | 100 | --ion-color-tertiary: #6a64ff; 101 | --ion-color-tertiary-rgb: 106,100,255; 102 | --ion-color-tertiary-contrast: #ffffff; 103 | --ion-color-tertiary-contrast-rgb: 255,255,255; 104 | --ion-color-tertiary-shade: #5d58e0; 105 | --ion-color-tertiary-tint: #7974ff; 106 | 107 | --ion-color-success: #2fdf75; 108 | --ion-color-success-rgb: 47,223,117; 109 | --ion-color-success-contrast: #000000; 110 | --ion-color-success-contrast-rgb: 0,0,0; 111 | --ion-color-success-shade: #29c467; 112 | --ion-color-success-tint: #44e283; 113 | 114 | --ion-color-warning: #ffd534; 115 | --ion-color-warning-rgb: 255,213,52; 116 | --ion-color-warning-contrast: #000000; 117 | --ion-color-warning-contrast-rgb: 0,0,0; 118 | --ion-color-warning-shade: #e0bb2e; 119 | --ion-color-warning-tint: #ffd948; 120 | 121 | --ion-color-danger: #ff4961; 122 | --ion-color-danger-rgb: 255,73,97; 123 | --ion-color-danger-contrast: #ffffff; 124 | --ion-color-danger-contrast-rgb: 255,255,255; 125 | --ion-color-danger-shade: #e04055; 126 | --ion-color-danger-tint: #ff5b71; 127 | 128 | --ion-color-dark: #f4f5f8; 129 | --ion-color-dark-rgb: 244,245,248; 130 | --ion-color-dark-contrast: #000000; 131 | --ion-color-dark-contrast-rgb: 0,0,0; 132 | --ion-color-dark-shade: #d7d8da; 133 | --ion-color-dark-tint: #f5f6f9; 134 | 135 | --ion-color-medium: #989aa2; 136 | --ion-color-medium-rgb: 152,154,162; 137 | --ion-color-medium-contrast: #000000; 138 | --ion-color-medium-contrast-rgb: 0,0,0; 139 | --ion-color-medium-shade: #86888f; 140 | --ion-color-medium-tint: #a2a4ab; 141 | 142 | --ion-color-light: #222428; 143 | --ion-color-light-rgb: 34,36,40; 144 | --ion-color-light-contrast: #ffffff; 145 | --ion-color-light-contrast-rgb: 255,255,255; 146 | --ion-color-light-shade: #1e2023; 147 | --ion-color-light-tint: #383a3e; 148 | } 149 | 150 | /* 151 | * iOS Dark Theme 152 | * ------------------------------------------- 153 | */ 154 | 155 | .ios body { 156 | --ion-background-color: #000000; 157 | --ion-background-color-rgb: 0,0,0; 158 | 159 | --ion-text-color: #ffffff; 160 | --ion-text-color-rgb: 255,255,255; 161 | 162 | --ion-color-step-50: #0d0d0d; 163 | --ion-color-step-100: #1a1a1a; 164 | --ion-color-step-150: #262626; 165 | --ion-color-step-200: #333333; 166 | --ion-color-step-250: #404040; 167 | --ion-color-step-300: #4d4d4d; 168 | --ion-color-step-350: #595959; 169 | --ion-color-step-400: #666666; 170 | --ion-color-step-450: #737373; 171 | --ion-color-step-500: #808080; 172 | --ion-color-step-550: #8c8c8c; 173 | --ion-color-step-600: #999999; 174 | --ion-color-step-650: #a6a6a6; 175 | --ion-color-step-700: #b3b3b3; 176 | --ion-color-step-750: #bfbfbf; 177 | --ion-color-step-800: #cccccc; 178 | --ion-color-step-850: #d9d9d9; 179 | --ion-color-step-900: #e6e6e6; 180 | --ion-color-step-950: #f2f2f2; 181 | 182 | --ion-item-background: #000000; 183 | 184 | --ion-card-background: #1c1c1d; 185 | } 186 | 187 | .ios ion-modal { 188 | --ion-background-color: var(--ion-color-step-100); 189 | --ion-toolbar-background: var(--ion-color-step-150); 190 | --ion-toolbar-border-color: var(--ion-color-step-250); 191 | } 192 | 193 | 194 | /* 195 | * Material Design Dark Theme 196 | * ------------------------------------------- 197 | */ 198 | 199 | .md body { 200 | --ion-background-color: #121212; 201 | --ion-background-color-rgb: 18,18,18; 202 | 203 | --ion-text-color: #ffffff; 204 | --ion-text-color-rgb: 255,255,255; 205 | 206 | --ion-border-color: #222222; 207 | 208 | --ion-color-step-50: #1e1e1e; 209 | --ion-color-step-100: #2a2a2a; 210 | --ion-color-step-150: #363636; 211 | --ion-color-step-200: #414141; 212 | --ion-color-step-250: #4d4d4d; 213 | --ion-color-step-300: #595959; 214 | --ion-color-step-350: #656565; 215 | --ion-color-step-400: #717171; 216 | --ion-color-step-450: #7d7d7d; 217 | --ion-color-step-500: #898989; 218 | --ion-color-step-550: #949494; 219 | --ion-color-step-600: #a0a0a0; 220 | --ion-color-step-650: #acacac; 221 | --ion-color-step-700: #b8b8b8; 222 | --ion-color-step-750: #c4c4c4; 223 | --ion-color-step-800: #d0d0d0; 224 | --ion-color-step-850: #dbdbdb; 225 | --ion-color-step-900: #e7e7e7; 226 | --ion-color-step-950: #f3f3f3; 227 | 228 | --ion-item-background: #1e1e1e; 229 | 230 | --ion-toolbar-background: #1f1f1f; 231 | 232 | --ion-tab-bar-background: #1f1f1f; 233 | 234 | --ion-card-background: #1e1e1e; 235 | } 236 | } 237 | -------------------------------------------------------------------------------- /demo/angular/src/zone-flags.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Prevents Angular change detection from 3 | * running with certain Web Component callbacks 4 | */ 5 | (window as any).__Zone_disable_customElements = true; 6 | -------------------------------------------------------------------------------- /demo/angular/tsconfig.app.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "extends": "./tsconfig.json", 4 | "compilerOptions": { 5 | "outDir": "./out-tsc/app", 6 | "types": [] 7 | }, 8 | "files": [ 9 | "src/main.ts", 10 | "src/polyfills.ts" 11 | ], 12 | "include": [ 13 | "src/**/*.d.ts" 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /demo/angular/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": false, 3 | "compilerOptions": { 4 | "baseUrl": "./", 5 | "outDir": "./dist/out-tsc", 6 | "sourceMap": true, 7 | "declaration": false, 8 | "downlevelIteration": true, 9 | "experimentalDecorators": true, 10 | "moduleResolution": "node", 11 | "importHelpers": true, 12 | "target": "es2015", 13 | "module": "es2020", 14 | "lib": [ 15 | "es2018", 16 | "dom" 17 | ] 18 | }, 19 | "angularCompilerOptions": { 20 | "enableI18nLegacyMessageIdFormat": false, 21 | "strictInjectionParameters": true, 22 | "strictInputAccessModifiers": true, 23 | "strictTemplates": true 24 | }, 25 | "exclude": [ 26 | "src/nativescript" 27 | ] 28 | } 29 | -------------------------------------------------------------------------------- /demo/angular/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "extends": "./tsconfig.json", 4 | "compilerOptions": { 5 | "outDir": "./out-tsc/spec", 6 | "types": [ 7 | "jasmine" 8 | ] 9 | }, 10 | "files": [ 11 | "src/test.ts", 12 | "src/polyfills.ts" 13 | ], 14 | "include": [ 15 | "src/**/*.spec.ts", 16 | "src/**/*.d.ts" 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /demo/angular/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "tslint:recommended", 3 | "rules": { 4 | "align": { 5 | "options": [ 6 | "parameters", 7 | "statements" 8 | ] 9 | }, 10 | "array-type": false, 11 | "arrow-return-shorthand": true, 12 | "curly": true, 13 | "deprecation": { 14 | "severity": "warning" 15 | }, 16 | "component-class-suffix": [true, "Page", "Component"], 17 | "contextual-lifecycle": true, 18 | "directive-class-suffix": true, 19 | "directive-selector": [ 20 | true, 21 | "attribute", 22 | "app", 23 | "camelCase" 24 | ], 25 | "component-selector": [ 26 | true, 27 | "element", 28 | "app", 29 | "kebab-case" 30 | ], 31 | "eofline": true, 32 | "import-blacklist": [ 33 | true, 34 | "rxjs/Rx" 35 | ], 36 | "import-spacing": true, 37 | "indent": { 38 | "options": [ 39 | "spaces" 40 | ] 41 | }, 42 | "max-classes-per-file": false, 43 | "max-line-length": [ 44 | true, 45 | 140 46 | ], 47 | "member-ordering": [ 48 | true, 49 | { 50 | "order": [ 51 | "static-field", 52 | "instance-field", 53 | "static-method", 54 | "instance-method" 55 | ] 56 | } 57 | ], 58 | "no-console": [ 59 | true, 60 | "debug", 61 | "info", 62 | "time", 63 | "timeEnd", 64 | "trace" 65 | ], 66 | "no-empty": false, 67 | "no-inferrable-types": [ 68 | true, 69 | "ignore-params" 70 | ], 71 | "no-non-null-assertion": true, 72 | "no-redundant-jsdoc": true, 73 | "no-switch-case-fall-through": true, 74 | "no-var-requires": false, 75 | "object-literal-key-quotes": [ 76 | true, 77 | "as-needed" 78 | ], 79 | "quotemark": [ 80 | true, 81 | "single" 82 | ], 83 | "semicolon": { 84 | "options": [ 85 | "always" 86 | ] 87 | }, 88 | "space-before-function-paren": { 89 | "options": { 90 | "anonymous": "never", 91 | "asyncArrow": "always", 92 | "constructor": "never", 93 | "method": "never", 94 | "named": "never" 95 | } 96 | }, 97 | "typedef-whitespace": { 98 | "options": [ 99 | { 100 | "call-signature": "nospace", 101 | "index-signature": "nospace", 102 | "parameter": "nospace", 103 | "property-declaration": "nospace", 104 | "variable-declaration": "nospace" 105 | }, 106 | { 107 | "call-signature": "onespace", 108 | "index-signature": "onespace", 109 | "parameter": "onespace", 110 | "property-declaration": "onespace", 111 | "variable-declaration": "onespace" 112 | } 113 | ] 114 | }, 115 | "variable-name": { 116 | "options": [ 117 | "ban-keywords", 118 | "check-format", 119 | "allow-pascal-case" 120 | ] 121 | }, 122 | "whitespace": { 123 | "options": [ 124 | "check-branch", 125 | "check-decl", 126 | "check-operator", 127 | "check-separator", 128 | "check-type", 129 | "check-typecast" 130 | ] 131 | }, 132 | "no-conflicting-lifecycle": true, 133 | "no-host-metadata-property": true, 134 | "no-input-rename": true, 135 | "no-inputs-metadata-property": true, 136 | "no-output-native": true, 137 | "no-output-on-prefix": true, 138 | "no-output-rename": true, 139 | "no-outputs-metadata-property": true, 140 | "template-banana-in-box": true, 141 | "template-no-negated-async": true, 142 | "use-lifecycle-interface": true, 143 | "use-pipe-transform-interface": true, 144 | "object-literal-sort-keys": false 145 | }, 146 | "rulesDirectory": [ 147 | "codelyzer" 148 | ] 149 | } -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@nativescript-community/capacitor-plugins", 3 | "version": "0.0.0-3", 4 | "description": "A native plugin for Capacitor created by NativeScript", 5 | "main": "src/index.ts", 6 | "files": [ 7 | "src/" 8 | ], 9 | "author": "Masahiko Sakakibara ", 10 | "license": "MIT", 11 | "scripts": { 12 | "release": "np", 13 | "build:nativescript": "build-nativescript", 14 | "build:mobile": "npm-run-all build build:nativescript" 15 | }, 16 | "dependencies": { 17 | "@nativescript/capacitor": "^1.0.0-beta.0", 18 | "@nativescript/core": "7.3.0-rc.0", 19 | "@nativescript/types": "7.3.0-rc.0" 20 | }, 21 | "devDependencies": { 22 | "np": "^7.4.0" 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /references.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | /// 4 | 5 | export {}; 6 | 7 | declare global { 8 | var androidCapacitorActivity: android.app.Activity; 9 | var native: NodeJS.Global & typeof globalThis; 10 | } 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/index.ts: -------------------------------------------------------------------------------- 1 | export { brightness } from './plugins/brightness'; 2 | export { rateMyApp } from './plugins/rate-my-app'; 3 | -------------------------------------------------------------------------------- /src/interfaces.ts: -------------------------------------------------------------------------------- 1 | import type { NativeProperty } from '@nativescript/capacitor'; 2 | 3 | /** 4 | * Define every plugin interface native helpers here. 5 | */ 6 | export interface brightnessPlugin { 7 | brightness: (value: number) => void; 8 | } 9 | export interface rateMyAppPlugin { 10 | rateMyApp: () => void; 11 | } 12 | 13 | /** 14 | * Define all extend interface. 15 | */ 16 | export interface pluginsGlobal extends brightnessPlugin, rateMyAppPlugin { 17 | } 18 | -------------------------------------------------------------------------------- /src/plugins/brightness.ts: -------------------------------------------------------------------------------- 1 | import '@nativescript/capacitor/bridge'; 2 | 3 | export const brightness = (value: number) => { 4 | if (native.isAndroid) { 5 | const context = native.androidCapacitorActivity; 6 | if (android.os.Build.VERSION.SDK_INT < 23) { 7 | const attr = context.getWindow().getAttributes(); 8 | attr.screenBrightness = value; 9 | context.getWindow().setAttributes(attr); 10 | } else { 11 | if (!android.provider.Settings.System.canWrite(context)) { 12 | const intent = new android.content.Intent( 13 | android.provider.Settings.ACTION_MANAGE_WRITE_SETTINGS 14 | ); 15 | intent.setData( 16 | android.net.Uri.parse("package:" + context.getPackageName()) 17 | ); 18 | intent.addFlags(android.content.Intent.FLAG_ACTIVITY_NEW_TASK); 19 | context.startActivity(intent); 20 | } 21 | 22 | if (android.provider.Settings.System.canWrite(context)) { 23 | android.provider.Settings.System.putInt( 24 | context.getContentResolver(), 25 | android.provider.Settings.System.SCREEN_BRIGHTNESS, 26 | value * 100 27 | ); 28 | } 29 | } 30 | } else { 31 | UIScreen.mainScreen.brightness = value; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/plugins/rate-my-app.ts: -------------------------------------------------------------------------------- 1 | import '@nativescript/capacitor/bridge'; 2 | 3 | export const rateMyApp = () => { 4 | if (native.isAndroid) { 5 | const context = native.androidCapacitorActivity; 6 | // @ts-ignore 7 | const googlePlayTasks = (com.google.android.play.core).tasks; 8 | 9 | const reviewDialogListener = new googlePlayTasks.OnCompleteListener({ 10 | onComplete: task => { 11 | if (task.isSuccessful()) { 12 | task.getResult(); 13 | } 14 | } 15 | }); 16 | const reviewIntentListener = new googlePlayTasks.OnCompleteListener({ 17 | onComplete: task => { 18 | if (task.isSuccessful()) { 19 | const reviewInfo = task.getResult(); 20 | const flow = manager.launchReviewFlow(context, reviewInfo); 21 | flow.addOnCompleteListener(reviewDialogListener); 22 | } else { 23 | const code = task.getException().getErrorCode(); 24 | } 25 | } 26 | }); 27 | 28 | // @ts-ignore 29 | const manager = com.google.android.play.core.review.ReviewManagerFactory.create(context) 30 | const request = manager.requestReviewFlow(); 31 | request.addOnCompleteListener(reviewIntentListener); 32 | } else if (native.isIOS) { 33 | SKStoreReviewController.requestReview() 34 | } else { 35 | throw new Error('Unsupported platform'); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": false, 3 | "compilerOptions": { 4 | "rootDir": ".", 5 | "baseUrl": "./", 6 | "outDir": "../../www/nativescript", 7 | "sourceMap": false, 8 | "declaration": false, 9 | "downlevelIteration": true, 10 | "experimentalDecorators": true, 11 | "module": "commonjs", 12 | "moduleResolution": "node", 13 | "importHelpers": true, 14 | "target": "es2015", 15 | "lib": [ 16 | "es2018", 17 | "dom" 18 | ] 19 | }, 20 | "files": [ 21 | "references.d.ts", 22 | "src/index.ts" 23 | ], 24 | "exclude": [ 25 | "src/nativescript" 26 | ] 27 | } 28 | --------------------------------------------------------------------------------