[#1360] Shared state is broken on older ios versions

- Fixes for iOS 16 and older
This commit is contained in:
Lukas Korba 2024-09-26 12:08:17 +02:00
parent 98ccc6a235
commit 9fe249ee1b
7 changed files with 119 additions and 107 deletions

View File

@ -6,6 +6,11 @@ directly impact users rather than highlighting other crucial architectural updat
## [Unreleased]
### Fixed
- Splash screen animation is blocked by the main thread on iOS 16 and older.
- Inactive hide balances button on iOS 16 and older.
- Inactive close button in the exchange rate hint bubble on iOS 16 and older.
## 1.2 build 9 (2024-09-17)
### Fixed

View File

@ -26,7 +26,7 @@ class ExchangeRateProvider {
init() {
if !_XCTIsTesting {
@Dependency (\.sdkSynchronizer) var sdkSynchronizer
@Dependency(\.sdkSynchronizer) var sdkSynchronizer
cancellable = sdkSynchronizer.exchangeRateUSDStream().sink { [weak self] result in
self?.resolveResult(result)
@ -37,7 +37,7 @@ class ExchangeRateProvider {
func refreshExchangeRateUSD() {
if !_XCTIsTesting {
// guard the feature is opted-in by a user
@Dependency (\.userStoredPreferences) var userStoredPreferences
@Dependency(\.userStoredPreferences) var userStoredPreferences
guard let exchangeRate = userStoredPreferences.exchangeRate(), exchangeRate.automatic else {
return
@ -47,7 +47,7 @@ class ExchangeRateProvider {
return
}
@Dependency (\.sdkSynchronizer) var sdkSynchronizer
@Dependency(\.sdkSynchronizer) var sdkSynchronizer
sdkSynchronizer.refreshExchangeRateUSD()
}
@ -69,7 +69,7 @@ class ExchangeRateProvider {
latestRate = result
@Dependency (\.zcashSDKEnvironment) var zcashSDKEnvironment
@Dependency(\.zcashSDKEnvironment) var zcashSDKEnvironment
if isStale
&& result.state != .fetching
@ -88,7 +88,7 @@ class ExchangeRateProvider {
}
if latestRate.state == .success {
@Dependency (\.zcashSDKEnvironment) var zcashSDKEnvironment
@Dependency(\.zcashSDKEnvironment) var zcashSDKEnvironment
isStale = false

View File

@ -115,6 +115,7 @@ extension Root {
case .splashFinished:
state.splashAppeared = true
exchangeRate.refreshExchangeRateUSD()
return .none
case .tabs, .initialization, .onboarding, .sandbox, .updateStateAfterConfigUpdate, .alert, .phraseDisplay, .synchronizerStateChanged,

View File

@ -158,7 +158,6 @@ extension Root {
guard sdkSynchronizer.latestState().syncStatus.isPrepared else {
return .none
}
exchangeRate.refreshExchangeRateUSD()
return .run { [state] send in
do {
try await sdkSynchronizer.start(true)
@ -294,7 +293,6 @@ extension Root {
case .initialization(.initializationSuccessfullyDone(let uAddress)):
state.tabsState.addressDetailsState.uAddress = uAddress
state.tabsState.settingsState.advancedSettingsState.uAddress = uAddress
exchangeRate.refreshExchangeRateUSD()
return .merge(
.send(.initialization(.registerForSynchronizersUpdate)),
.publisher {

View File

@ -146,6 +146,7 @@ public struct TabsView: View {
.zashiTitle { navBarView(store.selectedTab) }
.walletStatusPanel()
.overlayPreferenceValue(BoundsPreferenceKey.self) { preferences in
WithPerceptionTracking {
if store.isRateTooltipEnabled {
GeometryReader { geometry in
preferences.map {
@ -161,7 +162,9 @@ public struct TabsView: View {
}
}
}
}
.overlayPreferenceValue(ExchangeRateFeaturePreferenceKey.self) { preferences in
WithPerceptionTracking {
if store.isRateEducationEnabled {
GeometryReader { geometry in
preferences.map {
@ -239,6 +242,7 @@ public struct TabsView: View {
}
}
}
}
@ViewBuilder private func navBarView(_ tab: Tabs.State.Tab) -> some View {
switch tab {

View File

@ -62,6 +62,7 @@ public struct ZatoshiRepresentationView: View {
}
public var body: some View {
WithPerceptionTracking {
HStack {
if isFee {
Text(zatoshiStringRepresentation.feeFormat)
@ -91,6 +92,7 @@ public struct ZatoshiRepresentationView: View {
}
}
}
}
}
#Preview {

View File

@ -15,6 +15,7 @@ struct HiddenIfSetModifier: ViewModifier {
@Shared(.appStorage(.sensitiveContent)) var isSensitiveContentHidden = false
func body(content: Content) -> some View {
WithPerceptionTracking {
VStack(spacing: 0) {
if isSensitiveContentHidden {
Text(L10n.General.hideBalancesMostStandalone)
@ -23,6 +24,7 @@ struct HiddenIfSetModifier: ViewModifier {
}
}
}
}
}
extension Text {