about summary refs log tree commit diff
path: root/src/state/models/user-local-photos.ts
diff options
context:
space:
mode:
authorJoão Ferreiro <ferreiro@pinkroom.dev>2022-11-28 16:46:58 +0000
committerJoão Ferreiro <ferreiro@pinkroom.dev>2022-11-28 16:46:58 +0000
commit5ea750599d08229d4b5b10d0e724ca14c73735f5 (patch)
tree4e6f7511b054613b6d5ba189aeca692f95188953 /src/state/models/user-local-photos.ts
parentf5ff0fd2749b5f9ebd9c6b4129513ff8ad577c00 (diff)
downloadvoidsky-5ea750599d08229d4b5b10d0e724ca14c73735f5.tar.zst
upload images in composer v1
Diffstat (limited to 'src/state/models/user-local-photos.ts')
-rw-r--r--src/state/models/user-local-photos.ts25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/state/models/user-local-photos.ts b/src/state/models/user-local-photos.ts
new file mode 100644
index 000000000..4e01f1d94
--- /dev/null
+++ b/src/state/models/user-local-photos.ts
@@ -0,0 +1,25 @@
+import {PhotoIdentifier} from './../../../node_modules/@react-native-camera-roll/camera-roll/src/CameraRoll'
+import {makeAutoObservable} from 'mobx'
+import {CameraRoll} from '@react-native-camera-roll/camera-roll'
+import {RootStoreModel} from './root-store'
+
+export class UserLocalPhotosModel {
+  // state
+  photos: PhotoIdentifier[] = []
+
+  constructor(public rootStore: RootStoreModel) {
+    makeAutoObservable(this, {
+      rootStore: false,
+    })
+  }
+
+  async setup() {
+    await this._getPhotos()
+  }
+
+  private async _getPhotos() {
+    CameraRoll.getPhotos({first: 20}).then(r => {
+      this.photos = r.edges
+    })
+  }
+}