SEO
This commit is contained in:
19
utils/shareHandoff.ts
Normal file
19
utils/shareHandoff.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
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;
|
||||
};
|
||||
Reference in New Issue
Block a user