about summary refs log tree commit diff
path: root/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/canvas.ts15
-rw-r--r--src/lib/hooks/useIntentHandler.ts6
-rw-r--r--src/lib/statsig/gates.ts4
3 files changed, 23 insertions, 2 deletions
diff --git a/src/lib/canvas.ts b/src/lib/canvas.ts
new file mode 100644
index 000000000..760c0e67f
--- /dev/null
+++ b/src/lib/canvas.ts
@@ -0,0 +1,15 @@
+export const getCanvas = (base64: string): Promise<HTMLCanvasElement> => {
+  return new Promise(resolve => {
+    const image = new Image()
+    image.onload = () => {
+      const canvas = document.createElement('canvas')
+      canvas.width = image.width
+      canvas.height = image.height
+
+      const ctx = canvas.getContext('2d')
+      ctx?.drawImage(image, 0, 0)
+      resolve(canvas)
+    }
+    image.src = base64
+  })
+}
diff --git a/src/lib/hooks/useIntentHandler.ts b/src/lib/hooks/useIntentHandler.ts
index 8cccda48f..67f1c2c38 100644
--- a/src/lib/hooks/useIntentHandler.ts
+++ b/src/lib/hooks/useIntentHandler.ts
@@ -71,7 +71,7 @@ export function useIntentHandler() {
   }, [incomingUrl, composeIntent, verifyEmailIntent])
 }
 
-function useComposeIntent() {
+export function useComposeIntent() {
   const closeAllActiveElements = useCloseAllActiveElements()
   const {openComposer} = useComposerControls()
   const {hasSession} = useSession()
@@ -97,6 +97,10 @@ function useComposeIntent() {
           if (part.includes('https://') || part.includes('http://')) {
             return false
           }
+          console.log({
+            part,
+            text: VALID_IMAGE_REGEX.test(part),
+          })
           // We also should just filter out cases that don't have all the info we need
           return VALID_IMAGE_REGEX.test(part)
         })
diff --git a/src/lib/statsig/gates.ts b/src/lib/statsig/gates.ts
index 7966767d1..909b93e6b 100644
--- a/src/lib/statsig/gates.ts
+++ b/src/lib/statsig/gates.ts
@@ -1,3 +1,5 @@
 export type Gate =
   // Keep this alphabetic please.
-  'debug_show_feedcontext' | 'suggested_feeds_interstitial'
+  | 'debug_show_feedcontext'
+  | 'suggested_feeds_interstitial'
+  | 'ten_million_dialog'