Skip to content

Commit

Permalink
feat(profile): methods to read/change profile image (#126)
Browse files Browse the repository at this point in the history
  • Loading branch information
atabel authored Mar 6, 2024
1 parent 9c93e32 commit ed26783
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 0 deletions.
2 changes: 2 additions & 0 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,5 @@ export type {
} from './src/bottom-sheet';

export {openOnboarding} from './src/open-onboarding';

export {getProfileImage, startProfileImageFlow} from './src/profile';
15 changes: 15 additions & 0 deletions src/post-message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,21 @@ export type ResponsesFromNativeApp = {
status: 'enabled' | 'disabled';
};
};
GET_PROFILE_IMAGE: {
type: 'GET_PROFILE_IMAGE';
id: string;
payload: {
image: string | null;
};
};
START_PROFILE_IMAGE_FLOW: {
type: 'START_PROFILE_IMAGE_FLOW';
id: string;
payload: {
image: string | null;
isCancelled: boolean;
};
};
};

export type NativeAppResponsePayload<
Expand Down
14 changes: 14 additions & 0 deletions src/profile.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import {postMessageToNativeApp} from './post-message';

export const getProfileImage = (): Promise<{image: string | null}> =>
postMessageToNativeApp({
type: 'GET_PROFILE_IMAGE',
});

export const startProfileImageFlow = (): Promise<{
image: string | null;
isCancelled: boolean;
}> =>
postMessageToNativeApp({
type: 'START_PROFILE_IMAGE_FLOW',
});

0 comments on commit ed26783

Please sign in to comment.