Fix issue with refresh screen when user enters.

This commit is contained in:
Marcin Czachursk 2023-02-23 18:43:19 +01:00
parent cffecf231e
commit 794546887e
2 changed files with 8 additions and 3 deletions

View File

@ -1035,7 +1035,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 30;
CURRENT_PROJECT_VERSION = 31;
DEVELOPMENT_ASSET_PATHS = "\"Vernissage/Preview Content\"";
DEVELOPMENT_TEAM = B2U9FEKYP8;
ENABLE_PREVIEWS = YES;
@ -1072,7 +1072,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 30;
CURRENT_PROJECT_VERSION = 31;
DEVELOPMENT_ASSET_PATHS = "\"Vernissage/Preview Content\"";
DEVELOPMENT_TEAM = B2U9FEKYP8;
ENABLE_PREVIEWS = YES;

View File

@ -19,7 +19,7 @@ struct HomeFeedView: View {
@State private var allItemsLoaded = false
@State private var state: ViewState = .loading
@State private var taskId: UUID = .init()
@State private var taskId: UUID? = nil
@State private var opacity = 0.0
@State private var offset = -50.0
@ -105,6 +105,11 @@ struct HomeFeedView: View {
taskId = .init()
}
.task(id: self.taskId) {
// We have to run task only after refresing the list by the user.
guard self.taskId != nil else {
return
}
HapticService.shared.fireHaptic(of: .dataRefresh(intensity: 0.3))
await self.refreshData()
HapticService.shared.fireHaptic(of: .dataRefresh(intensity: 0.7))