-
-
Notifications
You must be signed in to change notification settings - Fork 991
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ios] add support for the
recently deleted
feature to the bookmark …
…manager - add and implement @protocol RecentlyDeletedCategoriesManager - move the bmmanager observing method to the @protocol BookmarksObservable to make manager mokable - add RecentlyDeletedCategory class as a lightweight version of the `CategoryData` to pass to it the swift Signed-off-by: Kiryl Kaveryn <kirylkaveryn@gmail.com>
- Loading branch information
1 parent
a639a94
commit f3d1cc6
Showing
8 changed files
with
128 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
iphone/CoreApi/CoreApi/Bookmarks/RecentlyDeletedCategory/RecentlyDeletedCategory+Core.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#import "RecentlyDeletedCategory.h" | ||
|
||
#include "kml/types.hpp" | ||
|
||
@interface RecentlyDeletedCategory (Core) | ||
|
||
- (instancetype)initWithCategoryData:(kml::CategoryData)data filePath:(std::string const &)filePath; | ||
|
||
@end |
15 changes: 15 additions & 0 deletions
15
iphone/CoreApi/CoreApi/Bookmarks/RecentlyDeletedCategory/RecentlyDeletedCategory.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#import <Foundation/Foundation.h> | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
@interface RecentlyDeletedCategory : NSObject | ||
|
||
@property(nonatomic, readonly) NSString * title; | ||
@property(nonatomic, readonly) NSURL * fileURL; | ||
@property(nonatomic, readonly) NSDate * deletionDate; | ||
|
||
- (instancetype)initTitle:(NSString *)title fileURL:(NSURL *)fileURL deletionDate:(NSDate *)deletionDate; | ||
|
||
@end | ||
|
||
NS_ASSUME_NONNULL_END |
35 changes: 35 additions & 0 deletions
35
iphone/CoreApi/CoreApi/Bookmarks/RecentlyDeletedCategory/RecentlyDeletedCategory.mm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#import "RecentlyDeletedCategory+Core.h" | ||
|
||
#include <map/bookmark_helpers.hpp> | ||
#include <platform/platform_ios.h> | ||
|
||
@implementation RecentlyDeletedCategory | ||
|
||
- (instancetype)initTitle:(NSString *)title fileURL:(NSURL *)fileURL deletionDate:(NSDate *)deletionDate { | ||
self = [super init]; | ||
if (self) { | ||
_title = title; | ||
_fileURL = fileURL; | ||
_deletionDate = deletionDate; | ||
} | ||
return self; | ||
} | ||
|
||
@end | ||
|
||
@implementation RecentlyDeletedCategory (Core) | ||
|
||
- (instancetype)initWithCategoryData:(kml::CategoryData)data filePath:(std::string const &)filePath { | ||
self = [super init]; | ||
if (self) { | ||
auto const name = GetPreferredBookmarkStr(data.m_name); | ||
_title = [NSString stringWithCString:name.c_str() encoding:NSUTF8StringEncoding]; | ||
auto const pathString = [NSString stringWithCString:filePath.c_str() encoding:NSUTF8StringEncoding]; | ||
_fileURL = [NSURL fileURLWithPath:pathString]; | ||
NSTimeInterval creationTime = Platform::GetFileCreationTime(filePath); | ||
_deletionDate = [NSDate dateWithTimeIntervalSince1970:creationTime]; | ||
} | ||
return self; | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters