Skip to content

Commit 06a1e60

Browse files
committed
Fixes + version bump.
1 parent ce43251 commit 06a1e60

File tree

9 files changed

+46
-18
lines changed

9 files changed

+46
-18
lines changed

Hanami.xcodeproj/project.pbxproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1250,7 +1250,7 @@
12501250
CODE_SIGN_ENTITLEMENTS = Hanami/Hanami.entitlements;
12511251
CODE_SIGN_IDENTITY = "Apple Development";
12521252
CODE_SIGN_STYLE = Automatic;
1253-
CURRENT_PROJECT_VERSION = 14;
1253+
CURRENT_PROJECT_VERSION = 15;
12541254
DEVELOPMENT_ASSET_PATHS = "\"Hanami/Preview Content\"";
12551255
DEVELOPMENT_TEAM = HJ9678T652;
12561256
ENABLE_PREVIEWS = YES;
@@ -1271,7 +1271,7 @@
12711271
"$(inherited)",
12721272
"@executable_path/Frameworks",
12731273
);
1274-
MARKETING_VERSION = 0.24.1;
1274+
MARKETING_VERSION = 0.25;
12751275
PRODUCT_BUNDLE_IDENTIFIER = moe.mkpwnz.Hanami;
12761276
PRODUCT_NAME = "Hanami - Manga Reader";
12771277
PROVISIONING_PROFILE_SPECIFIER = "";
@@ -1291,7 +1291,7 @@
12911291
CODE_SIGN_ENTITLEMENTS = Hanami/Hanami.entitlements;
12921292
CODE_SIGN_IDENTITY = "Apple Development";
12931293
CODE_SIGN_STYLE = Automatic;
1294-
CURRENT_PROJECT_VERSION = 14;
1294+
CURRENT_PROJECT_VERSION = 15;
12951295
DEVELOPMENT_ASSET_PATHS = "\"Hanami/Preview Content\"";
12961296
DEVELOPMENT_TEAM = HJ9678T652;
12971297
ENABLE_PREVIEWS = YES;
@@ -1312,7 +1312,7 @@
13121312
"$(inherited)",
13131313
"@executable_path/Frameworks",
13141314
);
1315-
MARKETING_VERSION = 0.24.1;
1315+
MARKETING_VERSION = 0.25;
13161316
PRODUCT_BUNDLE_IDENTIFIER = moe.mkpwnz.Hanami;
13171317
PRODUCT_NAME = "Hanami - Manga Reader";
13181318
PROVISIONING_PROFILE_SPECIFIER = "";

Hanami/App/Core/Home/HomeFeature.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ struct HomeFeature: ReducerProtocol {
203203
switch result {
204204
case .success(let response):
205205
for stat in response.statistics {
206-
state[keyPath: keyPath][id: stat.key]?.onlineMangaState!.statistics = stat.value
206+
state[keyPath: keyPath][id: stat.key]?.onlineMangaState?.statistics = stat.value
207207
}
208208

209209
return .none

Hanami/App/Core/Manga/MangaView/Offline/OfflineMangaView.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ extension OfflineMangaView {
360360
Button {
361361
ViewStore(store).send(.continueReadingButtonTapped)
362362
} label: {
363-
RoundedRectangle(cornerRadius: 6)
363+
RoundedRectangle(cornerRadius: 12)
364364
.fill(Color.theme.accent)
365365
.overlay {
366366
Text("Continue reading!")
@@ -398,7 +398,7 @@ extension OfflineMangaView {
398398
}
399399
}
400400

401-
struct MangaViewOffsetModifier: ViewModifier {
401+
private struct MangaViewOffsetModifier: ViewModifier {
402402
@Binding var offset: CGFloat
403403
@State private var startValue: CGFloat = 0
404404

@@ -420,7 +420,7 @@ extension OfflineMangaView {
420420
}
421421
}
422422

423-
struct MangaViewOffsetKey: PreferenceKey {
423+
private struct MangaViewOffsetKey: PreferenceKey {
424424
static var defaultValue: CGFloat = 0
425425

426426
static func reduce(value: inout CGFloat, nextValue: () -> CGFloat) {

Hanami/App/Core/Manga/MangaView/Online/OnlineMangaFeature.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ struct OnlineMangaFeature: ReducerProtocol {
3131
var croppedCoverArtURLs: [URL] {
3232
allCoverArtsInfo.compactMap(\.coverArtURL512)
3333
}
34+
var isErrorOccured = false
3435

3536
// different chapter option to start reading manga
3637
// swiftlint:disable:next identifier_name
@@ -118,6 +119,8 @@ struct OnlineMangaFeature: ReducerProtocol {
118119
switch action {
119120
// MARK: - Actions to be called from view
120121
case .onAppear:
122+
state.isErrorOccured = false
123+
121124
var effects = [
122125
databaseClient.getLastReadChapterID(mangaID: state.manga.id)
123126
.receive(on: mainQueue)
@@ -261,6 +264,8 @@ struct OnlineMangaFeature: ReducerProtocol {
261264

262265
hudClient.show(message: "Failed to fetch: \(error.description)")
263266

267+
state.isErrorOccured = true
268+
264269
return hapticClient.generateNotificationFeedback(.error).fireAndForget()
265270
}
266271

Hanami/App/Core/Manga/MangaView/Online/OnlineMangaView.swift

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ struct OnlineMangaView: View {
3737
let areChaptersFetched: Bool
3838
let firstChapterOptions: [ChapterDetails]?
3939
let userReadsManga: Bool
40+
let isErrorOccured: Bool
4041

4142
init(state: OnlineMangaFeature.State) {
4243
manga = state.manga
@@ -50,6 +51,7 @@ struct OnlineMangaView: View {
5051
areChaptersFetched = state.pagesState.hasValue
5152
firstChapterOptions = state.firstChapterOptions
5253
userReadsManga = state.isUserOnReadingView
54+
isErrorOccured = state.isErrorOccured
5355
}
5456
}
5557

@@ -261,7 +263,7 @@ extension OnlineMangaView {
261263

262264
Spacer()
263265

264-
chapterLoaderButton
266+
// chapterLoaderButton
265267

266268
refreshButton
267269
}
@@ -322,7 +324,7 @@ extension OnlineMangaView {
322324
),
323325
then: PagesView.init,
324326
else: {
325-
ProgressView()
327+
chaptersNotLoadedView
326328
.padding(.top, 50)
327329
.padding(.bottom, 20)
328330
}
@@ -337,6 +339,30 @@ extension OnlineMangaView {
337339
.padding(.horizontal, 5)
338340
}
339341

342+
private var chaptersNotLoadedView: some View {
343+
WithViewStore(store.actionless, observe: ViewState.init) { viewStore in
344+
if viewStore.isErrorOccured {
345+
errorMessage
346+
} else {
347+
ProgressView()
348+
}
349+
}
350+
}
351+
352+
private var errorMessage: some View {
353+
VStack(alignment: .center) {
354+
Text("There's some error...")
355+
.fontWeight(.bold)
356+
357+
Text("Sorry...")
358+
.fontWeight(.bold)
359+
360+
Text("👉👈")
361+
.fontWeight(.bold)
362+
}
363+
.font(.title3)
364+
}
365+
340366
@MainActor private var coverArtTab: some View {
341367
WithViewStore(store.actionless, observe: ViewState.init) { viewStore in
342368
LazyVGrid(columns: [GridItem(.adaptive(minimum: 160, maximum: 240), spacing: 10)]) {
@@ -608,7 +634,7 @@ extension OnlineMangaView {
608634
}
609635
}
610636

611-
struct MangaViewOffsetModifier: ViewModifier {
637+
private struct MangaViewOffsetModifier: ViewModifier {
612638
@Binding var offset: CGFloat
613639
@State private var startValue: CGFloat = 0
614640

@@ -630,7 +656,7 @@ extension OnlineMangaView {
630656
}
631657
}
632658

633-
struct MangaViewOffsetKey: PreferenceKey {
659+
private struct MangaViewOffsetKey: PreferenceKey {
634660
static var defaultValue: CGFloat = 0
635661

636662
static func reduce(value: inout CGFloat, nextValue: () -> CGFloat) {

Hanami/App/Core/MangaThumbnail/MangaThumbnailFeature.swift

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,7 @@ struct MangaThumbnailFeature: ReducerProtocol {
6666
return mangaClient
6767
.fetchCoverArtInfo(coverArtID)
6868
.catchToEffect(Action.thumbnailInfoLoaded)
69-
} else if !state.online {
70-
guard state.offlineMangaState!.coverArtPath.isNil else {
71-
return .none
72-
}
73-
69+
} else if !state.online && state.offlineMangaState!.coverArtPath.isNil {
7470
state.offlineMangaState!.coverArtPath = mangaClient.getCoverArtPath(
7571
state.manga.id, cacheClient
7672
)

Hanami/Clients/DatabaseClient.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,7 @@ extension DatabaseClient {
231231
func deleteManga(mangaID: UUID) -> EffectTask<Never> {
232232
.fireAndForget {
233233
remove(entityType: MangaMO.self, id: mangaID)
234+
saveContext()
234235
}
235236
}
236237

Hanami/Utils/NetworkMonitor.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import Combine
1111
final class NetworkMonitor: ObservableObject {
1212
static let shared = NetworkMonitor()
1313
private let monitor = NWPathMonitor()
14-
private let queue = DispatchQueue(label: "moe.mkpwnz.Hanami.NetworkMonitor")
14+
private let queue = DispatchQueue(label: "moe.mkpwnz.Hanami.NetworkMonitor", qos: .background)
1515
@Published private(set) var isConnected = true
1616

1717
private init() {

0 commit comments

Comments
 (0)