Skip to content

Commit

Permalink
iOS 1.15 (#417)
Browse files Browse the repository at this point in the history
* remove old code

* bookmark database

* favicon fix

* diable legacy bookmark

* changelog

* project version
  • Loading branch information
automactic authored Oct 31, 2021
1 parent 16d2110 commit 99a4b16
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 36 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 1.15

- Half sheet table of contents (iOS 15 & horizontally compact interfaces)
- Using quicklook to preview zim files in the files app
- Bookmark UI is made consistent with other article list UI (e.g. search results)

## 1.14.5

- Fixed crashes that could happen during search result snippet parsing
Expand Down
6 changes: 2 additions & 4 deletions Kiwix.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@
97C575F4202CB0E800E37502 /* NotificationCenter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 97C575F3202CB0E800E37502 /* NotificationCenter.framework */; };
97C575F7202CB0E800E37502 /* TodayViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 97C575F6202CB0E800E37502 /* TodayViewController.swift */; };
97C575FA202CB0E800E37502 /* MainInterface.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C575F8202CB0E800E37502 /* MainInterface.storyboard */; };
97C575FE202CB0E900E37502 /* Bookmarks.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = 97C575F2202CB0E800E37502 /* Bookmarks.appex */; platformFilter = ios; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
97C5763D202CD9C000E37502 /* NotificationCenter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 97C575F3202CB0E800E37502 /* NotificationCenter.framework */; platformFilter = ios; };
97CE4242249322E300B334E9 /* SearchResult.m in Sources */ = {isa = PBXBuildFile; fileRef = 97B3998C2467561900BC6F5B /* SearchResult.m */; };
97CE42432493234D00B334E9 /* SearchOperation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 97B3998F2467626A00BC6F5B /* SearchOperation.swift */; };
Expand Down Expand Up @@ -194,7 +193,6 @@
dstPath = "";
dstSubfolderSpec = 13;
files = (
97C575FE202CB0E900E37502 /* Bookmarks.appex in Embed App Extensions */,
97F425CE27151A0D00D0F738 /* QuickLookPreview.appex in Embed App Extensions */,
);
name = "Embed App Extensions";
Expand Down Expand Up @@ -1500,7 +1498,7 @@
CODE_SIGN_ENTITLEMENTS = iOS/Support/Kiwix.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 79;
CURRENT_PROJECT_VERSION = 81;
DEVELOPMENT_TEAM = L7HWM3SP3L;
ENABLE_BITCODE = YES;
GCC_C_LANGUAGE_STANDARD = c11;
Expand Down Expand Up @@ -1541,7 +1539,7 @@
CODE_SIGN_ENTITLEMENTS = iOS/Support/Kiwix.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 79;
CURRENT_PROJECT_VERSION = 81;
DEVELOPMENT_TEAM = L7HWM3SP3L;
ENABLE_BITCODE = YES;
GCC_C_LANGUAGE_STANDARD = c11;
Expand Down
12 changes: 6 additions & 6 deletions Model/Realm/Bookmark.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
import RealmSwift

class Bookmark: Object, ObjectKeyIdentifiable {
@objc dynamic var path = ""
@objc dynamic var zimFile: ZimFile?
@Persisted var path = ""
@Persisted var zimFile: ZimFile?

@objc dynamic var title = ""
@objc dynamic var snippet: String?
@objc dynamic var thumbImagePath: String?
@objc dynamic var date: Date?
@Persisted var title = ""
@Persisted var snippet: String?
@Persisted var thumbImagePath: String?
@Persisted var date: Date?
}
20 changes: 0 additions & 20 deletions iOS/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate, DirectoryMonitorDelegate
return true
}

func applicationWillEnterForeground(_ application: UIApplication) {
let scan = LibraryScanOperation(directoryURL: URL.documentDirectory)
LibraryOperationQueue.shared.addOperation(scan)
}

func applicationWillTerminate(_ application: UIApplication) {
fileMonitor.stop()
}
Expand Down Expand Up @@ -99,21 +94,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate, DirectoryMonitorDelegate
}
LibraryOperationQueue.shared.addOperation(operation)
}

// MARK: - Home Screen Quick Actions

func application(_ application: UIApplication, performActionFor shortcutItem: UIApplicationShortcutItem, completionHandler: @escaping (Bool) -> Void) {
guard let shortcut = Shortcut(rawValue: shortcutItem.type),
let navigationController = window?.rootViewController as? UINavigationController,
let rootViewController = navigationController.topViewController as? RootViewController else { completionHandler(false); return }
switch shortcut {
case .bookmark:
rootViewController.bookmarkButtonTapped()
case .search:
rootViewController.searchController.isActive = true
}
completionHandler(true)
}
}

// MARK: - Type Definition
Expand Down
4 changes: 2 additions & 2 deletions iOS/Controller/BookmarksViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ struct BookmarksView: View {
if let zimFile = bookmark.zimFile,
let path = bookmark.thumbImagePath,
let content = ZimFileService.shared.getURLContent(zimFileID: zimFile.fileID, contentPath: path) {
Favicon(data: content.data)
Favicon(data: content.data, contentMode: .fill, width: 18)
} else {
Favicon(data: bookmark.zimFile?.faviconData)
Favicon(data: bookmark.zimFile?.faviconData, width: 18)
}
VStack(alignment: .leading) {
Text(bookmark.title).fontWeight(.medium).lineLimit(1)
Expand Down
14 changes: 10 additions & 4 deletions iOS/SwiftUI/BuildingBlocks.swift
Original file line number Diff line number Diff line change
Expand Up @@ -90,26 +90,32 @@ struct DisclosureIndicator: View {

struct Favicon: View {
private let image: Image
private let contentMode: ContentMode
private let width: CGFloat
private let outline = RoundedRectangle(cornerRadius: 4, style: .continuous)

init(data: Data?) {
init(data: Data?, contentMode: ContentMode = .fit, width: CGFloat = 24) {
if let data = data, let image = UIImage(data: data) {
self.image = Image(uiImage: image)
} else {
self.image = Image("GenericZimFile")
}
self.contentMode = contentMode
self.width = width
}

init(uiImage: UIImage) {
init(uiImage: UIImage, contentMode: ContentMode = .fit, width: CGFloat = 24) {
self.image = Image(uiImage: uiImage)
self.contentMode = contentMode
self.width = width
}

var body: some View {
image
.renderingMode(.original)
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: 24, height: 24)
.aspectRatio(contentMode: contentMode)
.frame(width: width, height: width)
.background(Color(.white))
.clipShape(outline)
.overlay(outline.stroke(Color(.white).opacity(0.9), lineWidth: 1))
Expand Down

0 comments on commit 99a4b16

Please sign in to comment.