Skip to content
This repository has been archived by the owner on Dec 17, 2022. It is now read-only.

Commit

Permalink
[v1.2.0] >> E.H v1.2.0 Release
Browse files Browse the repository at this point in the history
  • Loading branch information
kayanouriko committed Aug 14, 2018
1 parent 198d3f6 commit 6752fd9
Show file tree
Hide file tree
Showing 65 changed files with 1,655 additions and 1,972 deletions.
126 changes: 69 additions & 57 deletions EHenTaiViewer.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

23 changes: 23 additions & 0 deletions EHenTaiViewer/Gallery+CoreDataClass.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//
// Gallery+CoreDataClass.h
// EHenTaiViewer
//
// Created by QinJ on 2018/8/13.
// Copyright © 2018 kayanouriko. All rights reserved.
//
//

#import <Foundation/Foundation.h>
#import <CoreData/CoreData.h>

@class GalleryPage;

NS_ASSUME_NONNULL_BEGIN

@interface Gallery : NSManagedObject

@end

NS_ASSUME_NONNULL_END

#import "Gallery+CoreDataProperties.h"
14 changes: 14 additions & 0 deletions EHenTaiViewer/Gallery+CoreDataClass.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//
// Gallery+CoreDataClass.m
// EHenTaiViewer
//
// Created by QinJ on 2018/8/13.
// Copyright © 2018 kayanouriko. All rights reserved.
//
//

#import "Gallery+CoreDataClass.h"

@implementation Gallery

@end
33 changes: 33 additions & 0 deletions EHenTaiViewer/Gallery+CoreDataProperties.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
//
// Gallery+CoreDataProperties.h
// EHenTaiViewer
//
// Created by QinJ on 2018/8/13.
// Copyright © 2018 kayanouriko. All rights reserved.
//
//

#import "Gallery+CoreDataClass.h"


NS_ASSUME_NONNULL_BEGIN

@interface Gallery (CoreDataProperties)

+ (NSFetchRequest<Gallery *> *)fetchRequest;

@property (nullable, nonatomic, copy) NSString *galleryid;
@property (nullable, nonatomic, retain) NSSet<GalleryPage *> *galleryPage;

@end

@interface Gallery (CoreDataGeneratedAccessors)

- (void)addGalleryPageObject:(GalleryPage *)value;
- (void)removeGalleryPageObject:(GalleryPage *)value;
- (void)addGalleryPage:(NSSet<GalleryPage *> *)values;
- (void)removeGalleryPage:(NSSet<GalleryPage *> *)values;

@end

NS_ASSUME_NONNULL_END
21 changes: 21 additions & 0 deletions EHenTaiViewer/Gallery+CoreDataProperties.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//
// Gallery+CoreDataProperties.m
// EHenTaiViewer
//
// Created by QinJ on 2018/8/13.
// Copyright © 2018 kayanouriko. All rights reserved.
//
//

#import "Gallery+CoreDataProperties.h"

@implementation Gallery (CoreDataProperties)

+ (NSFetchRequest<Gallery *> *)fetchRequest {
return [NSFetchRequest fetchRequestWithEntityName:@"Gallery"];
}

@dynamic galleryid;
@dynamic galleryPage;

@end
23 changes: 23 additions & 0 deletions EHenTaiViewer/GalleryPage+CoreDataClass.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//
// GalleryPage+CoreDataClass.h
// EHenTaiViewer
//
// Created by QinJ on 2018/8/13.
// Copyright © 2018 kayanouriko. All rights reserved.
//
//

#import <Foundation/Foundation.h>
#import <CoreData/CoreData.h>

@class Gallery;

NS_ASSUME_NONNULL_BEGIN

@interface GalleryPage : NSManagedObject

@end

NS_ASSUME_NONNULL_END

#import "GalleryPage+CoreDataProperties.h"
14 changes: 14 additions & 0 deletions EHenTaiViewer/GalleryPage+CoreDataClass.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//
// GalleryPage+CoreDataClass.m
// EHenTaiViewer
//
// Created by QinJ on 2018/8/13.
// Copyright © 2018 kayanouriko. All rights reserved.
//
//

#import "GalleryPage+CoreDataClass.h"

@implementation GalleryPage

@end
25 changes: 25 additions & 0 deletions EHenTaiViewer/GalleryPage+CoreDataProperties.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
//
// GalleryPage+CoreDataProperties.h
// EHenTaiViewer
//
// Created by QinJ on 2018/8/13.
// Copyright © 2018 kayanouriko. All rights reserved.
//
//

#import "GalleryPage+CoreDataClass.h"


NS_ASSUME_NONNULL_BEGIN

@interface GalleryPage (CoreDataProperties)

+ (NSFetchRequest<GalleryPage *> *)fetchRequest;

@property (nonatomic) int64_t page;
@property (nullable, nonatomic, copy) NSString *smallImageUrl;
@property (nullable, nonatomic, retain) Gallery *gallery;

@end

NS_ASSUME_NONNULL_END
22 changes: 22 additions & 0 deletions EHenTaiViewer/GalleryPage+CoreDataProperties.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//
// GalleryPage+CoreDataProperties.m
// EHenTaiViewer
//
// Created by QinJ on 2018/8/13.
// Copyright © 2018 kayanouriko. All rights reserved.
//
//

#import "GalleryPage+CoreDataProperties.h"

@implementation GalleryPage (CoreDataProperties)

+ (NSFetchRequest<GalleryPage *> *)fetchRequest {
return [NSFetchRequest fetchRequestWithEntityName:@"GalleryPage"];
}

@dynamic page;
@dynamic smallImageUrl;
@dynamic gallery;

@end
2 changes: 1 addition & 1 deletion EHenTaiViewer/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<key>CFBundleShortVersionString</key>
<string>1.2.0</string>
<key>CFBundleVersion</key>
<string>3</string>
<string>4</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSFaceIDUsageDescription</key>
Expand Down
36 changes: 36 additions & 0 deletions EHenTaiViewer/QJBrowerCollectManager.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
//
// QJBrowerCollectManager.h
// EHenTaiViewer
//
// Created by QinJ on 2018/8/13.
// Copyright © 2018 kayanouriko. All rights reserved.
//

// 管理书签相关

#import <Foundation/Foundation.h>

@class GalleryPage;

@interface QJBrowerCollectManager : NSObject

/** 获取全部书签
@param gid 画廊的唯一标识符
*/
+ (NSArray<GalleryPage *> *)getAllCollectPagesWithGid:(NSString *)gid;

/** 添加一个书签
@param gid 画廊的唯一标识符
@param pageIndex 书签信息,页码
@param smallImageUrl 书签信息,缩略图url
*/
+ (void)saveOnePageWithGid:(NSString *)gid pageIndex:(NSInteger)pageIndex smallImageUrl:(NSString *)smallImageUrl;

/** 删除一个书签
@param gid 画廊的唯一标识符
@param pageIndex 书签信息,页码
@param smallImageUrl 书签信息,缩略图url
*/
+ (void)deleteOnePageWithGid:(NSString *)gid pageIndex:(NSInteger)pageIndex smallImageUrl:(NSString *)smallImageUrl;

@end
86 changes: 86 additions & 0 deletions EHenTaiViewer/QJBrowerCollectManager.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
//
// QJBrowerCollectManager.m
// EHenTaiViewer
//
// Created by QinJ on 2018/8/13.
// Copyright © 2018 kayanouriko. All rights reserved.
//

#import "QJBrowerCollectManager.h"
// coredata
#import "Gallery+CoreDataClass.h"
#import "Gallery+CoreDataProperties.h"
#import "GalleryPage+CoreDataClass.h"
#import "GalleryPage+CoreDataProperties.h"

@implementation QJBrowerCollectManager

+ (NSArray<GalleryPage *> *)getAllCollectPagesWithGid:(NSString *)gid {
Gallery *gallery = [Gallery MR_findByAttribute:@"galleryid" withValue:gid].firstObject;
if (nil == gallery) {
return @[];
}
NSSet *galleryPage = gallery.galleryPage;
NSSortDescriptor *pageDescriptor = [NSSortDescriptor sortDescriptorWithKey:@"page" ascending:YES];
return [galleryPage sortedArrayUsingDescriptors:@[pageDescriptor]];
}

+ (void)saveOnePageWithGid:(NSString *)gid pageIndex:(NSInteger)pageIndex smallImageUrl:(NSString *)smallImageUrl {
// 添加
Gallery *gallery = [Gallery MR_findByAttribute:@"galleryid" withValue:gid].firstObject;
// 如果不存在,则创建一个
if (nil == gallery) {
gallery = [Gallery MR_createEntityInContext:[NSManagedObjectContext MR_defaultContext]];
gallery.galleryid = gid;
}
// 获取当前页的对象
NSArray *array = [GalleryPage MR_findByAttribute:@"gallery" withValue:gallery];
if (array.count) {
// 查找是否存在
NSPredicate *pagePredicate = [NSPredicate predicateWithFormat:@"page = %ld", pageIndex];
NSArray *selectArray = [array filteredArrayUsingPredicate:pagePredicate];
if (selectArray.count) {
GalleryPage *galleryPage = selectArray.firstObject;
galleryPage.page = pageIndex;
galleryPage.smallImageUrl = smallImageUrl;
}
else {
GalleryPage *galleryPage = [GalleryPage MR_createEntity];
galleryPage.page = pageIndex;
galleryPage.smallImageUrl = smallImageUrl;
[gallery addGalleryPageObject:galleryPage];
}
}
else {
GalleryPage *galleryPage = [GalleryPage MR_createEntity];
galleryPage.page = pageIndex;
galleryPage.smallImageUrl = smallImageUrl;
[gallery addGalleryPageObject:galleryPage];
}
[[NSManagedObjectContext MR_defaultContext] MR_saveToPersistentStoreAndWait];
}

+ (void)deleteOnePageWithGid:(NSString *)gid pageIndex:(NSInteger)pageIndex smallImageUrl:(NSString *)smallImageUrl {
Gallery *gallery = [Gallery MR_findByAttribute:@"galleryid" withValue:gid].firstObject;
if (gallery) {
NSArray *array = [GalleryPage MR_findByAttribute:@"gallery" withValue:gallery];
if (array.count) {
NSPredicate *pagePredicate = [NSPredicate predicateWithFormat:@"page = %ld", pageIndex];
NSArray *selectArray = [array filteredArrayUsingPredicate:pagePredicate];
for (GalleryPage *page in selectArray) {
[page MR_deleteEntity];
}
if (array.count <= 1) {
// 如果没有书签了删除本身
[gallery MR_deleteEntity];
}
}
else {
// 如果没有书签了删除本身
[gallery MR_deleteEntity];
}
[[NSManagedObjectContext MR_defaultContext] MR_saveToPersistentStoreAndWait];
}
}

@end
6 changes: 3 additions & 3 deletions EHenTaiViewer/QJBrowserBookMarkPopView.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
@property (nonatomic, weak) id<QJBrowserBookMarkPopViewDelegate> delegate;
@property (nonatomic, assign, getter=isShowed) BOOL showed;

+ (QJBrowserBookMarkPopView *)creatPopViewWithDelegate:(id<QJBrowserBookMarkPopViewDelegate>)theDelagate manager:(QJMangaManager *)manager;
+ (QJBrowserBookMarkPopView *)creatPopViewWithDelegate:(id<QJBrowserBookMarkPopViewDelegate>)theDelagate manager:(QJMangaManager *)manager gid:(NSString *)gid;

- (void)show;
- (void)changeFrameIfNeed;
- (void)showWithIndexPath:(NSIndexPath *)indexPath;
- (void)changeFrameIfNeedWithIndexPath:(NSIndexPath *)indexPath;

@end
Loading

0 comments on commit 6752fd9

Please sign in to comment.