about summary refs log tree commit diff
path: root/src/state/models/profile-view.ts
diff options
context:
space:
mode:
authorJoão Ferreiro <ferreiro@pinkroom.dev>2022-12-06 16:57:15 +0000
committerGitHub <noreply@github.com>2022-12-06 10:57:15 -0600
commit84a60592a86da2aab9e97a655e52792ff318190e (patch)
tree4bdc7e38f8e72a8baa4a48a84d0c8146d9aa1737 /src/state/models/profile-view.ts
parent4cc90b8ac98f00cb56001460bae12996763bd1c8 (diff)
downloadvoidsky-84a60592a86da2aab9e97a655e52792ff318190e.tar.zst
Upload profile image (#29)
* add editable button profile picture

* add editable button cover picture

* upload profile photos (save them locally)

* rollback pbxproj changes

* rollback podfile checksum (for git only)

* move edit photos onto edit profile modal

* adjust edit icon and image cropping size

* added temporary (react state) image

* added IMAGES_ENABLED flag

* minor lint fix

* save local photos on edit profile upload (wip)

* save profile photos on profile view state (wip)

* remove unecessary computed

* save photo in state before pushing it to viewmodel

* refactor profile pictures's state

* remove unnecessary isMe prop

* removing old comments

* tweak icon size & position

* A few styling tweaks and a fix to mobx state management

Co-authored-by: Paul Frazee <pfrazee@gmail.com>
Diffstat (limited to 'src/state/models/profile-view.ts')
-rw-r--r--src/state/models/profile-view.ts14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/state/models/profile-view.ts b/src/state/models/profile-view.ts
index 927374cc6..83389c82d 100644
--- a/src/state/models/profile-view.ts
+++ b/src/state/models/profile-view.ts
@@ -43,6 +43,10 @@ export class ProfileViewModel {
   postsCount: number = 0
   myState = new ProfileViewMyStateModel()
 
+  // TODO TEMP data to be implemented in the protocol
+  userAvatar: string | null = null
+  userBanner: string | null = null
+
   // added data
   descriptionEntities?: Entity[]
 
@@ -115,7 +119,15 @@ export class ProfileViewModel {
     }
   }
 
-  async updateProfile(fn: (existing?: Profile.Record) => Profile.Record) {
+  async updateProfile(
+    fn: (existing?: Profile.Record) => Profile.Record,
+    userAvatar: string | null, // TODO TEMP
+    userBanner: string | null, // TODO TEMP
+  ) {
+    // TODO TEMP add userBanner & userAvatar in the protocol when suported
+    this.userAvatar = userAvatar
+    this.userBanner = userBanner
+
     await apilib.updateProfile(this.rootStore, this.did, fn)
     await this.refresh()
   }