Skip to content
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

Migrate to TCA 1.0 #379

Merged
merged 32 commits into from
Jul 10, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
3d8b320
Rename `EffectTask` with `Effect`
Jimmy-Prime Mar 15, 2024
88fac74
Rename `ReducerProtocol` with `Reducer`
Jimmy-Prime Mar 15, 2024
52fd6c8
Fix 'init(value:)' is deprecated
Jimmy-Prime Mar 15, 2024
0026c04
Fix 'fireAndForget' is deprecated
Jimmy-Prime Mar 15, 2024
90c262a
Fix 'init(initialState:reducer:prepareDependencies:)' is deprecated
Jimmy-Prime Mar 15, 2024
ebb2387
Fix 'init(_:)' is deprecated
Jimmy-Prime Mar 16, 2024
253056d
Fix 'binding(_:fileID:line:)'
Jimmy-Prime Mar 16, 2024
53c4574
Fix 'eraseToEffect()' is deprecated
Jimmy-Prime Mar 16, 2024
fdbbbc4
Fix 'cancel(ids:)' is deprecated
Jimmy-Prime Mar 16, 2024
6f04b56
Merge pull request #368 from Jimmy-Prime/jimmy/fix-tca-warnings
chihchy Apr 4, 2024
76abb24
Enforce code style
chihchy Apr 11, 2024
6842553
Update code level contributors
chihchy Apr 11, 2024
4aedf46
Fix most warnings
Jimmy-Prime Apr 19, 2024
6407b4a
pr fix: Update Task.sleep call
Jimmy-Prime May 25, 2024
4c4163b
pr fix: Remove CancelID.teardown
Jimmy-Prime May 25, 2024
69f316b
Merge pull request #372 from Jimmy-Prime/jimmy/fix-most-warnings
chihchy May 27, 2024
a1b0463
Add async response for Request
Jimmy-Prime May 25, 2024
4f34187
Fix deprecation
Jimmy-Prime May 25, 2024
438d56e
Remove deprecated symbol
Jimmy-Prime May 25, 2024
3e7f279
TCA 1.0
Jimmy-Prime May 28, 2024
015e787
Fix bug: nesting binding is not matched
Jimmy-Prime May 28, 2024
093504c
Fix deprecated symbol
Jimmy-Prime May 28, 2024
0f475cc
Merge pull request #376 from Jimmy-Prime/jimmy/fix-publisher-deprecated
chihchy May 30, 2024
fd7805a
Resolve warnings & enforce code style
chihchy May 30, 2024
557a1b7
Update CI
chihchy May 30, 2024
033d8bc
Stop ignoring generated files in git
chihchy May 30, 2024
0de6620
Merge pull request #377 from EhPanda-Team/issue/resolve-warnings-and-…
chihchy May 30, 2024
856c492
Add MainActor attribution to avoid crashes
chihchy Jul 10, 2024
895b6d4
Add folder shortcuts
chihchy Jul 10, 2024
ca18060
Update Package.resolved version
chihchy Jul 10, 2024
4463781
Bump version to 2.7.5
chihchy Jul 10, 2024
0358bd5
Enforce code style
chihchy Jul 10, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix 'binding(_:fileID:line:)'
  • Loading branch information
Jimmy-Prime committed Mar 16, 2024
commit 253056d6ccd2562e8bc75cedc51dcf03a697dc9f
6 changes: 3 additions & 3 deletions EhPanda/View/Detail/Archives/ArchivesView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ struct ArchivesView: View {
NavigationView {
ZStack {
VStack {
HathArchivesView(archives: viewStore.hathArchives, selection: viewStore.binding(\.$selectedArchive))
HathArchivesView(archives: viewStore.hathArchives, selection: viewStore.$selectedArchive)
Spacer()
if let credits = Int(user.credits ?? ""), let galleryPoints = Int(user.galleryPoints ?? "") {
ArchiveFundsView(credits: credits, galleryPoints: galleryPoints)
Expand All @@ -55,12 +55,12 @@ struct ArchivesView: View {
}
.progressHUD(
config: viewStore.communicatingHUDConfig,
unwrapping: viewStore.binding(\.$route),
unwrapping: viewStore.$route,
case: /ArchivesReducer.Route.communicatingHUD
)
.progressHUD(
config: viewStore.messageHUDConfig,
unwrapping: viewStore.binding(\.$route),
unwrapping: viewStore.$route,
case: /ArchivesReducer.Route.messageHUD
)
.animation(.default, value: viewStore.hathArchives)
Expand Down
10 changes: 5 additions & 5 deletions EhPanda/View/Detail/Comments/CommentsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,14 @@ struct CommentsView: View {
}
}
}
.sheet(unwrapping: viewStore.binding(\.$route), case: /CommentsReducer.Route.postComment) { route in
.sheet(unwrapping: viewStore.$route, case: /CommentsReducer.Route.postComment) { route in
let hasCommentID = !route.wrappedValue.isEmpty
PostCommentView(
title: hasCommentID
? L10n.Localizable.PostCommentView.Title.editComment
: L10n.Localizable.PostCommentView.Title.postComment,
content: viewStore.binding(\.$commentContent),
isFocused: viewStore.binding(\.$postCommentFocused),
content: viewStore.$commentContent,
isFocused: viewStore.$postCommentFocused,
postAction: {
if hasCommentID {
viewStore.send(.postComment(galleryURL, route.wrappedValue))
Expand All @@ -116,7 +116,7 @@ struct CommentsView: View {
}
.progressHUD(
config: viewStore.hudConfig,
unwrapping: viewStore.binding(\.$route),
unwrapping: viewStore.$route,
case: /CommentsReducer.Route.hud
)
.animation(.default, value: viewStore.scrollRowOpacity)
Expand All @@ -143,7 +143,7 @@ struct CommentsView: View {
// MARK: NavigationLinks
private extension CommentsView {
@ViewBuilder var navigationLink: some View {
NavigationLink(unwrapping: viewStore.binding(\.$route), case: /CommentsReducer.Route.detail) { route in
NavigationLink(unwrapping: viewStore.$route, case: /CommentsReducer.Route.detail) { route in
DetailView(
store: store.scope(state: \.detailState, action: CommentsReducer.Action.detail),
gid: route.wrappedValue, user: user, setting: $setting,
Expand Down
12 changes: 6 additions & 6 deletions EhPanda/View/Detail/DetailSearch/DetailSearchView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ struct DetailSearchView: View {
}
)
.sheet(
unwrapping: viewStore.binding(\.$route),
unwrapping: viewStore.$route,
case: /DetailSearchReducer.Route.detail,
isEnabled: DeviceUtil.isPad
) { route in
Expand All @@ -58,7 +58,7 @@ struct DetailSearchView: View {
}
.autoBlur(radius: blurRadius).environment(\.inSheet, true).navigationViewStyle(.stack)
}
.sheet(unwrapping: viewStore.binding(\.$route), case: /DetailSearchReducer.Route.quickSearch) { _ in
.sheet(unwrapping: viewStore.$route, case: /DetailSearchReducer.Route.quickSearch) { _ in
QuickSearchView(
store: store.scope(state: \.quickDetailSearchState, action: DetailSearchReducer.Action.quickSearch)
) { keyword in
Expand All @@ -68,14 +68,14 @@ struct DetailSearchView: View {
.accentColor(setting.accentColor)
.autoBlur(radius: blurRadius)
}
.sheet(unwrapping: viewStore.binding(\.$route), case: /DetailSearchReducer.Route.filters) { _ in
.sheet(unwrapping: viewStore.$route, case: /DetailSearchReducer.Route.filters) { _ in
FiltersView(store: store.scope(state: \.filtersState, action: DetailSearchReducer.Action.filters))
.accentColor(setting.accentColor).autoBlur(radius: blurRadius)
}
.searchable(text: viewStore.binding(\.$keyword))
.searchable(text: viewStore.$keyword)
.searchSuggestions {
TagSuggestionView(
keyword: viewStore.binding(\.$keyword), translations: tagTranslator.translations,
keyword: viewStore.$keyword, translations: tagTranslator.translations,
showsImages: setting.showsImagesInTags, isEnabled: setting.showsTagsSearchSuggestion
)
}
Expand All @@ -96,7 +96,7 @@ struct DetailSearchView: View {

@ViewBuilder private var navigationLink: some View {
if DeviceUtil.isPhone {
NavigationLink(unwrapping: viewStore.binding(\.$route), case: /DetailSearchReducer.Route.detail) { route in
NavigationLink(unwrapping: viewStore.$route, case: /DetailSearchReducer.Route.detail) { route in
DetailView(
store: store.scope(state: \.detailState, action: DetailSearchReducer.Action.detail),
gid: route.wrappedValue, user: user, setting: $setting,
Expand Down
26 changes: 13 additions & 13 deletions EhPanda/View/Detail/DetailView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -121,15 +121,15 @@ struct DetailView: View {
ErrorView(error: error ?? .unknown, action: error?.isRetryable != false ? retryAction : nil)
.opacity(viewStore.galleryDetail == nil && error != nil ? 1 : 0)
}
.fullScreenCover(unwrapping: viewStore.binding(\.$route), case: /DetailReducer.Route.reading) { _ in
.fullScreenCover(unwrapping: viewStore.$route, case: /DetailReducer.Route.reading) { _ in
ReadingView(
store: store.scope(state: \.readingState, action: DetailReducer.Action.reading),
gid: gid, setting: $setting, blurRadius: blurRadius
)
.accentColor(setting.accentColor)
.autoBlur(radius: blurRadius)
}
.sheet(unwrapping: viewStore.binding(\.$route), case: /DetailReducer.Route.archives) { route in
.sheet(unwrapping: viewStore.$route, case: /DetailReducer.Route.archives) { route in
let (galleryURL, archiveURL) = route.wrappedValue
ArchivesView(
store: store.scope(state: \.archivesState, action: DetailReducer.Action.archives),
Expand All @@ -138,23 +138,23 @@ struct DetailView: View {
.accentColor(setting.accentColor)
.autoBlur(radius: blurRadius)
}
.sheet(unwrapping: viewStore.binding(\.$route), case: /DetailReducer.Route.torrents) { _ in
.sheet(unwrapping: viewStore.$route, case: /DetailReducer.Route.torrents) { _ in
TorrentsView(
store: store.scope(state: \.torrentsState, action: DetailReducer.Action.torrents),
gid: gid, token: viewStore.gallery.token, blurRadius: blurRadius
)
.accentColor(setting.accentColor)
.autoBlur(radius: blurRadius)
}
.sheet(unwrapping: viewStore.binding(\.$route), case: /DetailReducer.Route.share) { route in
.sheet(unwrapping: viewStore.$route, case: /DetailReducer.Route.share) { route in
ActivityView(activityItems: [route.wrappedValue])
.autoBlur(radius: blurRadius)
}
.sheet(unwrapping: viewStore.binding(\.$route), case: /DetailReducer.Route.postComment) { _ in
.sheet(unwrapping: viewStore.$route, case: /DetailReducer.Route.postComment) { _ in
PostCommentView(
title: L10n.Localizable.PostCommentView.Title.postComment,
content: viewStore.binding(\.$commentContent),
isFocused: viewStore.binding(\.$postCommentFocused),
content: viewStore.$commentContent,
isFocused: viewStore.$postCommentFocused,
postAction: {
if let galleryURL = viewStore.gallery.galleryURL {
viewStore.send(.postComment(galleryURL))
Expand All @@ -167,10 +167,10 @@ struct DetailView: View {
.accentColor(setting.accentColor)
.autoBlur(radius: blurRadius)
}
.sheet(unwrapping: viewStore.binding(\.$route), case: /DetailReducer.Route.newDawn) { route in
.sheet(unwrapping: viewStore.$route, case: /DetailReducer.Route.newDawn) { route in
NewDawnView(greeting: route.wrappedValue).autoBlur(radius: blurRadius)
}
.sheet(unwrapping: viewStore.binding(\.$route), case: /DetailReducer.Route.tagDetail) { route in
.sheet(unwrapping: viewStore.$route, case: /DetailReducer.Route.tagDetail) { route in
TagDetailView(detail: route.wrappedValue).autoBlur(radius: blurRadius)
}
.animation(.default, value: viewStore.showsUserRating)
Expand All @@ -189,13 +189,13 @@ struct DetailView: View {
// MARK: NavigationLinks
private extension DetailView {
@ViewBuilder var navigationLinks: some View {
NavigationLink(unwrapping: viewStore.binding(\.$route), case: /DetailReducer.Route.previews) { _ in
NavigationLink(unwrapping: viewStore.$route, case: /DetailReducer.Route.previews) { _ in
PreviewsView(
store: store.scope(state: \.previewsState, action: DetailReducer.Action.previews),
gid: gid, setting: $setting, blurRadius: blurRadius
)
}
NavigationLink(unwrapping: viewStore.binding(\.$route), case: /DetailReducer.Route.comments) { route in
NavigationLink(unwrapping: viewStore.$route, case: /DetailReducer.Route.comments) { route in
IfLetStore(store.scope(state: \.commentsState, action: DetailReducer.Action.comments)) { store in
CommentsView(
store: store, gid: gid, token: viewStore.gallery.token, apiKey: viewStore.apiKey,
Expand All @@ -205,15 +205,15 @@ private extension DetailView {
)
}
}
NavigationLink(unwrapping: viewStore.binding(\.$route), case: /DetailReducer.Route.detailSearch) { route in
NavigationLink(unwrapping: viewStore.$route, case: /DetailReducer.Route.detailSearch) { route in
IfLetStore(store.scope(state: \.detailSearchState, action: DetailReducer.Action.detailSearch)) { store in
DetailSearchView(
store: store, keyword: route.wrappedValue, user: user, setting: $setting,
blurRadius: blurRadius, tagTranslator: tagTranslator
)
}
}
NavigationLink(unwrapping: viewStore.binding(\.$route), case: /DetailReducer.Route.galleryInfos) { route in
NavigationLink(unwrapping: viewStore.$route, case: /DetailReducer.Route.galleryInfos) { route in
let (gallery, galleryDetail) = route.wrappedValue
GalleryInfosView(
store: store.scope(state: \.galleryInfosState, action: DetailReducer.Action.galleryInfos),
Expand Down
2 changes: 1 addition & 1 deletion EhPanda/View/Detail/GalleryInfos/GalleryInfosView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ struct GalleryInfosView: View {
}
.progressHUD(
config: viewStore.hudConfig,
unwrapping: viewStore.binding(\.$route),
unwrapping: viewStore.$route,
case: /GalleryInfosReducer.Route.hud
)
.navigationTitle(L10n.Localizable.GalleryInfosView.Title.galleryInfos)
Expand Down
2 changes: 1 addition & 1 deletion EhPanda/View/Detail/Previews/PreviewsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ struct PreviewsView: View {
.padding(.bottom)
.id(viewStore.databaseLoadingState)
}
.fullScreenCover(unwrapping: viewStore.binding(\.$route), case: /PreviewsReducer.Route.reading) { _ in
.fullScreenCover(unwrapping: viewStore.$route, case: /PreviewsReducer.Route.reading) { _ in
ReadingView(
store: store.scope(state: \.readingState, action: PreviewsReducer.Action.reading),
gid: gid, setting: $setting, blurRadius: blurRadius
Expand Down
4 changes: 2 additions & 2 deletions EhPanda/View/Detail/Torrents/TorrentsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ struct TorrentsView: View {
}
.opacity(error != nil && viewStore.torrents.isEmpty ? 1 : 0)
}
.sheet(unwrapping: viewStore.binding(\.$route), case: /TorrentsReducer.Route.share) { route in
.sheet(unwrapping: viewStore.$route, case: /TorrentsReducer.Route.share) { route in
ActivityView(activityItems: [route.wrappedValue])
.autoBlur(radius: blurRadius)
}
.progressHUD(
config: viewStore.hudConfig,
unwrapping: viewStore.binding(\.$route),
unwrapping: viewStore.$route,
case: /TorrentsReducer.Route.hud
)
.animation(.default, value: viewStore.torrents)
Expand Down
10 changes: 5 additions & 5 deletions EhPanda/View/Favorites/FavoritesView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ struct FavoritesView: View {
}
}
.sheet(
unwrapping: viewStore.binding(\.$route),
unwrapping: viewStore.$route,
case: /FavoritesReducer.Route.detail,
isEnabled: DeviceUtil.isPad
) { route in
Expand All @@ -69,7 +69,7 @@ struct FavoritesView: View {
}
.autoBlur(radius: blurRadius).environment(\.inSheet, true).navigationViewStyle(.stack)
}
.sheet(unwrapping: viewStore.binding(\.$route), case: /FavoritesReducer.Route.quickSearch) { _ in
.sheet(unwrapping: viewStore.$route, case: /FavoritesReducer.Route.quickSearch) { _ in
QuickSearchView(
store: store.scope(state: \.quickSearchState, action: FavoritesReducer.Action.quickSearch)
) { keyword in
Expand All @@ -79,10 +79,10 @@ struct FavoritesView: View {
.accentColor(setting.accentColor)
.autoBlur(radius: blurRadius)
}
.searchable(text: viewStore.binding(\.$keyword))
.searchable(text: viewStore.$keyword)
.searchSuggestions {
TagSuggestionView(
keyword: viewStore.binding(\.$keyword), translations: tagTranslator.translations,
keyword: viewStore.$keyword, translations: tagTranslator.translations,
showsImages: setting.showsImagesInTags, isEnabled: setting.showsTagsSearchSuggestion
)
}
Expand All @@ -104,7 +104,7 @@ struct FavoritesView: View {

@ViewBuilder private var navigationLink: some View {
if DeviceUtil.isPhone {
NavigationLink(unwrapping: viewStore.binding(\.$route), case: /FavoritesReducer.Route.detail) { route in
NavigationLink(unwrapping: viewStore.$route, case: /FavoritesReducer.Route.detail) { route in
DetailView(
store: store.scope(state: \.detailState, action: FavoritesReducer.Action.detail),
gid: route.wrappedValue, user: user, setting: $setting,
Expand Down
8 changes: 4 additions & 4 deletions EhPanda/View/Home/Frontpage/FrontpageView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ struct FrontpageView: View {
}
)
.sheet(
unwrapping: viewStore.binding(\.$route),
unwrapping: viewStore.$route,
case: /FrontpageReducer.Route.detail,
isEnabled: DeviceUtil.isPad
) { route in
Expand All @@ -57,11 +57,11 @@ struct FrontpageView: View {
}
.autoBlur(radius: blurRadius).environment(\.inSheet, true).navigationViewStyle(.stack)
}
.sheet(unwrapping: viewStore.binding(\.$route), case: /FrontpageReducer.Route.filters) { _ in
.sheet(unwrapping: viewStore.$route, case: /FrontpageReducer.Route.filters) { _ in
FiltersView(store: store.scope(state: \.filtersState, action: FrontpageReducer.Action.filters))
.autoBlur(radius: blurRadius).environment(\.inSheet, true)
}
.searchable(text: viewStore.binding(\.$keyword), prompt: L10n.Localizable.Searchable.Prompt.filter)
.searchable(text: viewStore.$keyword, prompt: L10n.Localizable.Searchable.Prompt.filter)
.onAppear {
if viewStore.galleries.isEmpty {
DispatchQueue.main.async {
Expand All @@ -76,7 +76,7 @@ struct FrontpageView: View {

@ViewBuilder private var navigationLink: some View {
if DeviceUtil.isPhone {
NavigationLink(unwrapping: viewStore.binding(\.$route), case: /FrontpageReducer.Route.detail) { route in
NavigationLink(unwrapping: viewStore.$route, case: /FrontpageReducer.Route.detail) { route in
DetailView(
store: store.scope(state: \.detailState, action: FrontpageReducer.Action.detail),
gid: route.wrappedValue, user: user, setting: $setting,
Expand Down
8 changes: 4 additions & 4 deletions EhPanda/View/Home/History/HistoryView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ struct HistoryView: View {
}
)
.sheet(
unwrapping: viewStore.binding(\.$route),
unwrapping: viewStore.$route,
case: /HistoryReducer.Route.detail,
isEnabled: DeviceUtil.isPad
) { route in
Expand All @@ -55,7 +55,7 @@ struct HistoryView: View {
}
.autoBlur(radius: blurRadius).environment(\.inSheet, true).navigationViewStyle(.stack)
}
.searchable(text: viewStore.binding(\.$keyword), prompt: L10n.Localizable.Searchable.Prompt.filter)
.searchable(text: viewStore.$keyword, prompt: L10n.Localizable.Searchable.Prompt.filter)
.onAppear {
if viewStore.galleries.isEmpty {
DispatchQueue.main.async {
Expand All @@ -70,7 +70,7 @@ struct HistoryView: View {

@ViewBuilder private var navigationLink: some View {
if DeviceUtil.isPhone {
NavigationLink(unwrapping: viewStore.binding(\.$route), case: /HistoryReducer.Route.detail) { route in
NavigationLink(unwrapping: viewStore.$route, case: /HistoryReducer.Route.detail) { route in
DetailView(
store: store.scope(state: \.detailState, action: HistoryReducer.Action.detail),
gid: route.wrappedValue, user: user, setting: $setting,
Expand All @@ -89,7 +89,7 @@ struct HistoryView: View {
.disabled(viewStore.loadingState != .idle || viewStore.galleries.isEmpty)
.confirmationDialog(
message: L10n.Localizable.ConfirmationDialog.Title.clear,
unwrapping: viewStore.binding(\.$route),
unwrapping: viewStore.$route,
case: /HistoryReducer.Route.clearHistory
) {
Button(L10n.Localizable.ConfirmationDialog.Button.clear, role: .destructive) {
Expand Down
Loading