Implement profile updates
parent
fe52d19c48
commit
38ed9a7943
|
@ -138,29 +138,17 @@ export async function unfollow(store: RootStoreModel, followUri: string) {
|
||||||
|
|
||||||
export async function updateProfile(
|
export async function updateProfile(
|
||||||
store: RootStoreModel,
|
store: RootStoreModel,
|
||||||
|
did: string,
|
||||||
modifyFn: (existing?: Profile.Record) => Profile.Record,
|
modifyFn: (existing?: Profile.Record) => Profile.Record,
|
||||||
) {
|
) {
|
||||||
// TODO NOW replaceme
|
|
||||||
const res = await store.api.app.bsky.actor.profile.list({
|
const res = await store.api.app.bsky.actor.profile.list({
|
||||||
user: store.me.did || '',
|
user: did || '',
|
||||||
})
|
})
|
||||||
const existing = res.records[0]
|
const existing = res.records[0]
|
||||||
if (existing) {
|
await store.api.app.bsky.actor.updateProfile({
|
||||||
await store.api.app.bsky.actor.profile.put(
|
did: did || '',
|
||||||
{
|
...modifyFn(existing?.value),
|
||||||
did: store.me.did || '',
|
})
|
||||||
rkey: new AtUri(existing.uri).rkey,
|
|
||||||
},
|
|
||||||
modifyFn(existing.value),
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
await store.api.app.bsky.actor.profile.create(
|
|
||||||
{
|
|
||||||
did: store.me.did || '',
|
|
||||||
},
|
|
||||||
modifyFn(),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function inviteToScene(
|
export async function inviteToScene(
|
||||||
|
|
|
@ -111,10 +111,7 @@ export class ProfileViewModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
async updateProfile(fn: (existing?: Profile.Record) => Profile.Record) {
|
async updateProfile(fn: (existing?: Profile.Record) => Profile.Record) {
|
||||||
if (this.did !== this.rootStore.me.did) {
|
await apilib.updateProfile(this.rootStore, this.did, fn)
|
||||||
throw new Error('Not your profile!')
|
|
||||||
}
|
|
||||||
await apilib.updateProfile(this.rootStore, fn)
|
|
||||||
await this.refresh()
|
await this.refresh()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11770,6 +11770,9 @@ var methodSchemaDict = {
|
||||||
schema: {
|
schema: {
|
||||||
type: "object",
|
type: "object",
|
||||||
properties: {
|
properties: {
|
||||||
|
did: {
|
||||||
|
type: "string"
|
||||||
|
},
|
||||||
displayName: {
|
displayName: {
|
||||||
type: "string",
|
type: "string",
|
||||||
maxLength: 64
|
maxLength: 64
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -7,6 +7,7 @@ export interface CallOptions {
|
||||||
encoding: 'application/json';
|
encoding: 'application/json';
|
||||||
}
|
}
|
||||||
export interface InputSchema {
|
export interface InputSchema {
|
||||||
|
did?: string;
|
||||||
displayName?: string;
|
displayName?: string;
|
||||||
description?: string;
|
description?: string;
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -43,7 +43,13 @@ export function Component({}: {}) {
|
||||||
handle: fullHandle,
|
handle: fullHandle,
|
||||||
})
|
})
|
||||||
// set the scene profile
|
// set the scene profile
|
||||||
// TODO
|
await store.api.app.bsky.actor
|
||||||
|
.updateProfile({
|
||||||
|
did: createSceneRes.data.did,
|
||||||
|
displayName,
|
||||||
|
description,
|
||||||
|
})
|
||||||
|
.catch(e => console.error(e)) // an error here is not critical
|
||||||
// follow the scene
|
// follow the scene
|
||||||
await store.api.app.bsky.graph.follow
|
await store.api.app.bsky.graph.follow
|
||||||
.create(
|
.create(
|
||||||
|
|
|
@ -127,7 +127,7 @@ export const ProfileHeader = observer(function ProfileHeader({
|
||||||
if (isCreator) {
|
if (isCreator) {
|
||||||
dropdownItems.push({
|
dropdownItems.push({
|
||||||
label: 'Edit Profile',
|
label: 'Edit Profile',
|
||||||
onPress: () => {}, // TODO
|
onPress: onPressEditProfile,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if (isMember) {
|
if (isMember) {
|
||||||
|
|
|
@ -6,10 +6,8 @@ Paul's todo list
|
||||||
- Cursor behaviors on all views
|
- Cursor behaviors on all views
|
||||||
- Update swipe behaviors: edge always goes back, leftmost always goes back, main connects to selector if present
|
- Update swipe behaviors: edge always goes back, leftmost always goes back, main connects to selector if present
|
||||||
- Onboarding flow
|
- Onboarding flow
|
||||||
> Confirm email
|
- Confirm email
|
||||||
- Setup profile?
|
- Setup profile?
|
||||||
- Create scene
|
|
||||||
> Set profile during creation
|
|
||||||
- Onboarding
|
- Onboarding
|
||||||
- Finish explainers
|
- Finish explainers
|
||||||
- Discover scenes view
|
- Discover scenes view
|
||||||
|
@ -20,8 +18,6 @@ Paul's todo list
|
||||||
- User profile
|
- User profile
|
||||||
- User
|
- User
|
||||||
- Invite to scene
|
- Invite to scene
|
||||||
- Scene
|
|
||||||
> Edit profile
|
|
||||||
- Reply gating
|
- Reply gating
|
||||||
- Composer
|
- Composer
|
||||||
- View on post
|
- View on post
|
||||||
|
@ -35,6 +31,6 @@ Paul's todo list
|
||||||
- Follows list
|
- Follows list
|
||||||
- Members list
|
- Members list
|
||||||
- Bugs
|
- Bugs
|
||||||
> Auth token refresh seems broken
|
- Auth token refresh seems broken
|
||||||
- Check that sub components arent reloading too much
|
- Check that sub components arent reloading too much
|
||||||
- Titles are getting screwed up (possibly swipe related)
|
- Titles are getting screwed up (possibly swipe related)
|
Loading…
Reference in New Issue