20 lines
595 B
TypeScript
20 lines
595 B
TypeScript
const SHARE_INTENT_SCHEME = 'greenlens';
|
|
export const SHARE_INTENT_KEY = `${SHARE_INTENT_SCHEME}ShareKey`;
|
|
|
|
const sharedImageHandoff = new Map<string, string>();
|
|
|
|
export const storeSharedImageUri = (uri: string): string => {
|
|
const key = `share-${Date.now()}-${Math.random().toString(36).slice(2, 10)}`;
|
|
sharedImageHandoff.set(key, uri);
|
|
return key;
|
|
};
|
|
|
|
export const consumeSharedImageUri = (key: string | null | undefined): string | null => {
|
|
if (!key) return null;
|
|
const uri = sharedImageHandoff.get(key) || null;
|
|
if (uri) {
|
|
sharedImageHandoff.delete(key);
|
|
}
|
|
return uri;
|
|
};
|