diff options
author | Daniel Weipert <git@mail.dweipert.de> | 2024-01-26 14:51:36 +0100 |
---|---|---|
committer | Daniel Weipert <git@mail.dweipert.de> | 2024-01-26 14:52:57 +0100 |
commit | d3bf2d09f740221771806789b00bf915c9f5f2e3 (patch) | |
tree | 95f99eabd763dff1907f107393504ee75aa747d7 /mobile/app | |
parent | 466d03a38cb01e9ff9a2d11be113a81c2bdce34a (diff) |
Diffstat (limited to 'mobile/app')
-rw-r--r-- | mobile/app/app-root.xml | 2 | ||||
-rw-r--r-- | mobile/app/app.css | 6 | ||||
-rw-r--r-- | mobile/app/app.ts | 14 | ||||
-rw-r--r-- | mobile/app/gallery-page.ts | 7 | ||||
-rw-r--r-- | mobile/app/gallery-page.xml | 7 | ||||
-rw-r--r-- | mobile/app/gallery-view-model.ts | 51 | ||||
-rw-r--r-- | mobile/app/main-page.ts | 7 | ||||
-rw-r--r-- | mobile/app/main-page.xml | 17 | ||||
-rw-r--r-- | mobile/app/main-view-model.ts | 29 |
9 files changed, 0 insertions, 140 deletions
diff --git a/mobile/app/app-root.xml b/mobile/app/app-root.xml deleted file mode 100644 index 54e70d9..0000000 --- a/mobile/app/app-root.xml +++ /dev/null @@ -1,2 +0,0 @@ -<Frame defaultPage="main-page"> -</Frame> diff --git a/mobile/app/app.css b/mobile/app/app.css deleted file mode 100644 index 14de482..0000000 --- a/mobile/app/app.css +++ /dev/null @@ -1,6 +0,0 @@ -@import '@nativescript/theme/css/core.css'; -@import '@nativescript/theme/css/default.css'; - -Button.-primary { - font-size: 18; -} diff --git a/mobile/app/app.ts b/mobile/app/app.ts deleted file mode 100644 index 1947b6e..0000000 --- a/mobile/app/app.ts +++ /dev/null @@ -1,14 +0,0 @@ -/* -In NativeScript, the app.ts file is the entry point to your application. -You can use this file to perform app-level initialization, but the primary -purpose of the file is to pass control to the app’s first module. -*/ - -import { Application } from '@nativescript/core'; - -Application.run({ moduleName: 'app-root' }); - -/* -Do not place any code after the application has been started as it will not -be executed on iOS. -*/ diff --git a/mobile/app/gallery-page.ts b/mobile/app/gallery-page.ts deleted file mode 100644 index 517ac8a..0000000 --- a/mobile/app/gallery-page.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { EventData, Page } from '@nativescript/core' -import { GalleryModel } from './gallery-view-model'; - -export function navigatingTo(args: EventData) { - const page = <Page>args.object; - page.bindingContext = new GalleryModel(); -} diff --git a/mobile/app/gallery-page.xml b/mobile/app/gallery-page.xml deleted file mode 100644 index aa545e8..0000000 --- a/mobile/app/gallery-page.xml +++ /dev/null @@ -1,7 +0,0 @@ -<Page xmlns="http://schemas.nativescript.org/tns.xsd" navigatingTo="navigatingTo"> - <ActionBar title="Galleries" icon="" /> - - <StackLayout class="p-20"> - <Button text="peng" tap="{{ peng }}" class="-primary" /> - </StackLayout> -</Page> 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)); - } - }); - } -} diff --git a/mobile/app/main-page.ts b/mobile/app/main-page.ts deleted file mode 100644 index 745d6c6..0000000 --- a/mobile/app/main-page.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { EventData, Page } from '@nativescript/core' -import { LoginModel } from './main-view-model'; - -export function navigatingTo(args: EventData) { - const page = <Page>args.object; - page.bindingContext = new LoginModel(); -} diff --git a/mobile/app/main-page.xml b/mobile/app/main-page.xml deleted file mode 100644 index 03fff55..0000000 --- a/mobile/app/main-page.xml +++ /dev/null @@ -1,17 +0,0 @@ -<Page xmlns="http://schemas.nativescript.org/tns.xsd" navigatingTo="navigatingTo"> - <ActionBar title="Image Sync" icon=""> - <ActionItem - text="Galleries" - tap="{{ goToGalleries }}" - /> - </ActionBar> - - <StackLayout class="p-20"> - <Label text="Login" class="h1 text-center" /> - - <TextField hint="Server" text="{{ server }}" class="h2" /> - <TextField hint="Username" text="{{ username }}" class="h2" /> - <TextField hint="Password" text="{{ password }}" secure="true" class="h2" /> - <Button text="Login" tap="{{ onLogin }}" class="-primary" /> - </StackLayout> -</Page> diff --git a/mobile/app/main-view-model.ts b/mobile/app/main-view-model.ts deleted file mode 100644 index 714abe1..0000000 --- a/mobile/app/main-view-model.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { Frame, Http, Observable } from '@nativescript/core'; - -export class LoginModel extends Observable { - public server: string = 'http://192.168.178.59:8080'; - public username: string; - public password: string; - - constructor() { - super(); - } - - async onLogin() { - const content = new FormData(); - content.append('username', this.username); - content.append('password', this.password); - const response = await Http.request({ - url: this.server, - method: 'POST', - content: content, - }); - - console.log(response.content?.toString()); - } - - goToGalleries() { - const frame = Frame.topmost(); - frame.navigate('gallery-page'); - } -} |