Skip to content

Commit

Permalink
Merge pull request #657 from DroidKaigi/feature/617-favoriteBugFix
Browse files Browse the repository at this point in the history
Removed problematic toast (was not specified in Figma for this view)
  • Loading branch information
charles-b-stb authored Aug 21, 2024
2 parents b4ba879 + 3c31206 commit 1a5181c
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 18 deletions.
10 changes: 0 additions & 10 deletions app-ios/Sources/TimetableFeature/Resource/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,6 @@
},
"|" : {

},
"AddFavorite" : {
"localizations" : {
"ja" : {
"stringUnit" : {
"state" : "translated",
"value" : "ブックマークに追加されました"
}
}
}
},
"Timetable" : {
"localizations" : {
Expand Down
1 change: 0 additions & 1 deletion app-ios/Sources/TimetableFeature/TimetableListView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ public struct TimetableView: View {
}
Spacer()
}
.toast($store.toast)
.background(AssetColors.Surface.surface.swiftUIColor)
.frame(maxWidth: .infinity)
.toolbar{
Expand Down
9 changes: 2 additions & 7 deletions app-ios/Sources/TimetableFeature/TimetableReducer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ public struct TimetableReducer : Sendable{
@ObservableState
public struct State: Equatable {
var timetableItems: [TimetableTimeGroupItems] = [] //Should be simple objects
var toast: ToastState?

public init(timetableItems: [TimetableTimeGroupItems] = []) {
self.timetableItems = timetableItems
Expand All @@ -26,7 +25,7 @@ public struct TimetableReducer : Sendable{
case view(View)
case requestDay(DayTab)
case response(Result<[TimetableItemWithFavorite], any Error>)
case favoriteResponse(Result<Bool, any Error>)
case favoriteResponse(Result<Void, any Error>)

public enum View : Sendable {
case onAppear
Expand Down Expand Up @@ -101,13 +100,9 @@ public struct TimetableReducer : Sendable{
return .run { send in
await send(.favoriteResponse(Result {
try await timetableClient.toggleBookmark(id: item.timetableItem.id)
return item.isFavorited
}))
}
case let .favoriteResponse(.success(isFavorited)):
if !isFavorited {
state.toast = .init(text: String(localized: "AddFavorite", bundle: .module))
}
case .favoriteResponse(.success):
return .none
case let .favoriteResponse(.failure(error)):
print(error.localizedDescription)
Expand Down

0 comments on commit 1a5181c

Please sign in to comment.