Skip to content

Commit

Permalink
refactor: rename fextNext() to fetchNextPage()
Browse files Browse the repository at this point in the history
  • Loading branch information
bouassaba committed Nov 23, 2024
1 parent a6dfc8c commit 824a571
Show file tree
Hide file tree
Showing 31 changed files with 73 additions and 73 deletions.
8 changes: 4 additions & 4 deletions Sources/Screens/Browser/BrowserList.swift
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ struct BrowserList: View {
}
}
.refreshable {
browserStore.fetchNext(replace: true)
browserStore.fetchNextPage(replace: true)
}
} else {
ProgressView()
Expand Down Expand Up @@ -123,7 +123,7 @@ struct BrowserList: View {
}
.onChange(of: browserStore.query) {
browserStore.clear()
browserStore.fetchNext()
browserStore.fetchNextPage()
}
.sync($browserStore.searchText, with: $searchText)
.sync($browserStore.showError, with: $showError)
Expand All @@ -135,7 +135,7 @@ struct BrowserList: View {

private func fetchData() {
browserStore.fetch()
browserStore.fetchNext(replace: true)
browserStore.fetchNextPage(replace: true)
}

private func startTimers() {
Expand All @@ -152,7 +152,7 @@ struct BrowserList: View {

private func onListItemAppear(_ id: String) {
if browserStore.isEntityThreshold(id) {
browserStore.fetchNext()
browserStore.fetchNextPage()
}
}
}
2 changes: 1 addition & 1 deletion Sources/Screens/Browser/BrowserStore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class BrowserStore: ObservableObject {
try await fileClient?.fetchList(id, options: .init(query: query, page: page, size: size, type: .folder))
}

func fetchNext(replace: Bool = false) {
func fetchNextPage(replace: Bool = false) {
guard let fileID else { return }
guard !isLoading else { return }

Expand Down
2 changes: 1 addition & 1 deletion Sources/Screens/File/FileCopy.swift
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ struct FileCopy: View {
withErrorHandling(delaySeconds: 1) {
result = try await fileStore.copy(Array(fileStore.selection), to: destinationID)
if fileStore.isLastPage() {
fileStore.fetchNext()
fileStore.fetchNextPage()
}
if let result {
if result.failed.isEmpty {
Expand Down
2 changes: 1 addition & 1 deletion Sources/Screens/File/FileGrid.swift
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ struct FileGrid: View {

private func onListItemAppear(_ id: String) {
if fileStore.isEntityThreshold(id) {
fileStore.fetchNext()
fileStore.fetchNextPage()
}
}
}
2 changes: 1 addition & 1 deletion Sources/Screens/File/FileList.swift
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ struct FileList: View {

private func onListItemAppear(_ id: String) {
if fileStore.isEntityThreshold(id) {
fileStore.fetchNext()
fileStore.fetchNextPage()
}
}
}
6 changes: 3 additions & 3 deletions Sources/Screens/File/FileOverview.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ struct FileOverview: View {
}
.searchable(text: $searchText)
.onChange(of: fileStore.searchText) { fileStore.searchPublisher.send($1) }
.refreshable { fileStore.fetchNext(replace: true) }
.refreshable { fileStore.fetchNextPage(replace: true) }
} else {
ProgressView()
}
Expand Down Expand Up @@ -74,7 +74,7 @@ struct FileOverview: View {
}
.onChange(of: fileStore.query) {
fileStore.clear()
fileStore.fetchNext(replace: true)
fileStore.fetchNextPage(replace: true)
}
.sync($fileStore.searchText, with: $searchText)
.sync($fileStore.showError, with: $showError)
Expand All @@ -86,7 +86,7 @@ struct FileOverview: View {

private func fetchData() {
fileStore.fetch()
fileStore.fetchNext(replace: true)
fileStore.fetchNextPage(replace: true)
fileStore.fetchTaskCount()
}

Expand Down
2 changes: 1 addition & 1 deletion Sources/Screens/File/FileStore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ class FileStore: ObservableObject {
try await fileClient?.fetchList(id, options: .init(query: query, page: page, size: size))
}

func fetchNext(replace: Bool = false) {
func fetchNextPage(replace: Bool = false) {
guard let current else { return }
guard !isLoading else { return }

Expand Down
2 changes: 1 addition & 1 deletion Sources/Screens/File/FileUpload.swift
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ struct FileUpload: View {
}
_ = try await fileStore.upload(url, workspaceID: workspace.id)
if fileStore.isLastPage() {
fileStore.fetchNext()
fileStore.fetchNextPage()
}
url.stopAccessingSecurityScopedResource()
dispatchGroup.leave()
Expand Down
2 changes: 1 addition & 1 deletion Sources/Screens/File/FolderCreate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ struct FolderCreate: View {
parentID: parentID
)
if fileStore.isLastPage() {
fileStore.fetchNext()
fileStore.fetchNextPage()
}
return true
} success: {
Expand Down
8 changes: 4 additions & 4 deletions Sources/Screens/Group/GroupList.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ struct GroupList: View {
}
.navigationTitle("Groups")
.refreshable {
groupStore.fetchNext(replace: true)
groupStore.fetchNextPage(replace: true)
}
.toolbar {
ToolbarItem(placement: .topBarLeading) {
Expand Down Expand Up @@ -102,7 +102,7 @@ struct GroupList: View {
}
.onChange(of: groupStore.query) {
groupStore.clear()
groupStore.fetchNext()
groupStore.fetchNextPage()
}
.sync($groupStore.searchText, with: $searchText)
.sync($groupStore.showError, with: $showError)
Expand All @@ -113,7 +113,7 @@ struct GroupList: View {
}

private func fetchData() {
groupStore.fetchNext(replace: true)
groupStore.fetchNextPage(replace: true)
}

private func startTimers() {
Expand All @@ -130,7 +130,7 @@ struct GroupList: View {

private func onListItemAppear(_ id: String) {
if groupStore.isEntityThreshold(id) {
groupStore.fetchNext()
groupStore.fetchNextPage()
}
}
}
8 changes: 4 additions & 4 deletions Sources/Screens/Group/GroupMemberList.swift
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ struct GroupMemberList: View {
}
}
.refreshable {
userStore.fetchNext(replace: true)
userStore.fetchNextPage(replace: true)
}
.toolbar {
ToolbarItem(placement: .topBarLeading) {
Expand Down Expand Up @@ -98,7 +98,7 @@ struct GroupMemberList: View {
}
.onChange(of: userStore.query) {
userStore.clear()
userStore.fetchNext()
userStore.fetchNextPage()
}
.sync($userStore.searchText, with: $searchText)
.sync($userStore.showError, with: $showError)
Expand All @@ -109,7 +109,7 @@ struct GroupMemberList: View {
}

private func fetchData() {
userStore.fetchNext(replace: true)
userStore.fetchNextPage(replace: true)
}

private func startTimers() {
Expand All @@ -126,7 +126,7 @@ struct GroupMemberList: View {

private func onListItemAppear(_ id: String) {
if userStore.isEntityThreshold(id) {
userStore.fetchNext()
userStore.fetchNextPage()
}
}
}
8 changes: 4 additions & 4 deletions Sources/Screens/Group/GroupSelector.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ struct GroupSelector: View {
}
}
.refreshable {
groupStore.fetchNext(replace: true)
groupStore.fetchNextPage(replace: true)
}
.voErrorAlert(
isPresented: $showError,
Expand Down Expand Up @@ -94,7 +94,7 @@ struct GroupSelector: View {
}
.onChange(of: groupStore.query) {
groupStore.clear()
groupStore.fetchNext()
groupStore.fetchNextPage()
}
.sync($groupStore.showError, with: $showError)
.sync($groupStore.searchText, with: $searchText)
Expand All @@ -106,12 +106,12 @@ struct GroupSelector: View {

private func onListItemAppear(_ id: String) {
if groupStore.isEntityThreshold(id) {
groupStore.fetchNext()
groupStore.fetchNextPage()
}
}

private func fetchData() {
groupStore.fetchNext(replace: true)
groupStore.fetchNextPage(replace: true)
}

private func startTimers() {
Expand Down
2 changes: 1 addition & 1 deletion Sources/Screens/Group/GroupStore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class GroupStore: ObservableObject {
}
}

func fetchNext(replace: Bool = false) {
func fetchNextPage(replace: Bool = false) {
guard !isLoading else { return }

var nextPage = -1
Expand Down
4 changes: 2 additions & 2 deletions Sources/Screens/Insights/InsightsChart.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ struct InsightsChart: View {
.navigationBarTitleDisplayMode(.inline)
.navigationTitle("Insights")
.refreshable {
insightsStore.fetchEntityNext(replace: true)
insightsStore.fetchEntityNextPage(replace: true)
}
.toolbar {
ToolbarItem(placement: .topBarTrailing) {
Expand Down Expand Up @@ -93,7 +93,7 @@ struct InsightsChart: View {
}

private func fetchData() {
insightsStore.fetchEntityNext(replace: true)
insightsStore.fetchEntityNextPage(replace: true)
}

private func startTimers() {
Expand Down
8 changes: 4 additions & 4 deletions Sources/Screens/Insights/InsightsEntityList.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ struct InsightsEntityList: View {
.navigationBarTitleDisplayMode(.inline)
.navigationTitle("Insights")
.refreshable {
insightsStore.fetchEntityNext(replace: true)
insightsStore.fetchEntityNextPage(replace: true)
}
.toolbar {
ToolbarItem(placement: .topBarTrailing) {
Expand Down Expand Up @@ -84,7 +84,7 @@ struct InsightsEntityList: View {
}
.onChange(of: insightsStore.query) {
insightsStore.clear()
insightsStore.fetchEntityNext()
insightsStore.fetchEntityNextPage()
}
.sync($insightsStore.searchText, with: $searchText)
.sync($insightsStore.showError, with: $showError)
Expand All @@ -95,7 +95,7 @@ struct InsightsEntityList: View {
}

private func fetchData() {
insightsStore.fetchEntityNext(replace: true)
insightsStore.fetchEntityNextPage(replace: true)
}

private func startTimers() {
Expand All @@ -112,7 +112,7 @@ struct InsightsEntityList: View {

private func onListItemAppear(_ id: String) {
if insightsStore.isEntityThreshold(id) {
insightsStore.fetchEntityNext()
insightsStore.fetchEntityNextPage()
}
}
}
2 changes: 1 addition & 1 deletion Sources/Screens/Insights/InsightsStore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ class InsightsStore: ObservableObject {
)
}

func fetchEntityNext(replace: Bool = false) {
func fetchEntityNextPage(replace: Bool = false) {
var nextPage = -1
var list: VOInsights.EntityList?

Expand Down
6 changes: 3 additions & 3 deletions Sources/Screens/Invitation/InvitationIncomingList.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ struct InvitationIncomingList: View {
}
}
.refreshable {
invitationStore.fetchNext(replace: true)
invitationStore.fetchNextPage(replace: true)
}
} else {
ProgressView()
Expand Down Expand Up @@ -81,7 +81,7 @@ struct InvitationIncomingList: View {
}

private func fetchData() {
invitationStore.fetchNext(replace: true)
invitationStore.fetchNextPage(replace: true)
}

private func startTimers() {
Expand All @@ -98,7 +98,7 @@ struct InvitationIncomingList: View {

private func onListItemAppear(_ id: String) {
if invitationStore.isEntityThreshold(id) {
invitationStore.fetchNext()
invitationStore.fetchNextPage()
}
}
}
6 changes: 3 additions & 3 deletions Sources/Screens/Invitation/InvitationOutgoingList.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ struct InvitationOutgoingList: View {
}
}
.refreshable {
invitationStore.fetchNext(replace: true)
invitationStore.fetchNextPage(replace: true)
}
} else {
ProgressView()
Expand Down Expand Up @@ -97,7 +97,7 @@ struct InvitationOutgoingList: View {
}

private func fetchData() {
invitationStore.fetchNext(replace: true)
invitationStore.fetchNextPage(replace: true)
}

private func startTimers() {
Expand All @@ -117,7 +117,7 @@ struct InvitationOutgoingList: View {

private func onListItemAppear(_ id: String) {
if invitationStore.isEntityThreshold(id) {
invitationStore.fetchNext()
invitationStore.fetchNextPage()
}
}
}
2 changes: 1 addition & 1 deletion Sources/Screens/Invitation/InvitationStore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class InvitationStore: ObservableObject {
}
}

func fetchNext(replace: Bool = false) {
func fetchNextPage(replace: Bool = false) {
guard !entitiesIsLoading else { return }

var nextPage = -1
Expand Down
Loading

0 comments on commit 824a571

Please sign in to comment.