[APP-705] Metrics revamp pt2 (#896)
* export track function from analytics.tsx * fix create account tracking * fix tracking sign in * add custom feed events * fix type errors * refactor create post event * add profile follow & unfollow events * refactor PostsFeedSliceModel into its own file * refactor PostThreadItemModel into its own file * reorganize code a lil bit * refactor post-thread-item to use post-feed-item model under the hood * add post events * add post reply tracking * track custom feed load more * track list subscribe and unsubscribe
This commit is contained in:
parent
bfaa6d73f3
commit
a8bbaa06c7
22 changed files with 436 additions and 386 deletions
|
@ -3,6 +3,7 @@ import {makeAutoObservable, runInAction} from 'mobx'
|
|||
import {RootStoreModel} from 'state/models/root-store'
|
||||
import {sanitizeDisplayName} from 'lib/strings/display-names'
|
||||
import {updateDataOptimistically} from 'lib/async/revertible'
|
||||
import {track} from 'lib/analytics/analytics'
|
||||
|
||||
export class CustomFeedModel {
|
||||
// data
|
||||
|
@ -56,11 +57,23 @@ export class CustomFeedModel {
|
|||
// =
|
||||
|
||||
async save() {
|
||||
await this.rootStore.preferences.addSavedFeed(this.uri)
|
||||
try {
|
||||
await this.rootStore.preferences.addSavedFeed(this.uri)
|
||||
} catch (error) {
|
||||
this.rootStore.log.error('Failed to save feed', error)
|
||||
} finally {
|
||||
track('CustomFeed:Save')
|
||||
}
|
||||
}
|
||||
|
||||
async unsave() {
|
||||
await this.rootStore.preferences.removeSavedFeed(this.uri)
|
||||
try {
|
||||
await this.rootStore.preferences.removeSavedFeed(this.uri)
|
||||
} catch (error) {
|
||||
this.rootStore.log.error('Failed to unsave feed', error)
|
||||
} finally {
|
||||
track('CustomFeed:Unsave')
|
||||
}
|
||||
}
|
||||
|
||||
async like() {
|
||||
|
@ -80,6 +93,8 @@ export class CustomFeedModel {
|
|||
)
|
||||
} catch (e: any) {
|
||||
this.rootStore.log.error('Failed to like feed', e)
|
||||
} finally {
|
||||
track('CustomFeed:Like')
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -100,6 +115,8 @@ export class CustomFeedModel {
|
|||
)
|
||||
} catch (e: any) {
|
||||
this.rootStore.log.error('Failed to unlike feed', e)
|
||||
} finally {
|
||||
track('CustomFeed:Unlike')
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue