about summary refs log tree commit diff
path: root/src/screens/Onboarding/util.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/screens/Onboarding/util.ts')
-rw-r--r--src/screens/Onboarding/util.ts76
1 files changed, 0 insertions, 76 deletions
diff --git a/src/screens/Onboarding/util.ts b/src/screens/Onboarding/util.ts
index 417417707..f3c800d05 100644
--- a/src/screens/Onboarding/util.ts
+++ b/src/screens/Onboarding/util.ts
@@ -5,66 +5,6 @@ import {
 } from '@atproto/api'
 
 import {until} from '#/lib/async/until'
-import {PRIMARY_FEEDS} from './StepAlgoFeeds'
-
-function shuffle(array: any) {
-  let currentIndex = array.length,
-    randomIndex
-
-  // While there remain elements to shuffle.
-  while (currentIndex > 0) {
-    // Pick a remaining element.
-    randomIndex = Math.floor(Math.random() * currentIndex)
-    currentIndex--
-
-    // And swap it with the current element.
-    ;[array[currentIndex], array[randomIndex]] = [
-      array[randomIndex],
-      array[currentIndex],
-    ]
-  }
-
-  return array
-}
-
-export function aggregateInterestItems(
-  interests: string[],
-  map: {[key: string]: string[]},
-  fallbackItems: string[],
-) {
-  const selected = interests.length
-  const all = interests
-    .map(i => {
-      // suggestions from server
-      const rawSuggestions = map[i]
-
-      // safeguard against a missing interest->suggestion mapping
-      if (!rawSuggestions || !rawSuggestions.length) {
-        return []
-      }
-
-      const suggestions = shuffle(rawSuggestions)
-
-      if (selected === 1) {
-        return suggestions // return all
-      } else if (selected === 2) {
-        return suggestions.slice(0, 5) // return 5
-      } else {
-        return suggestions.slice(0, 3) // return 3
-      }
-    })
-    .flat()
-  // dedupe suggestions
-  const results = Array.from(new Set(all))
-
-  // backfill
-  if (results.length < 20) {
-    results.push(...shuffle(fallbackItems))
-  }
-
-  // dedupe and return 20
-  return Array.from(new Set(results)).slice(0, 20)
-}
 
 export async function bulkWriteFollows(agent: BskyAgent, dids: string[]) {
   const session = agent.session
@@ -109,19 +49,3 @@ async function whenFollowsIndexed(
       }),
   )
 }
-
-/**
- * Kinda hacky, but we want Discover to appear as the first pinned
- * feed after Following
- */
-export function sortPrimaryAlgorithmFeeds(uris: string[]) {
-  return uris.sort((a, b) => {
-    if (a === PRIMARY_FEEDS[0]?.uri) {
-      return -1
-    }
-    if (b === PRIMARY_FEEDS[0]?.uri) {
-      return 1
-    }
-    return a.localeCompare(b)
-  })
-}