mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
Add popular reads to new users based on client
This commit is contained in:
parent
4b7950458c
commit
9496827c6b
2 changed files with 19 additions and 8 deletions
|
|
@ -126,7 +126,6 @@ export class AddPopularReadsToNewUser
|
|||
}
|
||||
|
||||
async afterInsert(event: InsertEvent<Profile>): Promise<void> {
|
||||
const isIOSUser = event.entity.user.source === 'APPLE'
|
||||
await addPopularReadsForNewUser(event.entity.user.id, isIOSUser)
|
||||
await addPopularReadsForNewUser(event.entity.user.id)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ export const addPopularRead = async (
|
|||
|
||||
const addPopularReads = async (
|
||||
userId: string,
|
||||
...names: string[]
|
||||
names: string[]
|
||||
): Promise<AddPopularReadResult[]> => {
|
||||
const results: AddPopularReadResult[] = []
|
||||
for (const name of names) {
|
||||
|
|
@ -114,15 +114,27 @@ const addPopularReads = async (
|
|||
|
||||
export const addPopularReadsForNewUser = async (
|
||||
userId: string,
|
||||
isIOSUser = false
|
||||
client = 'web'
|
||||
): Promise<void> => {
|
||||
await addPopularReads(
|
||||
userId,
|
||||
const defaultReads = [
|
||||
'omnivore_get_started',
|
||||
'power_read_it_later',
|
||||
'omnivore_organize',
|
||||
isIOSUser ? 'omnivore_ios' : 'omnivore_android'
|
||||
)
|
||||
]
|
||||
|
||||
switch (client) {
|
||||
case 'web':
|
||||
defaultReads.push('omnivore_web')
|
||||
break
|
||||
case 'ios':
|
||||
defaultReads.push('omnivore_ios')
|
||||
break
|
||||
case 'android':
|
||||
defaultReads.push('omnivore_android')
|
||||
break
|
||||
}
|
||||
|
||||
await addPopularReads(userId, defaultReads)
|
||||
}
|
||||
|
||||
const popularReads = [
|
||||
|
|
|
|||
Loading…
Reference in a new issue