How kayanouriko/e-hentaiviewer works
Project type and purpose
• This is an iOS native client (“EHenTaiViewer”) for the e-hentai/exhentai web service.
• It uses Objective-C, Cocoa Touch, CoreData for persistence, and several third-party libraries via CocoaPods.
• It provides features like browsing galleries, viewing images, searching, tagging, commenting, bookmarking, and settings management.
File structure
• Top-level Xcode project and workspace files (EHenTaiViewer.xcodeproj, EHenTaiViewer.xcworkspace).
• An “EHenTaiViewer” directory containing:
• App entry (main.m, AppDelegate.*)
• Storyboards/XIBs & assets (Base.lproj, Assets.xcassets, various .xib)
• View controllers and custom views (QJ*.h/.m, QJ*.xib)
• Data models (EhCoreData.xcdatamodeld, Gallery+CoreData*, Tag+CoreData*)
• Networking/parsing (QJNetworkTool, QJHenTaiParser, XPathQuery, TFHpple)
• Managers (QJMangaManager, QJBrowerCollectManager, QJPasteManager, QJProtectTool)
• Utilities (extensions, QJTool, Reachability, UIDevice+QJDevice)
• Pods directory with frameworks: MagicalRecord (CoreData helpers), Masonry (Auto Layout DSL), YYCache/YYImage/YYWebImage (caching & image loading).
README for additional insights
• Confirms it’s a full-featured e-hentai/exhentai reader: login, gallery details, image viewing, bookmarks, comments, search, tags.
• Mentions CoreData (“EhCoreData.xcdatamodeld”), caching to improve performance, network parsing of HTML.
a. Main components
1. UI Layer
– Storyboards & XIBs
– View Controllers (Home, Gallery Detail, Image Viewer, Search, Comments, Settings, etc.)
– Custom Views / Cells (collection view cells, comment cells, search bars)
2. Domain / Business Logic
– Controllers & Managers (QJMangaManager, QJBrowerCollectManager, QJProtectTool, QJPasteManager, QJNetworkTool)
– Parsers (QJHenTaiParser, TFHpple, XPathQuery)
– Models (QJGalleryItem, QJMangaImageModel, QJTagModel)
3. Data Layer
– CoreData stack (EhCoreData.xcdatamodeld + MagicalRecord)
– On-disk & memory cache (YYCache)
4. Third-Party Frameworks
– Networking: Reachability
– Layout: Masonry
– Image: YYWebImage, YYImage
– Persistence helper: MagicalRecord
5. External Services
– HTTP(s) requests to e-hentai/exhentai web API
b. Relationships and interactions
• UI Layer → Domain Logic: user taps in a view controller → calls a Manager (e.g., QJMangaManager.fetchGalleryList).
• Domain Logic → Networking: Manager uses QJNetworkTool (and Reachability) to issue HTTP GET/POST.
• Networking → Parser: raw HTML/JSON response passed to QJHenTaiParser / TFHpple / XPathQuery.
• Parser → Domain Model: parser produces QJGalleryItem, QJCommentItem, etc.
• Domain Model → Data Layer: models saved/fetched via MagicalRecord into CoreData; image URLs cached in YYCache.
• Data Layer → UI Layer: view controllers fetch from CoreData or YYCache to display galleries/thumbnails.
• Image Loader: UI → YYWebImage for asynchronous image download & caching.
c. Architectural patterns & design principles
• MVC: View Controllers mediate between Views and Models/Managers.
• Singleton & Shared Instances: QJGlobalInfo, QJNetworkTool, QJMangaManager.
• Delegation & DataSource: UITableView/UICollectionView patterns.
• Separation of Concerns: Networking, Parsing, Data Persistence, UI rendering.
d. Key technologies & libraries
• Objective-C / Cocoa Touch
• CoreData via MagicalRecord
• CocoaPods packages: Masonry, YYWebImage/YYImage/YYCache, TFHpple, Reachability
• HTML/XML parsing: TFHpple / XPathQuery
• Layout & UI: Storyboards/XIBs, custom UIViews, Masonry