Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

601 bookmarks initial libkiwix implementation #679

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Revert
  • Loading branch information
BPerlakiH committed Mar 3, 2024
commit 0727fc8ef6313a9b437f794ea08f8bad1f4595cb
5 changes: 0 additions & 5 deletions Model/LibBookmarks/LibBookmark.mm
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,6 @@ - (instancetype) init: (NSURL *) url inZIM: (NSUUID *) zimFileID withTitle: (non
return self;
}

//- (const kiwix::Bookmark &) bridged {
// static const kiwix::Bookmark bookmark = kiwix::Bookmark([self book], self.url_c, self.title_c);
// return bookmark;
//}

- (kiwix::Book) book {
return [ZimFileService.sharedInstance getBookBy: self.zimFileID];
}
Expand Down
6 changes: 3 additions & 3 deletions Model/ZimFileService/ZimFileService.mm
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ - (void)open:(NSURL *)url {
}

- (void)close:(NSUUID *)zimFileID {
self.archives->erase([ZimFileService zimfileID_C: zimFileID]);
self.archives->erase([self zimfileID_C: zimFileID]);
[self.fileURLs[zimFileID] stopAccessingSecurityScopedResource];
[self.fileURLs removeObjectForKey:zimFileID];
}
Expand Down Expand Up @@ -201,12 +201,12 @@ - (NSDictionary *)getContent:(NSUUID *)zimFileID contentPath:(NSString *)content
# pragma mark - private

/// Converts the UUID to a C representation
+ (std::string) zimfileID_C: (NSUUID *_Nonnull) zimFileID {
- (std::string) zimfileID_C: (NSUUID *_Nonnull) zimFileID {
return [[[zimFileID UUIDString] lowercaseString] cStringUsingEncoding:NSUTF8StringEncoding];
}

- (zim::Archive *_Nullable) archiveBy: (NSUUID *_Nonnull) zimFileID {
std::string zimFileID_C = [ZimFileService zimfileID_C: zimFileID];
std::string zimFileID_C = [self zimfileID_C: zimFileID];
auto found = self.archives->find(zimFileID_C);
if (found == self.archives->end()) {
return nil;
Expand Down
Loading