diff options
Diffstat (limited to 'src/state/models')
-rw-r--r-- | src/state/models/profile-view.ts | 2 | ||||
-rw-r--r-- | src/state/models/shell-ui.ts | 16 | ||||
-rw-r--r-- | src/state/models/user-local-photos.ts | 11 |
3 files changed, 19 insertions, 10 deletions
diff --git a/src/state/models/profile-view.ts b/src/state/models/profile-view.ts index 3228c57e8..79882a562 100644 --- a/src/state/models/profile-view.ts +++ b/src/state/models/profile-view.ts @@ -1,5 +1,5 @@ import {makeAutoObservable, runInAction} from 'mobx' -import {Image as PickedImage} from '../../view/com/util/images/ImageCropPicker' +import {Image as PickedImage} from '../../view/com/util/images/image-crop-picker/ImageCropPicker' import { AppBskyActorGetProfile as GetProfile, AppBskyActorProfile as Profile, diff --git a/src/state/models/shell-ui.ts b/src/state/models/shell-ui.ts index b84d6ece9..09ffd265a 100644 --- a/src/state/models/shell-ui.ts +++ b/src/state/models/shell-ui.ts @@ -1,6 +1,7 @@ import {makeAutoObservable} from 'mobx' import {ProfileViewModel} from './profile-view' import {isObj, hasProp} from '../lib/type-guards' +import {PickedMedia} from '../../view/com/util/images/image-crop-picker/types' export class ConfirmModal { name = 'confirm' @@ -52,6 +53,17 @@ export class ReportAccountModal { } } +export class CropImageModal { + name = 'crop-image' + + constructor( + public uri: string, + public onSelect: (img?: PickedMedia) => void, + ) { + makeAutoObservable(this) + } +} + interface LightboxModel {} export class ProfileImageLightbox implements LightboxModel { @@ -98,6 +110,7 @@ export class ShellUiModel { | ServerInputModal | ReportPostModal | ReportAccountModal + | CropImageModal | undefined isLightboxActive = false activeLightbox: ProfileImageLightbox | ImagesLightbox | undefined @@ -140,7 +153,8 @@ export class ShellUiModel { | EditProfileModal | ServerInputModal | ReportPostModal - | ReportAccountModal, + | ReportAccountModal + | CropImageModal, ) { this.isModalActive = true this.activeModal = modal diff --git a/src/state/models/user-local-photos.ts b/src/state/models/user-local-photos.ts index 08b2b3901..b14e8a6a4 100644 --- a/src/state/models/user-local-photos.ts +++ b/src/state/models/user-local-photos.ts @@ -16,14 +16,9 @@ export class UserLocalPhotosModel { } async setup() { - await this._getPhotos() - } - - private async _getPhotos() { - CameraRoll.getPhotos({first: 20}).then(r => { - runInAction(() => { - this.photos = r.edges - }) + const r = await CameraRoll.getPhotos({first: 20}) + runInAction(() => { + this.photos = r.edges }) } } |