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 ![apple](https://cdn3.iconfinder.com/data/icons/picons-social/57/16-apple-32.png) ![android](https://cdn4.iconfinder.com/data/icons/logos-3/228/android-32.png) -## Usage -[Please check the following article.](nativescript-imagepicker/README.md) -### Prerequisites - - [nodejs](https://nodejs.org/) - - [nativescript](https://www.nativescript.org/) +[![npm](https://img.shields.io/npm/v/nativescript-imagepicker.svg)](https://www.npmjs.com/package/nativescript-imagepicker) +[![npm](https://img.shields.io/npm/dm/nativescript-imagepicker.svg)](https://www.npmjs.com/package/nativescript-imagepicker) +[![Build Status](https://travis-ci.org/NativeScript/nativescript-imagepicker.svg?branch=master)](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 -``` - - - - - - - - -