Skip to content

Commit

Permalink
Resolve warnings & enforce code style
Browse files Browse the repository at this point in the history
  • Loading branch information
chihchy committed May 30, 2024
1 parent 0f475cc commit dfb90d5
Show file tree
Hide file tree
Showing 12 changed files with 57 additions and 26 deletions.
1 change: 1 addition & 0 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ identifier_name:

excluded:
- EhPandaTests
- EhPanda/App/Generated
5 changes: 4 additions & 1 deletion EhPanda/DataFlow/AppRouteReducer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,10 @@ struct AppRouteReducer: Reducer {
case .fetchGallery(let url, let isGalleryImageURL):
state.route = .hud
return .run { send in
let response = await GalleryReverseRequest(url: url, isGalleryImageURL: isGalleryImageURL).response()
let response = await GalleryReverseRequest(
url: url, isGalleryImageURL: isGalleryImageURL
)
.response()
await send(Action.fetchGalleryDone(url, response))
}

Expand Down
7 changes: 0 additions & 7 deletions EhPanda/Models/Tags/TagDetail.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,4 @@ struct TagDetail: Equatable {
let description: String
let imageURLs: [URL]
let links: [URL]

init(title: String, description: String, imageURLs: [URL], links: [URL]) {
self.title = title
self.description = description
self.imageURLs = imageURLs
self.links = links
}
}
3 changes: 2 additions & 1 deletion EhPanda/View/Detail/Archives/ArchivesReducer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@ struct ArchivesReducer: Reducer {
let response = await SendDownloadCommandRequest(
archiveURL: archiveURL,
resolution: selectedArchive.resolution.parameter
).response()
)
.response()
await send(Action.fetchDownloadResponseDone(response))
}
.cancellable(id: CancelID.fetchDownloadResponse)
Expand Down
16 changes: 12 additions & 4 deletions EhPanda/View/Detail/Comments/CommentsReducer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -193,13 +193,17 @@ struct CommentsReducer: Reducer {
commentID: commentID,
content: commentContent,
galleryURL: galleryURL
).response()
)
.response()
await send(Action.performCommentActionDone(response))
}
.cancellable(id: CancelID.postComment)
} else {
return .run { [commentContent = state.commentContent] send in
let response = await CommentGalleryRequest(content: commentContent, galleryURL: galleryURL).response()
let response = await CommentGalleryRequest(
content: commentContent, galleryURL: galleryURL
)
.response()
await send(Action.performCommentActionDone(response))
}
.cancellable(id: CancelID.postComment)
Expand All @@ -217,7 +221,8 @@ struct CommentsReducer: Reducer {
token: token,
commentID: commentID,
commentVote: vote
).response()
)
.response()
await send(Action.performCommentActionDone(response))
}
.cancellable(id: CancelID.voteComment)
Expand All @@ -228,7 +233,10 @@ struct CommentsReducer: Reducer {
case .fetchGallery(let url, let isGalleryImageURL):
state.route = .hud
return .run { send in
let response = await GalleryReverseRequest(url: url, isGalleryImageURL: isGalleryImageURL).response()
let response = await GalleryReverseRequest(
url: url, isGalleryImageURL: isGalleryImageURL
)
.response()
await send(Action.fetchGalleryDone(url, response))
}
.cancellable(id: CancelID.fetchGallery)
Expand Down
14 changes: 10 additions & 4 deletions EhPanda/View/Detail/DetailReducer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,8 @@ struct DetailReducer: Reducer {
gid: gid,
token: state.gallery.token,
rating: state.userRating
).response()
)
.response()
await send(Action.anyGalleryOpsDone(response))
}.cancellable(id: CancelID.rateGallery)

Expand All @@ -335,7 +336,8 @@ struct DetailReducer: Reducer {
gid: state.gallery.id,
token: state.gallery.token,
favIndex: favIndex
).response()
)
.response()
await send(Action.anyGalleryOpsDone(response))
}
.cancellable(id: CancelID.favorGallery)
Expand All @@ -350,7 +352,10 @@ struct DetailReducer: Reducer {
case .postComment(let galleryURL):
guard !state.commentContent.isEmpty else { return .none }
return .run { [commentContent = state.commentContent] send in
let response = await CommentGalleryRequest(content: commentContent, galleryURL: galleryURL).response()
let response = await CommentGalleryRequest(
content: commentContent, galleryURL: galleryURL
)
.response()
await send(Action.anyGalleryOpsDone(response))
}
.cancellable(id: CancelID.postComment)
Expand All @@ -366,7 +371,8 @@ struct DetailReducer: Reducer {
token: state.gallery.token,
tag: tag,
vote: vote
).response()
)
.response()
await send(Action.anyGalleryOpsDone(response))
}
.cancellable(id: CancelID.voteTag)
Expand Down
5 changes: 4 additions & 1 deletion EhPanda/View/Detail/DetailSearch/DetailSearchReducer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,10 @@ struct DetailSearchReducer: Reducer {
state.footerLoadingState = .loading
let filter = databaseClient.fetchFilterSynchronously(range: .search)
return .run { [lastKeyword = state.lastKeyword] send in
let response = await MoreSearchGalleriesRequest(keyword: lastKeyword, filter: filter, lastID: lastID).response()
let response = await MoreSearchGalleriesRequest(
keyword: lastKeyword, filter: filter, lastID: lastID
)
.response()
await send(Action.fetchMoreGalleriesDone(response))
}
.cancellable(id: CancelID.fetchMoreGalleries)
Expand Down
6 changes: 4 additions & 2 deletions EhPanda/View/Favorites/FavoritesReducer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ struct FavoritesReducer: Reducer {
return .run { [state] send in
let response = await FavoritesGalleriesRequest(
favIndex: state.index, keyword: state.keyword, sortOrder: sortOrder
).response()
)
.response()
await send(Action.fetchGalleriesDone(state.index, response))
}

Expand Down Expand Up @@ -154,7 +155,8 @@ struct FavoritesReducer: Reducer {
lastID: lastID,
lastTimestamp: lastItemTimestamp,
keyword: state.keyword
).response()
)
.response()
await send(Action.fetchMoreGalleriesDone(state.index, response))
}

Expand Down
10 changes: 8 additions & 2 deletions EhPanda/View/Home/Toplists/ToplistsReducer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,10 @@ struct ToplistsReducer: Reducer {
state.rawPageNumber[state.type]?.resetPages()
}
return .run { [type = state.type] send in
let response = await ToplistsGalleriesRequest(catIndex: type.categoryIndex, pageNum: pageNum).response()
let response = await ToplistsGalleriesRequest(
catIndex: type.categoryIndex, pageNum: pageNum
)
.response()
await send(Action.fetchGalleriesDone(type, response))
}
.cancellable(id: CancelID.fetchGalleries)
Expand Down Expand Up @@ -179,7 +182,10 @@ struct ToplistsReducer: Reducer {
state.rawFooterLoadingState[state.type] = .loading
let pageNum = pageNumber.current + 1
return .run { [type = state.type] send in
let response = await MoreToplistsGalleriesRequest(catIndex: type.categoryIndex, pageNum: pageNum).response()
let response = await MoreToplistsGalleriesRequest(
catIndex: type.categoryIndex, pageNum: pageNum
)
.response()
await send(Action.fetchMoreGalleriesDone(type, response))
}
.cancellable(id: CancelID.fetchMoreGalleries)
Expand Down
5 changes: 4 additions & 1 deletion EhPanda/View/Home/Watched/WatchedReducer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,10 @@ struct WatchedReducer: Reducer {
state.footerLoadingState = .loading
let filter = databaseClient.fetchFilterSynchronously(range: .watched)
return .run { [keyword = state.keyword] send in
let response = await MoreWatchedGalleriesRequest(filter: filter, lastID: lastID, keyword: keyword).response()
let response = await MoreWatchedGalleriesRequest(
filter: filter, lastID: lastID, keyword: keyword
)
.response()
await send(Action.fetchMoreGalleriesDone(response))
}
.cancellable(id: CancelID.fetchMoreGalleries)
Expand Down
6 changes: 4 additions & 2 deletions EhPanda/View/Reading/ReadingReducer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,8 @@ struct ReadingReducer: Reducer {
galleryURL: galleryURL,
thumbnailURL: thumbnailURL,
storedImageURL: imageURL
).response()
)
.response()
await send(Action.refetchNormalImageURLsDone(index, response))
}
.cancellable(id: CancelID.refetchNormalImageURLs)
Expand Down Expand Up @@ -617,7 +618,8 @@ struct ReadingReducer: Reducer {
mpvKey: mpvKey,
mpvImageKey: mpvImageKey,
skipServerIdentifier: skipServerIdentifier
).response()
)
.response()
await send(Action.fetchMPVImageURLDone(index, response))
}
.cancellable(id: CancelID.fetchMPVImageURL)
Expand Down
5 changes: 4 additions & 1 deletion EhPanda/View/Search/SearchReducer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,10 @@ struct SearchReducer: Reducer {
state.footerLoadingState = .loading
let filter = databaseClient.fetchFilterSynchronously(range: .search)
return .run { [lastKeyword = state.lastKeyword] send in
let response = await MoreSearchGalleriesRequest(keyword: lastKeyword, filter: filter, lastID: lastID).response()
let response = await MoreSearchGalleriesRequest(
keyword: lastKeyword, filter: filter, lastID: lastID
)
.response()
await send(Action.fetchMoreGalleriesDone(response))
}
.cancellable(id: CancelID.fetchMoreGalleries)
Expand Down

0 comments on commit dfb90d5

Please sign in to comment.