fix up store review after follows
This commit is contained in:
@@ -24,7 +24,7 @@ async function askForStoreReviewWithDelay() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
// prompt if user has had 100 sessions or followed 50 people
|
// prompt if user has had 100 sessions or followed 50 people
|
||||||
if (numSessions >= 10 || numFollowed >= 50) {
|
if (numSessions >= 100 || numFollowed >= 50) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
askForStoreReivew().then(() => {
|
askForStoreReivew().then(() => {
|
||||||
persisted
|
persisted
|
||||||
@@ -58,7 +58,6 @@ export async function incrementStoreReviewSessions() {
|
|||||||
if (isWeb) return
|
if (isWeb) return
|
||||||
|
|
||||||
const {numSessions, ...others} = persisted.get('storeReview')
|
const {numSessions, ...others} = persisted.get('storeReview')
|
||||||
console.log('incrementStoreReviewSessions', numSessions, others)
|
|
||||||
await persisted.write('storeReview', {
|
await persisted.write('storeReview', {
|
||||||
numSessions: numSessions + 1,
|
numSessions: numSessions + 1,
|
||||||
...others,
|
...others,
|
||||||
@@ -67,8 +66,6 @@ export async function incrementStoreReviewSessions() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function listenSessionChangeForStoreReview() {
|
export function listenSessionChangeForStoreReview() {
|
||||||
console.log('listenSessionChangeForStoreReview')
|
|
||||||
|
|
||||||
// sets up AppState listener
|
// sets up AppState listener
|
||||||
const l = AppState.addEventListener('change', () => {
|
const l = AppState.addEventListener('change', () => {
|
||||||
if (AppState.currentState === 'active') {
|
if (AppState.currentState === 'active') {
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ import {s, colors} from 'lib/styles'
|
|||||||
import {logger} from '#/logger'
|
import {logger} from '#/logger'
|
||||||
import {useSession} from '#/state/session'
|
import {useSession} from '#/state/session'
|
||||||
import {Shadow} from '#/state/cache/types'
|
import {Shadow} from '#/state/cache/types'
|
||||||
|
import {incrementStoreReviewFollowed} from '#/lib/store-review'
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
profile: Shadow<AppBskyActorDefs.ProfileViewDetailed>
|
profile: Shadow<AppBskyActorDefs.ProfileViewDetailed>
|
||||||
@@ -166,6 +167,7 @@ function ProfileHeaderLoaded({
|
|||||||
profile.displayName || profile.handle,
|
profile.displayName || profile.handle,
|
||||||
)}`,
|
)}`,
|
||||||
)
|
)
|
||||||
|
incrementStoreReviewFollowed()
|
||||||
} catch (e: any) {
|
} catch (e: any) {
|
||||||
logger.error('Failed to follow', {error: String(e)})
|
logger.error('Failed to follow', {error: String(e)})
|
||||||
Toast.show(`There was an issue! ${e.toString()}`)
|
Toast.show(`There was an issue! ${e.toString()}`)
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ import {
|
|||||||
useProfileFollowMutation,
|
useProfileFollowMutation,
|
||||||
useProfileUnfollowMutation,
|
useProfileUnfollowMutation,
|
||||||
} from '#/state/queries/profile'
|
} from '#/state/queries/profile'
|
||||||
|
import {incrementStoreReviewFollowed} from '#/lib/store-review'
|
||||||
|
|
||||||
const OUTER_PADDING = 10
|
const OUTER_PADDING = 10
|
||||||
const INNER_PADDING = 14
|
const INNER_PADDING = 14
|
||||||
@@ -218,6 +219,7 @@ function SuggestedFollow({
|
|||||||
try {
|
try {
|
||||||
track('ProfileHeader:SuggestedFollowFollowed')
|
track('ProfileHeader:SuggestedFollowFollowed')
|
||||||
await followMutation.mutateAsync({did: profile.did})
|
await followMutation.mutateAsync({did: profile.did})
|
||||||
|
incrementStoreReviewFollowed()
|
||||||
} catch (e: any) {
|
} catch (e: any) {
|
||||||
Toast.show('An issue occurred, please try again.')
|
Toast.show('An issue occurred, please try again.')
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user