接入友盟统计与 U-APM,并优化宣传页打卡点标签交互。

友盟 SDK 改为隐私同意后再初始化;宣传页标签新增滑块位移动画,超过 5 个时选中项自动滚动居中。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-07-03 09:23:15 +08:00
parent c7f557f361
commit 00c3cd0a93
134 changed files with 6555 additions and 590 deletions

View File

@ -51,12 +51,14 @@ struct RootView: View {
@State private var sessionBootstrapper: SessionBootstrapper
@State private var isColdStartBootstrapPending = true
@State private var appConfigAPI: AppConfigAPI
@State private var preferencesStore: AppPreferencesStore
/// API token provider
init() {
let apiClient = APIClient()
let tokenStore = SessionTokenStore()
let snapshotStore = AccountSnapshotStore()
let preferencesStore = AppPreferencesStore()
_snapshotStore = State(initialValue: snapshotStore)
_apiClient = State(initialValue: apiClient)
_authAPI = State(initialValue: AuthAPI(client: apiClient))
@ -89,11 +91,17 @@ struct RootView: View {
_locationReportAPI = State(initialValue: locationReportAPI)
_homeLocationViewModel = StateObject(wrappedValue: HomeLocationViewModel(api: locationReportAPI))
_cooperationOrderAPI = State(initialValue: CooperationOrderAPI(client: apiClient))
_preferencesStore = State(initialValue: preferencesStore)
_authSessionCoordinator = State(
initialValue: AuthSessionCoordinator(
tokenStore: tokenStore,
snapshotStore: snapshotStore,
preferencesStore: AppPreferencesStore()
preferencesStore: preferencesStore,
onPrivacyAgreementPersisted: { accepted in
guard accepted else { return }
AMapBootstrap.configure(apiKey: AMapConfig.apiKey)
UMengSDKBootstrap.shared.configureIfAllowed(preferencesStore: preferencesStore)
}
)
)
_sessionBootstrapper = State(
@ -157,6 +165,7 @@ struct RootView: View {
.environment(\.authSessionCoordinator, authSessionCoordinator)
.task {
apiClient.bindAuthTokenProvider { appSession.token }
configurePrivacyGatedThirdPartySDKsIfAllowed()
PushNotificationManager.shared.configure(api: pushAPI, session: appSession, router: appRouter)
await sessionBootstrapper.restore(
appSession: appSession,
@ -256,6 +265,14 @@ struct RootView: View {
}
return "\(phaseText)-\(accountContext.currentScenic?.id ?? 0)"
}
/// SDK
private func configurePrivacyGatedThirdPartySDKsIfAllowed() {
guard preferencesStore.loadPrivacyAgreementAccepted() else { return }
AMapBootstrap.configure(apiKey: AMapConfig.apiKey)
UMengSDKBootstrap.shared.configureIfAllowed(preferencesStore: preferencesStore)
}
}
#Preview {