fix up store review after follows

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