@@ -5,19 +5,15 @@ import { takePicture, requestPermissions } from "nativescript-camera";
5
5
import * as appModule from "application" ;
6
6
import * as imageSourceModule from "image-source" ;
7
7
8
- import { ImagePicker , ImageOptions } from "nativescript-imagepicker" ;
9
-
10
8
import * as trace from "trace" ;
11
9
trace . addCategories ( trace . categories . Debug ) ;
12
10
trace . enable ( ) ;
13
11
14
- var list ;
15
-
16
12
export function navigatingTo ( args : EventData ) {
17
13
var page = < Page > args . object ;
18
14
let picturePath = null ;
19
- list = page . getViewById ( "urls-list" ) ;
20
- page . bindingContext = fromObject ( { cameraImage : picturePath , saveToGallery : true } ) ;
15
+
16
+ page . bindingContext = fromObject ( { cameraImage : picturePath , saveToGallery : true } ) ;
21
17
}
22
18
23
19
export function onRequestPermissionsTap ( args : EventData ) {
@@ -27,56 +23,15 @@ export function onRequestPermissionsTap(args: EventData) {
27
23
export function onTakePictureTap ( args : EventData ) {
28
24
let page = < Page > ( < View > args . object ) . page ;
29
25
let saveToGallery = page . bindingContext . get ( "saveToGallery" ) ;
30
- takePicture ( { width : 180 , height : 180 , keepAspectRatio : false , saveToGallery : saveToGallery } ) .
26
+ takePicture ( { width : 180 , height : 180 , keepAspectRatio : false , saveToGallery : saveToGallery } ) .
31
27
then ( ( imageAsset ) => {
32
28
let source = new imageSourceModule . ImageSource ( ) ;
33
29
source . fromAsset ( imageAsset ) . then ( ( source ) => {
34
30
console . log ( `Size: ${ source . width } x${ source . height } ` ) ;
35
31
} ) ;
36
32
page . bindingContext . set ( "cameraImage" , imageAsset ) ;
37
- } ,
33
+ } ,
38
34
( err ) => {
39
35
console . log ( "Error -> " + err . message ) ;
40
36
} ) ;
41
- }
42
-
43
-
44
- export function onSelectMultipleTap ( args ) {
45
- var imagepicker = require ( "nativescript-imagepicker" ) ;
46
- var context = imagepicker . create ( {
47
- mode : "multiple"
48
- } ) ;
49
- startSelection ( context ) ;
50
- }
51
-
52
-
53
- export function onSelectSingleTap ( args ) {
54
- var imagepicker = require ( "nativescript-imagepicker" ) ;
55
- var context = imagepicker . create ( {
56
- mode : "single"
57
- } ) ;
58
- startSelection ( context ) ;
59
- }
60
-
61
-
62
- export function startSelection ( context ) {
63
- context
64
- . authorize ( )
65
- . then ( ( ) => {
66
- list . items = [ ] ;
67
- return context . present ( ) ;
68
- } )
69
- . then ( selection => {
70
- console . log ( "Selection done:" ) ;
71
- var tempList = [ ] ;
72
- selection . forEach ( function ( selected ) {
73
- console . log ( "----------------" ) ;
74
- console . log ( "uri: " + selected . uri ) ;
75
- console . log ( "fileUri: " + selected . fileUri ) ;
76
- tempList . push ( selected ) ;
77
- } ) ;
78
- list . items = tempList ;
79
- } ) . catch ( ( e ) => {
80
- console . log ( e ) ;
81
- } ) ;
82
37
}
0 commit comments