about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorHailey <me@haileyok.com>2024-07-07 05:07:28 -0700
committerGitHub <noreply@github.com>2024-07-07 13:07:28 +0100
commita6b3c97df0fa93e6a0d2ebf33824e8a1c5699ef9 (patch)
tree38dc3bdf386b87e1dae89dfa61afd15ad51bd78c /src
parent6b5e3181fb9681e0c0c3b23df29552674183d212 (diff)
downloadvoidsky-a6b3c97df0fa93e6a0d2ebf33824e8a1c5699ef9.tar.zst
Ensure `/start` navigates to `/starter-pack` when clicking a link internally (#4745)
* remove temporary metadata removal

* ensure proper navigation
Diffstat (limited to 'src')
-rw-r--r--src/lib/strings/url-helpers.ts6
-rw-r--r--src/view/com/util/post-embeds/ExternalLinkEmbed.tsx56
2 files changed, 33 insertions, 29 deletions
diff --git a/src/lib/strings/url-helpers.ts b/src/lib/strings/url-helpers.ts
index 742c7ef79..0407df757 100644
--- a/src/lib/strings/url-helpers.ts
+++ b/src/lib/strings/url-helpers.ts
@@ -5,6 +5,7 @@ import TLDs from 'tlds'
 import {logger} from '#/logger'
 import {BSKY_SERVICE} from 'lib/constants'
 import {isInvalidHandle} from 'lib/strings/handles'
+import {startUriToStarterPackUri} from 'lib/strings/starter-pack'
 
 export const BSKY_APP_HOST = 'https://bsky.app'
 const BSKY_TRUSTED_HOSTS = [
@@ -187,6 +188,11 @@ export function convertBskyAppUrlIfNeeded(url: string): string {
   if (isBskyAppUrl(url)) {
     try {
       const urlp = new URL(url)
+
+      if (isBskyStartUrl(url)) {
+        return startUriToStarterPackUri(urlp.pathname)
+      }
+
       return urlp.pathname
     } catch (e) {
       console.error('Unexpected error in convertBskyAppUrlIfNeeded()', e)
diff --git a/src/view/com/util/post-embeds/ExternalLinkEmbed.tsx b/src/view/com/util/post-embeds/ExternalLinkEmbed.tsx
index e7fd6cb8f..cc742c8c0 100644
--- a/src/view/com/util/post-embeds/ExternalLinkEmbed.tsx
+++ b/src/view/com/util/post-embeds/ExternalLinkEmbed.tsx
@@ -79,37 +79,35 @@ export const ExternalLinkEmbed = ({
         ) : embedPlayerParams ? (
           <ExternalPlayer link={link} params={embedPlayerParams} />
         ) : undefined}
-        {!starterPackParsed ? (
-          <View
-            style={[
-              a.flex_1,
-              a.py_sm,
-              {
-                paddingHorizontal: isMobile ? 10 : 14,
-              },
-            ]}>
+        <View
+          style={[
+            a.flex_1,
+            a.py_sm,
+            {
+              paddingHorizontal: isMobile ? 10 : 14,
+            },
+          ]}>
+          <Text
+            type="sm"
+            numberOfLines={1}
+            style={[pal.textLight, {marginVertical: 2}]}>
+            {toNiceDomain(link.uri)}
+          </Text>
+
+          {!embedPlayerParams?.isGif && !embedPlayerParams?.dimensions && (
+            <Text type="lg-bold" numberOfLines={3} style={[pal.text]}>
+              {link.title || link.uri}
+            </Text>
+          )}
+          {link.description ? (
             <Text
-              type="sm"
-              numberOfLines={1}
-              style={[pal.textLight, {marginVertical: 2}]}>
-              {toNiceDomain(link.uri)}
+              type="md"
+              numberOfLines={link.thumb ? 2 : 4}
+              style={[pal.text, a.mt_xs]}>
+              {link.description}
             </Text>
-
-            {!embedPlayerParams?.isGif && !embedPlayerParams?.dimensions && (
-              <Text type="lg-bold" numberOfLines={3} style={[pal.text]}>
-                {link.title || link.uri}
-              </Text>
-            )}
-            {link.description ? (
-              <Text
-                type="md"
-                numberOfLines={link.thumb ? 2 : 4}
-                style={[pal.text, a.mt_xs]}>
-                {link.description}
-              </Text>
-            ) : undefined}
-          </View>
-        ) : null}
+          ) : undefined}
+        </View>
       </LinkWrapper>
     </View>
   )