diff --git a/.gitignore b/.gitignore index cdaf6d7..c96a83f 100644 --- a/.gitignore +++ b/.gitignore @@ -35,3 +35,4 @@ demo-angular/report/report.html demo-angular/report/stats.json /src/platforms/android/nativescript_imagepicker.aar /src/*.tgz +!demo-vue/app/app.js diff --git a/demo-angular/README.md b/demo-angular/README.md new file mode 100644 index 0000000..833bd4a --- /dev/null +++ b/demo-angular/README.md @@ -0,0 +1,9 @@ +# Example for using nativescript-imagepicker plugin +## This example demonstrates how to use plugin with angular + +If you want to test it out on an emulator or a device you can follow the instructions below: + +* `git clone https://github.com/NativeScript/nativescript-imagepicker.git` +* `cd nativescript-imagepicker/demo` or `cd nativescript-imagepicker/demo-angular` +* `npm run build.plugin && npm install` +* `tns run android` or `tns run ios` depending on the platform you want to test diff --git a/demo-angular/app/app.component.html b/demo-angular/app/app.component.html index 82bbd9a..64c3d76 100644 --- a/demo-angular/app/app.component.html +++ b/demo-angular/app/app.component.html @@ -3,13 +3,13 @@ - + + [src]="image" stretch="aspectFill"> diff --git a/demo-vue/.gitignore b/demo-vue/.gitignore new file mode 100644 index 0000000..0cdaa5c --- /dev/null +++ b/demo-vue/.gitignore @@ -0,0 +1,34 @@ +# NativeScript +hooks/ +!hooks/after-createProject/*.js +node_modules/ +platforms/ + +# NativeScript Template +*.js.map +!webpack.config.js +*.css + +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# General +.DS_Store +.AppleDouble +.LSOverride +.idea +.cloud +.project +tmp/ +typings/ + +# Visual Studio Code +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json diff --git a/demo-vue/README.md b/demo-vue/README.md new file mode 100644 index 0000000..f36ed64 --- /dev/null +++ b/demo-vue/README.md @@ -0,0 +1,9 @@ +# Example for using nativescript-imagepicker plugin +## This example demonstrates how to use plugin with vue + +If you want to test it out on an emulator or a device you can follow the instructions below: + +`git clone https://github.com/NativeScript/nativescript-imagepicker.git` +`cd nativescript-imagepicker/demo-vue` +`npm run build.plugin && npm install` +`tns run android --bundle` or `tns run ios --bundle` depending on the platform you want to test \ No newline at end of file diff --git a/demo-vue/app/App_Resources/Android/AndroidManifest.xml b/demo-vue/app/App_Resources/Android/AndroidManifest.xml new file mode 100644 index 0000000..9961000 --- /dev/null +++ b/demo-vue/app/App_Resources/Android/AndroidManifest.xml @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/demo-vue/app/App_Resources/Android/app.gradle b/demo-vue/app/App_Resources/Android/app.gradle new file mode 100644 index 0000000..085f8d0 --- /dev/null +++ b/demo-vue/app/App_Resources/Android/app.gradle @@ -0,0 +1,19 @@ +// Add your native dependencies here: + +// Uncomment to add recyclerview-v7 dependency +//dependencies { +// implementation 'com.android.support:recyclerview-v7:+' +//} + +// If you want to add something to be applied before applying plugins' include.gradle files +// e.g. project.ext.googlePlayServicesVersion = "15.0.1" +// create a file named before-plugins.gradle in the current directory and place it there + +android { + defaultConfig { + generatedDensities = [] + } + aaptOptions { + additionalParameters "--no-version-vectors" + } +} diff --git a/demo-vue/app/App_Resources/Android/drawable-hdpi/background.png b/demo-vue/app/App_Resources/Android/drawable-hdpi/background.png new file mode 100644 index 0000000..6420032 Binary files /dev/null and b/demo-vue/app/App_Resources/Android/drawable-hdpi/background.png differ diff --git a/demo-vue/app/App_Resources/Android/drawable-hdpi/icon.png b/demo-vue/app/App_Resources/Android/drawable-hdpi/icon.png new file mode 100644 index 0000000..117b444 Binary files /dev/null and b/demo-vue/app/App_Resources/Android/drawable-hdpi/icon.png differ diff --git a/demo-vue/app/App_Resources/Android/drawable-hdpi/logo.png b/demo-vue/app/App_Resources/Android/drawable-hdpi/logo.png new file mode 100644 index 0000000..711905f Binary files /dev/null and b/demo-vue/app/App_Resources/Android/drawable-hdpi/logo.png differ diff --git a/demo-vue/app/App_Resources/Android/drawable-ldpi/background.png b/demo-vue/app/App_Resources/Android/drawable-ldpi/background.png new file mode 100644 index 0000000..03befc2 Binary files /dev/null and b/demo-vue/app/App_Resources/Android/drawable-ldpi/background.png differ diff --git a/demo-vue/app/App_Resources/Android/drawable-ldpi/icon.png b/demo-vue/app/App_Resources/Android/drawable-ldpi/icon.png new file mode 100644 index 0000000..bd04848 Binary files /dev/null and b/demo-vue/app/App_Resources/Android/drawable-ldpi/icon.png differ diff --git a/demo-vue/app/App_Resources/Android/drawable-ldpi/logo.png b/demo-vue/app/App_Resources/Android/drawable-ldpi/logo.png new file mode 100644 index 0000000..af908e4 Binary files /dev/null and b/demo-vue/app/App_Resources/Android/drawable-ldpi/logo.png differ diff --git a/demo-vue/app/App_Resources/Android/drawable-mdpi/background.png b/demo-vue/app/App_Resources/Android/drawable-mdpi/background.png new file mode 100644 index 0000000..cfe4a7c Binary files /dev/null and b/demo-vue/app/App_Resources/Android/drawable-mdpi/background.png differ diff --git a/demo-vue/app/App_Resources/Android/drawable-mdpi/icon.png b/demo-vue/app/App_Resources/Android/drawable-mdpi/icon.png new file mode 100644 index 0000000..32aa617 Binary files /dev/null and b/demo-vue/app/App_Resources/Android/drawable-mdpi/icon.png differ diff --git a/demo-vue/app/App_Resources/Android/drawable-mdpi/logo.png b/demo-vue/app/App_Resources/Android/drawable-mdpi/logo.png new file mode 100644 index 0000000..c21ae44 Binary files /dev/null and b/demo-vue/app/App_Resources/Android/drawable-mdpi/logo.png differ diff --git a/demo-vue/app/App_Resources/Android/drawable-nodpi/splash_screen.xml b/demo-vue/app/App_Resources/Android/drawable-nodpi/splash_screen.xml new file mode 100644 index 0000000..ada77f9 --- /dev/null +++ b/demo-vue/app/App_Resources/Android/drawable-nodpi/splash_screen.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/demo-vue/app/App_Resources/Android/drawable-xhdpi/background.png b/demo-vue/app/App_Resources/Android/drawable-xhdpi/background.png new file mode 100644 index 0000000..b06ae26 Binary files /dev/null and b/demo-vue/app/App_Resources/Android/drawable-xhdpi/background.png differ diff --git a/demo-vue/app/App_Resources/Android/drawable-xhdpi/icon.png b/demo-vue/app/App_Resources/Android/drawable-xhdpi/icon.png new file mode 100644 index 0000000..1295004 Binary files /dev/null and b/demo-vue/app/App_Resources/Android/drawable-xhdpi/icon.png differ diff --git a/demo-vue/app/App_Resources/Android/drawable-xhdpi/logo.png b/demo-vue/app/App_Resources/Android/drawable-xhdpi/logo.png new file mode 100644 index 0000000..4ad5346 Binary files /dev/null and b/demo-vue/app/App_Resources/Android/drawable-xhdpi/logo.png differ diff --git a/demo-vue/app/App_Resources/Android/drawable-xxhdpi/background.png b/demo-vue/app/App_Resources/Android/drawable-xxhdpi/background.png new file mode 100644 index 0000000..9bc7f01 Binary files /dev/null and b/demo-vue/app/App_Resources/Android/drawable-xxhdpi/background.png differ diff --git a/demo-vue/app/App_Resources/Android/drawable-xxhdpi/icon.png b/demo-vue/app/App_Resources/Android/drawable-xxhdpi/icon.png new file mode 100644 index 0000000..541e759 Binary files /dev/null and b/demo-vue/app/App_Resources/Android/drawable-xxhdpi/icon.png differ diff --git a/demo-vue/app/App_Resources/Android/drawable-xxhdpi/logo.png b/demo-vue/app/App_Resources/Android/drawable-xxhdpi/logo.png new file mode 100644 index 0000000..bcc4011 Binary files /dev/null and b/demo-vue/app/App_Resources/Android/drawable-xxhdpi/logo.png differ diff --git a/demo-vue/app/App_Resources/Android/drawable-xxxhdpi/background.png b/demo-vue/app/App_Resources/Android/drawable-xxxhdpi/background.png new file mode 100644 index 0000000..d93c3d8 Binary files /dev/null and b/demo-vue/app/App_Resources/Android/drawable-xxxhdpi/background.png differ diff --git a/demo-vue/app/App_Resources/Android/drawable-xxxhdpi/icon.png b/demo-vue/app/App_Resources/Android/drawable-xxxhdpi/icon.png new file mode 100644 index 0000000..072b601 Binary files /dev/null and b/demo-vue/app/App_Resources/Android/drawable-xxxhdpi/icon.png differ diff --git a/demo-vue/app/App_Resources/Android/drawable-xxxhdpi/logo.png b/demo-vue/app/App_Resources/Android/drawable-xxxhdpi/logo.png new file mode 100644 index 0000000..96acb1e Binary files /dev/null and b/demo-vue/app/App_Resources/Android/drawable-xxxhdpi/logo.png differ diff --git a/demo-vue/app/App_Resources/Android/values-v21/colors.xml b/demo-vue/app/App_Resources/Android/values-v21/colors.xml new file mode 100644 index 0000000..a64641a --- /dev/null +++ b/demo-vue/app/App_Resources/Android/values-v21/colors.xml @@ -0,0 +1,4 @@ + + + #3d5afe + \ No newline at end of file diff --git a/demo-vue/app/App_Resources/Android/values-v21/styles.xml b/demo-vue/app/App_Resources/Android/values-v21/styles.xml new file mode 100644 index 0000000..acff7c9 --- /dev/null +++ b/demo-vue/app/App_Resources/Android/values-v21/styles.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/demo-vue/app/App_Resources/Android/values/colors.xml b/demo-vue/app/App_Resources/Android/values/colors.xml new file mode 100644 index 0000000..74ad882 --- /dev/null +++ b/demo-vue/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-vue/app/App_Resources/Android/values/styles.xml b/demo-vue/app/App_Resources/Android/values/styles.xml new file mode 100644 index 0000000..fae0f4b --- /dev/null +++ b/demo-vue/app/App_Resources/Android/values/styles.xml @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + diff --git a/demo-vue/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/Contents.json b/demo-vue/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..4034b76 --- /dev/null +++ b/demo-vue/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,98 @@ +{ + "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" : "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" : "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" + }, + { + "size" : "1024x1024", + "idiom" : "ios-marketing", + "filename" : "icon-1024.png", + "scale" : "1x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/demo-vue/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-1024.png b/demo-vue/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-1024.png new file mode 100644 index 0000000..fe7c504 Binary files /dev/null and b/demo-vue/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-1024.png differ diff --git a/demo-vue/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29.png b/demo-vue/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29.png new file mode 100644 index 0000000..275ddd1 Binary files /dev/null and b/demo-vue/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29.png differ diff --git a/demo-vue/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@2x.png b/demo-vue/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@2x.png new file mode 100644 index 0000000..906e4b4 Binary files /dev/null and b/demo-vue/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@2x.png differ diff --git a/demo-vue/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@3x.png b/demo-vue/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@3x.png new file mode 100644 index 0000000..5b9a78e Binary files /dev/null and b/demo-vue/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@3x.png differ diff --git a/demo-vue/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40.png b/demo-vue/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40.png new file mode 100644 index 0000000..3e4a7ea Binary files /dev/null and b/demo-vue/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40.png differ diff --git a/demo-vue/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@2x.png b/demo-vue/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@2x.png new file mode 100644 index 0000000..f1cf7ae Binary files /dev/null and b/demo-vue/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@2x.png differ diff --git a/demo-vue/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@3x.png b/demo-vue/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@3x.png new file mode 100644 index 0000000..a6b0b6f Binary files /dev/null and b/demo-vue/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@3x.png differ diff --git a/demo-vue/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@2x.png b/demo-vue/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@2x.png new file mode 100644 index 0000000..091c136 Binary files /dev/null and b/demo-vue/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@2x.png differ diff --git a/demo-vue/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@3x.png b/demo-vue/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@3x.png new file mode 100644 index 0000000..eb0279c Binary files /dev/null and b/demo-vue/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@3x.png differ diff --git a/demo-vue/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76.png b/demo-vue/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76.png new file mode 100644 index 0000000..42d84e1 Binary files /dev/null and b/demo-vue/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76.png differ diff --git a/demo-vue/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76@2x.png b/demo-vue/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76@2x.png new file mode 100644 index 0000000..50f1e70 Binary files /dev/null and b/demo-vue/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76@2x.png differ diff --git a/demo-vue/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-83.5@2x.png b/demo-vue/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-83.5@2x.png new file mode 100644 index 0000000..11dc75f Binary files /dev/null and b/demo-vue/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-83.5@2x.png differ diff --git a/demo-vue/app/App_Resources/iOS/Assets.xcassets/Contents.json b/demo-vue/app/App_Resources/iOS/Assets.xcassets/Contents.json new file mode 100644 index 0000000..da4a164 --- /dev/null +++ b/demo-vue/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-vue/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Contents.json b/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Contents.json new file mode 100644 index 0000000..11bfcf5 --- /dev/null +++ b/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Contents.json @@ -0,0 +1,176 @@ +{ + "images" : [ + { + "extent" : "full-screen", + "idiom" : "iphone", + "subtype" : "2436h", + "filename" : "Default-1125h.png", + "minimum-system-version" : "11.0", + "orientation" : "portrait", + "scale" : "3x" + }, + { + "orientation" : "landscape", + "idiom" : "iphone", + "extent" : "full-screen", + "filename" : "Default-Landscape-X.png", + "minimum-system-version" : "11.0", + "subtype" : "2436h", + "scale" : "3x" + }, + { + "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/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-1125h.png b/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-1125h.png new file mode 100644 index 0000000..2913f85 Binary files /dev/null and b/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-1125h.png differ diff --git a/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-568h@2x.png b/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-568h@2x.png new file mode 100644 index 0000000..d7f17fc Binary files /dev/null and b/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-568h@2x.png differ diff --git a/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-667h@2x.png b/demo-vue/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-vue/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-667h@2x.png differ diff --git a/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-736h@3x.png b/demo-vue/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-vue/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-736h@3x.png differ diff --git a/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape-X.png b/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape-X.png new file mode 100644 index 0000000..cd94a3a Binary files /dev/null and b/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape-X.png differ diff --git a/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape.png b/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape.png new file mode 100644 index 0000000..3365ba3 Binary files /dev/null and b/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape.png differ diff --git a/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape@2x.png b/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape@2x.png new file mode 100644 index 0000000..a44945c Binary files /dev/null and b/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape@2x.png differ diff --git a/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape@3x.png b/demo-vue/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-vue/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape@3x.png differ diff --git a/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait.png b/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait.png new file mode 100644 index 0000000..1a50079 Binary files /dev/null and b/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait.png differ diff --git a/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait@2x.png b/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait@2x.png new file mode 100644 index 0000000..73d8b92 Binary files /dev/null and b/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait@2x.png differ diff --git a/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default.png b/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default.png new file mode 100644 index 0000000..9f1f6ce Binary files /dev/null and b/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default.png differ diff --git a/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default@2x.png b/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default@2x.png new file mode 100644 index 0000000..514fc5c Binary files /dev/null and b/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default@2x.png differ diff --git a/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/Contents.json b/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/Contents.json new file mode 100644 index 0000000..4f4e9c5 --- /dev/null +++ b/demo-vue/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-vue/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill.png b/demo-vue/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-vue/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill.png differ diff --git a/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill@2x.png b/demo-vue/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-vue/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill@2x.png differ diff --git a/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/Contents.json b/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/Contents.json new file mode 100644 index 0000000..23c0ffd --- /dev/null +++ b/demo-vue/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-vue/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center.png b/demo-vue/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-vue/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center.png differ diff --git a/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center@2x.png b/demo-vue/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-vue/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center@2x.png differ diff --git a/demo-vue/app/App_Resources/iOS/Info.plist b/demo-vue/app/App_Resources/iOS/Info.plist new file mode 100644 index 0000000..65b54cd --- /dev/null +++ b/demo-vue/app/App_Resources/iOS/Info.plist @@ -0,0 +1,51 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleDisplayName + ${PRODUCT_NAME} + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1.0 + LSRequiresIPhoneOS + + UILaunchStoryboardName + LaunchScreen + UIRequiresFullScreen + + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UIStatusBarStyle + UIStatusBarStyleLightContent + UIViewControllerBasedStatusBarAppearance + + + diff --git a/demo-vue/app/App_Resources/iOS/LaunchScreen.storyboard b/demo-vue/app/App_Resources/iOS/LaunchScreen.storyboard new file mode 100644 index 0000000..2ad9471 --- /dev/null +++ b/demo-vue/app/App_Resources/iOS/LaunchScreen.storyboard @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/demo-vue/app/App_Resources/iOS/build.xcconfig b/demo-vue/app/App_Resources/iOS/build.xcconfig new file mode 100644 index 0000000..4b01184 --- /dev/null +++ b/demo-vue/app/App_Resources/iOS/build.xcconfig @@ -0,0 +1,7 @@ +// 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/demo-vue/app/_app-common.scss b/demo-vue/app/_app-common.scss new file mode 100644 index 0000000..052a9cc --- /dev/null +++ b/demo-vue/app/_app-common.scss @@ -0,0 +1,7 @@ +// Place any CSS rules you want to apply on both iOS and Android here. +// This is where the vast majority of your CSS code goes. + +//Font icon +.fa { + font-family: "FontAwesome"; +} diff --git a/demo-vue/app/_app-variables.scss b/demo-vue/app/_app-variables.scss new file mode 100644 index 0000000..08316a1 --- /dev/null +++ b/demo-vue/app/_app-variables.scss @@ -0,0 +1,78 @@ +// Import the theme’s variables. If you’re using a color scheme +// other than “light”, switch the path to the alternative scheme, +// for example '~nativescript-theme-core/scss/dark'. +@import '~nativescript-theme-core/scss/light'; + +// Custom colors +$background-dark: #F8F8F8 !default; +$background-light: #FFFFFF !default; + +$blue-dark: #022734 !default; +$blue-light: #02556E !default; +$blue-50: rgba($blue-dark, 0.5) !default; +$blue-20: rgba($blue-dark, 0.2) !default; +$blue-10: rgba($blue-dark, 0.1) !default; + +$accent-dark: #3A53FF !default; +$accent-light: #4781FE !default; + +$success-dark: #06CE6A !default; +$success-light: #00E676 !default; + +$warning-dark: #f39c11 !default; +$warning-light: #F2C112 !default; + +$error-dark: #D84039 !default; +$error-light: #ED473F !default; + +$midnight-dark: #0F336D !default; +$midnight-light: #14418B !default; + +$night-dark: #023141 !default; +$night-light: #01526C !default; + +// Sizes +$base-font-size: 11; + +$border-width: 1; +$border-radius: 3; + + +/** + * Theme variables overrides +**/ + +// Colors +$background: #fff; +$primary: lighten(#000, 13%); +$secondary: lighten(#000, 46%); +$disabled: lighten(#000, 62%); +$accent: $accent-dark; +$error: $error-light; + +// SideDrawer +$item-color-android : #737373; +$item-active-background: #F8F8F8; +$item-active-color: $accent; +$item-active-icon-color: $item-active-color; +$item-color-ios: $blue-dark; +$item-color-android: $blue-dark; + +$side-drawer-header-background: #fafafa; +$side-drawer-header-brand: #737373; +$side-drawer-background: #FFFFFF; + +// ActionBar +$ab-background: $accent; +$ab-color: $white; + +// Buttons +$btn-color-inverse: $white; +$btn-color: $accent; +$btn-color-secondary: darken($btn-color, 10%); +$btn-color-outline-highlighted: lighten($btn-color, 10%); + +//Text colors +$headings-color: $blue-dark; +$secondary: $blue-dark; +$text-color: $blue-dark; \ No newline at end of file diff --git a/demo-vue/app/app.js b/demo-vue/app/app.js new file mode 100644 index 0000000..d9a7d43 --- /dev/null +++ b/demo-vue/app/app.js @@ -0,0 +1,15 @@ +import Vue from "nativescript-vue"; + +import Home from "./components/Home"; + +new Vue({ + + template: ` + + + `, + + components: { + Home + } +}).$start(); diff --git a/demo-vue/app/app.scss b/demo-vue/app/app.scss new file mode 100644 index 0000000..320b1b2 --- /dev/null +++ b/demo-vue/app/app.scss @@ -0,0 +1,9 @@ +// Import app variables +@import 'app-variables'; + +// Import the theme’s main ruleset - both index and platform specific. +@import '~nativescript-theme-core/scss/index'; +@import '~nativescript-theme-core/scss/platforms/index.android'; + +// Import common styles +@import 'app-common'; diff --git a/demo-vue/app/components/Home.vue b/demo-vue/app/components/Home.vue new file mode 100644 index 0000000..a0b98db --- /dev/null +++ b/demo-vue/app/components/Home.vue @@ -0,0 +1,97 @@ + + + + + diff --git a/demo-vue/app/fonts/FontAwesome.ttf b/demo-vue/app/fonts/FontAwesome.ttf new file mode 100644 index 0000000..35acda2 Binary files /dev/null and b/demo-vue/app/fonts/FontAwesome.ttf differ diff --git a/demo-vue/app/package.json b/demo-vue/app/package.json new file mode 100644 index 0000000..509921d --- /dev/null +++ b/demo-vue/app/package.json @@ -0,0 +1,7 @@ +{ + "main": "app.js", + "android": { + "v8Flags": "--expose_gc", + "requireModules": ["nativescript-imagepicker"] + } +} diff --git a/demo-vue/package.json b/demo-vue/package.json new file mode 100644 index 0000000..c59477e --- /dev/null +++ b/demo-vue/package.json @@ -0,0 +1,29 @@ +{ + "nativescript": { + "id": "org.nativescript.demovue", + "tns-android": { + "version": "5.1.0" + }, + "tns-ios": { + "version": "5.1.0" + } + }, + "dependencies": { + "nativescript-imagepicker": "../src", + "nativescript-theme-core": "~1.0.4", + "nativescript-vue": "~2.0.0", + "tns-core-modules": "^5.1.0" + }, + "devDependencies": { + "@babel/core": "~7.1.0", + "@babel/preset-env": "~7.1.0", + "babel-loader": "~8.0.0", + "nativescript-dev-webpack": "~0.18.0", + "nativescript-vue-template-compiler": "~2.0.0", + "node-sass": "~4.9.0", + "vue-loader": "~15.4.0" + }, + "scripts": { + "build.plugin": "cd ../src && npm run build" + } +} \ No newline at end of file diff --git a/demo-vue/webpack.config.js b/demo-vue/webpack.config.js new file mode 100644 index 0000000..0880900 --- /dev/null +++ b/demo-vue/webpack.config.js @@ -0,0 +1,266 @@ +const { relative, resolve, sep } = require("path"); + +const webpack = require("webpack"); +const CleanWebpackPlugin = require("clean-webpack-plugin"); +const CopyWebpackPlugin = require("copy-webpack-plugin"); +const { BundleAnalyzerPlugin } = require("webpack-bundle-analyzer"); +const UglifyJsPlugin = require("uglifyjs-webpack-plugin"); + +const VueLoaderPlugin = require('vue-loader/lib/plugin'); +const NsVueTemplateCompiler = require("nativescript-vue-template-compiler"); + +const nsWebpack = require("nativescript-dev-webpack"); +const nativescriptTarget = require("nativescript-dev-webpack/nativescript-target"); +const { NativeScriptWorkerPlugin } = require("nativescript-worker-loader/NativeScriptWorkerPlugin"); + +module.exports = env => { + // Add your custom Activities, Services and other android app components here. + const appComponents = [ + "tns-core-modules/ui/frame", + "tns-core-modules/ui/frame/activity", + ]; + + const platform = env && (env.android && "android" || env.ios && "ios"); + if (!platform) { + throw new Error("You need to provide a target platform!"); + } + + const platforms = ["ios", "android"]; + const projectRoot = __dirname; + + // Default destination inside platforms//... + const dist = resolve(projectRoot, nsWebpack.getAppPath(platform, projectRoot)); + const appResourcesPlatformDir = platform === "android" ? "Android" : "iOS"; + + const { + // The 'appPath' and 'appResourcesPath' values are fetched from + // the nsconfig.json configuration file + // when bundling with `tns run android|ios --bundle`. + appPath = "app", + appResourcesPath = "app/App_Resources", + + // You can provide the following flags when running 'tns run android|ios' + snapshot, // --env.snapshot + production, // --env.production + report, // --env.report + hmr, // --env.hmr + } = env; + + const externals = (env.externals || []).map((e) => { // --env.externals + return new RegExp(e + ".*"); + }); + + const mode = production ? "production" : "development" + + const appFullPath = resolve(projectRoot, appPath); + const appResourcesFullPath = resolve(projectRoot, appResourcesPath); + + const entryModule = nsWebpack.getEntryModule(appFullPath); + const entryPath = `.${sep}${entryModule}.js`; + console.log(`Bundling application for entryPath ${entryPath}...`); + + const config = { + mode: mode, + context: appFullPath, + externals, + watchOptions: { + ignored: [ + appResourcesFullPath, + // Don't watch hidden files + "**/.*", + ], + }, + target: nativescriptTarget, + // target: nativeScriptVueTarget, + entry: { + bundle: entryPath, + }, + output: { + pathinfo: false, + path: dist, + libraryTarget: "commonjs2", + filename: "[name].js", + globalObject: "global", + }, + resolve: { + extensions: [".vue", ".js", ".scss", ".css"], + // Resolve {N} system modules from tns-core-modules + modules: [ + resolve(__dirname, "node_modules/tns-core-modules"), + resolve(__dirname, "node_modules"), + "node_modules/tns-core-modules", + "node_modules", + ], + alias: { + '~': appFullPath, + '@': appFullPath, + 'vue': 'nativescript-vue' + }, + // don't resolve symlinks to symlinked modules + symlinks: false, + }, + resolveLoader: { + // don't resolve symlinks to symlinked loaders + symlinks: false, + }, + node: { + // Disable node shims that conflict with NativeScript + "http": false, + "timers": false, + "setImmediate": false, + "fs": "empty", + "__dirname": false, + }, + devtool: "none", + optimization: { + splitChunks: { + cacheGroups: { + vendor: { + name: "vendor", + chunks: "all", + test: (module) => { + const moduleName = module.nameForCondition ? module.nameForCondition() : ''; + return /[\\/]node_modules[\\/]/.test(moduleName) || + appComponents.some(comp => comp === moduleName); + + }, + enforce: true, + }, + }, + }, + minimize: Boolean(production), + minimizer: [ + new UglifyJsPlugin({ + parallel: true, + cache: true, + uglifyOptions: { + output: { + comments: false, + }, + compress: { + // The Android SBG has problems parsing the output + // when these options are enabled + 'collapse_vars': platform !== "android", + sequences: platform !== "android", + }, + }, + }), + ], + }, + module: { + rules: [{ + test: new RegExp(entryPath), + use: [ + // Require all Android app components + platform === "android" && { + loader: "nativescript-dev-webpack/android-app-components-loader", + options: { modules: appComponents }, + }, + + { + loader: "nativescript-dev-webpack/bundle-config-loader", + options: { + registerPages: true, // applicable only for non-angular apps + loadCss: !snapshot, // load the application css if in debug mode + }, + }, + ].filter(loader => Boolean(loader)), + }, + { + test: /\.css$/, + use: [ + 'nativescript-dev-webpack/style-hot-loader', + 'nativescript-dev-webpack/apply-css-loader.js', + { loader: "css-loader", options: { minimize: false, url: false } }, + ], + }, + { + test: /\.scss$/, + use: [ + 'nativescript-dev-webpack/style-hot-loader', + 'nativescript-dev-webpack/apply-css-loader.js', + { loader: "css-loader", options: { minimize: false, url: false } }, + "sass-loader", + ], + }, + { + test: /\.js$/, + loader: 'babel-loader', + }, + { + test: /\.vue$/, + loader: "vue-loader", + options: { + compiler: NsVueTemplateCompiler, + }, + }, + ], + }, + plugins: [ + // ... Vue Loader plugin omitted + // make sure to include the plugin! + new VueLoaderPlugin(), + // Define useful constants like TNS_WEBPACK + new webpack.DefinePlugin({ + "global.TNS_WEBPACK": "true", + "TNS_ENV": JSON.stringify(mode) + }), + // Remove all files from the out dir. + new CleanWebpackPlugin([`${dist}/**/*`]), + // Copy native app resources to out dir. + new CopyWebpackPlugin([{ + from: `${appResourcesFullPath}/${appResourcesPlatformDir}`, + to: `${dist}/App_Resources/${appResourcesPlatformDir}`, + context: projectRoot, + }]), + // Copy assets to out dir. Add your own globs as needed. + new CopyWebpackPlugin([ + { from: { glob: "fonts/**" } }, + { from: { glob: "**/*.+(jpg|png)" } }, + { from: { glob: "assets/**/*" } }, + ], { ignore: [`${relative(appPath, appResourcesFullPath)}/**`] }), + // Generate a bundle starter script and activate it in package.json + new nsWebpack.GenerateBundleStarterPlugin([ + "./vendor", + "./bundle", + ]), + // For instructions on how to set up workers with webpack + // check out https://github.com/nativescript/worker-loader + new NativeScriptWorkerPlugin(), + new nsWebpack.PlatformFSPlugin({ + platform, + platforms, + }), + // Does IPC communication with the {N} CLI to notify events when running in watch mode. + new nsWebpack.WatchStateLoggerPlugin(), + ], + }; + + if (report) { + // Generate report files for bundles content + config.plugins.push(new BundleAnalyzerPlugin({ + analyzerMode: "static", + openAnalyzer: false, + generateStatsFile: true, + reportFilename: resolve(projectRoot, "report", `report.html`), + statsFilename: resolve(projectRoot, "report", `stats.json`), + })); + } + + if (snapshot) { + config.plugins.push(new nsWebpack.NativeScriptSnapshotPlugin({ + chunk: "vendor", + requireModules: [ + "tns-core-modules/bundle-entry-points", + ], + projectRoot, + webpackConfig: config, + })); + } + + if (hmr) { + config.plugins.push(new webpack.HotModuleReplacementPlugin()); + } + + return config; +}; \ No newline at end of file diff --git a/demo/README.md b/demo/README.md index 40ec4e7..6a8c65f 100644 --- a/demo/README.md +++ b/demo/README.md @@ -1,4 +1,6 @@ -This NativeScript project demonstrates how the plugin works. +# Example for using nativescript-imagepicker plugin +## This example demonstrates how to use plugin + If you want to test it out on an emulator or a device you can follow the instructions below: * `git clone https://github.com/NativeScript/nativescript-imagepicker.git` diff --git a/demo/app/main-page.xml b/demo/app/main-page.xml index c43a3bc..e133bb1 100644 --- a/demo/app/main-page.xml +++ b/demo/app/main-page.xml @@ -3,10 +3,10 @@ - + - + diff --git a/demo/e2e/test.e2e.ts b/demo/e2e/test.e2e.ts index c7d2f82..94f32ea 100644 --- a/demo/e2e/test.e2e.ts +++ b/demo/e2e/test.e2e.ts @@ -1,5 +1,5 @@ import { AppiumDriver, createDriver, SearchOptions } from "nativescript-dev-appium"; -import { isSauceLab, runType, capabilitiesName } from "nativescript-dev-appium/lib/parser"; +import { isSauceLab, runType } from "nativescript-dev-appium/lib/parser"; import { expect } from "chai"; const isSauceRun = isSauceLab; @@ -30,9 +30,8 @@ describe("Imagepicker", async function () { // await driver.driver.resetApp(); const pickSingleButtonText = "Pick Single"; let confirmButtonText = isAndroid ? "Allow" : "OK"; - let uploadPicVerification = "image 0"; - const pickSingleButton = await driver.findElementByText(pickSingleButtonText, SearchOptions.contains); + let pickSingleButton = await driver.findElementByText(pickSingleButtonText, SearchOptions.contains); await pickSingleButton.click(); const confirmButton = await driver.findElementByText(confirmButtonText); await confirmButton.click(); @@ -40,12 +39,12 @@ describe("Imagepicker", async function () { if (isAndroid) { const imagesFolderXpath = await driver.elementHelper.getXPathByText(imagesFolderName, SearchOptions.contains); await driver.driver.sleep(3000); - const imagesFolder = await driver.driver.elementByXPathIfExists(imagesFolderXpath, 10000); + let imagesFolder = await driver.driver.elementByXPathIfExists(imagesFolderXpath, 10000); if (isSauceRun && imagesFolder) { await imagesFolder.click(); - const downloadFolder = await driver.findElementByClassName(driver.locators.image); - await downloadFolder.click(); + imagesFolder = await driver.findElementByClassName(driver.locators.image); + await imagesFolder.click(); } } else { const cameraRollFolder = await driver.findElementByText(imagesFolderNameIos); @@ -55,7 +54,10 @@ describe("Imagepicker", async function () { const pickedImage = await driver.findElementByClassName(driver.locators.image); await pickedImage.click(); - const result = await driver.findElementByText(uploadPicVerification, SearchOptions.contains); + pickSingleButton = await driver.findElementByText(pickSingleButtonText, SearchOptions.contains); + expect(pickSingleButton).to.exist; + + const result = await driver.findElementByClassName(driver.locators.image); expect(result).to.exist; });