diff options
Diffstat (limited to 'mobile/app/gallery-view-model.ts')
-rw-r--r-- | mobile/app/gallery-view-model.ts | 51 |
1 files changed, 0 insertions, 51 deletions
diff --git a/mobile/app/gallery-view-model.ts b/mobile/app/gallery-view-model.ts deleted file mode 100644 index e15839a..0000000 --- a/mobile/app/gallery-view-model.ts +++ /dev/null @@ -1,51 +0,0 @@ -import { AndroidActivityRequestPermissionsEventData, Application, Observable, Utils } from '@nativescript/core'; - -export class GalleryModel extends Observable { - constructor() { - super(); - } - - peng() { - const check = function () { - return new Promise((resolve, reject) => { - (Application.android.foregroundActivity || Application.android.startActivity).requestPermissions([ - android.Manifest.permission.READ_EXTERNAL_STORAGE, - ], 1337); - function onActivityResult(args) { - if (args.requestCode === 1337) { - Application.android.off(Application.android.activityRequestPermissionsEvent, onActivityResult); - console.log(args); - console.log(args.grantResults); - resolve(args); - } - } - Application.android.on(Application.android.activityRequestPermissionsEvent, onActivityResult); - }); - } - - - check().then(() => { - console.log('query'); - const cursor = Utils.android.getApplicationContext().getContentResolver().query( - android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI, - [ - android.provider.MediaStore.Images.ImageColumns._ID, - android.provider.MediaStore.Images.ImageColumns.BUCKET_DISPLAY_NAME, - android.provider.MediaStore.Images.ImageColumns.DATE_TAKEN, - ], - '1) GROUP BY (' + android.provider.MediaStore.Images.ImageColumns.BUCKET_DISPLAY_NAME, - null, - null - ); - - console.log(cursor, cursor.getCount()); - if (cursor) { - console.log(cursor.moveToFirst()); - - const bucketColumn = cursor.getColumnIndex(android.provider.MediaStore.Images.ImageColumns.BUCKET_DISPLAY_NAME); - console.log(bucketColumn); - // console.log(cursor.getString(bucketColumn)); - } - }); - } -} |