diff --git a/.gitignore b/.gitignore
index 747219d..94d6c4e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,18 +1,33 @@
-# Output
-dist
-
-# Dev dependencies
-node_modules
-
-# Source, written in TypeScript so JavaScript is not necessary
-nativescript-imagepicker/**/*.js
-nativescript-imagepicker/**/*.js.map
-
-# Example platforms
-/examples/ExampleImgPick/platforms/
-/examples/ExampleImgPick/lib/
-/examples/ExampleImgPickNG/platforms/
-/examples/ExampleImgPickNG/lib/
-/examples/ExampleImgPickNG/**/*.js
-/examples/ExampleImgPickNG/**/*.js.map
+.vscode
+.idea
.DS_Store
+*.js
+*.js.map
+*.log
+!src/scripts/*.js
+!seed-tests/*.js
+seed-tests/seed-copy/**/*.*
+seed-tests/seed-copy-new-git-repo/**/*.*
+demo/app/*.js
+!demo/karma.conf.js
+!demo/app/tests/*.js
+demo/*.d.ts
+!demo/references.d.ts
+demo/lib
+demo/platforms
+demo/node_modules
+demo-angular/app/*.js
+!demo-angular/karma.conf.js
+!demo-angular/app/tests/*.js
+demo-angular/*.d.ts
+!demo-angular/references.d.ts
+demo-angular/lib
+demo-angular/platforms
+demo-angular/node_modules
+node_modules
+publish/src
+publish/package
+demo/report/report.html
+demo/report/stats.json
+demo-angular/report/report.html
+demo-angular/report/stats.json
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..a25947b
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,64 @@
+matrix:
+ include:
+ - stage: "Lint"
+ language: node_js
+ os: linux
+ node_js: "6"
+ script: cd src && npm run ci.tslint && cd ../demo && npm run ci.tslint && cd ../demo-angular && npm run ci.tslint
+ - stage: "WebPack"
+ os: osx
+ env:
+ - Platform="iOS"
+ osx_image: xcode8.3
+ language: node_js
+ node_js: "6"
+ jdk: oraclejdk8
+ script: cd demo && npm run build.plugin && npm i && npm run build-ios-bundle && cd ../demo-angular && npm run build.plugin && npm i && npm run build-ios-bundle
+ - language: android
+ os: linux
+ env:
+ - Platform="Android"
+ jdk: oraclejdk8
+ before_install: nvm install 6.10.3
+ script: cd demo && npm run build.plugin && npm i && npm run build-android-bundle && cd ../demo-angular && npm run build.plugin && npm i && npm run build-android-bundle
+ - stage: "Build"
+ env:
+ - Android="25"
+ language: android
+ os: linux
+ jdk: oraclejdk8
+ before_install: nvm install 6.10.3
+ script: cd demo && npm run ci.android.build && cd ../demo-angular && npm run ci.android.build
+ - os: osx
+ env:
+ - iOS="10.3"
+ - Xcode="8.3"
+ osx_image: xcode8.3
+ language: node_js
+ node_js: "6"
+ jdk: oraclejdk8
+ script: cd demo && npm run ci.ios.build && cd ../demo-angular && npm run ci.ios.build
+
+android:
+ components:
+ - tools
+ - platform-tools
+ - build-tools-25.0.2
+ - android-25
+ - extra-android-m2repository
+
+before_cache:
+ - rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
+
+cache:
+ directories:
+ - .nvm
+ - $HOME/.gradle/caches/
+ - $HOME/.gradle/wrapper/
+
+install:
+ - echo no | npm install -g nativescript
+ - tns usage-reporting disable
+ - tns error-reporting disable
+
+
\ No newline at end of file
diff --git a/README.md b/README.md
index 4d9b081..caa95f8 100644
--- a/README.md
+++ b/README.md
@@ -1,24 +1,107 @@
-# Image Picker for the NativeScript framework
-An image picker control that supports multiple selection.
+# NativeScript Image Picker  
-## Usage
-[Please check the following article.](nativescript-imagepicker/README.md)
-### Prerequisites
- - [nodejs](https://nodejs.org/)
- - [nativescript](https://www.nativescript.org/)
+[](https://www.npmjs.com/package/nativescript-imagepicker)
+[](https://www.npmjs.com/package/nativescript-imagepicker)
+[](https://travis-ci.org/NativeScript/nativescript-imagepicker)
+
+Imagepicker plugin supporting both single and multiple selection.
+
Plugin supports **iOS8+** and uses [Photos Framework](https://developer.apple.com/library/prerelease/ios//documentation/Photos/Reference/Photos_Framework/index.html).
+
For **Android** it uses Intents to open the stock images or file pickers. For Android 6 (API 23) and above the permissions to read file storage should be explicitly required. See demo for implementation details.
+
+## Installation
+
+In Command prompt / Terminal navigate to your application root folder and run:
-## Development
-Go to `nativescript-imagepicker`:
-```
-npm link
```
-Go to `examples\ExampleImgPick`:
+tns plugin add
```
-npm link nativescript-imagepicker
+
+## Usage
+
+The best way to explore the usage of the plugin is to inspect both demo apps in the plugin repository.
+In `demo` folder you can find the usage of the plugin for TypeScript non-Angular application. Refer to `demo/app/main-page.ts`.
+In `demo-angular` is the usage in an Angular app. Refer to `demo-angular/app/app.component.ts`.
+
+In addition to the plugin usage, both apps are webpack configured.
+
+In short here are the steps:
+
+### Import the plugin
+
+*TypeScript*
+```
+import * as imagepicker from "nativescript-imagepicker";
```
-Then you can run the app using either:
+
+*Javascript*
+```
+var imagepicker = require("nativescript-imagepicker");
```
-tns run ios
-tns run android
+
+### Create imagepicker
+
+Create imagepicker in `single` or `multiple` mode to specifiy if the imagepicker will be used for single or multiple selection of images
+
+*TypeScript*
+```
+let context = imagepicker.create({
+ mode: "single" // use "multiple" for multiple selection
+});
+````
+
+*Javascript*
+````
+var context = imagepicker.create({ mode: "single" }); // use "multiple" for multiple selection
+````
+
+### Request permissions, show the images list and process the selection
+
+```
+context
+ .authorize()
+ .then(function() {
+ return context.present();
+ })
+ .then(function(selection) {
+ selection.forEach(function(selected) {
+ // process the selected image
+ });
+ list.items = selection;
+ }).catch(function (e) {
+ // process error
+ });
```
+
+> **NOTE**: To request permissions for Android 6+ (API 23+) we use [nativescript-permissions](https://www.npmjs.com/package/nativescript-permissions).
+
+## API
+
+### Methods
+
+* create(options) - creates instance of the imagepicker. Possible options are:
+
+| Option | Platform | Default | Description |
+| --- | --- | --- | --- |
+| mode | both | multiple | The mode if the imagepicker. Possible values are `single` for single selection and `multiple` for multiple selection. |
+| doneText | iOS | Done | The text of the "Done" button on top right. |
+| cancelText | iOS | Cancel | The text of the "Cancel" button on top left. |
+| albumsText | iOS | Albums | The title of the "Albums" screen from where the selection of album and images can be done. |
+| newestFirst | iOS | false | Set to `true` to sort the images in an album by newest first. |
+
+* authorize() - request iOS specific permissions.
+* present() - show the albums to present the user the ability to select images. Returns an array of the selected images.
+* cancel() - cancel selection. iOS only.
+* done() - confirm the selection is ready. iOS only.
+
+
+### Properties
+| Property | Default | Description |
+| --- | --- | --- |
+| selection | null | An array of selected image assets. |
+| albums | null | Albums from where the images are picked. |
+
+
+## License
+
+2015, Telerik AD
\ No newline at end of file
diff --git a/examples/ExampleImgPickNG/app/App_Resources/Android/AndroidManifest.xml b/demo-angular/app/App_Resources/Android/AndroidManifest.xml
similarity index 100%
rename from examples/ExampleImgPickNG/app/App_Resources/Android/AndroidManifest.xml
rename to demo-angular/app/App_Resources/Android/AndroidManifest.xml
diff --git a/demo-angular/app/App_Resources/Android/app.gradle b/demo-angular/app/App_Resources/Android/app.gradle
new file mode 100644
index 0000000..9725aa2
--- /dev/null
+++ b/demo-angular/app/App_Resources/Android/app.gradle
@@ -0,0 +1,16 @@
+// Add your native dependencies here:
+
+// Uncomment to add recyclerview-v7 dependency
+//dependencies {
+// compile 'com.android.support:recyclerview-v7:+'
+//}
+
+android {
+ defaultConfig {
+ generatedDensities = []
+ applicationId = "org.nativescript.imagepickerdemoangular"
+ }
+ aaptOptions {
+ additionalParameters "--no-version-vectors"
+ }
+}
diff --git a/examples/ExampleImgPickNG/app/App_Resources/Android/drawable-hdpi/background.png b/demo-angular/app/App_Resources/Android/drawable-hdpi/background.png
similarity index 100%
rename from examples/ExampleImgPickNG/app/App_Resources/Android/drawable-hdpi/background.png
rename to demo-angular/app/App_Resources/Android/drawable-hdpi/background.png
diff --git a/examples/ExampleImgPick/app/App_Resources/Android/drawable-hdpi/icon.png b/demo-angular/app/App_Resources/Android/drawable-hdpi/icon.png
old mode 100755
new mode 100644
similarity index 100%
rename from examples/ExampleImgPick/app/App_Resources/Android/drawable-hdpi/icon.png
rename to demo-angular/app/App_Resources/Android/drawable-hdpi/icon.png
diff --git a/examples/ExampleImgPickNG/app/App_Resources/Android/drawable-hdpi/logo.png b/demo-angular/app/App_Resources/Android/drawable-hdpi/logo.png
similarity index 100%
rename from examples/ExampleImgPickNG/app/App_Resources/Android/drawable-hdpi/logo.png
rename to demo-angular/app/App_Resources/Android/drawable-hdpi/logo.png
diff --git a/examples/ExampleImgPickNG/app/App_Resources/Android/drawable-ldpi/background.png b/demo-angular/app/App_Resources/Android/drawable-ldpi/background.png
similarity index 100%
rename from examples/ExampleImgPickNG/app/App_Resources/Android/drawable-ldpi/background.png
rename to demo-angular/app/App_Resources/Android/drawable-ldpi/background.png
diff --git a/examples/ExampleImgPick/app/App_Resources/Android/drawable-ldpi/icon.png b/demo-angular/app/App_Resources/Android/drawable-ldpi/icon.png
old mode 100755
new mode 100644
similarity index 100%
rename from examples/ExampleImgPick/app/App_Resources/Android/drawable-ldpi/icon.png
rename to demo-angular/app/App_Resources/Android/drawable-ldpi/icon.png
diff --git a/examples/ExampleImgPickNG/app/App_Resources/Android/drawable-ldpi/logo.png b/demo-angular/app/App_Resources/Android/drawable-ldpi/logo.png
similarity index 100%
rename from examples/ExampleImgPickNG/app/App_Resources/Android/drawable-ldpi/logo.png
rename to demo-angular/app/App_Resources/Android/drawable-ldpi/logo.png
diff --git a/examples/ExampleImgPickNG/app/App_Resources/Android/drawable-mdpi/background.png b/demo-angular/app/App_Resources/Android/drawable-mdpi/background.png
similarity index 100%
rename from examples/ExampleImgPickNG/app/App_Resources/Android/drawable-mdpi/background.png
rename to demo-angular/app/App_Resources/Android/drawable-mdpi/background.png
diff --git a/examples/ExampleImgPick/app/App_Resources/Android/drawable-mdpi/icon.png b/demo-angular/app/App_Resources/Android/drawable-mdpi/icon.png
old mode 100755
new mode 100644
similarity index 100%
rename from examples/ExampleImgPick/app/App_Resources/Android/drawable-mdpi/icon.png
rename to demo-angular/app/App_Resources/Android/drawable-mdpi/icon.png
diff --git a/examples/ExampleImgPickNG/app/App_Resources/Android/drawable-mdpi/logo.png b/demo-angular/app/App_Resources/Android/drawable-mdpi/logo.png
similarity index 100%
rename from examples/ExampleImgPickNG/app/App_Resources/Android/drawable-mdpi/logo.png
rename to demo-angular/app/App_Resources/Android/drawable-mdpi/logo.png
diff --git a/examples/ExampleImgPickNG/app/App_Resources/Android/drawable-nodpi/splash_screen.xml b/demo-angular/app/App_Resources/Android/drawable-nodpi/splash_screen.xml
similarity index 100%
rename from examples/ExampleImgPickNG/app/App_Resources/Android/drawable-nodpi/splash_screen.xml
rename to demo-angular/app/App_Resources/Android/drawable-nodpi/splash_screen.xml
diff --git a/examples/ExampleImgPickNG/app/App_Resources/Android/drawable-xhdpi/background.png b/demo-angular/app/App_Resources/Android/drawable-xhdpi/background.png
similarity index 100%
rename from examples/ExampleImgPickNG/app/App_Resources/Android/drawable-xhdpi/background.png
rename to demo-angular/app/App_Resources/Android/drawable-xhdpi/background.png
diff --git a/examples/ExampleImgPickNG/app/App_Resources/Android/drawable-xhdpi/icon.png b/demo-angular/app/App_Resources/Android/drawable-xhdpi/icon.png
similarity index 100%
rename from examples/ExampleImgPickNG/app/App_Resources/Android/drawable-xhdpi/icon.png
rename to demo-angular/app/App_Resources/Android/drawable-xhdpi/icon.png
diff --git a/examples/ExampleImgPickNG/app/App_Resources/Android/drawable-xhdpi/logo.png b/demo-angular/app/App_Resources/Android/drawable-xhdpi/logo.png
similarity index 100%
rename from examples/ExampleImgPickNG/app/App_Resources/Android/drawable-xhdpi/logo.png
rename to demo-angular/app/App_Resources/Android/drawable-xhdpi/logo.png
diff --git a/examples/ExampleImgPickNG/app/App_Resources/Android/drawable-xxhdpi/background.png b/demo-angular/app/App_Resources/Android/drawable-xxhdpi/background.png
similarity index 100%
rename from examples/ExampleImgPickNG/app/App_Resources/Android/drawable-xxhdpi/background.png
rename to demo-angular/app/App_Resources/Android/drawable-xxhdpi/background.png
diff --git a/examples/ExampleImgPickNG/app/App_Resources/Android/drawable-xxhdpi/icon.png b/demo-angular/app/App_Resources/Android/drawable-xxhdpi/icon.png
similarity index 100%
rename from examples/ExampleImgPickNG/app/App_Resources/Android/drawable-xxhdpi/icon.png
rename to demo-angular/app/App_Resources/Android/drawable-xxhdpi/icon.png
diff --git a/examples/ExampleImgPickNG/app/App_Resources/Android/drawable-xxhdpi/logo.png b/demo-angular/app/App_Resources/Android/drawable-xxhdpi/logo.png
similarity index 100%
rename from examples/ExampleImgPickNG/app/App_Resources/Android/drawable-xxhdpi/logo.png
rename to demo-angular/app/App_Resources/Android/drawable-xxhdpi/logo.png
diff --git a/examples/ExampleImgPickNG/app/App_Resources/Android/drawable-xxxhdpi/background.png b/demo-angular/app/App_Resources/Android/drawable-xxxhdpi/background.png
similarity index 100%
rename from examples/ExampleImgPickNG/app/App_Resources/Android/drawable-xxxhdpi/background.png
rename to demo-angular/app/App_Resources/Android/drawable-xxxhdpi/background.png
diff --git a/examples/ExampleImgPickNG/app/App_Resources/Android/drawable-xxxhdpi/icon.png b/demo-angular/app/App_Resources/Android/drawable-xxxhdpi/icon.png
similarity index 100%
rename from examples/ExampleImgPickNG/app/App_Resources/Android/drawable-xxxhdpi/icon.png
rename to demo-angular/app/App_Resources/Android/drawable-xxxhdpi/icon.png
diff --git a/examples/ExampleImgPickNG/app/App_Resources/Android/drawable-xxxhdpi/logo.png b/demo-angular/app/App_Resources/Android/drawable-xxxhdpi/logo.png
similarity index 100%
rename from examples/ExampleImgPickNG/app/App_Resources/Android/drawable-xxxhdpi/logo.png
rename to demo-angular/app/App_Resources/Android/drawable-xxxhdpi/logo.png
diff --git a/examples/ExampleImgPickNG/app/App_Resources/Android/values-v21/colors.xml b/demo-angular/app/App_Resources/Android/values-v21/colors.xml
similarity index 100%
rename from examples/ExampleImgPickNG/app/App_Resources/Android/values-v21/colors.xml
rename to demo-angular/app/App_Resources/Android/values-v21/colors.xml
diff --git a/examples/ExampleImgPickNG/app/App_Resources/Android/values-v21/styles.xml b/demo-angular/app/App_Resources/Android/values-v21/styles.xml
similarity index 100%
rename from examples/ExampleImgPickNG/app/App_Resources/Android/values-v21/styles.xml
rename to demo-angular/app/App_Resources/Android/values-v21/styles.xml
diff --git a/examples/ExampleImgPickNG/app/App_Resources/Android/values/colors.xml b/demo-angular/app/App_Resources/Android/values/colors.xml
similarity index 100%
rename from examples/ExampleImgPickNG/app/App_Resources/Android/values/colors.xml
rename to demo-angular/app/App_Resources/Android/values/colors.xml
diff --git a/examples/ExampleImgPickNG/app/App_Resources/Android/values/styles.xml b/demo-angular/app/App_Resources/Android/values/styles.xml
similarity index 100%
rename from examples/ExampleImgPickNG/app/App_Resources/Android/values/styles.xml
rename to demo-angular/app/App_Resources/Android/values/styles.xml
diff --git a/examples/ExampleImgPickNG/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/Contents.json b/demo-angular/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/Contents.json
similarity index 100%
rename from examples/ExampleImgPickNG/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/Contents.json
rename to demo-angular/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/Contents.json
diff --git a/examples/ExampleImgPickNG/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29.png b/demo-angular/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29.png
similarity index 100%
rename from examples/ExampleImgPickNG/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29.png
rename to demo-angular/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29.png
diff --git a/examples/ExampleImgPickNG/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@2x.png b/demo-angular/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@2x.png
similarity index 100%
rename from examples/ExampleImgPickNG/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@2x.png
rename to demo-angular/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@2x.png
diff --git a/examples/ExampleImgPickNG/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@3x.png b/demo-angular/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@3x.png
similarity index 100%
rename from examples/ExampleImgPickNG/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@3x.png
rename to demo-angular/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@3x.png
diff --git a/examples/ExampleImgPickNG/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40.png b/demo-angular/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40.png
similarity index 100%
rename from examples/ExampleImgPickNG/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40.png
rename to demo-angular/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40.png
diff --git a/examples/ExampleImgPickNG/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@2x.png b/demo-angular/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@2x.png
similarity index 100%
rename from examples/ExampleImgPickNG/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@2x.png
rename to demo-angular/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@2x.png
diff --git a/examples/ExampleImgPickNG/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@3x.png b/demo-angular/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@3x.png
similarity index 100%
rename from examples/ExampleImgPickNG/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@3x.png
rename to demo-angular/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@3x.png
diff --git a/examples/ExampleImgPickNG/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-50.png b/demo-angular/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-50.png
old mode 100755
new mode 100644
similarity index 100%
rename from examples/ExampleImgPickNG/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-50.png
rename to demo-angular/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-50.png
diff --git a/examples/ExampleImgPickNG/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-50@2x.png b/demo-angular/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-50@2x.png
old mode 100755
new mode 100644
similarity index 100%
rename from examples/ExampleImgPickNG/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-50@2x.png
rename to demo-angular/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-50@2x.png
diff --git a/examples/ExampleImgPickNG/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-57.png b/demo-angular/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-57.png
old mode 100755
new mode 100644
similarity index 100%
rename from examples/ExampleImgPickNG/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-57.png
rename to demo-angular/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-57.png
diff --git a/examples/ExampleImgPickNG/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-57@2x.png b/demo-angular/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-57@2x.png
old mode 100755
new mode 100644
similarity index 100%
rename from examples/ExampleImgPickNG/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-57@2x.png
rename to demo-angular/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-57@2x.png
diff --git a/examples/ExampleImgPickNG/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@2x.png b/demo-angular/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@2x.png
similarity index 100%
rename from examples/ExampleImgPickNG/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@2x.png
rename to demo-angular/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@2x.png
diff --git a/examples/ExampleImgPickNG/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@3x.png b/demo-angular/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@3x.png
similarity index 100%
rename from examples/ExampleImgPickNG/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@3x.png
rename to demo-angular/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@3x.png
diff --git a/examples/ExampleImgPick/app/App_Resources/iOS/icon-72.png b/demo-angular/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-72.png
old mode 100755
new mode 100644
similarity index 100%
rename from examples/ExampleImgPick/app/App_Resources/iOS/icon-72.png
rename to demo-angular/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-72.png
diff --git a/examples/ExampleImgPick/app/App_Resources/iOS/icon-72@2x.png b/demo-angular/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-72@2x.png
old mode 100755
new mode 100644
similarity index 100%
rename from examples/ExampleImgPick/app/App_Resources/iOS/icon-72@2x.png
rename to demo-angular/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-72@2x.png
diff --git a/examples/ExampleImgPickNG/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76.png b/demo-angular/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76.png
similarity index 100%
rename from examples/ExampleImgPickNG/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76.png
rename to demo-angular/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76.png
diff --git a/examples/ExampleImgPickNG/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76@2x.png b/demo-angular/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76@2x.png
similarity index 100%
rename from examples/ExampleImgPickNG/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76@2x.png
rename to demo-angular/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76@2x.png
diff --git a/examples/ExampleImgPickNG/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-83.5@2x.png b/demo-angular/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-83.5@2x.png
similarity index 100%
rename from examples/ExampleImgPickNG/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-83.5@2x.png
rename to demo-angular/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-83.5@2x.png
diff --git a/examples/ExampleImgPickNG/app/App_Resources/iOS/Assets.xcassets/Contents.json b/demo-angular/app/App_Resources/iOS/Assets.xcassets/Contents.json
similarity index 100%
rename from examples/ExampleImgPickNG/app/App_Resources/iOS/Assets.xcassets/Contents.json
rename to demo-angular/app/App_Resources/iOS/Assets.xcassets/Contents.json
diff --git a/examples/ExampleImgPickNG/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Contents.json b/demo-angular/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Contents.json
similarity index 100%
rename from examples/ExampleImgPickNG/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Contents.json
rename to demo-angular/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Contents.json
diff --git a/examples/ExampleImgPick/app/App_Resources/iOS/Default-568h@2x.png b/demo-angular/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-568h@2x.png
old mode 100755
new mode 100644
similarity index 100%
rename from examples/ExampleImgPick/app/App_Resources/iOS/Default-568h@2x.png
rename to demo-angular/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-568h@2x.png
diff --git a/examples/ExampleImgPickNG/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-667h@2x.png b/demo-angular/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-667h@2x.png
similarity index 100%
rename from examples/ExampleImgPickNG/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-667h@2x.png
rename to demo-angular/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-667h@2x.png
diff --git a/examples/ExampleImgPickNG/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-736h@3x.png b/demo-angular/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-736h@3x.png
similarity index 100%
rename from examples/ExampleImgPickNG/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-736h@3x.png
rename to demo-angular/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-736h@3x.png
diff --git a/examples/ExampleImgPick/app/App_Resources/iOS/Default-Landscape.png b/demo-angular/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape.png
old mode 100755
new mode 100644
similarity index 100%
rename from examples/ExampleImgPick/app/App_Resources/iOS/Default-Landscape.png
rename to demo-angular/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape.png
diff --git a/examples/ExampleImgPick/app/App_Resources/iOS/Default-Landscape@2x.png b/demo-angular/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape@2x.png
old mode 100755
new mode 100644
similarity index 100%
rename from examples/ExampleImgPick/app/App_Resources/iOS/Default-Landscape@2x.png
rename to demo-angular/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape@2x.png
diff --git a/examples/ExampleImgPickNG/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape@3x.png b/demo-angular/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape@3x.png
similarity index 100%
rename from examples/ExampleImgPickNG/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape@3x.png
rename to demo-angular/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape@3x.png
diff --git a/examples/ExampleImgPick/app/App_Resources/iOS/Default-Portrait.png b/demo-angular/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait.png
old mode 100755
new mode 100644
similarity index 100%
rename from examples/ExampleImgPick/app/App_Resources/iOS/Default-Portrait.png
rename to demo-angular/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait.png
diff --git a/examples/ExampleImgPick/app/App_Resources/iOS/Default-Portrait@2x.png b/demo-angular/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait@2x.png
old mode 100755
new mode 100644
similarity index 100%
rename from examples/ExampleImgPick/app/App_Resources/iOS/Default-Portrait@2x.png
rename to demo-angular/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait@2x.png
diff --git a/examples/ExampleImgPick/app/App_Resources/iOS/Default.png b/demo-angular/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default.png
old mode 100755
new mode 100644
similarity index 100%
rename from examples/ExampleImgPick/app/App_Resources/iOS/Default.png
rename to demo-angular/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default.png
diff --git a/examples/ExampleImgPick/app/App_Resources/iOS/Default@2x.png b/demo-angular/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default@2x.png
old mode 100755
new mode 100644
similarity index 100%
rename from examples/ExampleImgPick/app/App_Resources/iOS/Default@2x.png
rename to demo-angular/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default@2x.png
diff --git a/examples/ExampleImgPickNG/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/Contents.json b/demo-angular/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/Contents.json
similarity index 100%
rename from examples/ExampleImgPickNG/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/Contents.json
rename to demo-angular/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/Contents.json
diff --git a/examples/ExampleImgPickNG/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill.png b/demo-angular/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill.png
similarity index 100%
rename from examples/ExampleImgPickNG/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill.png
rename to demo-angular/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill.png
diff --git a/examples/ExampleImgPickNG/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill@2x.png b/demo-angular/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill@2x.png
similarity index 100%
rename from examples/ExampleImgPickNG/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill@2x.png
rename to demo-angular/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill@2x.png
diff --git a/examples/ExampleImgPickNG/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/Contents.json b/demo-angular/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/Contents.json
similarity index 100%
rename from examples/ExampleImgPickNG/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/Contents.json
rename to demo-angular/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/Contents.json
diff --git a/examples/ExampleImgPickNG/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center.png b/demo-angular/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center.png
similarity index 100%
rename from examples/ExampleImgPickNG/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center.png
rename to demo-angular/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center.png
diff --git a/examples/ExampleImgPickNG/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center@2x.png b/demo-angular/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center@2x.png
similarity index 100%
rename from examples/ExampleImgPickNG/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center@2x.png
rename to demo-angular/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center@2x.png
diff --git a/examples/ExampleImgPickNG/app/App_Resources/iOS/Info.plist b/demo-angular/app/App_Resources/iOS/Info.plist
similarity index 100%
rename from examples/ExampleImgPickNG/app/App_Resources/iOS/Info.plist
rename to demo-angular/app/App_Resources/iOS/Info.plist
diff --git a/examples/ExampleImgPickNG/app/App_Resources/iOS/LaunchScreen.storyboard b/demo-angular/app/App_Resources/iOS/LaunchScreen.storyboard
similarity index 100%
rename from examples/ExampleImgPickNG/app/App_Resources/iOS/LaunchScreen.storyboard
rename to demo-angular/app/App_Resources/iOS/LaunchScreen.storyboard
diff --git a/examples/ExampleImgPickNG/app/App_Resources/iOS/build.xcconfig b/demo-angular/app/App_Resources/iOS/build.xcconfig
similarity index 53%
rename from examples/ExampleImgPickNG/app/App_Resources/iOS/build.xcconfig
rename to demo-angular/app/App_Resources/iOS/build.xcconfig
index 9d73843..0562055 100644
--- a/examples/ExampleImgPickNG/app/App_Resources/iOS/build.xcconfig
+++ b/demo-angular/app/App_Resources/iOS/build.xcconfig
@@ -1,7 +1,5 @@
// You can add custom settings here
// for example you can uncomment the following line to force distribution code signing
// CODE_SIGN_IDENTITY = iPhone Distribution
-// To build for device with XCode 8 you need to specify your development team. More info: https://developer.apple.com/library/prerelease/content/releasenotes/DeveloperTools/RN-Xcode/Introduction.html
-// DEVELOPMENT_TEAM = YOUR_TEAM_ID;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
diff --git a/examples/ExampleImgPickNG/app/app.component.html b/demo-angular/app/app.component.html
similarity index 97%
rename from examples/ExampleImgPickNG/app/app.component.html
rename to demo-angular/app/app.component.html
index 672333e..7efff0d 100644
--- a/examples/ExampleImgPickNG/app/app.component.html
+++ b/demo-angular/app/app.component.html
@@ -6,7 +6,7 @@
-
+
diff --git a/demo-angular/app/app.component.ts b/demo-angular/app/app.component.ts
new file mode 100644
index 0000000..b35dd6f
--- /dev/null
+++ b/demo-angular/app/app.component.ts
@@ -0,0 +1,53 @@
+import { Component, ChangeDetectorRef } from "@angular/core";
+import { ListView } from "tns-core-modules/ui/list-view";
+import { isAndroid } from "tns-core-modules/platform";
+import * as imagepicker from "nativescript-imagepicker";
+
+@Component({
+ selector: "my-app",
+ templateUrl: "app.component.html",
+})
+export class AppComponent {
+
+ items = [];
+
+ constructor(private _changeDetectionRef: ChangeDetectorRef) {
+ }
+
+ onSelectMultipleTap() {
+ let context = imagepicker.create({
+ mode: "multiple"
+ });
+ this.startSelection(context);
+ }
+
+ onSelectSingleTap() {
+ let context = imagepicker.create({
+ mode: "single"
+ });
+ this.startSelection(context);
+ }
+
+ startSelection(context) {
+ let _that = this;
+
+ context
+ .authorize()
+ .then(() => {
+ _that.items = [];
+ return context.present();
+ })
+ .then((selection) => {
+ console.log("Selection done:");
+ selection.forEach(function (selected) {
+ console.log("----------------");
+ console.log("uri: " + selected.uri);
+ console.log("fileUri: " + selected.fileUri);
+ });
+ _that.items = selection;
+ _that._changeDetectionRef.detectChanges();
+ }).catch(function (e) {
+ console.log(e);
+ });
+ }
+}
diff --git a/examples/ExampleImgPickNG/app/app.css b/demo-angular/app/app.css
similarity index 87%
rename from examples/ExampleImgPickNG/app/app.css
rename to demo-angular/app/app.css
index 167390c..3d1ec43 100644
--- a/examples/ExampleImgPickNG/app/app.css
+++ b/demo-angular/app/app.css
@@ -1,7 +1,7 @@
-@import '~/css/core.light.css';
-
+@import '~/css/core.light.css';
+
button, label, stack-layout {
- horizontal-align: center;
+ horizontal-align: center;
}
button {
diff --git a/examples/ExampleImgPickNG/app/app.module.ts b/demo-angular/app/app.module.ts
similarity index 100%
rename from examples/ExampleImgPickNG/app/app.module.ts
rename to demo-angular/app/app.module.ts
diff --git a/examples/ExampleImgPickNG/app/main.aot.ts b/demo-angular/app/main.aot.ts
similarity index 100%
rename from examples/ExampleImgPickNG/app/main.aot.ts
rename to demo-angular/app/main.aot.ts
diff --git a/examples/ExampleImgPickNG/app/main.ts b/demo-angular/app/main.ts
similarity index 100%
rename from examples/ExampleImgPickNG/app/main.ts
rename to demo-angular/app/main.ts
diff --git a/examples/ExampleImgPickNG/app/package.json b/demo-angular/app/package.json
similarity index 52%
rename from examples/ExampleImgPickNG/app/package.json
rename to demo-angular/app/package.json
index f2346d7..647b454 100644
--- a/examples/ExampleImgPickNG/app/package.json
+++ b/demo-angular/app/package.json
@@ -3,6 +3,6 @@
"v8Flags": "--expose_gc"
},
"main": "main.js",
- "name": "tns-template-hello-world-ng",
- "version": "3.0.0-rc.1"
+ "name": "tns-template-hello-world",
+ "version": "3.1.0"
}
diff --git a/demo-angular/app/tests/tests.js b/demo-angular/app/tests/tests.js
new file mode 100644
index 0000000..d3c9b80
--- /dev/null
+++ b/demo-angular/app/tests/tests.js
@@ -0,0 +1,12 @@
+// var ImagePicker = require("nativescript-imagepicker").ImagePicker;
+// var imagePicker = new ImagePicker();
+
+// describe("greet function", function() {
+// it("exists", function() {
+// expect(yourPlugin.greet).toBeDefined();
+// });
+
+// it("returns a string", function() {
+// expect(yourPlugin.greet()).toEqual("Hello, NS");
+// });
+// });
\ No newline at end of file
diff --git a/demo-angular/app/vendor-platform.android.ts b/demo-angular/app/vendor-platform.android.ts
new file mode 100644
index 0000000..c9a8794
--- /dev/null
+++ b/demo-angular/app/vendor-platform.android.ts
@@ -0,0 +1,9 @@
+require("application");
+if (!global["__snapshot"]) {
+ /*
+ In case snapshot generation is enabled these modules will get into the bundle but will not be required/evaluated.
+ The snapshot webpack plugin will add them to the tns-java-classes.js bundle file. This way, they will be evaluated on app start as early as possible.
+ */
+ require("ui/frame");
+ require("ui/frame/activity");
+}
diff --git a/examples/ExampleImgPickNG/app/vendor-platform.ios.ts b/demo-angular/app/vendor-platform.ios.ts
similarity index 100%
rename from examples/ExampleImgPickNG/app/vendor-platform.ios.ts
rename to demo-angular/app/vendor-platform.ios.ts
diff --git a/examples/ExampleImgPickNG/app/vendor.ts b/demo-angular/app/vendor.ts
similarity index 100%
rename from examples/ExampleImgPickNG/app/vendor.ts
rename to demo-angular/app/vendor.ts
diff --git a/demo-angular/karma.conf.js b/demo-angular/karma.conf.js
new file mode 100644
index 0000000..91d9c28
--- /dev/null
+++ b/demo-angular/karma.conf.js
@@ -0,0 +1,77 @@
+module.exports = function(config) {
+ config.set({
+
+ // base path that will be used to resolve all patterns (eg. files, exclude)
+ basePath: '',
+
+
+ // frameworks to use
+ // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
+ frameworks: ['jasmine'],
+
+
+ // list of files / patterns to load in the browser
+ files: [
+ 'app/**/*.js',
+ ],
+
+
+ // list of files to exclude
+ exclude: [
+ ],
+
+
+ // preprocess matching files before serving them to the browser
+ // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
+ preprocessors: {
+ },
+
+
+ // test results reporter to use
+ // possible values: 'dots', 'progress'
+ // available reporters: https://npmjs.org/browse/keyword/karma-reporter
+ reporters: ['progress'],
+
+
+ // web server port
+ port: 9876,
+
+
+ // enable / disable colors in the output (reporters and logs)
+ colors: true,
+
+
+ // level of logging
+ // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
+ logLevel: config.LOG_INFO,
+
+
+ // enable / disable watching file and executing tests whenever any file changes
+ autoWatch: true,
+
+
+ // start these browsers
+ // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
+ browsers: [],
+
+ customLaunchers: {
+ android: {
+ base: 'NS',
+ platform: 'android'
+ },
+ ios: {
+ base: 'NS',
+ platform: 'ios'
+ },
+ ios_simulator: {
+ base: 'NS',
+ platform: 'ios',
+ arguments: ['--emulator']
+ }
+ },
+
+ // Continuous Integration mode
+ // if true, Karma captures browsers, runs the tests and exits
+ singleRun: true
+ });
+};
diff --git a/demo-angular/package.json b/demo-angular/package.json
new file mode 100644
index 0000000..b593e04
--- /dev/null
+++ b/demo-angular/package.json
@@ -0,0 +1,68 @@
+{
+ "nativescript": {
+ "id": "org.nativescript.imagepickerdemoangular",
+ "tns-ios": {
+ "version": "3.1.0"
+ },
+ "tns-android": {
+ "version": "3.1.1"
+ }
+ },
+ "dependencies": {
+ "@angular/common": "~4.1.0",
+ "@angular/compiler": "~4.1.0",
+ "@angular/core": "~4.1.0",
+ "@angular/forms": "~4.1.0",
+ "@angular/http": "~4.1.0",
+ "@angular/platform-browser": "~4.1.0",
+ "@angular/platform-browser-dynamic": "~4.1.0",
+ "@angular/router": "~4.1.0",
+ "nativescript-angular": "~3.1.0",
+ "nativescript-imagepicker": "../src",
+ "nativescript-theme-core": "^1.0.4",
+ "nativescript-unit-test-runner": "^0.3.4",
+ "reflect-metadata": "~0.1.8",
+ "rxjs": "^5.3.0",
+ "tns-core-modules": "^3.0.0"
+ },
+ "devDependencies": {
+ "@angular/compiler-cli": "~4.1.0",
+ "@ngtools/webpack": "~1.5.0",
+ "babel-traverse": "6.24.1",
+ "babel-types": "6.24.1",
+ "babylon": "6.16.1",
+ "copy-webpack-plugin": "~4.0.1",
+ "extract-text-webpack-plugin": "~3.0.0",
+ "lazy": "1.0.11",
+ "nativescript-css-loader": "~0.26.0",
+ "nativescript-dev-typescript": "^0.4.2",
+ "nativescript-dev-webpack": "^0.7.3",
+ "raw-loader": "~0.5.1",
+ "resolve-url-loader": "~2.1.0",
+ "typescript": "~2.3.4",
+ "webpack": "~3.2.0",
+ "webpack-sources": "~1.0.1",
+ "zone.js": "^0.8.5",
+ "filewalker": "0.1.2",
+ "jasmine-core": "^2.5.2",
+ "karma": "^1.3.0",
+ "karma-jasmine": "^1.0.2",
+ "karma-nativescript-launcher": "^0.4.0",
+ "tslint": "~5.4.3",
+ "webpack-bundle-analyzer": "^2.8.2",
+ "tns-platform-declarations": "^3.0.0"
+ },
+ "scripts": {
+ "build.plugin": "cd ../src && npm run build",
+ "ci.tslint": "npm i && tslint --config '../tslint.json' 'app/**/*.ts' --exclude '**/node_modules/**'",
+ "ci.android.build": "npm run build.plugin && tns build android",
+ "ci.ios.build": "npm run build.plugin && tns build ios",
+ "ns-bundle": "ns-bundle",
+ "publish-ios-bundle": "npm run ns-bundle --ios --publish-app",
+ "generate-android-snapshot": "generate-android-snapshot --targetArchs arm,arm64,ia32 --install",
+ "start-android-bundle": "npm run ns-bundle --android --run-app",
+ "start-ios-bundle": "npm run ns-bundle --ios --run-app",
+ "build-android-bundle": "npm run ns-bundle --android --build-app",
+ "build-ios-bundle": "npm run ns-bundle --ios --build-app"
+ }
+}
diff --git a/examples/ExampleImgPickNG/tsconfig.aot.json b/demo-angular/tsconfig.aot.json
similarity index 79%
rename from examples/ExampleImgPickNG/tsconfig.aot.json
rename to demo-angular/tsconfig.aot.json
index b1221e9..a0c68e2 100644
--- a/examples/ExampleImgPickNG/tsconfig.aot.json
+++ b/demo-angular/tsconfig.aot.json
@@ -1,33 +1,38 @@
{
- "extend": "./tsconfig",
+ "extends": "./tsconfig",
"compilerOptions": {
"baseUrl": ".",
"paths": {
- "ui/*": ["node_modules/tns-core-modules/ui/*"],
- "platform": ["node_modules/tns-core-modules/platform"],
- "image-source": ["node_modules/tns-core-modules/image-source"],
- "xml": ["node_modules/tns-core-modules/xml"],
- "xhr": ["node_modules/tns-core-modules/xhr"],
- "text": ["node_modules/tns-core-modules/text"],
- "data": ["node_modules/tns-core-modules/data"],
- "fetch": ["node_modules/tns-core-modules/fetch"],
- "trace": ["node_modules/tns-core-modules/trace"],
- "fps-meter": ["node_modules/tns-core-modules/fps-meter"],
- "color": ["node_modules/tns-core-modules/color"],
+ "application": ["node_modules/tns-core-modules/application"],
"application-settings": ["node_modules/tns-core-modules/application-settings"],
- "http": ["node_modules/tns-core-modules/http"],
"camera": ["node_modules/tns-core-modules/camera"],
+ "color": ["node_modules/tns-core-modules/color"],
+ "connectivity": ["node_modules/tns-core-modules/connectivity"],
"console": ["node_modules/tns-core-modules/console"],
- "timer": ["node_modules/tns-core-modules/timer"],
- "utils": ["node_modules/tns-core-modules/utils"],
- "location": ["node_modules/tns-core-modules/location"],
+ "data/*": ["node_modules/tns-core-modules/data/*"],
+ "fetch": ["node_modules/tns-core-modules/fetch"],
"file-system": ["node_modules/tns-core-modules/file-system"],
- "application": ["node_modules/tns-core-modules/application"],
+ "fps-meter": ["node_modules/tns-core-modules/fps-meter"],
+ "globals": ["node_modules/tns-core-modules/globals"],
+ "http": ["node_modules/tns-core-modules/http"],
"image-asset": ["node_modules/tns-core-modules/image-asset"],
- "connectivity": ["node_modules/tns-core-modules/connectivity"],
- "globals": ["node_modules/tns-core-modules/globals"]
- }
+ "image-source": ["node_modules/tns-core-modules/image-source"],
+ "location": ["node_modules/tns-core-modules/location"],
+ "platform": ["node_modules/tns-core-modules/platform"],
+ "text": ["node_modules/tns-core-modules/text"],
+ "timer": ["node_modules/tns-core-modules/timer"],
+ "trace": ["node_modules/tns-core-modules/trace"],
+ "ui/*": ["node_modules/tns-core-modules/ui/*"],
+ "utils/*": ["node_modules/tns-core-modules/utils/*"],
+ "xhr": ["node_modules/tns-core-modules/xhr"],
+ "xml": ["node_modules/tns-core-modules/xml"]
+ },
+ "skipLibCheck": true
},
+ "exclude": [
+ "node_modules",
+ "platforms"
+ ],
"angularCompilerOptions": {
"skipMetadataEmit": true,
"genDir": "./"
diff --git a/examples/ExampleImgPickNG/tsconfig.json b/demo-angular/tsconfig.json
similarity index 57%
rename from examples/ExampleImgPickNG/tsconfig.json
rename to demo-angular/tsconfig.json
index 19bd5e8..00eee17 100644
--- a/examples/ExampleImgPickNG/tsconfig.json
+++ b/demo-angular/tsconfig.json
@@ -1,20 +1,28 @@
{
"compilerOptions": {
- "module": "commonjs",
"target": "es5",
- "experimentalDecorators": true,
+ "module": "commonjs",
+ "declaration": false,
+ "removeComments": true,
+ "noLib": false,
"emitDecoratorMetadata": true,
- "noEmitHelpers": true,
- "noEmitOnError": false,
+ "experimentalDecorators": true,
"lib": [
- "es2015.iterable",
"es6",
"dom"
],
+ "pretty": true,
+ "allowUnreachableCode": false,
+ "allowUnusedLabels": false,
+ "noEmitHelpers": true,
+ "noEmitOnError": false,
+ "noImplicitAny": false,
+ "noImplicitReturns": true,
+ "noImplicitUseStrict": false,
+ "noFallthroughCasesInSwitch": true,
"baseUrl": ".",
"paths": {
"*": [
- "./node_modules/tns-core-modules/*",
"./node_modules/*"
]
}
@@ -23,5 +31,6 @@
"node_modules",
"platforms",
"**/*.aot.ts"
- ]
+ ],
+ "compileOnSave": false
}
\ No newline at end of file
diff --git a/examples/ExampleImgPick/app/App_Resources/Android/AndroidManifest.xml b/demo/app/App_Resources/Android/AndroidManifest.xml
similarity index 86%
rename from examples/ExampleImgPick/app/App_Resources/Android/AndroidManifest.xml
rename to demo/app/App_Resources/Android/AndroidManifest.xml
index 8d827dc..9db8321 100644
--- a/examples/ExampleImgPick/app/App_Resources/Android/AndroidManifest.xml
+++ b/demo/app/App_Resources/Android/AndroidManifest.xml
@@ -23,15 +23,18 @@
android:allowBackup="true"
android:icon="@drawable/icon"
android:label="@string/app_name"
- android:theme="@style/AppTheme" >
+ android:theme="@style/AppTheme">
+
+ android:configChanges="keyboardHidden|orientation|screenSize"
+ android:theme="@style/LaunchScreenTheme">
-
-
+
+
+
diff --git a/examples/ExampleImgPickNG/app/App_Resources/Android/app.gradle b/demo/app/App_Resources/Android/app.gradle
similarity index 83%
rename from examples/ExampleImgPickNG/app/App_Resources/Android/app.gradle
rename to demo/app/App_Resources/Android/app.gradle
index 5795f4c..d80211c 100644
--- a/examples/ExampleImgPickNG/app/App_Resources/Android/app.gradle
+++ b/demo/app/App_Resources/Android/app.gradle
@@ -8,7 +8,7 @@
android {
defaultConfig {
generatedDensities = []
- applicationId = "org.nativescript.ExampleImgPickNG"
+ applicationId = "org.nativescript.imagepickerdemo"
}
aaptOptions {
additionalParameters "--no-version-vectors"
diff --git a/demo/app/App_Resources/Android/drawable-hdpi/background.png b/demo/app/App_Resources/Android/drawable-hdpi/background.png
new file mode 100644
index 0000000..eb381c2
Binary files /dev/null and b/demo/app/App_Resources/Android/drawable-hdpi/background.png differ
diff --git a/examples/ExampleImgPickNG/app/App_Resources/Android/drawable-hdpi/icon.png b/demo/app/App_Resources/Android/drawable-hdpi/icon.png
old mode 100755
new mode 100644
similarity index 100%
rename from examples/ExampleImgPickNG/app/App_Resources/Android/drawable-hdpi/icon.png
rename to demo/app/App_Resources/Android/drawable-hdpi/icon.png
diff --git a/demo/app/App_Resources/Android/drawable-hdpi/logo.png b/demo/app/App_Resources/Android/drawable-hdpi/logo.png
new file mode 100644
index 0000000..5218f4c
Binary files /dev/null and b/demo/app/App_Resources/Android/drawable-hdpi/logo.png differ
diff --git a/demo/app/App_Resources/Android/drawable-ldpi/background.png b/demo/app/App_Resources/Android/drawable-ldpi/background.png
new file mode 100644
index 0000000..748b2ad
Binary files /dev/null and b/demo/app/App_Resources/Android/drawable-ldpi/background.png differ
diff --git a/examples/ExampleImgPickNG/app/App_Resources/Android/drawable-ldpi/icon.png b/demo/app/App_Resources/Android/drawable-ldpi/icon.png
old mode 100755
new mode 100644
similarity index 100%
rename from examples/ExampleImgPickNG/app/App_Resources/Android/drawable-ldpi/icon.png
rename to demo/app/App_Resources/Android/drawable-ldpi/icon.png
diff --git a/demo/app/App_Resources/Android/drawable-ldpi/logo.png b/demo/app/App_Resources/Android/drawable-ldpi/logo.png
new file mode 100644
index 0000000..b9e102a
Binary files /dev/null and b/demo/app/App_Resources/Android/drawable-ldpi/logo.png differ
diff --git a/demo/app/App_Resources/Android/drawable-mdpi/background.png b/demo/app/App_Resources/Android/drawable-mdpi/background.png
new file mode 100644
index 0000000..efeaf29
Binary files /dev/null and b/demo/app/App_Resources/Android/drawable-mdpi/background.png differ
diff --git a/examples/ExampleImgPickNG/app/App_Resources/Android/drawable-mdpi/icon.png b/demo/app/App_Resources/Android/drawable-mdpi/icon.png
old mode 100755
new mode 100644
similarity index 100%
rename from examples/ExampleImgPickNG/app/App_Resources/Android/drawable-mdpi/icon.png
rename to demo/app/App_Resources/Android/drawable-mdpi/icon.png
diff --git a/demo/app/App_Resources/Android/drawable-mdpi/logo.png b/demo/app/App_Resources/Android/drawable-mdpi/logo.png
new file mode 100644
index 0000000..6263387
Binary files /dev/null and b/demo/app/App_Resources/Android/drawable-mdpi/logo.png differ
diff --git a/demo/app/App_Resources/Android/drawable-nodpi/splash_screen.xml b/demo/app/App_Resources/Android/drawable-nodpi/splash_screen.xml
new file mode 100644
index 0000000..ada77f9
--- /dev/null
+++ b/demo/app/App_Resources/Android/drawable-nodpi/splash_screen.xml
@@ -0,0 +1,8 @@
+
+ -
+
+
+ -
+
+
+
\ No newline at end of file
diff --git a/demo/app/App_Resources/Android/drawable-xhdpi/background.png b/demo/app/App_Resources/Android/drawable-xhdpi/background.png
new file mode 100644
index 0000000..612bbd0
Binary files /dev/null and b/demo/app/App_Resources/Android/drawable-xhdpi/background.png differ
diff --git a/demo/app/App_Resources/Android/drawable-xhdpi/icon.png b/demo/app/App_Resources/Android/drawable-xhdpi/icon.png
new file mode 100644
index 0000000..f291882
Binary files /dev/null and b/demo/app/App_Resources/Android/drawable-xhdpi/icon.png differ
diff --git a/demo/app/App_Resources/Android/drawable-xhdpi/logo.png b/demo/app/App_Resources/Android/drawable-xhdpi/logo.png
new file mode 100644
index 0000000..ad8ee2f
Binary files /dev/null and b/demo/app/App_Resources/Android/drawable-xhdpi/logo.png differ
diff --git a/demo/app/App_Resources/Android/drawable-xxhdpi/background.png b/demo/app/App_Resources/Android/drawable-xxhdpi/background.png
new file mode 100644
index 0000000..0fa88e2
Binary files /dev/null and b/demo/app/App_Resources/Android/drawable-xxhdpi/background.png differ
diff --git a/examples/ExampleImgPickNG/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-72@2x.png b/demo/app/App_Resources/Android/drawable-xxhdpi/icon.png
old mode 100755
new mode 100644
similarity index 100%
rename from examples/ExampleImgPickNG/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-72@2x.png
rename to demo/app/App_Resources/Android/drawable-xxhdpi/icon.png
diff --git a/demo/app/App_Resources/Android/drawable-xxhdpi/logo.png b/demo/app/App_Resources/Android/drawable-xxhdpi/logo.png
new file mode 100644
index 0000000..6683278
Binary files /dev/null and b/demo/app/App_Resources/Android/drawable-xxhdpi/logo.png differ
diff --git a/demo/app/App_Resources/Android/drawable-xxxhdpi/background.png b/demo/app/App_Resources/Android/drawable-xxxhdpi/background.png
new file mode 100644
index 0000000..c650f64
Binary files /dev/null and b/demo/app/App_Resources/Android/drawable-xxxhdpi/background.png differ
diff --git a/demo/app/App_Resources/Android/drawable-xxxhdpi/icon.png b/demo/app/App_Resources/Android/drawable-xxxhdpi/icon.png
new file mode 100644
index 0000000..50887a8
Binary files /dev/null and b/demo/app/App_Resources/Android/drawable-xxxhdpi/icon.png differ
diff --git a/demo/app/App_Resources/Android/drawable-xxxhdpi/logo.png b/demo/app/App_Resources/Android/drawable-xxxhdpi/logo.png
new file mode 100644
index 0000000..fa6331c
Binary files /dev/null and b/demo/app/App_Resources/Android/drawable-xxxhdpi/logo.png differ
diff --git a/demo/app/App_Resources/Android/values-v21/colors.xml b/demo/app/App_Resources/Android/values-v21/colors.xml
new file mode 100644
index 0000000..a64641a
--- /dev/null
+++ b/demo/app/App_Resources/Android/values-v21/colors.xml
@@ -0,0 +1,4 @@
+
+
+ #3d5afe
+
\ No newline at end of file
diff --git a/demo/app/App_Resources/Android/values-v21/styles.xml b/demo/app/App_Resources/Android/values-v21/styles.xml
new file mode 100644
index 0000000..dac8727
--- /dev/null
+++ b/demo/app/App_Resources/Android/values-v21/styles.xml
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/demo/app/App_Resources/Android/values/colors.xml b/demo/app/App_Resources/Android/values/colors.xml
new file mode 100644
index 0000000..74ad882
--- /dev/null
+++ b/demo/app/App_Resources/Android/values/colors.xml
@@ -0,0 +1,7 @@
+
+
+ #F5F5F5
+ #757575
+ #33B5E5
+ #272734
+
\ No newline at end of file
diff --git a/demo/app/App_Resources/Android/values/styles.xml b/demo/app/App_Resources/Android/values/styles.xml
new file mode 100644
index 0000000..1e8c7f2
--- /dev/null
+++ b/demo/app/App_Resources/Android/values/styles.xml
@@ -0,0 +1,45 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/Contents.json b/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/Contents.json
new file mode 100644
index 0000000..5f53593
--- /dev/null
+++ b/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/Contents.json
@@ -0,0 +1,128 @@
+{
+ "images" : [
+ {
+ "size" : "29x29",
+ "idiom" : "iphone",
+ "filename" : "icon-29.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "29x29",
+ "idiom" : "iphone",
+ "filename" : "icon-29@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "29x29",
+ "idiom" : "iphone",
+ "filename" : "icon-29@3x.png",
+ "scale" : "3x"
+ },
+ {
+ "size" : "40x40",
+ "idiom" : "iphone",
+ "filename" : "icon-40@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "40x40",
+ "idiom" : "iphone",
+ "filename" : "icon-40@3x.png",
+ "scale" : "3x"
+ },
+ {
+ "size" : "57x57",
+ "idiom" : "iphone",
+ "filename" : "icon-57.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "57x57",
+ "idiom" : "iphone",
+ "filename" : "icon-57@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "60x60",
+ "idiom" : "iphone",
+ "filename" : "icon-60@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "60x60",
+ "idiom" : "iphone",
+ "filename" : "icon-60@3x.png",
+ "scale" : "3x"
+ },
+ {
+ "size" : "29x29",
+ "idiom" : "ipad",
+ "filename" : "icon-29.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "29x29",
+ "idiom" : "ipad",
+ "filename" : "icon-29@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "40x40",
+ "idiom" : "ipad",
+ "filename" : "icon-40.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "40x40",
+ "idiom" : "ipad",
+ "filename" : "icon-40@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "50x50",
+ "idiom" : "ipad",
+ "filename" : "icon-50.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "50x50",
+ "idiom" : "ipad",
+ "filename" : "icon-50@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "72x72",
+ "idiom" : "ipad",
+ "filename" : "icon-72.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "72x72",
+ "idiom" : "ipad",
+ "filename" : "icon-72@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "76x76",
+ "idiom" : "ipad",
+ "filename" : "icon-76.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "76x76",
+ "idiom" : "ipad",
+ "filename" : "icon-76@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "83.5x83.5",
+ "idiom" : "ipad",
+ "filename" : "icon-83.5@2x.png",
+ "scale" : "2x"
+ }
+ ],
+ "info" : {
+ "version" : 1,
+ "author" : "xcode"
+ }
+}
\ No newline at end of file
diff --git a/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29.png b/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29.png
new file mode 100644
index 0000000..9e15af0
Binary files /dev/null and b/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29.png differ
diff --git a/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@2x.png b/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@2x.png
new file mode 100644
index 0000000..7b9e555
Binary files /dev/null and b/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@2x.png differ
diff --git a/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@3x.png b/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@3x.png
new file mode 100644
index 0000000..76f61ec
Binary files /dev/null and b/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@3x.png differ
diff --git a/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40.png b/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40.png
new file mode 100644
index 0000000..15b06db
Binary files /dev/null and b/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40.png differ
diff --git a/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@2x.png b/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@2x.png
new file mode 100644
index 0000000..585065f
Binary files /dev/null and b/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@2x.png differ
diff --git a/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@3x.png b/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@3x.png
new file mode 100644
index 0000000..a450c42
Binary files /dev/null and b/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@3x.png differ
diff --git a/examples/ExampleImgPick/app/App_Resources/iOS/Icon-Small-50.png b/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-50.png
old mode 100755
new mode 100644
similarity index 100%
rename from examples/ExampleImgPick/app/App_Resources/iOS/Icon-Small-50.png
rename to demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-50.png
diff --git a/examples/ExampleImgPick/app/App_Resources/iOS/Icon-Small-50@2x.png b/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-50@2x.png
old mode 100755
new mode 100644
similarity index 100%
rename from examples/ExampleImgPick/app/App_Resources/iOS/Icon-Small-50@2x.png
rename to demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-50@2x.png
diff --git a/examples/ExampleImgPick/app/App_Resources/iOS/icon.png b/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-57.png
old mode 100755
new mode 100644
similarity index 100%
rename from examples/ExampleImgPick/app/App_Resources/iOS/icon.png
rename to demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-57.png
diff --git a/examples/ExampleImgPick/app/App_Resources/iOS/icon@2x.png b/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-57@2x.png
old mode 100755
new mode 100644
similarity index 100%
rename from examples/ExampleImgPick/app/App_Resources/iOS/icon@2x.png
rename to demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-57@2x.png
diff --git a/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@2x.png b/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@2x.png
new file mode 100644
index 0000000..457b6d9
Binary files /dev/null and b/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@2x.png differ
diff --git a/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@3x.png b/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@3x.png
new file mode 100644
index 0000000..fa5a6ac
Binary files /dev/null and b/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@3x.png differ
diff --git a/examples/ExampleImgPickNG/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-72.png b/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-72.png
old mode 100755
new mode 100644
similarity index 100%
rename from examples/ExampleImgPickNG/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-72.png
rename to demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-72.png
diff --git a/examples/ExampleImgPick/app/App_Resources/iOS/icon-60@2x.png b/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-72@2x.png
old mode 100755
new mode 100644
similarity index 65%
rename from examples/ExampleImgPick/app/App_Resources/iOS/icon-60@2x.png
rename to demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-72@2x.png
index 693f67f..4f69cb2
Binary files a/examples/ExampleImgPick/app/App_Resources/iOS/icon-60@2x.png and b/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-72@2x.png differ
diff --git a/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76.png b/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76.png
new file mode 100644
index 0000000..94abcf7
Binary files /dev/null and b/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76.png differ
diff --git a/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76@2x.png b/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76@2x.png
new file mode 100644
index 0000000..2e71dd3
Binary files /dev/null and b/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76@2x.png differ
diff --git a/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-83.5@2x.png b/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-83.5@2x.png
new file mode 100644
index 0000000..4abc9ec
Binary files /dev/null and b/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-83.5@2x.png differ
diff --git a/demo/app/App_Resources/iOS/Assets.xcassets/Contents.json b/demo/app/App_Resources/iOS/Assets.xcassets/Contents.json
new file mode 100644
index 0000000..da4a164
--- /dev/null
+++ b/demo/app/App_Resources/iOS/Assets.xcassets/Contents.json
@@ -0,0 +1,6 @@
+{
+ "info" : {
+ "version" : 1,
+ "author" : "xcode"
+ }
+}
\ No newline at end of file
diff --git a/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Contents.json b/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Contents.json
new file mode 100644
index 0000000..4414bad
--- /dev/null
+++ b/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Contents.json
@@ -0,0 +1,158 @@
+{
+ "images" : [
+ {
+ "extent" : "full-screen",
+ "idiom" : "iphone",
+ "subtype" : "736h",
+ "filename" : "Default-736h@3x.png",
+ "minimum-system-version" : "8.0",
+ "orientation" : "portrait",
+ "scale" : "3x"
+ },
+ {
+ "extent" : "full-screen",
+ "idiom" : "iphone",
+ "subtype" : "736h",
+ "filename" : "Default-Landscape@3x.png",
+ "minimum-system-version" : "8.0",
+ "orientation" : "landscape",
+ "scale" : "3x"
+ },
+ {
+ "extent" : "full-screen",
+ "idiom" : "iphone",
+ "subtype" : "667h",
+ "filename" : "Default-667h@2x.png",
+ "minimum-system-version" : "8.0",
+ "orientation" : "portrait",
+ "scale" : "2x"
+ },
+ {
+ "orientation" : "portrait",
+ "idiom" : "iphone",
+ "filename" : "Default@2x.png",
+ "extent" : "full-screen",
+ "minimum-system-version" : "7.0",
+ "scale" : "2x"
+ },
+ {
+ "extent" : "full-screen",
+ "idiom" : "iphone",
+ "subtype" : "retina4",
+ "filename" : "Default-568h@2x.png",
+ "minimum-system-version" : "7.0",
+ "orientation" : "portrait",
+ "scale" : "2x"
+ },
+ {
+ "orientation" : "portrait",
+ "idiom" : "ipad",
+ "filename" : "Default-Portrait.png",
+ "extent" : "full-screen",
+ "minimum-system-version" : "7.0",
+ "scale" : "1x"
+ },
+ {
+ "orientation" : "landscape",
+ "idiom" : "ipad",
+ "filename" : "Default-Landscape.png",
+ "extent" : "full-screen",
+ "minimum-system-version" : "7.0",
+ "scale" : "1x"
+ },
+ {
+ "orientation" : "portrait",
+ "idiom" : "ipad",
+ "filename" : "Default-Portrait@2x.png",
+ "extent" : "full-screen",
+ "minimum-system-version" : "7.0",
+ "scale" : "2x"
+ },
+ {
+ "orientation" : "landscape",
+ "idiom" : "ipad",
+ "filename" : "Default-Landscape@2x.png",
+ "extent" : "full-screen",
+ "minimum-system-version" : "7.0",
+ "scale" : "2x"
+ },
+ {
+ "orientation" : "portrait",
+ "idiom" : "iphone",
+ "filename" : "Default.png",
+ "extent" : "full-screen",
+ "scale" : "1x"
+ },
+ {
+ "orientation" : "portrait",
+ "idiom" : "iphone",
+ "filename" : "Default@2x.png",
+ "extent" : "full-screen",
+ "scale" : "2x"
+ },
+ {
+ "orientation" : "portrait",
+ "idiom" : "iphone",
+ "filename" : "Default-568h@2x.png",
+ "extent" : "full-screen",
+ "subtype" : "retina4",
+ "scale" : "2x"
+ },
+ {
+ "orientation" : "portrait",
+ "idiom" : "ipad",
+ "extent" : "to-status-bar",
+ "scale" : "1x"
+ },
+ {
+ "orientation" : "portrait",
+ "idiom" : "ipad",
+ "filename" : "Default-Portrait.png",
+ "extent" : "full-screen",
+ "scale" : "1x"
+ },
+ {
+ "orientation" : "landscape",
+ "idiom" : "ipad",
+ "extent" : "to-status-bar",
+ "scale" : "1x"
+ },
+ {
+ "orientation" : "landscape",
+ "idiom" : "ipad",
+ "filename" : "Default-Landscape.png",
+ "extent" : "full-screen",
+ "scale" : "1x"
+ },
+ {
+ "orientation" : "portrait",
+ "idiom" : "ipad",
+ "extent" : "to-status-bar",
+ "scale" : "2x"
+ },
+ {
+ "orientation" : "portrait",
+ "idiom" : "ipad",
+ "filename" : "Default-Portrait@2x.png",
+ "extent" : "full-screen",
+ "scale" : "2x"
+ },
+ {
+ "orientation" : "landscape",
+ "idiom" : "ipad",
+ "extent" : "to-status-bar",
+ "scale" : "2x"
+ },
+ {
+ "orientation" : "landscape",
+ "idiom" : "ipad",
+ "filename" : "Default-Landscape@2x.png",
+ "extent" : "full-screen",
+ "scale" : "2x"
+ }
+ ],
+ "info" : {
+ "version" : 1,
+ "author" : "xcode"
+ }
+}
\ No newline at end of file
diff --git a/examples/ExampleImgPickNG/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-568h@2x.png b/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-568h@2x.png
similarity index 100%
rename from examples/ExampleImgPickNG/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-568h@2x.png
rename to demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-568h@2x.png
diff --git a/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-667h@2x.png b/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-667h@2x.png
new file mode 100644
index 0000000..b884154
Binary files /dev/null and b/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-667h@2x.png differ
diff --git a/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-736h@3x.png b/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-736h@3x.png
new file mode 100644
index 0000000..faab4b6
Binary files /dev/null and b/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-736h@3x.png differ
diff --git a/examples/ExampleImgPickNG/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape.png b/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape.png
similarity index 100%
rename from examples/ExampleImgPickNG/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape.png
rename to demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape.png
diff --git a/examples/ExampleImgPickNG/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape@2x.png b/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape@2x.png
similarity index 100%
rename from examples/ExampleImgPickNG/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape@2x.png
rename to demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape@2x.png
diff --git a/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape@3x.png b/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape@3x.png
new file mode 100644
index 0000000..e6dca62
Binary files /dev/null and b/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape@3x.png differ
diff --git a/examples/ExampleImgPickNG/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait.png b/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait.png
similarity index 100%
rename from examples/ExampleImgPickNG/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait.png
rename to demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait.png
diff --git a/examples/ExampleImgPickNG/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait@2x.png b/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait@2x.png
similarity index 100%
rename from examples/ExampleImgPickNG/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait@2x.png
rename to demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait@2x.png
diff --git a/examples/ExampleImgPickNG/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default.png b/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default.png
similarity index 100%
rename from examples/ExampleImgPickNG/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default.png
rename to demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default.png
diff --git a/examples/ExampleImgPickNG/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default@2x.png b/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default@2x.png
similarity index 100%
rename from examples/ExampleImgPickNG/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default@2x.png
rename to demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default@2x.png
diff --git a/demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/Contents.json b/demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/Contents.json
new file mode 100644
index 0000000..4f4e9c5
--- /dev/null
+++ b/demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/Contents.json
@@ -0,0 +1,22 @@
+{
+ "images" : [
+ {
+ "idiom" : "universal",
+ "filename" : "LaunchScreen-AspectFill.png",
+ "scale" : "1x"
+ },
+ {
+ "idiom" : "universal",
+ "filename" : "LaunchScreen-AspectFill@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "idiom" : "universal",
+ "scale" : "3x"
+ }
+ ],
+ "info" : {
+ "version" : 1,
+ "author" : "xcode"
+ }
+}
\ No newline at end of file
diff --git a/demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill.png b/demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill.png
new file mode 100644
index 0000000..c293f9c
Binary files /dev/null and b/demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill.png differ
diff --git a/demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill@2x.png b/demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill@2x.png
new file mode 100644
index 0000000..233693a
Binary files /dev/null and b/demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill@2x.png differ
diff --git a/demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/Contents.json b/demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/Contents.json
new file mode 100644
index 0000000..23c0ffd
--- /dev/null
+++ b/demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/Contents.json
@@ -0,0 +1,22 @@
+{
+ "images" : [
+ {
+ "idiom" : "universal",
+ "filename" : "LaunchScreen-Center.png",
+ "scale" : "1x"
+ },
+ {
+ "idiom" : "universal",
+ "filename" : "LaunchScreen-Center@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "idiom" : "universal",
+ "scale" : "3x"
+ }
+ ],
+ "info" : {
+ "version" : 1,
+ "author" : "xcode"
+ }
+}
\ No newline at end of file
diff --git a/demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center.png b/demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center.png
new file mode 100644
index 0000000..a5a775a
Binary files /dev/null and b/demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center.png differ
diff --git a/demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center@2x.png b/demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center@2x.png
new file mode 100644
index 0000000..154c193
Binary files /dev/null and b/demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center@2x.png differ
diff --git a/examples/ExampleImgPick/app/App_Resources/iOS/Info.plist b/demo/app/App_Resources/iOS/Info.plist
similarity index 97%
rename from examples/ExampleImgPick/app/App_Resources/iOS/Info.plist
rename to demo/app/App_Resources/iOS/Info.plist
index 18f333a..ea3e3ea 100644
--- a/examples/ExampleImgPick/app/App_Resources/iOS/Info.plist
+++ b/demo/app/App_Resources/iOS/Info.plist
@@ -24,6 +24,8 @@
UILaunchStoryboardName
LaunchScreen
+ UIRequiresFullScreen
+
UIRequiredDeviceCapabilities
armv7
diff --git a/demo/app/App_Resources/iOS/LaunchScreen.storyboard b/demo/app/App_Resources/iOS/LaunchScreen.storyboard
new file mode 100644
index 0000000..2ad9471
--- /dev/null
+++ b/demo/app/App_Resources/iOS/LaunchScreen.storyboard
@@ -0,0 +1,49 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/demo/app/App_Resources/iOS/build.xcconfig b/demo/app/App_Resources/iOS/build.xcconfig
new file mode 100644
index 0000000..0562055
--- /dev/null
+++ b/demo/app/App_Resources/iOS/build.xcconfig
@@ -0,0 +1,5 @@
+// You can add custom settings here
+// for example you can uncomment the following line to force distribution code signing
+// CODE_SIGN_IDENTITY = iPhone Distribution
+ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
diff --git a/demo/app/app.css b/demo/app/app.css
new file mode 100644
index 0000000..eb6c292
--- /dev/null
+++ b/demo/app/app.css
@@ -0,0 +1,3 @@
+button {
+ font-size:42;
+}
\ No newline at end of file
diff --git a/demo/app/app.ts b/demo/app/app.ts
new file mode 100644
index 0000000..63def2a
--- /dev/null
+++ b/demo/app/app.ts
@@ -0,0 +1,5 @@
+import "./bundle-config";
+import * as application from 'tns-core-modules/application';
+
+application.setCssFileName("./app.css");
+application.start({ moduleName: "main-page" });
\ No newline at end of file
diff --git a/demo/app/bundle-config.ts b/demo/app/bundle-config.ts
new file mode 100644
index 0000000..8e4e338
--- /dev/null
+++ b/demo/app/bundle-config.ts
@@ -0,0 +1,5 @@
+if ((global).TNS_WEBPACK) {
+ require("tns-core-modules/bundle-entry-points");
+
+ global.registerModule("main-page", () => require("./main-page"));
+}
diff --git a/examples/ExampleImgPick/app/main-page.js b/demo/app/main-page.ts
similarity index 52%
rename from examples/ExampleImgPick/app/main-page.js
rename to demo/app/main-page.ts
index e8cf891..6b2ec52 100644
--- a/examples/ExampleImgPick/app/main-page.js
+++ b/demo/app/main-page.ts
@@ -1,27 +1,24 @@
-var frame = require("ui/frame");
-var platform = require("platform");
-var imagepicker = require("nativescript-imagepicker");
+import { EventData } from 'tns-core-modules/data/observable';
+import { Page } from 'tns-core-modules/ui/page';
+import { isAndroid } from "tns-core-modules/platform";
+import * as imagepicker from "nativescript-imagepicker";
-var page;
-var list;
+let list;
-function pageLoaded(args) {
- page = args.object;
+export function pageLoaded(args: EventData) {
+ let page = args.object;
list = page.getViewById("urls-list");
}
-exports.pageLoaded = pageLoaded;
-function onSelectMultipleTap(args) {
- var context = imagepicker.create({ mode: "multiple" });
+export function onSelectMultipleTap(args) {
+ let context = imagepicker.create({ mode: "multiple" });
startSelection(context);
}
-exports.onSelectMultipleTap = onSelectMultipleTap;
-function onSelectSingleTap(args) {
- var context = imagepicker.create({ mode: "single" });
+export function onSelectSingleTap(args) {
+ let context = imagepicker.create({ mode: "single" });
startSelection(context);
}
-exports.onSelectSingleTap = onSelectSingleTap;
function startSelection(context) {
context
@@ -35,10 +32,9 @@ function startSelection(context) {
selection.forEach(function(selected) {
console.log("----------------");
console.log("uri: " + selected.uri);
- console.log("fileUri: " + selected.getImage);
});
list.items = selection;
}).catch(function (e) {
console.log(e);
});
-}
+}
\ No newline at end of file
diff --git a/examples/ExampleImgPick/app/main-page.xml b/demo/app/main-page.xml
similarity index 97%
rename from examples/ExampleImgPick/app/main-page.xml
rename to demo/app/main-page.xml
index 6e17f36..b73788a 100644
--- a/examples/ExampleImgPick/app/main-page.xml
+++ b/demo/app/main-page.xml
@@ -6,7 +6,7 @@
-
+
diff --git a/examples/ExampleImgPick/app/package.json b/demo/app/package.json
similarity index 81%
rename from examples/ExampleImgPick/app/package.json
rename to demo/app/package.json
index accb6a6..1981e7e 100644
--- a/examples/ExampleImgPick/app/package.json
+++ b/demo/app/package.json
@@ -4,5 +4,5 @@
},
"main": "app.js",
"name": "tns-template-hello-world",
- "version": "3.0.0-rc.1"
+ "version": "3.1.0"
}
diff --git a/demo/app/tests/tests.js b/demo/app/tests/tests.js
new file mode 100644
index 0000000..9748b12
--- /dev/null
+++ b/demo/app/tests/tests.js
@@ -0,0 +1,12 @@
+var YourPlugin = require("nativescript-yourplugin").YourPlugin;
+var yourPlugin = new YourPlugin();
+
+describe("greet function", function() {
+ it("exists", function() {
+ expect(yourPlugin.greet).toBeDefined();
+ });
+
+ it("returns a string", function() {
+ expect(yourPlugin.greet()).toEqual("Hello, NS");
+ });
+});
\ No newline at end of file
diff --git a/demo/app/vendor-platform.android.ts b/demo/app/vendor-platform.android.ts
new file mode 100644
index 0000000..c9a8794
--- /dev/null
+++ b/demo/app/vendor-platform.android.ts
@@ -0,0 +1,9 @@
+require("application");
+if (!global["__snapshot"]) {
+ /*
+ In case snapshot generation is enabled these modules will get into the bundle but will not be required/evaluated.
+ The snapshot webpack plugin will add them to the tns-java-classes.js bundle file. This way, they will be evaluated on app start as early as possible.
+ */
+ require("ui/frame");
+ require("ui/frame/activity");
+}
diff --git a/examples/ExampleImgPick/app/vendor-platform.ios.js b/demo/app/vendor-platform.ios.ts
similarity index 100%
rename from examples/ExampleImgPick/app/vendor-platform.ios.js
rename to demo/app/vendor-platform.ios.ts
diff --git a/examples/ExampleImgPick/app/vendor.js b/demo/app/vendor.ts
similarity index 100%
rename from examples/ExampleImgPick/app/vendor.js
rename to demo/app/vendor.ts
diff --git a/demo/karma.conf.js b/demo/karma.conf.js
new file mode 100644
index 0000000..91d9c28
--- /dev/null
+++ b/demo/karma.conf.js
@@ -0,0 +1,77 @@
+module.exports = function(config) {
+ config.set({
+
+ // base path that will be used to resolve all patterns (eg. files, exclude)
+ basePath: '',
+
+
+ // frameworks to use
+ // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
+ frameworks: ['jasmine'],
+
+
+ // list of files / patterns to load in the browser
+ files: [
+ 'app/**/*.js',
+ ],
+
+
+ // list of files to exclude
+ exclude: [
+ ],
+
+
+ // preprocess matching files before serving them to the browser
+ // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
+ preprocessors: {
+ },
+
+
+ // test results reporter to use
+ // possible values: 'dots', 'progress'
+ // available reporters: https://npmjs.org/browse/keyword/karma-reporter
+ reporters: ['progress'],
+
+
+ // web server port
+ port: 9876,
+
+
+ // enable / disable colors in the output (reporters and logs)
+ colors: true,
+
+
+ // level of logging
+ // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
+ logLevel: config.LOG_INFO,
+
+
+ // enable / disable watching file and executing tests whenever any file changes
+ autoWatch: true,
+
+
+ // start these browsers
+ // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
+ browsers: [],
+
+ customLaunchers: {
+ android: {
+ base: 'NS',
+ platform: 'android'
+ },
+ ios: {
+ base: 'NS',
+ platform: 'ios'
+ },
+ ios_simulator: {
+ base: 'NS',
+ platform: 'ios',
+ arguments: ['--emulator']
+ }
+ },
+
+ // Continuous Integration mode
+ // if true, Karma captures browsers, runs the tests and exits
+ singleRun: true
+ });
+};
diff --git a/demo/package.json b/demo/package.json
new file mode 100644
index 0000000..1b199c2
--- /dev/null
+++ b/demo/package.json
@@ -0,0 +1,55 @@
+{
+ "nativescript": {
+ "id": "org.nativescript.imagepickerdemo",
+ "tns-ios": {
+ "version": "3.1.0"
+ },
+ "tns-android": {
+ "version": "3.1.1"
+ }
+ },
+ "dependencies": {
+ "nativescript-imagepicker": "../src",
+ "nativescript-theme-core": "^1.0.4",
+ "nativescript-unit-test-runner": "^0.3.4",
+ "tns-core-modules": "^3.1.0"
+ },
+ "devDependencies": {
+ "babel-traverse": "6.24.1",
+ "babel-types": "6.24.1",
+ "babylon": "6.16.1",
+ "copy-webpack-plugin": "~4.0.1",
+ "extract-text-webpack-plugin": "~2.1.0",
+ "nativescript-css-loader": "~0.26.0",
+ "nativescript-dev-webpack": "^0.7.3",
+ "raw-loader": "~0.5.1",
+ "resolve-url-loader": "~2.0.2",
+ "webpack": "~3.2.0",
+ "webpack-sources": "~0.2.3",
+ "awesome-typescript-loader": "~3.1.2",
+ "filewalker": "0.1.2",
+ "jasmine-core": "^2.5.2",
+ "karma": "^1.3.0",
+ "karma-jasmine": "^1.0.2",
+ "karma-nativescript-launcher": "^0.4.0",
+ "lazy": "1.0.11",
+ "nativescript-dev-typescript": "libs",
+ "typescript": "~2.3.0",
+ "tslint": "~5.4.3",
+ "webpack-bundle-analyzer": "^2.8.2",
+ "tns-platform-declarations": "^3.0.0"
+ },
+ "scripts": {
+ "build.plugin": "cd ../src && npm run build",
+ "ci.tslint": "npm i && tslint --config '../tslint.json' 'app/**/*.ts' --exclude '**/node_modules/**'",
+ "ci.android.build": "npm run build.plugin && tns build android",
+ "ci.ios.build": "npm run build.plugin && tns build ios",
+ "ns-bundle": "ns-bundle",
+ "publish-ios-bundle": "npm run ns-bundle --ios --publish-app",
+ "generate-android-snapshot": "generate-android-snapshot --targetArchs arm,arm64,ia32 --install",
+ "start-android-bundle": "npm run ns-bundle --android --run-app",
+ "start-ios-bundle": "npm run ns-bundle --ios --run-app",
+ "build-android-bundle": "npm run ns-bundle --android --build-app",
+ "build-ios-bundle": "npm run ns-bundle --ios --build-app"
+ }
+}
\ No newline at end of file
diff --git a/nativescript-imagepicker/tsconfig.json b/demo/tsconfig.json
similarity index 61%
rename from nativescript-imagepicker/tsconfig.json
rename to demo/tsconfig.json
index e57b25e..ed6d540 100644
--- a/nativescript-imagepicker/tsconfig.json
+++ b/demo/tsconfig.json
@@ -1,23 +1,28 @@
{
"compilerOptions": {
- "module": "commonjs",
"target": "es5",
- "noImplicitAny": false,
- "removeComments": true,
- "preserveConstEnums": true,
- "sourceMap": false,
+ "module": "commonjs",
"declaration": false,
+ "removeComments": true,
"noLib": false,
- "noEmitHelpers": true,
+ "emitDecoratorMetadata": true,
"experimentalDecorators": true,
"lib": [
"es6",
"dom"
],
+ "pretty": true,
+ "allowUnreachableCode": false,
+ "allowUnusedLabels": false,
+ "noEmitHelpers": true,
+ "noEmitOnError": false,
+ "noImplicitAny": false,
+ "noImplicitReturns": true,
+ "noImplicitUseStrict": false,
+ "noFallthroughCasesInSwitch": true,
"baseUrl": ".",
"paths": {
"*": [
- "./node_modules/tns-core-modules/*",
"./node_modules/*"
]
}
@@ -25,5 +30,6 @@
"exclude": [
"node_modules",
"platforms"
- ]
-}
+ ],
+ "compileOnSave": false
+}
\ No newline at end of file
diff --git a/examples/ExampleImgPick/app/App_Resources/Android/app.gradle b/examples/ExampleImgPick/app/App_Resources/Android/app.gradle
deleted file mode 100644
index 6836aa5..0000000
--- a/examples/ExampleImgPick/app/App_Resources/Android/app.gradle
+++ /dev/null
@@ -1,9 +0,0 @@
-android {
- defaultConfig {
- generatedDensities = []
- applicationId = "org.nativescript.ExampleImgPick"
- }
- aaptOptions {
- additionalParameters "--no-version-vectors"
- }
-}
diff --git a/examples/ExampleImgPick/app/App_Resources/Android/drawable-nodpi/splashscreen.9.png b/examples/ExampleImgPick/app/App_Resources/Android/drawable-nodpi/splashscreen.9.png
deleted file mode 100644
index bd53be2..0000000
Binary files a/examples/ExampleImgPick/app/App_Resources/Android/drawable-nodpi/splashscreen.9.png and /dev/null differ
diff --git a/examples/ExampleImgPick/app/App_Resources/iOS/Icon-Small.png b/examples/ExampleImgPick/app/App_Resources/iOS/Icon-Small.png
deleted file mode 100755
index 9e13a22..0000000
Binary files a/examples/ExampleImgPick/app/App_Resources/iOS/Icon-Small.png and /dev/null differ
diff --git a/examples/ExampleImgPick/app/App_Resources/iOS/Icon-Small@2x.png b/examples/ExampleImgPick/app/App_Resources/iOS/Icon-Small@2x.png
deleted file mode 100755
index 89dd84c..0000000
Binary files a/examples/ExampleImgPick/app/App_Resources/iOS/Icon-Small@2x.png and /dev/null differ
diff --git a/examples/ExampleImgPick/app/App_Resources/iOS/icon-40.png b/examples/ExampleImgPick/app/App_Resources/iOS/icon-40.png
deleted file mode 100755
index 9b36ac4..0000000
Binary files a/examples/ExampleImgPick/app/App_Resources/iOS/icon-40.png and /dev/null differ
diff --git a/examples/ExampleImgPick/app/App_Resources/iOS/icon-40@2x.png b/examples/ExampleImgPick/app/App_Resources/iOS/icon-40@2x.png
deleted file mode 100755
index 8ce4b88..0000000
Binary files a/examples/ExampleImgPick/app/App_Resources/iOS/icon-40@2x.png and /dev/null differ
diff --git a/examples/ExampleImgPick/app/App_Resources/iOS/icon-60.png b/examples/ExampleImgPick/app/App_Resources/iOS/icon-60.png
deleted file mode 100755
index d2e9518..0000000
Binary files a/examples/ExampleImgPick/app/App_Resources/iOS/icon-60.png and /dev/null differ
diff --git a/examples/ExampleImgPick/app/App_Resources/iOS/icon-76.png b/examples/ExampleImgPick/app/App_Resources/iOS/icon-76.png
deleted file mode 100755
index 1c659c6..0000000
Binary files a/examples/ExampleImgPick/app/App_Resources/iOS/icon-76.png and /dev/null differ
diff --git a/examples/ExampleImgPick/app/App_Resources/iOS/icon-76@2x.png b/examples/ExampleImgPick/app/App_Resources/iOS/icon-76@2x.png
deleted file mode 100755
index bcc126d..0000000
Binary files a/examples/ExampleImgPick/app/App_Resources/iOS/icon-76@2x.png and /dev/null differ
diff --git a/examples/ExampleImgPick/app/LICENSE b/examples/ExampleImgPick/app/LICENSE
deleted file mode 100644
index a2ea2e6..0000000
--- a/examples/ExampleImgPick/app/LICENSE
+++ /dev/null
@@ -1,23 +0,0 @@
-Copyright (c) 2015, Telerik AD
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
-1. Redistributions of source code must retain the above copyright notice, this
-list of conditions and the following disclaimer.
-
-2. Redistributions in binary form must reproduce the above copyright notice,
-this list of conditions and the following disclaimer in the documentation
-and/or other materials provided with the distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/examples/ExampleImgPick/app/app.css b/examples/ExampleImgPick/app/app.css
deleted file mode 100644
index 4900388..0000000
--- a/examples/ExampleImgPick/app/app.css
+++ /dev/null
@@ -1,3 +0,0 @@
-button {
- font-size: 42;
-}
diff --git a/examples/ExampleImgPick/app/app.js b/examples/ExampleImgPick/app/app.js
deleted file mode 100644
index fb08e31..0000000
--- a/examples/ExampleImgPick/app/app.js
+++ /dev/null
@@ -1,5 +0,0 @@
-require("./bundle-config");
-var application = require("application");
-
-application.cssFile = "./app.css";
-application.start({ moduleName: "main-page" });
diff --git a/examples/ExampleImgPick/app/bundle-config.js b/examples/ExampleImgPick/app/bundle-config.js
deleted file mode 100644
index 333bf49..0000000
--- a/examples/ExampleImgPick/app/bundle-config.js
+++ /dev/null
@@ -1,5 +0,0 @@
-if (global.TNS_WEBPACK) {
- require("bundle-entry-points");
-
- global.registerModule("main-page", () => require("./main-page") );
-}
diff --git a/examples/ExampleImgPick/app/vendor-platform.android.js b/examples/ExampleImgPick/app/vendor-platform.android.js
deleted file mode 100644
index ba9742f..0000000
--- a/examples/ExampleImgPick/app/vendor-platform.android.js
+++ /dev/null
@@ -1,25 +0,0 @@
-// Resolve JavaScript classes that extend a Java class, and need to resolve
-// their JavaScript module from a bundled script. For example:
-// NativeScriptApplication, NativeScriptActivity, etc.
-//
-// This module gets bundled together with the rest of the app code and the
-// `require` calls get resolved to the correct bundling import call.
-//
-// At runtime the module gets loaded *before* the rest of the app code, so code
-// placed here needs to be careful about its dependencies.
-
-require("application");
-require("ui/frame");
-require("ui/frame/activity");
-
-if (global.TNS_WEBPACK) {
- global.__requireOverride = function (name, dir) {
- if (name === "./tns_modules/application/application.js") {
- return require("application");
- } else if (name === "./tns_modules/ui/frame/frame.js") {
- return require("ui/frame");
- } else if (name === "./tns_modules/ui/frame/activity.js") {
- return require("ui/frame/activity");
- }
- };
-}
diff --git a/examples/ExampleImgPick/package.json b/examples/ExampleImgPick/package.json
deleted file mode 100644
index aa7f52d..0000000
--- a/examples/ExampleImgPick/package.json
+++ /dev/null
@@ -1,46 +0,0 @@
-{
- "description": "An example app using the image picker plugin.",
- "readme": "# This is the source of an example application using the NativeScript image picker plugin.",
- "repository": {
- "type": "git",
- "url": "https://github.com/PanayotCankov/nativescript-imagepicker"
- },
- "name": "ExampleImgPick",
- "version": "0.0.2",
- "nativescript": {
- "id": "org.nativescript.ExampleImgPick",
- "tns-ios": {
- "version": "3.0.0-rc.1"
- },
- "tns-android": {
- "version": "3.0.0"
- }
- },
- "dependencies": {
- "nativescript-imagepicker": "file:../../nativescript-imagepicker",
- "nativescript-telerik-ui": "^2.0.1",
- "tns-core-modules": "^3.0.0 || ^3.0.0-rc.1"
- },
- "devDependencies": {
- "babel-traverse": "^6.24.1",
- "babel-types": "^6.24.1",
- "babylon": "^6.16.1",
- "copy-webpack-plugin": "~4.0.1",
- "extract-text-webpack-plugin": "~2.1.0",
- "lazy": "1.0.11",
- "nativescript-css-loader": "~0.26.0",
- "nativescript-dev-webpack": "^0.4.0",
- "raw-loader": "~0.5.1",
- "resolve-url-loader": "~2.0.2",
- "webpack": "~2.4.1",
- "webpack-sources": "~0.2.3",
- "awesome-typescript-loader": "~3.0.0-beta.9"
- },
- "scripts": {
- "ns-bundle": "ns-bundle",
- "start-android-bundle": "npm run ns-bundle --android --start-app",
- "start-ios-bundle": "npm run ns-bundle --ios --start-app",
- "build-android-bundle": "npm run ns-bundle --android --build-app",
- "build-ios-bundle": "npm run ns-bundle --ios --build-app"
- }
-}
diff --git a/examples/ExampleImgPick/webpack.android.js b/examples/ExampleImgPick/webpack.android.js
deleted file mode 100644
index 968e93b..0000000
--- a/examples/ExampleImgPick/webpack.android.js
+++ /dev/null
@@ -1,2 +0,0 @@
-var makeConfig = require("./webpack.common");
-module.exports = makeConfig("android");
diff --git a/examples/ExampleImgPick/webpack.common.js b/examples/ExampleImgPick/webpack.common.js
deleted file mode 100644
index a509e5c..0000000
--- a/examples/ExampleImgPick/webpack.common.js
+++ /dev/null
@@ -1,129 +0,0 @@
-var webpack = require("webpack");
-var nsWebpack = require("nativescript-dev-webpack");
-var nativescriptTarget = require("nativescript-dev-webpack/nativescript-target");
-var path = require("path");
-var CopyWebpackPlugin = require("copy-webpack-plugin");
-var ExtractTextPlugin = require("extract-text-webpack-plugin");
-
-module.exports = function (platform, destinationApp) {
- if (!destinationApp) {
- //Default destination inside platforms//...
- destinationApp = nsWebpack.getAppPath(platform);
- }
- var entry = {};
- //Discover entry module from package.json
- entry.bundle = "./" + nsWebpack.getEntryModule();
- //Vendor entry with third party libraries.
- entry.vendor = "./vendor";
- //app.css bundle
- entry["app.css"] = "./app.css";
-
- var plugins = [
- new ExtractTextPlugin("app.css"),
- //Vendor libs go to the vendor.js chunk
- new webpack.optimize.CommonsChunkPlugin({
- name: ["vendor"]
- }),
- //Define useful constants like TNS_WEBPACK
- new webpack.DefinePlugin({
- "global.TNS_WEBPACK": "true",
- }),
- //Copy assets to out dir. Add your own globs as needed.
- new CopyWebpackPlugin([
- { from: "app.css" },
- { from: "css/**" },
- { from: "fonts/**" },
- { from: "**/*.jpg" },
- { from: "**/*.png" },
- { from: "**/*.xml" },
- ], { ignore: ["App_Resources/**"] }),
- //Generate a bundle starter script and activate it in package.json
- new nsWebpack.GenerateBundleStarterPlugin([
- "./vendor",
- "./bundle",
- ]),
- ];
-
- if (process.env.npm_config_uglify) {
- plugins.push(new webpack.LoaderOptionsPlugin({
- minimize: true
- }));
-
- //Work around an Android issue by setting compress = false
- var compress = platform !== "android";
- plugins.push(new webpack.optimize.UglifyJsPlugin({
- mangle: {
- except: nsWebpack.uglifyMangleExcludes,
- },
- compress: compress,
- }));
- }
-
- return {
- context: path.resolve("./app"),
- target: nativescriptTarget,
- entry: entry,
- output: {
- pathinfo: true,
- path: path.resolve(destinationApp),
- libraryTarget: "commonjs2",
- filename: "[name].js",
- },
- resolve: {
- //Resolve platform-specific modules like module.android.js
- extensions: [
- ".js",
- ".css",
- "." + platform + ".js",
- "." + platform + ".css",
- ],
- //Resolve {N} system modules from tns-core-modules
- modules: [
- "node_modules/tns-core-modules",
- "node_modules"
- ]
- },
- node: {
- //Disable node shims that conflict with NativeScript
- "http": false,
- "timers": false,
- "setImmediate": false,
- "fs": "empty",
- },
- module: {
- loaders: [
- {
- test: /\.html$/,
- loader: "raw-loader"
- },
- // Root app.css file gets extracted with bundled dependencies
- {
- test: /app\.css$/,
- loader: ExtractTextPlugin.extract([
- "resolve-url-loader",
- "nativescript-css-loader",
- "nativescript-dev-webpack/platform-css-loader",
- ]),
- },
- // Other CSS files get bundled using the raw loader
- {
- test: /\.css$/,
- exclude: /app\.css$/,
- loaders: [
- "raw-loader",
- ]
- },
- // SASS support
- {
- test: /\.scss$/,
- loaders: [
- "raw-loader",
- "resolve-url-loader",
- "sass-loader"
- ]
- },
- ]
- },
- plugins: plugins,
- };
-};
diff --git a/examples/ExampleImgPick/webpack.ios.js b/examples/ExampleImgPick/webpack.ios.js
deleted file mode 100644
index 806f3ef..0000000
--- a/examples/ExampleImgPick/webpack.ios.js
+++ /dev/null
@@ -1,2 +0,0 @@
-var makeConfig = require("./webpack.common");
-module.exports = makeConfig("ios");
diff --git a/examples/ExampleImgPickNG/app/app.component.ts b/examples/ExampleImgPickNG/app/app.component.ts
deleted file mode 100644
index 66079d8..0000000
--- a/examples/ExampleImgPickNG/app/app.component.ts
+++ /dev/null
@@ -1,51 +0,0 @@
-import { Component, ChangeDetectorRef } from "@angular/core";
-import { ListView } from "ui/list-view";
-
-let imagepicker = require("nativescript-imagepicker");
-
-@Component({
- selector: "my-app",
- templateUrl: "app.component.html",
-})
-export class AppComponent {
-
- items = [];
-
- constructor(private _changeDetectionRef: ChangeDetectorRef) {
- }
-
- onSelectMultipleTap() {
- let context = imagepicker.create({
- mode: "multiple"
- });
- this.startSelection(context);
- }
-
- onSelectSingleTap() {
- let context = imagepicker.create({
- mode: "single"
- });
- this.startSelection(context);
- }
-
- startSelection(context) {
- context
- .authorize()
- .then(() => {
- this.items = [];
- return context.present();
- })
- .then((selection) => {
- console.log("Selection done:");
- selection.forEach(function (selected) {
- console.log("----------------");
- console.log("uri: " + selected.uri);
- console.log("fileUri: " + selected.fileUri);
- });
- this.items = selection;
- this._changeDetectionRef.detectChanges();
- }).catch(function (e) {
- console.log(e);
- });
- }
-}
diff --git a/examples/ExampleImgPickNG/app/vendor-platform.android.ts b/examples/ExampleImgPickNG/app/vendor-platform.android.ts
deleted file mode 100644
index ba9742f..0000000
--- a/examples/ExampleImgPickNG/app/vendor-platform.android.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-// Resolve JavaScript classes that extend a Java class, and need to resolve
-// their JavaScript module from a bundled script. For example:
-// NativeScriptApplication, NativeScriptActivity, etc.
-//
-// This module gets bundled together with the rest of the app code and the
-// `require` calls get resolved to the correct bundling import call.
-//
-// At runtime the module gets loaded *before* the rest of the app code, so code
-// placed here needs to be careful about its dependencies.
-
-require("application");
-require("ui/frame");
-require("ui/frame/activity");
-
-if (global.TNS_WEBPACK) {
- global.__requireOverride = function (name, dir) {
- if (name === "./tns_modules/application/application.js") {
- return require("application");
- } else if (name === "./tns_modules/ui/frame/frame.js") {
- return require("ui/frame");
- } else if (name === "./tns_modules/ui/frame/activity.js") {
- return require("ui/frame/activity");
- }
- };
-}
diff --git a/examples/ExampleImgPickNG/package.json b/examples/ExampleImgPickNG/package.json
deleted file mode 100644
index a80ea49..0000000
--- a/examples/ExampleImgPickNG/package.json
+++ /dev/null
@@ -1,58 +0,0 @@
-{
- "description": "NativeScript Application",
- "license": "SEE LICENSE IN ",
- "readme": "NativeScript Application",
- "repository": "",
- "nativescript": {
- "id": "org.nativescript.ExampleImgPickNG",
- "tns-ios": {
- "version": "3.0.0-rc.1"
- },
- "tns-android": {
- "version": "3.0.0-rc.1"
- }
- },
- "dependencies": {
- "@angular/common": "~4.1.0",
- "@angular/compiler": "~4.1.0",
- "@angular/core": "~4.1.0",
- "@angular/forms": "~4.1.0",
- "@angular/http": "~4.1.0",
- "@angular/platform-browser": "~4.1.0",
- "@angular/platform-browser-dynamic": "~4.1.0",
- "@angular/router": "~4.1.0",
- "nativescript-angular": "rc",
- "nativescript-imagepicker": "file:../../nativescript-imagepicker",
- "nativescript-telerik-ui": "^2.0.1",
- "nativescript-theme-core": "^1.0.3",
- "reflect-metadata": "~0.1.8",
- "rxjs": "^5.3.0",
- "tns-core-modules": "^3.0.0 || ^3.0.0-rc.1"
- },
- "devDependencies": {
- "@angular/compiler-cli": "~4.1.0",
- "@ngtools/webpack": "1.3.1",
- "babel-traverse": "6.24.1",
- "babel-types": "6.24.1",
- "babylon": "6.16.1",
- "copy-webpack-plugin": "~4.0.1",
- "extract-text-webpack-plugin": "~2.1.0",
- "lazy": "1.0.11",
- "nativescript-css-loader": "~0.26.0",
- "nativescript-dev-typescript": "^0.4.2",
- "nativescript-dev-webpack": "^0.4.0",
- "raw-loader": "~0.5.1",
- "resolve-url-loader": "~2.0.2",
- "typescript": "~2.3.1",
- "webpack": "~2.4.1",
- "webpack-sources": "~0.2.3",
- "zone.js": "^0.8.5"
- },
- "scripts": {
- "ns-bundle": "ns-bundle",
- "start-android-bundle": "npm run ns-bundle --android --start-app",
- "start-ios-bundle": "npm run ns-bundle --ios --start-app",
- "build-android-bundle": "npm run ns-bundle --android --build-app",
- "build-ios-bundle": "npm run ns-bundle --ios --build-app"
- }
-}
diff --git a/examples/ExampleImgPickNG/references.d.ts b/examples/ExampleImgPickNG/references.d.ts
deleted file mode 100644
index b14f383..0000000
--- a/examples/ExampleImgPickNG/references.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-/// Needed for autocompletion and compilation.
\ No newline at end of file
diff --git a/nativescript-imagepicker/LICENSE b/nativescript-imagepicker/LICENSE
deleted file mode 100644
index 185c64a..0000000
--- a/nativescript-imagepicker/LICENSE
+++ /dev/null
@@ -1,23 +0,0 @@
-Copyright (c) 2015, Telerik AD
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
-1. Redistributions of source code must retain the above copyright notice, this
-list of conditions and the following disclaimer.
-
-2. Redistributions in binary form must reproduce the above copyright notice,
-this list of conditions and the following disclaimer in the documentation
-and/or other materials provided with the distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\ No newline at end of file
diff --git a/nativescript-imagepicker/README.md b/nativescript-imagepicker/README.md
deleted file mode 100644
index dca2881..0000000
--- a/nativescript-imagepicker/README.md
+++ /dev/null
@@ -1,131 +0,0 @@
-# Image Picker for the NativeScript framework
-An image picker control that supports multiple selection.
-
-For iOS it supports iOS8+ (read: it does not work for iOS7). It is implemented using the [Photos Framework](https://developer.apple.com/library/prerelease/ios//documentation/Photos/Reference/Photos_Framework/index.html) backed up by UI implemented using the NativeScript UI modules.
-
-On Android it uses Intents to open the stock image or file pickers.
-
- - [Source](https://github.com/NativeScript/nativescript-imagepicker)
- - [Issues](https://github.com/NativeScript/nativescript-imagepicker/issues)
-
-Examples:
- - [Select and Upload](https://github.com/NativeScript/sample-ImageUpload)
- - [ImagePicker](https://github.com/NativeScript/nativescript-imagepicker/tree/master/examples/ExampleImgPick/app)
-
-## Installation
-
-### Install plugin using NativeScript CLI
-From the command prompt go to your app's root folder and execute:
-```
-tns plugin add nativescript-imagepicker
-```
-
-### Install plugin using AppBuilder CLI
-```
-appbuilder plugin add nativescript-imagepicker
-```
-
-### Install plugin using AppBuilder IDE
-In the Project Navigator, right click your project and choose Manage Packages.
-Choose the Plugins Marketplace tab.
-Search or browse for a plugin and click Install.
-
-## Usage
-
-For sample application with single and multiple image selection ready for Android and IOS
-[follow this link](https://github.com/NativeScript/sample-ImageUpload)
-
-### How-to Pick Multiple Images
-```
-var imagepickerModule = require("nativescript-imagepicker");
-
-function selectImages() {
- var context = imagepicker.create({
- mode: "multiple"
- });
-
- context
- .authorize()
- .then(function() {
- return context.present();
- })
- .then(function(selection) {
- console.log("Selection done:");
- selection.forEach(function(selected) {
- console.log(" - " + selected.uri);
- });
- }).catch(function (e) {
- console.log(e);
- });
-}
-```
-### How-to Pick Single Image
-```
-var context = imagepicker.create({
- mode: "single"
-});
-```
-### How-to Bind Selected Images
-#### main-page.xml
-```
-
-
-
-
-
-
-
-
-
-
-
-
-```
-#### main-page.js
-```
-var imagepickerModule = require("nativescript-imagepicker");
-
-var page;
-var list;
-
-function pageLoaded(args) {
- page = args.object;
- list = page.getViewById("urls-list");
-}
-
-function onSelectMultipleTap(args) {
- var context = imagepickerModule.create({
- mode: "multiple"
- });
- startSelection(context);
-}
-
-function onSelectSingleTap(args) {
- var context = imagepickerModule.create({
- mode: "single"
- });
- startSelection(context);
-}
-
-function startSelection(context) {
- context
- .authorize()
- .then(function() {
- list.items = [];
- return context.present();
- })
- .then(function(selection) {
- selection.forEach(function(selected) {
- console.log("uri: " + selected.uri);
- console.log("fileUri: " + selected.fileUri);
- });
- list.items = selection;
- }).catch(function (e) {
- console.log(e);
- });
-}
-
-exports.pageLoaded = pageLoaded;
-exports.onSelectMultipleTap = onSelectMultipleTap;
-exports.onSelectSingleTap = onSelectSingleTap;
-```
diff --git a/nativescript-imagepicker/bundle-entry-points.js b/nativescript-imagepicker/bundle-entry-points.js
deleted file mode 100644
index 58ef2fd..0000000
--- a/nativescript-imagepicker/bundle-entry-points.js
+++ /dev/null
@@ -1,5 +0,0 @@
-// Register "dynamically" loaded module that need to be resolved by the
-// XML/component builders.
-
-global.registerModule("nativescript-imagepicker/albums", () => require("nativescript-imagepicker/albums"));
-global.registerModule("nativescript-imagepicker/images", () => require("nativescript-imagepicker/images"));
\ No newline at end of file
diff --git a/nativescript-imagepicker/package.json b/nativescript-imagepicker/package.json
deleted file mode 100644
index 3836fee..0000000
--- a/nativescript-imagepicker/package.json
+++ /dev/null
@@ -1,30 +0,0 @@
-{
- "description": "A plugin for the NativeScript framework implementing multiple image picker",
- "repository": {
- "type": "git",
- "url": "https://github.com/NativeScript/nativescript-imagepicker"
- },
- "name": "nativescript-imagepicker",
- "version": "3.0.2",
- "nativescript": {
- "platforms": {
- "android": "3.0.0",
- "ios": "3.0.0"
- }
- },
- "author": "NativeScript Team",
- "main": "viewmodel",
- "devDependencies": {
- "nativescript-telerik-ui": "^3.0.0",
- "tns-core-modules": "^3.0.0",
- "tns-platform-declarations": "^3.0.0",
- "typescript": "2.3.4"
- },
- "peerDependencies": {
- "nativescript-telerik-ui": "^3.0.0",
- "tns-core-modules": "^3.0.0 || >=3.0.0-2017"
- },
- "scripts": {
- "prepublish": "tsc"
- }
-}
diff --git a/nativescript-imagepicker/reference.d.ts b/nativescript-imagepicker/reference.d.ts
deleted file mode 100644
index 424df77..0000000
--- a/nativescript-imagepicker/reference.d.ts
+++ /dev/null
@@ -1,2 +0,0 @@
-///
-///
diff --git a/publish/pack.sh b/publish/pack.sh
new file mode 100755
index 0000000..212f22f
--- /dev/null
+++ b/publish/pack.sh
@@ -0,0 +1,47 @@
+#!/bin/bash
+
+SOURCE_DIR=../src;
+TO_SOURCE_DIR=src;
+PACK_DIR=package;
+ROOT_DIR=..;
+PUBLISH=--publish
+
+install(){
+ npm i
+}
+
+pack() {
+
+ echo 'Clearing /src and /package...'
+ node_modules/.bin/rimraf "$TO_SOURCE_DIR"
+ node_modules/.bin/rimraf "$PACK_DIR"
+
+ # copy src
+ echo 'Copying src...'
+ node_modules/.bin/ncp "$SOURCE_DIR" "$TO_SOURCE_DIR"
+
+ # copy README & LICENSE to src
+ echo 'Copying README and LICENSE to /src...'
+ node_modules/.bin/ncp "$ROOT_DIR"/LICENSE "$TO_SOURCE_DIR"/LICENSE
+ node_modules/.bin/ncp "$ROOT_DIR"/README.md "$TO_SOURCE_DIR"/README.md
+
+ # compile package and copy files required by npm
+ echo 'Building /src...'
+ cd "$TO_SOURCE_DIR"
+ node_modules/.bin/tsc
+ cd ..
+
+ echo 'Creating package...'
+ # create package dir
+ mkdir "$PACK_DIR"
+
+ # create the package
+ cd "$PACK_DIR"
+ npm pack ../"$TO_SOURCE_DIR"
+
+ # delete source directory used to create the package
+ cd ..
+ node_modules/.bin/rimraf "$TO_SOURCE_DIR"
+}
+
+install && pack
\ No newline at end of file
diff --git a/publish/package.json b/publish/package.json
new file mode 100644
index 0000000..d5c28e9
--- /dev/null
+++ b/publish/package.json
@@ -0,0 +1,9 @@
+{
+ "name": "nativescript-publish",
+ "version": "1.0.0",
+ "description": "Publish helper",
+ "devDependencies": {
+ "ncp": "^2.0.0",
+ "rimraf": "^2.5.0"
+ }
+}
diff --git a/publish/publish.sh b/publish/publish.sh
new file mode 100644
index 0000000..8e72704
--- /dev/null
+++ b/publish/publish.sh
@@ -0,0 +1,11 @@
+#!/bin/bash
+
+PACK_DIR=package;
+
+publish() {
+ cd $PACK_DIR
+ echo 'Publishing to npm...'
+ npm publish *.tgz
+}
+
+./pack.sh && publish
\ No newline at end of file
diff --git a/src/.npmignore b/src/.npmignore
new file mode 100644
index 0000000..6dcf540
--- /dev/null
+++ b/src/.npmignore
@@ -0,0 +1,4 @@
+*.map
+*.ts
+!*.d.ts
+tsconfig.json
\ No newline at end of file
diff --git a/src/albums.ios.d.ts b/src/albums.ios.d.ts
new file mode 100644
index 0000000..5846044
--- /dev/null
+++ b/src/albums.ios.d.ts
@@ -0,0 +1,6 @@
+import { Page } from "tns-core-modules/ui/page";
+export declare function onAlbumsItemTap(args: any): void;
+export declare function pageLoaded(args: any): void;
+export declare function navigatedFrom(args: any): void;
+export declare function done(args: any): void;
+export declare function albumsPageFactory(): Page;
diff --git a/nativescript-imagepicker/albums.ios.ts b/src/albums.ios.ts
similarity index 61%
rename from nativescript-imagepicker/albums.ios.ts
rename to src/albums.ios.ts
index d6a94a6..e80f1be 100644
--- a/nativescript-imagepicker/albums.ios.ts
+++ b/src/albums.ios.ts
@@ -1,39 +1,41 @@
// Apple example: https://developer.apple.com/library/ios/samplecode/UsingPhotosFramework/Listings/SamplePhotosApp_AAPLRootListViewController_m.html
-import data_observable = require("data/observable");
-import data_observablearray = require("data/observable-array");
+import data_observable = require("tns-core-modules/data/observable");
+import data_observablearray = require("tns-core-modules/data/observable-array");
-import ui_frame = require("ui/frame");
-import { Page } from "ui/page";
-import { ActionBar, NavigationButton, ActionItems, ActionItem } from "ui/action-bar";
-import { ListView } from "ui/list-view";
-import { Label } from "ui/label";
+import ui_frame = require("tns-core-modules/ui/frame");
+import { Page } from "tns-core-modules/ui/page";
+import { ActionBar, NavigationButton, ActionItems, ActionItem } from "tns-core-modules/ui/action-bar";
+import { ListView } from "tns-core-modules/ui/list-view";
+import { Label } from "tns-core-modules/ui/label";
-import { ImagePicker } from "./viewmodel.ios";
+import { ImagePicker } from "./imagepicker.ios";
+
+let imagesModule;
if (global.TNS_WEBPACK) {
- var imagesModule = require("./images.ios");
+ imagesModule = require("./images.ios");
require("bundle-entry-points");
} else {
- var imagesModule = require("./images");
+ imagesModule = require("./images");
}
-var page;
-var goingToAlbum: boolean = false;
+let page;
+let goingToAlbum: boolean = false;
export function onAlbumsItemTap(args) {
- var list = args.object;
- var topmost = ui_frame.topmost();
+ let list = args.object;
+ let topmost = ui_frame.topmost();
goingToAlbum = true;
topmost.navigate({
create: imagesModule.imagesPageFactory,
context: list.items.getItem(args.index)
});
-};
+}
export function pageLoaded(args) {
page = args.object;
- var list = page.getViewById("albums-list");
+ let list = page.getViewById("albums-list");
list.on(ListView.itemLoadingEvent, function(args) {
if (args.ios) {
@@ -54,30 +56,30 @@ export function navigatedFrom(args) {
}
export function done(args) {
- var topmost = ui_frame.topmost();
+ let topmost = ui_frame.topmost();
topmost.goBack();
page.bindingContext.done();
}
export function albumsPageFactory(): Page {
- //
+ //
let page = new Page();
page.on(Page.loadedEvent, pageLoaded);
page.on(Page.navigatedFromEvent, navigatedFrom);
- //
+ //
let actionBar = new ActionBar();
actionBar.bind({ targetProperty: "title", sourceProperty: "albumsText", twoWay: false });
- //
+ //
//
- //
+ //
let navigationButton = new NavigationButton();
navigationButton.bind({ targetProperty: "text", sourceProperty: "cancelText", twoWay: false });
actionBar.navigationButton = navigationButton;
- //
+ //
//
//
- //
+ //
let actionItems = new ActionItems();
let item = new ActionItem();
item.bind({ targetProperty: "text", sourceProperty: "selection.length", twoWay: false,
@@ -87,17 +89,16 @@ export function albumsPageFactory(): Page {
actionBar.actionItems.addItem(item);
page.actionBar = actionBar;
- //
+ //
let listView = new ListView();
listView.id = "albums-list";
listView.bind({ targetProperty: "items", sourceProperty: "albums", twoWay: false });
listView.on(ListView.itemTapEvent, onAlbumsItemTap);
- listView.itemTemplate =
- "" +
- "" +
- "" +
- "" +
- "";
+ listView.itemTemplate = " \
+ \
+ \
+ \
+ ";
page.content = listView;
diff --git a/nativescript-imagepicker/albums.xml b/src/albums.xml
similarity index 100%
rename from nativescript-imagepicker/albums.xml
rename to src/albums.xml
diff --git a/nativescript-imagepicker/viewmodel.android.ts b/src/imagepicker.android.ts
similarity index 74%
rename from nativescript-imagepicker/viewmodel.android.ts
rename to src/imagepicker.android.ts
index d4999c2..03bd969 100644
--- a/nativescript-imagepicker/viewmodel.android.ts
+++ b/src/imagepicker.android.ts
@@ -1,19 +1,20 @@
-import * as observable from "data/observable";
-import * as imagesource from "image-source";
-import * as application from "application";
-import * as platform from "platform";
-import * as imageAssetModule from "image-asset";
+import * as observable from "tns-core-modules/data/observable";
+import * as imagesource from "tns-core-modules/image-source";
+import * as application from "tns-core-modules/application";
+import * as platform from "tns-core-modules/platform";
+import * as imageAssetModule from "tns-core-modules/image-asset";
+import * as permissions from "nativescript-permissions";
interface ArrayBufferStatic extends ArrayBufferConstructor {
from(buffer: java.nio.ByteBuffer): ArrayBuffer;
}
-var Intent = android.content.Intent;
-var Activity = android.app.Activity;
-var MediaStore = android.provider.MediaStore;
-var DocumentsContract = (android.provider).DocumentsContract;
-var BitmapFactory = android.graphics.BitmapFactory;
-var StaticArrayBuffer = ArrayBuffer;
+let Intent = android.content.Intent;
+let Activity = android.app.Activity;
+let MediaStore = android.provider.MediaStore;
+let DocumentsContract = (android.provider).DocumentsContract;
+let BitmapFactory = android.graphics.BitmapFactory;
+let StaticArrayBuffer = ArrayBuffer;
export class SelectedAsset extends imageAssetModule.ImageAsset {
private _uri: android.net.Uri;
@@ -47,7 +48,7 @@ export class SelectedAsset extends imageAssetModule.ImageAsset {
return new Promise((resolve, reject) => {
try {
if (!this._data) {
- var bb = this.getByteBuffer(this._uri);
+ let bb = this.getByteBuffer(this._uri);
this._data = StaticArrayBuffer.from(bb);
}
resolve(this._data);
@@ -57,7 +58,7 @@ export class SelectedAsset extends imageAssetModule.ImageAsset {
});
}
- //[Deprecated. Please use thumbAsset instead.]
+ // [Deprecated. Please use thumbAsset instead.]
get thumb(): imagesource.ImageSource {
if (!this._thumbRequested) {
this.decodeThumbUri();
@@ -85,15 +86,18 @@ export class SelectedAsset extends imageAssetModule.ImageAsset {
return this._fileUri;
}
- private static _calculateFileUri(uri : android.net.Uri) {
- var isKitKat = android.os.Build.VERSION.SDK_INT >= 19;//android.os.Build.VERSION_CODES.KITKAT
+ private static _calculateFileUri(uri: android.net.Uri) {
+ let isKitKat = android.os.Build.VERSION.SDK_INT >= 19; // android.os.Build.VERSION_CODES.KITKAT
if (isKitKat && DocumentsContract.isDocumentUri(application.android.context, uri)) {
+ let docId, id, type;
+ let contentUri: android.net.Uri = null;
+
// ExternalStorageProvider
if (SelectedAsset.isExternalStorageDocument(uri)) {
- var docId = DocumentsContract.getDocumentId(uri);
- var id = docId.split(":")[1];
- var type = docId.split(":")[0];
+ docId = DocumentsContract.getDocumentId(uri);
+ id = docId.split(":")[1];
+ type = docId.split(":")[0];
if ("primary" === type.toLowerCase()) {
return android.os.Environment.getExternalStorageDirectory() + "/" + id;
@@ -103,20 +107,19 @@ export class SelectedAsset extends imageAssetModule.ImageAsset {
}
// DownloadsProvider
else if (SelectedAsset.isDownloadsDocument(uri)) {
- var id = DocumentsContract.getDocumentId(uri);
- var contentUri = android.content.ContentUris.withAppendedId(
+ id = DocumentsContract.getDocumentId(uri);
+ contentUri = android.content.ContentUris.withAppendedId(
android.net.Uri.parse("content://downloads/public_downloads"), long(id));
return SelectedAsset.getDataColumn(contentUri, null, null);
}
// MediaProvider
else if (SelectedAsset.isMediaDocument(uri)) {
- var docId = DocumentsContract.getDocumentId(uri);
- var split = docId.split(":");
- var type = split[0];
- var id = split[1];
+ docId = DocumentsContract.getDocumentId(uri);
+ let split = docId.split(":");
+ type = split[0];
+ id = split[1];
- var contentUri: android.net.Uri = null;
if ("image" === type) {
contentUri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI;
} else if ("video" === type) {
@@ -125,8 +128,8 @@ export class SelectedAsset extends imageAssetModule.ImageAsset {
contentUri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI;
}
- var selection = "_id=?";
- var selectionArgs = [id];
+ let selection = "_id=?";
+ let selectionArgs = [id];
return SelectedAsset.getDataColumn(contentUri, selection, selectionArgs);
}
@@ -143,19 +146,18 @@ export class SelectedAsset extends imageAssetModule.ImageAsset {
}
return undefined;
- };
+ }
private static getDataColumn(uri: android.net.Uri, selection, selectionArgs) {
- var cursor = null;
- var columns = [MediaStore.MediaColumns.DATA];
-
- var filePath;
+ let cursor = null;
+ let columns = [MediaStore.MediaColumns.DATA];
+ let filePath;
try {
cursor = this.getContentResolver().query(uri, columns, selection, selectionArgs, null);
if (cursor != null && cursor.moveToFirst()) {
- var column_index = cursor.getColumnIndexOrThrow(columns[0]);
+ let column_index = cursor.getColumnIndexOrThrow(columns[0]);
filePath = cursor.getString(column_index);
if (filePath) {
return filePath;
@@ -172,21 +174,23 @@ export class SelectedAsset extends imageAssetModule.ImageAsset {
}
return undefined;
- };
+ }
private static isExternalStorageDocument(uri: android.net.Uri) {
return "com.android.externalstorage.documents" === uri.getAuthority();
- };
+ }
+
private static isDownloadsDocument(uri: android.net.Uri) {
return "com.android.providers.downloads.documents" === uri.getAuthority();
- };
+ }
+
private static isMediaDocument(uri: android.net.Uri) {
return "com.android.providers.media.documents" === uri.getAuthority();
- };
+ }
private decodeThumbUri(): void {
// Decode image size
- var REQUIRED_SIZE = {
+ let REQUIRED_SIZE = {
maxWidth: 100,
maxHeight: 100
};
@@ -198,7 +202,7 @@ export class SelectedAsset extends imageAssetModule.ImageAsset {
private decodeThumbAssetUri(): void {
// Decode image size
- var REQUIRED_SIZE = {
+ let REQUIRED_SIZE = {
maxWidth: 100,
maxHeight: 100
};
@@ -215,19 +219,19 @@ export class SelectedAsset extends imageAssetModule.ImageAsset {
* @param options The options that should be used to produce the correct image scale.
*/
private getSampleSize(uri: android.net.Uri, options?: { maxWidth: number, maxHeight: number }): number {
- var boundsOptions = new BitmapFactory.Options();
+ let boundsOptions = new BitmapFactory.Options();
boundsOptions.inJustDecodeBounds = true;
BitmapFactory.decodeStream(this.openInputStream(uri), null, boundsOptions);
// Find the correct scale value. It should be the power of 2.
- var outWidth = boundsOptions.outWidth;
- var outHeight = boundsOptions.outHeight;
- var scale = 1;
+ let outWidth = boundsOptions.outWidth;
+ let outHeight = boundsOptions.outHeight;
+ let scale = 1;
if (options) {
// TODO: Refactor to accomodate different scaling options
// Right now, it just selects the smallest of the two sizes
// and scales the image proportionally to that.
- var targetSize = options.maxWidth < options.maxHeight ? options.maxWidth : options.maxHeight;
+ let targetSize = options.maxWidth < options.maxHeight ? options.maxWidth : options.maxHeight;
while (!(this.matchesSize(targetSize, outWidth) ||
this.matchesSize(targetSize, outHeight))) {
outWidth /= 2;
@@ -248,10 +252,10 @@ export class SelectedAsset extends imageAssetModule.ImageAsset {
* @param options The options that should be used to decode the image.
*/
private decodeUri(uri: android.net.Uri, options?: { maxWidth: number, maxHeight: number }): imagesource.ImageSource {
- var downsampleOptions = new BitmapFactory.Options();
+ let downsampleOptions = new BitmapFactory.Options();
downsampleOptions.inSampleSize = this.getSampleSize(uri, options);
- var bitmap = BitmapFactory.decodeStream(this.openInputStream(uri), null, downsampleOptions);
- var image = new imagesource.ImageSource();
+ let bitmap = BitmapFactory.decodeStream(this.openInputStream(uri), null, downsampleOptions);
+ let image = new imagesource.ImageSource();
image.setNativeSource(bitmap);
return image;
}
@@ -262,9 +266,9 @@ export class SelectedAsset extends imageAssetModule.ImageAsset {
* @param options The options that should be used to decode the image.
*/
private decodeUriForImageAsset(uri: android.net.Uri, options?: { maxWidth: number, maxHeight: number }): imageAssetModule.ImageAsset {
- var downsampleOptions = new BitmapFactory.Options();
+ let downsampleOptions = new BitmapFactory.Options();
downsampleOptions.inSampleSize = this.getSampleSize(uri, options);
- var bitmap = BitmapFactory.decodeStream(this.openInputStream(uri), null, downsampleOptions);
+ let bitmap = BitmapFactory.decodeStream(this.openInputStream(uri), null, downsampleOptions);
return new imageAssetModule.ImageAsset(bitmap);
}
@@ -272,18 +276,18 @@ export class SelectedAsset extends imageAssetModule.ImageAsset {
* Retrieves the raw data of the given file and exposes it as a byte buffer.
*/
private getByteBuffer(uri: android.net.Uri): java.nio.ByteBuffer {
- var file: android.content.res.AssetFileDescriptor = null;
+ let file: android.content.res.AssetFileDescriptor = null;
try {
file = SelectedAsset.getContentResolver().openAssetFileDescriptor(uri, "r");
// Determine how many bytes to allocate in memory based on the file length
- var length: number = file.getLength();
- var buffer: java.nio.ByteBuffer = java.nio.ByteBuffer.allocateDirect(length);
- var bytes = buffer.array();
- var stream = file.createInputStream();
+ let length: number = file.getLength();
+ let buffer: java.nio.ByteBuffer = java.nio.ByteBuffer.allocateDirect(length);
+ let bytes = buffer.array();
+ let stream = file.createInputStream();
// Buffer the data in 4KiB amounts
- var reader = new java.io.BufferedInputStream(stream, 4096);
+ let reader = new java.io.BufferedInputStream(stream, 4096);
reader.read(bytes, 0, bytes.length);
return buffer;
} finally {
@@ -314,44 +318,48 @@ export class ImagePicker {
}
authorize(): Promise {
- return Promise.resolve();
+ if ((android).os.Build.VERSION.SDK_INT >= 23) {
+ return permissions.requestPermission([(android).Manifest.permission.READ_EXTERNAL_STORAGE]);
+ } else {
+ return Promise.resolve();
+ }
}
present(): Promise {
return new Promise((resolve, reject) => {
// WARNING: If we want to support multiple pickers we will need to have a range of IDs here:
- var RESULT_CODE_PICKER_IMAGES = 9192;
+ let RESULT_CODE_PICKER_IMAGES = 9192;
- var application = require("application");
+ let application = require("application");
application.android.on(application.AndroidApplication.activityResultEvent, onResult);
function onResult(args) {
- var requestCode = args.requestCode;
- var resultCode = args.resultCode;
- var data = args.intent;
+ let requestCode = args.requestCode;
+ let resultCode = args.resultCode;
+ let data = args.intent;
- if (requestCode == RESULT_CODE_PICKER_IMAGES) {
- if (resultCode == Activity.RESULT_OK) {
+ if (requestCode === RESULT_CODE_PICKER_IMAGES) {
+ if (resultCode === Activity.RESULT_OK) {
try {
- var results = [];
+ let results = [];
- var clip = data.getClipData();
+ let clip = data.getClipData();
if (clip) {
- var count = clip.getItemCount();
- for (var i = 0; i < count; i++) {
- var clipItem = clip.getItemAt(i);
+ let count = clip.getItemCount();
+ for (let i = 0; i < count; i++) {
+ let clipItem = clip.getItemAt(i);
if (clipItem) {
- var uri = clipItem.getUri();
+ let uri = clipItem.getUri();
if (uri) {
results.push(new SelectedAsset(uri));
}
}
}
} else {
- var uri = data.getData();
+ let uri = data.getData();
results.push(new SelectedAsset(uri));
}
@@ -371,9 +379,9 @@ export class ImagePicker {
return;
}
}
- };
+ }
- var intent = new Intent();
+ let intent = new Intent();
intent.setType("image/*");
// TODO: Use (android).content.Intent.EXTRA_ALLOW_MULTIPLE
@@ -383,7 +391,7 @@ export class ImagePicker {
intent.setAction(Intent.ACTION_GET_CONTENT);
- var chooser = Intent.createChooser(intent, "Select Picture");
+ let chooser = Intent.createChooser(intent, "Select Picture");
application.android.foregroundActivity.startActivityForResult(intent, RESULT_CODE_PICKER_IMAGES);
});
}
diff --git a/nativescript-imagepicker/viewmodel.ios.ts b/src/imagepicker.ios.ts
similarity index 89%
rename from nativescript-imagepicker/viewmodel.ios.ts
rename to src/imagepicker.ios.ts
index e25ba3e..dd5f4c3 100644
--- a/nativescript-imagepicker/viewmodel.ios.ts
+++ b/src/imagepicker.ios.ts
@@ -1,15 +1,16 @@
-import * as data_observable from "data/observable";
-import * as data_observablearray from "data/observable-array";
-import * as frame from "ui/frame";
-import * as imageAssetModule from "image-asset";
-import * as image_source from "image-source";
+import * as data_observable from "tns-core-modules/data/observable";
+import * as data_observablearray from "tns-core-modules/data/observable-array";
+import * as frame from "tns-core-modules/ui/frame";
+import * as imageAssetModule from "tns-core-modules/image-asset";
+import * as image_source from "tns-core-modules/image-source";
+let albumsModule;
if (global.TNS_WEBPACK) {
- var albumsModule = require("./albums.ios");
+ albumsModule = require("./albums.ios");
require("bundle-entry-points");
} else {
- var albumsModule = require("./albums");
+ albumsModule = require("./albums");
}
const IMAGE_WIDTH = 80;
@@ -137,7 +138,7 @@ export class Album extends data_observable.Observable {
return this._assets;
}
- //[Deprecated. Please use thumbAsset instead.]
+ // [Deprecated. Please use thumbAsset instead.]
get thumb(): image_source.ImageSource {
return this._thumb;
}
@@ -212,8 +213,8 @@ export class Asset extends SelectedAsset {
}
set selected(value: boolean) {
- if (!!value == this.selected) return;
- var index = this.album.imagePicker.selection.indexOf(this);
+ if (!!value === this.selected) return;
+ let index = this.album.imagePicker.selection.indexOf(this);
if (value) {
this._selected = true;
if (this.album.imagePicker.mode === "single") {
@@ -275,7 +276,7 @@ class ImagePickerPH extends ImagePicker {
authorize(): Promise {
return new Promise((resolve, reject) => {
- var runloop = CFRunLoopGetCurrent();
+ let runloop = CFRunLoopGetCurrent();
PHPhotoLibrary.requestAuthorization(function (result) {
if (result === PHAuthorizationStatus.Authorized) {
resolve();
@@ -292,8 +293,8 @@ class ImagePickerPH extends ImagePicker {
}
addAlbumsForFetchResult(result: PHFetchResult): void {
- for (var i = 0; i < result.count; i++) {
- var item = result.objectAtIndex(i);
+ for (let i = 0; i < result.count; i++) {
+ let item = result.objectAtIndex(i);
if (item.isKindOfClass(PHAssetCollection)) {
this.addAlbumForAssetCollection(item);
} else {
@@ -303,8 +304,8 @@ class ImagePickerPH extends ImagePicker {
}
addAlbumForAssetCollection(assetCollection: PHAssetCollection): void {
- var album = new AlbumPH(this, assetCollection.localizedTitle);
- var pfAssets = PHAsset.fetchAssetsInAssetCollectionOptions(assetCollection, null);
+ let album = new AlbumPH(this, assetCollection.localizedTitle);
+ let pfAssets = PHAsset.fetchAssetsInAssetCollectionOptions(assetCollection, null);
album.addAssetsForFetchResult(pfAssets);
if (album.assets.length > 0) {
this.albums.push(album);
@@ -314,7 +315,7 @@ class ImagePickerPH extends ImagePicker {
createPHImageThumb(target, asset: PHAsset): void {
PHImageManager.defaultManager().requestImageForAssetTargetSizeContentModeOptionsResultHandler(asset, this._thumbRequestSize, PHImageContentMode.AspectFill,
this._thumbRequestOptions, function (target, uiImage, info) {
- var imageSource = new image_source.ImageSource();
+ let imageSource = new image_source.ImageSource();
imageSource.setNativeSource(uiImage);
target.setThumb(imageSource);
}.bind(this, target));
@@ -323,7 +324,7 @@ class ImagePickerPH extends ImagePicker {
createPHImageThumbAsset(target, asset: PHAsset): void {
PHImageManager.defaultManager().requestImageForAssetTargetSizeContentModeOptionsResultHandler(asset, this._thumbRequestSize, PHImageContentMode.AspectFill,
this._thumbRequestOptions, function (target, uiImage, info) {
- var imageAsset = new imageAssetModule.ImageAsset(uiImage);
+ let imageAsset = new imageAssetModule.ImageAsset(uiImage);
imageAsset.options = {
width: this._options.maxWidth && this._options.maxWidth < IMAGE_WIDTH ? this._options.maxWidth : IMAGE_WIDTH,
height: this._options.maxHeight && this._options.IMAGE_HEIGHT < 80 ? this._options.IMAGE_HEIGHT : IMAGE_HEIGHT,
@@ -336,12 +337,12 @@ class ImagePickerPH extends ImagePicker {
/**
* Creates a new ImageSource from the given image, using the given sizing options.
* @param image The image asset that should be put into an ImageSource.
- * @param options The options that should be used to create the ImageSource.
+ * @param options The options that should be used to create the ImageSource.
*/
createPHImage(image: PHAsset, options?: ImageOptions): Promise {
return new Promise((resolve, reject) => {
- var size: CGSize = options ? CGSizeMake(options.maxWidth, options.maxHeight) : PHImageManagerMaximumSize;
- var resizeMode = PHImageRequestOptions.alloc().init();
+ let size: CGSize = options ? CGSizeMake(options.maxWidth, options.maxHeight) : PHImageManagerMaximumSize;
+ let resizeMode = PHImageRequestOptions.alloc().init();
// TODO: Decide whether it is benefical to use PHImageRequestOptionsResizeModeFast
// Accuracy vs Performance. It is probably best to expose these as iOS specific options.
@@ -359,7 +360,7 @@ class ImagePickerPH extends ImagePicker {
resizeMode,
(createdImage, data) => {
if (createdImage) {
- var imageSource = new image_source.ImageSource();
+ let imageSource = new image_source.ImageSource();
imageSource.setNativeSource(createdImage);
// TODO: Determine whether runOnRunLoop is needed
@@ -374,8 +375,8 @@ class ImagePickerPH extends ImagePicker {
}
done(): void {
- var result = [];
- for (var i = 0; i < this.selection.length; ++i) {
+ let result = [];
+ for (let i = 0; i < this.selection.length; ++i) {
result.push(this.selection.getItem(i));
}
this.notifySelection(result);
@@ -388,10 +389,10 @@ class ImagePickerPH extends ImagePicker {
this._initialized = true;
- var smart = PHAssetCollection.fetchAssetCollectionsWithTypeSubtypeOptions(PHAssetCollectionType.SmartAlbum, PHAssetCollectionSubtype.AlbumRegular, null);
+ let smart = PHAssetCollection.fetchAssetCollectionsWithTypeSubtypeOptions(PHAssetCollectionType.SmartAlbum, PHAssetCollectionSubtype.AlbumRegular, null);
this.addAlbumsForFetchResult(smart);
- var user = PHCollection.fetchTopLevelUserCollectionsWithOptions(null);
+ let user = PHCollection.fetchTopLevelUserCollectionsWithOptions(null);
this.addAlbumsForFetchResult(user);
}
}
@@ -407,8 +408,8 @@ class AlbumPH extends Album {
}
addAssetsForFetchResult(result: PHFetchResult): void {
- for (var i = 0; i < result.count; i++) {
- var asset = result.objectAtIndex(i);
+ for (let i = 0; i < result.count; i++) {
+ let asset = result.objectAtIndex(i);
if (asset.isKindOfClass(PHAsset)) {
this.addAsset(asset);
} else {
@@ -418,9 +419,10 @@ class AlbumPH extends Album {
}
addAsset(asset: PHAsset): void {
- var imagePicker = this.imagePicker;
- var item = new AssetPH(this, asset, this._options);
- if (!this._setThumb && !imagePicker) {
+ let imagePicker = this.imagePicker;
+ let item = new AssetPH(this, asset, this._options);
+
+ if (!this._setThumb && imagePicker) {
this._setThumb = true;
imagePicker.createPHImageThumb(this, asset);
imagePicker.createPHImageThumbAsset(this, asset);
@@ -492,7 +494,7 @@ class AssetPH extends Asset {
AssetPH._uriRequestOptions.synchronous = true;
}
- var uri;
+ let uri;
PHImageManager.defaultManager().requestImageDataForAssetOptionsResultHandler(this._phAsset, AssetPH._uriRequestOptions, (data, uti, orientation, info) => {
uri = info.objectForKey("PHImageFileURLKey");
});
@@ -504,7 +506,7 @@ class AssetPH extends Asset {
data(): Promise {
return new Promise((resolve, reject) => {
- var runloop = CFRunLoopGetCurrent();
+ let runloop = CFRunLoopGetCurrent();
PHImageManager.defaultManager().requestImageDataForAssetOptionsResultHandler(this._phAsset, null, (data, dataUTI, orientation, info) => {
if (data) {
resolve(data);
diff --git a/nativescript-imagepicker/images.ios.ts b/src/images.ios.ts
similarity index 71%
rename from nativescript-imagepicker/images.ios.ts
rename to src/images.ios.ts
index cda3ba6..417f3d2 100644
--- a/nativescript-imagepicker/images.ios.ts
+++ b/src/images.ios.ts
@@ -1,14 +1,14 @@
-import application = require("application");
-import platform = require("platform");
+import application = require("tns-core-modules/application");
+import platform = require("tns-core-modules/platform");
-import ui_frame = require("ui/frame");
-import { Page } from "ui/page";
-import { ActionBar, NavigationButton, ActionItems, ActionItem } from "ui/action-bar";
+import ui_frame = require("tns-core-modules/ui/frame");
+import { Page } from "tns-core-modules/ui/page";
+import { ActionBar, NavigationButton, ActionItems, ActionItem } from "tns-core-modules/ui/action-bar";
import { RadListView, ListViewGridLayout } from "nativescript-telerik-ui/listview";
-var page;
-var list;
-var album;
+let page;
+let list;
+let album;
export function pageLoaded(args) {
page = args.object;
@@ -19,13 +19,13 @@ export function pageLoaded(args) {
list.listViewLayout.spanCount = Math.floor(platform.screen.mainScreen.widthDIPs / 80);
application.on("orientationChanged", function (e: application.OrientationChangedEventData) {
- var currentPageWidth = platform.screen.mainScreen.heightDIPs
+ let currentPageWidth = platform.screen.mainScreen.heightDIPs;
list.listViewLayout.spanCount = Math.floor(currentPageWidth / 80);
});
}
export function done(args) {
- var topmost = ui_frame.topmost();
+ let topmost = ui_frame.topmost();
topmost.goBack();
topmost.goBack();
@@ -33,24 +33,24 @@ export function done(args) {
}
export function imagesPageFactory(): Page {
- //
+ //
let page = new Page();
page.on(Page.loadedEvent, pageLoaded);
-
- //
+
+ //
let actionBar = new ActionBar();
actionBar.bind({ targetProperty: "title", sourceProperty: "title", twoWay: false });
- //
+ //
//
- //
+ //
let navigationButton = new NavigationButton();
navigationButton.text = "Albums";
actionBar.navigationButton = navigationButton;
- //
+ //
//
- //
+ //
let actionItems = new ActionItems();
let item = new ActionItem();
item.bind({
@@ -62,22 +62,22 @@ export function imagesPageFactory(): Page {
actionBar.actionItems.addItem(item);
page.actionBar = actionBar;
- //
+ //
let listView = new RadListView();
listView.id = "images-list";
listView.bind({ targetProperty: "items", sourceProperty: "assets", twoWay: false });
- //
+ //
//
- //
+ //
let listViewGridLayout = new ListViewGridLayout();
listViewGridLayout.scrollDirection = "Vertical";
listViewGridLayout.spanCount = 4;
listViewGridLayout.itemHeight = 80;
listView.listViewLayout = listViewGridLayout;
listView.itemTemplate =
- "" +
- "" +
- "";
+ " \
+ \
+ ";
page.content = listView;
diff --git a/nativescript-imagepicker/images.xml b/src/images.xml
similarity index 100%
rename from nativescript-imagepicker/images.xml
rename to src/images.xml
diff --git a/nativescript-imagepicker/index.d.ts b/src/index.d.ts
similarity index 88%
rename from nativescript-imagepicker/index.d.ts
rename to src/index.d.ts
index 3170e98..4d3b161 100644
--- a/nativescript-imagepicker/index.d.ts
+++ b/src/index.d.ts
@@ -1,6 +1,6 @@
-import observable = require("data/observable");
-import imagesource = require("image-source");
-import imageAssetModule = require("image-asset");
+import observable = require("tns-core-modules/data/observable");
+import imagesource = require("tns-core-modules/image-source");
+import imageAssetModule = require("tns-core-modules/image-asset");
export interface ImageOptions {
/**
@@ -14,7 +14,6 @@ export interface ImageOptions {
maxHeight?: number;
}
-
export class SelectedAsset extends imageAssetModule.ImageAsset {
/**
* [Deprecated. SelectedAsset will be used directly as a source for the thumb image]
@@ -66,7 +65,7 @@ export class ImagePicker {
/**
* Present the image picker UI.
- * The result will be an array of SelectedAsset instances provided when the promise is fulfiled.
+ * The result will be an array of SelectedAsset instances provided when the promise is fulfiled.
*/
present(): Promise;
}
@@ -94,13 +93,6 @@ interface Options {
* Set the text for the albums button in iOS
*/
albumsText?: string;
-
- android?: {
- /**
- * Provide a reason for permission request to access external storage on api levels above 23.
- */
- read_external_storage?: string;
- }
}
export function create(options?: Options): ImagePicker;
diff --git a/src/package.json b/src/package.json
new file mode 100644
index 0000000..4485180
--- /dev/null
+++ b/src/package.json
@@ -0,0 +1,57 @@
+{
+ "name": "nativescript-imagepicker",
+ "version": "3.0.3",
+ "description": "A plugin for the NativeScript framework implementing multiple image picker",
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/NativeScript/nativescript-imagepicker"
+ },
+ "main": "imagepicker",
+ "typings": "index.d.ts",
+ "nativescript": {
+ "platforms": {
+ "android": "3.0.0",
+ "ios": "3.0.0"
+ }
+ },
+ "scripts": {
+ "ngc": "node --max-old-space-size=8192 ./node_modules/.bin/ngc",
+ "build": "npm i && tsc",
+ "prepublishOnly": "npm run build",
+ "ci.tslint": "npm i && tslint '**/*.ts' --config '../tslint.json' --exclude '**/node_modules/**'",
+ "tsc": "tsc -skipLibCheck",
+ "postclone": "npm i && node scripts/postclone.js && cd ../demo && npm i && cd ../src && npm run plugin.link",
+ "test.android": "npm i && npm run tsc && npm run tslint && cd ../demo && tns build android && tns test android --justlaunch && cd ../demo-angular && tns build android && tns test android --justlaunch",
+ "test.ios": "npm i && npm run tsc && npm run tslint && cd ../demo && tns build ios && tns test ios --justlaunch",
+ "tslint": "cd .. && tslint \"**/*.ts\" --config tslint.json --exclude \"**/node_modules/**\"",
+ "plugin.link": "npm link && cd ../demo && npm link nativescript-imagepicker && cd ../demo-angular && npm link nativescript-imagepicker",
+ "plugin.tscwatch": "npm run tsc -- -w",
+ "demo.ios": "npm i && npm run tsc && cd ../demo && tns run ios --syncAllFiles",
+ "demo.android": "npm i && npm run tsc && cd ../demo && tns run android --syncAllFiles",
+ "clean": "rm -rf node_modules && cd ../demo && rm -rf hooks node_modules platforms && cd ../src && npm run plugin.link"
+ },
+ "keywords": [
+ "NativeScript",
+ "JavaScript",
+ "Android",
+ "iOS"
+ ],
+ "author": "NativeScript Team",
+ "bugs": {
+ "url": "https://github.com/NativeScript/nativescript-imagepicker/issues"
+ },
+ "license": "Apache-2.0",
+ "homepage": "https://github.com/NativeScript/nativescript-imagepicker",
+ "readmeFilename": "README.md",
+ "devDependencies": {
+ "tns-core-modules": "^3.1.0",
+ "tns-platform-declarations": "^3.0.0",
+ "typescript": "~2.3.0",
+ "tslint": "~5.4.3"
+ },
+ "dependencies": {
+ "nativescript-telerik-ui": "^3.0.0",
+ "nativescript-permissions": "~1.2.3"
+ },
+ "bootstrapper": "nativescript-plugin-seed"
+}
\ No newline at end of file
diff --git a/src/platforms/android/AndroidManifest.xml b/src/platforms/android/AndroidManifest.xml
new file mode 100644
index 0000000..5a0779c
--- /dev/null
+++ b/src/platforms/android/AndroidManifest.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
diff --git a/src/platforms/android/README.md b/src/platforms/android/README.md
new file mode 100644
index 0000000..ba1db50
--- /dev/null
+++ b/src/platforms/android/README.md
@@ -0,0 +1,9 @@
+# Android permissions and dependencies
+
+* (Optional) Use AndroidManifest.xml to describe any permissions, features or other configuration specifics required or used by your plugin for Android.
+NOTE: The NativeScript CLI will not resolve any contradicting or duplicate entries during the merge. After the plugin is installed, you need to manually resolve such issues.
+
+* (Optional) Use include.gradle configuration to describe any native dependencies. If there are no such, this file can be removed. For more information, see the [include.gradle Specification](http://docs.nativescript.org/plugins/plugins#includegradle-specification)
+
+
+[Read more about nativescript plugins](http://docs.nativescript.org/plugins/plugins)
\ No newline at end of file
diff --git a/src/platforms/android/include.gradle b/src/platforms/android/include.gradle
new file mode 100644
index 0000000..158f5c1
--- /dev/null
+++ b/src/platforms/android/include.gradle
@@ -0,0 +1,15 @@
+/* Include.gradle configuration: http://docs.nativescript.org/plugins/plugins#includegradle-specification */
+
+android {
+ productFlavors {
+ "nativescript-imagepicker" {
+ dimension "nativescript-imagepicker"
+ }
+ }
+}
+
+dependencies {
+ // Describe plugin native Android dependencies like
+ // compile "groupName:pluginName:ver"
+ // EXAMPLE: compile "com.facebook.fresco:fresco:0.9.0+"
+}
\ No newline at end of file
diff --git a/nativescript-imagepicker/platforms/ios/Info.plist b/src/platforms/ios/Info.plist
similarity index 100%
rename from nativescript-imagepicker/platforms/ios/Info.plist
rename to src/platforms/ios/Info.plist
diff --git a/src/platforms/ios/README.md b/src/platforms/ios/README.md
new file mode 100644
index 0000000..f12514c
--- /dev/null
+++ b/src/platforms/ios/README.md
@@ -0,0 +1,9 @@
+# iOS permissions and dependencies
+
+
+* (Optional) Use Info.plist to describe any permissions, features or other configuration specifics required or used by your plugin for iOS.
+NOTE: The NativeScript CLI will not resolve any contradicting or duplicate entries during the merge. After the plugin is installed, you need to manually resolve such issues.
+* (Optional) Use build.xcconfig configuration to describe any plugin the native dependencies. If there are no such, this file can be removed. For more information, see the [build.xcconfig Specification section](http://docs.nativescript.org/plugins/plugins#buildxcconfig-specification).
+
+
+[Read more about nativescript plugins](http://docs.nativescript.org/plugins/plugins)
\ No newline at end of file
diff --git a/src/platforms/ios/build.xcconfig b/src/platforms/ios/build.xcconfig
new file mode 100644
index 0000000..e69de29
diff --git a/src/references.d.ts b/src/references.d.ts
new file mode 100644
index 0000000..1e5e961
--- /dev/null
+++ b/src/references.d.ts
@@ -0,0 +1,2 @@
+///
+///
diff --git a/src/tsconfig.json b/src/tsconfig.json
new file mode 100644
index 0000000..985b276
--- /dev/null
+++ b/src/tsconfig.json
@@ -0,0 +1,26 @@
+{
+ "compilerOptions": {
+ "target": "es5",
+ "module": "commonjs",
+ "declaration": false,
+ "removeComments": true,
+ "noLib": false,
+ "emitDecoratorMetadata": true,
+ "experimentalDecorators": true,
+ "lib": ["es6", "dom"],
+ "sourceMap": true,
+ "pretty": true,
+ "allowUnreachableCode": false,
+ "allowUnusedLabels": false,
+ "noEmitHelpers": true,
+ "noEmitOnError": false,
+ "noImplicitAny": false,
+ "noImplicitReturns": true,
+ "noImplicitUseStrict": false,
+ "noFallthroughCasesInSwitch": true
+ },
+ "exclude": [
+ "node_modules"
+ ],
+ "compileOnSave": false
+}
\ No newline at end of file
diff --git a/tests/ios/basic-selection.js b/tests/ios/basic-selection.js
deleted file mode 100644
index 41eec6d..0000000
--- a/tests/ios/basic-selection.js
+++ /dev/null
@@ -1,10 +0,0 @@
-
-var target = UIATarget.localTarget();
-
-target.frontMostApp().mainWindow().buttons()["Select Images"].tap();
-target.frontMostApp().mainWindow().tableViews()["albums-list"].tapWithOptions({tapOffset:{x:0.31, y:0.07}});
-target.frontMostApp().mainWindow().elements()["images-list"].images()[0].tapWithOptions({tapOffset:{x:0.49, y:0.48}});
-target.frontMostApp().mainWindow().elements()["images-list"].images()[3].tapWithOptions({tapOffset:{x:0.57, y:0.49}});
-target.frontMostApp().navigationBar().rightButton().tap();
-target.frontMostApp().mainWindow().tableViews()["urls-list"].tapWithOptions({tapOffset:{x:0.26, y:0.02}});
-target.frontMostApp().mainWindow().tableViews()["urls-list"].tapWithOptions({tapOffset:{x:0.25, y:0.06}});
diff --git a/tslint.json b/tslint.json
new file mode 100644
index 0000000..4d35c69
--- /dev/null
+++ b/tslint.json
@@ -0,0 +1,57 @@
+{
+ "rules": {
+ "class-name": true,
+ "comment-format": [
+ true,
+ "check-space"
+ ],
+ "indent": [
+ true,
+ "spaces"
+ ],
+ "no-duplicate-variable": true,
+ "no-eval": true,
+ "no-internal-module": true,
+ "no-trailing-whitespace": true,
+ "no-var-keyword": true,
+ "one-line": [
+ true,
+ "check-open-brace",
+ "check-whitespace"
+ ],
+ "quotemark": [
+ false,
+ "double"
+ ],
+ "semicolon": [
+ true,
+ "always"
+ ],
+ "triple-equals": [
+ true,
+ "allow-null-check"
+ ],
+ "typedef-whitespace": [
+ true,
+ {
+ "call-signature": "nospace",
+ "index-signature": "nospace",
+ "parameter": "nospace",
+ "property-declaration": "nospace",
+ "variable-declaration": "nospace"
+ }
+ ],
+ "variable-name": [
+ true,
+ "ban-keywords"
+ ],
+ "whitespace": [
+ true,
+ "check-branch",
+ "check-decl",
+ "check-operator",
+ "check-separator",
+ "check-type"
+ ]
+ }
+}
\ No newline at end of file