Skip to content

Commit

Permalink
Merge branch 'main' into 975-improve-iphone-launch-sequence
Browse files Browse the repository at this point in the history
  • Loading branch information
BPerlakiH authored Oct 5, 2024
2 parents 00fe1ef + c25cbff commit 572ea2e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
7 changes: 3 additions & 4 deletions Model/DownloadService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -273,11 +273,9 @@ final class DownloadService: NSObject, URLSessionDelegate, URLSessionTaskDelegat
guard let taskDescription = task.taskDescription,
let zimFileID = UUID(uuidString: taskDescription),
let httpResponse = task.response as? HTTPURLResponse else { return }

// download finished successfully if there's no error
// and the status code is in the 200 < 300 range
guard let error = error as NSError? else {
self.deleteDownloadTask(zimFileID: zimFileID)
if (200..<300).contains(httpResponse.statusCode) {
os_log(
"Download finished successfully. File ID: %s.",
Expand All @@ -293,6 +291,7 @@ final class DownloadService: NSObject, URLSessionDelegate, URLSessionTaskDelegat
zimFileID.uuidString,
httpResponse.statusCode
)
self.deleteDownloadTask(zimFileID: zimFileID)
}
return
}
Expand Down Expand Up @@ -344,7 +343,6 @@ final class DownloadService: NSObject, URLSessionDelegate, URLSessionTaskDelegat
func urlSession(_ session: URLSession,
downloadTask: URLSessionDownloadTask,
didFinishDownloadingTo location: URL) {

guard let httpResponse = downloadTask.response as? HTTPURLResponse else { return }

guard (200..<300).contains(httpResponse.statusCode) else {
Expand All @@ -367,7 +365,7 @@ final class DownloadService: NSObject, URLSessionDelegate, URLSessionTaskDelegat

// move file
guard let directory = FileManager.default.urls(for: searchPath, in: .userDomainMask).first,
let zimFileID = UUID(uuidString: downloadTask.taskDescription ?? "") else {return}
let zimFileID = UUID(uuidString: downloadTask.taskDescription ?? "") else { return }
let fileName = downloadTask.response?.suggestedFilename
?? downloadTask.originalRequest?.url?.lastPathComponent
?? zimFileID.uuidString + ".zim"
Expand All @@ -379,6 +377,7 @@ final class DownloadService: NSObject, URLSessionDelegate, URLSessionTaskDelegat
await LibraryOperations.open(url: destination)
// schedule notification
scheduleDownloadCompleteNotification(zimFileID: zimFileID)
deleteDownloadTask(zimFileID: zimFileID)
}
}

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ python3 -m venv .venv
source .venv/bin/activate
pip install -e .

kiwix-build --target-platform apple_all_static libkiwix
kiwix-build --config apple_all_static libkiwix
# assuming your kiwix-build and apple folder at at same level
cp -r BUILD_apple_all_static/INSTALL/lib/CoreKiwix.xcframework ../apple/
```
Expand Down
6 changes: 5 additions & 1 deletion Support/uk.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@
"zim_file.action.open_main_page.title" = "Відкрити головну сторінку";
"zim_file.action.reveal_in_finder.title" = "Показати у Finder";
"zim_file.action.toggle_cellular" = "Завантажити використовуючи стільникові дані";
"zim_file.action.unlink.title" = "Відв'язати";
"zim_file.action.unlink.message" = "Усі закладки, пов’язані з цим файлом ZIM, будуть видалені, але оригінальний файл залишиться на місці.";
"zim_file.action.unlink.button.title" = "Відв'язати";
"zim_file.action.delete.title" = "Видалити";
"zim_file.action.delete.message" = "Файл ZIM і всі закладки, пов’язані з цим файлом ZIM, будуть видалені.";
"zim_file.action.delete.button.title" = "Видалити";
Expand Down Expand Up @@ -106,6 +108,7 @@
"reading_settings.zoom.title" = "Масштаб сторінки";
"reading_settings.zoom.reset.button" = "Скинути";
"reading_settings.external_link.title" = "Зовнішні посилання";
"reading_settings.search_snippet.title" = "Фрагмент пошуку";
"reading_settings.tab.reading" = "Читання";
"library_settings.catalog.title" = "Каталог";
"library_settings.button.refresh_now" = "Оновити зараз";
Expand All @@ -115,7 +118,8 @@
"library_settings.languages.title" = "Мови";
"library_settings.tab.library.title" = "Бібліотека";
"settings.navigation.title" = "Налаштування";
"library_settings.toggle.cellular" = "Завантажити використовуючи стільникові дані";
"library_settings.toggle.cellular" = "Завантажувати використовуючи стільникові дані";
"library_settings.new-download-task-description" = "Зміни застосовуватимуться лише до нових завантажень.";
"catalog_settings.last_refresh.text" = "Останнє оновлення";
"catalog_settings.refreshing.text" = "Оновлення...";
"catalog_settings.refresh_now.button" = "Оновити зараз";
Expand Down

0 comments on commit 572ea2e

Please sign in to comment.