68 lines
2.4 KiB
Objective-C
68 lines
2.4 KiB
Objective-C
//
|
|
// WRPageHighlight.h
|
|
// WeRead (微信读书)
|
|
// Reverse-engineered header
|
|
//
|
|
// Annotation model for text highlights. Stores the highlighted text range,
|
|
// color, and associated metadata. 3 methods identified from binary.
|
|
//
|
|
// Inherits from or relates to WRPageMark (base class).
|
|
//
|
|
|
|
#import <Foundation/Foundation.h>
|
|
#import <UIKit/UIKit.h>
|
|
|
|
NS_ASSUME_NONNULL_BEGIN
|
|
|
|
@class WRBook;
|
|
@class WRBookmark;
|
|
|
|
// ---------------------------------------------------------------------------
|
|
// Highlight color presets
|
|
// ---------------------------------------------------------------------------
|
|
typedef NS_ENUM(NSInteger, WRHighlightColor) {
|
|
WRHighlightColorYellow = 0,
|
|
WRHighlightColorBlue = 1,
|
|
WRHighlightColorRed = 2,
|
|
WRHighlightColorGreen = 3,
|
|
WRHighlightColorPurple = 4,
|
|
};
|
|
|
|
// ---------------------------------------------------------------------------
|
|
// WRPageHighlight
|
|
// ---------------------------------------------------------------------------
|
|
@interface WRPageHighlight : NSObject
|
|
|
|
@property (nonatomic, copy) NSString *highlightId; // unique ID
|
|
@property (nonatomic, copy) NSString *bookId;
|
|
@property (nonatomic, copy) NSString *chapterUid;
|
|
@property (nonatomic, assign) NSInteger startPos; // global start position
|
|
@property (nonatomic, assign) NSInteger endPos; // global end position
|
|
@property (nonatomic, assign) NSInteger chapterOffset; // offset within chapter
|
|
@property (nonatomic, copy) NSString *markedText; // the highlighted text
|
|
@property (nonatomic, assign) WRHighlightColor color; // highlight color enum
|
|
@property (nonatomic, copy, nullable) NSString *colorStyle; // color name string
|
|
@property (nonatomic, assign) NSInteger pageIndex; // page in the reader
|
|
@property (nonatomic, assign) NSTimeInterval createTime;
|
|
@property (nonatomic, assign) BOOL isSynced;
|
|
|
|
#pragma mark - Methods (3 identified from binary)
|
|
|
|
/// Initialize a highlight with the given range and color.
|
|
- (instancetype)initWithBookId:(NSString *)bookId
|
|
chapterUid:(NSString *)chapterUid
|
|
startPos:(NSInteger)startPos
|
|
endPos:(NSInteger)endPos
|
|
text:(NSString *)text
|
|
color:(WRHighlightColor)color;
|
|
|
|
/// Convert this highlight to a WRBookmark for persistence/sync.
|
|
- (WRBookmark *)toBookmark;
|
|
|
|
/// Return the highlight color as a UIColor for rendering.
|
|
- (UIColor *)uiColor;
|
|
|
|
@end
|
|
|
|
NS_ASSUME_NONNULL_END
|