-
Notifications
You must be signed in to change notification settings - Fork 66
IOS-5365 Integrate membership data fetching refactoring for non-blocking startup #4296
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
IOS-5365 Integrate membership data fetching refactoring for non-blocking startup #4296
Conversation
Bugs/IssuesMembershipStatusStorage.swift:43-47 _currentMembership = nil
_cachedTiers = [] |
…ing startup Change MembershipStatusStorage to use noCache: false at startup to prevent blocking app launch with network calls. Add membershipTiersUpdate event handler to process async tier updates from middleware. Cache membership and tiers separately for efficient rebuilding.
cc75f94 to
22db5e7
Compare
Bugs/IssuesMembershipStatusStorage.swift:72-82, 84-93
The class is marked Suggested fix: Remove the explicit private func handleMembershipUpdate(_ update: Anytype_Event.Membership.Update) {
_currentMembership = update.data
rebuildStatusIfReady()
if let tier = _cachedTiers.first(where: { $0.id.id == update.data.tier }) {
AnytypeAnalytics.instance().logChangePlan(tier: tier)
}
}
private func handleMembershipTiersUpdate(_ update: Anytype_Event.Membership.TiersUpdate) {
let filteredTiers = update.tiers
.filter { FeatureFlags.membershipTestTiers || !$0.isTest }
Task {
_cachedTiers = await filteredTiers.asyncMap { await builder.buildMembershipTier(tier: $0) }.compactMap { $0 }
rebuildStatusIfReady()
}
}Note: The async work in |
Bugs/IssuesMembershipStatusStorage.swift:79-81 Consider moving the analytics call into MembershipStatusStorage.swift:96 Best PracticesMembershipStatusStorage.swift:88 let builtTiers = await filteredTiers.asyncMap { await builder.buildMembershipTier(tier: $0) }
_cachedTiers = builtTiers.compactMap { $0 } |
Bugs/IssuesMembershipStatusStorage.swift:93 MembershipStatusStorage.swift:87 MembershipStatusStorage.swift:38 Best PracticesMembershipStatusStorage.swift:102-106 |
Summary
noCache: falseto prevent blocking app launch with network callsmembershipTiersUpdateevent handler for async tier updates from middleware