├── BakerShelf ├── info │ ├── made-with-baker.png │ ├── info.html │ └── style.css ├── lib │ ├── UIColor+Extensions.h │ ├── UIColor+Extensions.m │ ├── NSData+Base64.h │ ├── NSString+UUID.h │ ├── NSURL+Extensions.h │ ├── NSString+Extensions.h │ ├── NSMutableURLRequest+WebServiceClient.h │ ├── NSString+UUID.m │ ├── NSURL+Extensions.m │ ├── NSString+Extensions.m │ ├── NSMutableURLRequest+WebServiceClient.m │ ├── Reachability.h │ └── NSData+Base64.m ├── UICustomNavigationController.h ├── UICustomNavigationBar.h ├── ShelfStatus.h ├── IssuesManager.h ├── BakerAPI.h ├── UICustomNavigationController.m ├── ShelfStatus.m ├── UIConstants.h ├── PurchasesManager.h ├── BakerIssue.h ├── UICustomNavigationBar.m ├── IssueViewController.h ├── ShelfViewController.h └── Constants.h ├── books └── a-study-in-scarlet │ ├── gfx │ ├── blood.png │ ├── dots-menu.png │ ├── background.jpg │ ├── baker-badge.png │ ├── blood-drop.png │ ├── cover-image.png │ ├── background-portrait.png │ ├── background-landscape.png │ └── baker-framework-badge.png │ ├── images │ ├── 1-01-a.gif │ ├── 1-01-b.gif │ ├── 1-02-a.gif │ ├── 1-02-b.gif │ ├── 1-03-a.gif │ ├── 1-03-b.gif │ ├── 1-04-a.gif │ ├── 1-04-b.gif │ ├── 1-05-a.gif │ ├── 1-06-a.gif │ ├── 1-06-b.gif │ ├── 1-07-a.gif │ ├── 1-07-b.gif │ ├── 2-01-a.gif │ ├── 2-01-b.gif │ ├── 2-02-a.gif │ ├── 2-02-b.gif │ ├── 2-03-a.gif │ ├── 2-04-a.gif │ ├── 2-04-b.gif │ ├── 2-05-a.gif │ ├── 2-06-a.gif │ ├── 2-06-b.gif │ └── 2-07-a.gif │ ├── a-study-in-scarlet.png │ ├── Book Cover.html │ ├── book.json │ ├── Tail.html │ ├── Book Index.html │ ├── index.html │ ├── js │ └── blood.js │ └── css │ ├── index.css │ └── book.css ├── Baker ├── BakerAssets.xcassets │ ├── back.imageset │ │ ├── back.png │ │ ├── back@2x.png │ │ └── Contents.json │ ├── forward.imageset │ │ ├── forward.png │ │ ├── forward@2x.png │ │ └── Contents.json │ ├── AppIcon.appiconset │ │ ├── iPad App iOS6.png │ │ ├── iPad App iOS7.png │ │ ├── iPhone App iOS6.png │ │ ├── iPad App iOS6@2x.png │ │ ├── iPad App iOS7@2x.png │ │ ├── iPhone App iOS6@2x.png │ │ ├── iPhone App iOS7@2x.png │ │ └── Contents.json │ ├── LaunchImage.launchimage │ │ ├── iPad Landscape iOS7.png │ │ ├── iPad Portrait iOS7.png │ │ ├── iPad Landscape iOS7@2x.png │ │ ├── iPad Portrait iOS7@2x.png │ │ ├── iPhone Portrait iOS7 R4.png │ │ ├── iPhone Portrait iOS7@2x.png │ │ ├── iPad Portrait iOS6 no status bar.png │ │ ├── iPad Landscape iOS6 no status bar.png │ │ ├── iPad Portrait iOS6 no status bar@2x.png │ │ ├── iPad Landscape iOS6 no status bar@2x-1.png │ │ └── Contents.json │ ├── navigation-bar-bg.imageset │ │ ├── navigation-bar-bg.png │ │ ├── navigation-bar-bg@2x.png │ │ └── Contents.json │ ├── newsstand-app-icon.imageset │ │ ├── newsstand-app-icon.png │ │ ├── newsstand-app-icon@2x.png │ │ └── Contents.json │ ├── shelf-bg-portrait.imageset │ │ ├── shelf-bg-portrait-568h.png │ │ ├── shelf-bg-portrait~ipad.png │ │ ├── shelf-bg-portrait~iphone.png │ │ ├── shelf-bg-portrait@2x~ipad.png │ │ ├── shelf-bg-portrait@2x~iphone.png │ │ └── Contents.json │ ├── shelf-bg-landscape.imageset │ │ ├── shelf-bg-landscape-568h.png │ │ ├── shelf-bg-landscape~ipad.png │ │ ├── shelf-bg-landscape@2x~ipad.png │ │ ├── shelf-bg-landscape~iphone.png │ │ ├── shelf-bg-landscape@2x~iphone.png │ │ └── Contents.json │ └── navigation-bar-bg-ios6.imageset │ │ ├── navigation-bar-bg-ios6.png │ │ ├── navigation-bar-bg-ios6@2x.png │ │ └── Contents.json ├── Baker-Prefix.pch ├── main.m ├── AppDelegate.h ├── BakerAnalyticsEvents.h ├── Baker-Info.plist ├── en.lproj │ └── Localizable.strings └── BakerAnalyticsEvents.m ├── CONTRIBUTING.md ├── .gitignore ├── Baker.xcodeproj └── project.xcworkspace │ └── contents.xcworkspacedata ├── README.md └── BakerView ├── lib ├── minizip │ ├── mztools.h │ ├── crypt.h │ └── ioapi.h ├── SSZipArchive.h ├── JSONStatus.h ├── GTMNSString+HTML.h ├── Utils.h ├── JSONStatus.m └── Utils.m ├── InterceptorWindow.h ├── BakerBookStatus.h ├── ui ├── PageTitleLabel.h └── PageTitleLabel.m ├── InterceptorWindow.m ├── BakerBookStatus.m ├── ModalViewController.h ├── IndexViewController.h ├── BakerBook.h └── BakerViewController.h /BakerShelf/info/made-with-baker.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Simbul/baker/HEAD/BakerShelf/info/made-with-baker.png -------------------------------------------------------------------------------- /books/a-study-in-scarlet/gfx/blood.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Simbul/baker/HEAD/books/a-study-in-scarlet/gfx/blood.png -------------------------------------------------------------------------------- /books/a-study-in-scarlet/gfx/dots-menu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Simbul/baker/HEAD/books/a-study-in-scarlet/gfx/dots-menu.png -------------------------------------------------------------------------------- /books/a-study-in-scarlet/images/1-01-a.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Simbul/baker/HEAD/books/a-study-in-scarlet/images/1-01-a.gif -------------------------------------------------------------------------------- /books/a-study-in-scarlet/images/1-01-b.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Simbul/baker/HEAD/books/a-study-in-scarlet/images/1-01-b.gif -------------------------------------------------------------------------------- /books/a-study-in-scarlet/images/1-02-a.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Simbul/baker/HEAD/books/a-study-in-scarlet/images/1-02-a.gif -------------------------------------------------------------------------------- /books/a-study-in-scarlet/images/1-02-b.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Simbul/baker/HEAD/books/a-study-in-scarlet/images/1-02-b.gif -------------------------------------------------------------------------------- /books/a-study-in-scarlet/images/1-03-a.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Simbul/baker/HEAD/books/a-study-in-scarlet/images/1-03-a.gif -------------------------------------------------------------------------------- /books/a-study-in-scarlet/images/1-03-b.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Simbul/baker/HEAD/books/a-study-in-scarlet/images/1-03-b.gif -------------------------------------------------------------------------------- /books/a-study-in-scarlet/images/1-04-a.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Simbul/baker/HEAD/books/a-study-in-scarlet/images/1-04-a.gif -------------------------------------------------------------------------------- /books/a-study-in-scarlet/images/1-04-b.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Simbul/baker/HEAD/books/a-study-in-scarlet/images/1-04-b.gif -------------------------------------------------------------------------------- /books/a-study-in-scarlet/images/1-05-a.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Simbul/baker/HEAD/books/a-study-in-scarlet/images/1-05-a.gif -------------------------------------------------------------------------------- /books/a-study-in-scarlet/images/1-06-a.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Simbul/baker/HEAD/books/a-study-in-scarlet/images/1-06-a.gif -------------------------------------------------------------------------------- /books/a-study-in-scarlet/images/1-06-b.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Simbul/baker/HEAD/books/a-study-in-scarlet/images/1-06-b.gif -------------------------------------------------------------------------------- /books/a-study-in-scarlet/images/1-07-a.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Simbul/baker/HEAD/books/a-study-in-scarlet/images/1-07-a.gif -------------------------------------------------------------------------------- /books/a-study-in-scarlet/images/1-07-b.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Simbul/baker/HEAD/books/a-study-in-scarlet/images/1-07-b.gif -------------------------------------------------------------------------------- /books/a-study-in-scarlet/images/2-01-a.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Simbul/baker/HEAD/books/a-study-in-scarlet/images/2-01-a.gif -------------------------------------------------------------------------------- /books/a-study-in-scarlet/images/2-01-b.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Simbul/baker/HEAD/books/a-study-in-scarlet/images/2-01-b.gif -------------------------------------------------------------------------------- /books/a-study-in-scarlet/images/2-02-a.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Simbul/baker/HEAD/books/a-study-in-scarlet/images/2-02-a.gif -------------------------------------------------------------------------------- /books/a-study-in-scarlet/images/2-02-b.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Simbul/baker/HEAD/books/a-study-in-scarlet/images/2-02-b.gif -------------------------------------------------------------------------------- /books/a-study-in-scarlet/images/2-03-a.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Simbul/baker/HEAD/books/a-study-in-scarlet/images/2-03-a.gif -------------------------------------------------------------------------------- /books/a-study-in-scarlet/images/2-04-a.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Simbul/baker/HEAD/books/a-study-in-scarlet/images/2-04-a.gif -------------------------------------------------------------------------------- /books/a-study-in-scarlet/images/2-04-b.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Simbul/baker/HEAD/books/a-study-in-scarlet/images/2-04-b.gif -------------------------------------------------------------------------------- /books/a-study-in-scarlet/images/2-05-a.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Simbul/baker/HEAD/books/a-study-in-scarlet/images/2-05-a.gif -------------------------------------------------------------------------------- /books/a-study-in-scarlet/images/2-06-a.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Simbul/baker/HEAD/books/a-study-in-scarlet/images/2-06-a.gif -------------------------------------------------------------------------------- /books/a-study-in-scarlet/images/2-06-b.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Simbul/baker/HEAD/books/a-study-in-scarlet/images/2-06-b.gif -------------------------------------------------------------------------------- /books/a-study-in-scarlet/images/2-07-a.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Simbul/baker/HEAD/books/a-study-in-scarlet/images/2-07-a.gif -------------------------------------------------------------------------------- /books/a-study-in-scarlet/gfx/background.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Simbul/baker/HEAD/books/a-study-in-scarlet/gfx/background.jpg -------------------------------------------------------------------------------- /books/a-study-in-scarlet/gfx/baker-badge.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Simbul/baker/HEAD/books/a-study-in-scarlet/gfx/baker-badge.png -------------------------------------------------------------------------------- /books/a-study-in-scarlet/gfx/blood-drop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Simbul/baker/HEAD/books/a-study-in-scarlet/gfx/blood-drop.png -------------------------------------------------------------------------------- /books/a-study-in-scarlet/gfx/cover-image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Simbul/baker/HEAD/books/a-study-in-scarlet/gfx/cover-image.png -------------------------------------------------------------------------------- /books/a-study-in-scarlet/a-study-in-scarlet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Simbul/baker/HEAD/books/a-study-in-scarlet/a-study-in-scarlet.png -------------------------------------------------------------------------------- /Baker/BakerAssets.xcassets/back.imageset/back.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Simbul/baker/HEAD/Baker/BakerAssets.xcassets/back.imageset/back.png -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | This repo is not maintained anymore. 2 | 3 | The new official fork can be found at https://github.com/bakerframework/baker/. 4 | -------------------------------------------------------------------------------- /Baker/BakerAssets.xcassets/back.imageset/back@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Simbul/baker/HEAD/Baker/BakerAssets.xcassets/back.imageset/back@2x.png -------------------------------------------------------------------------------- /books/a-study-in-scarlet/gfx/background-portrait.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Simbul/baker/HEAD/books/a-study-in-scarlet/gfx/background-portrait.png -------------------------------------------------------------------------------- /Baker/BakerAssets.xcassets/forward.imageset/forward.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Simbul/baker/HEAD/Baker/BakerAssets.xcassets/forward.imageset/forward.png -------------------------------------------------------------------------------- /books/a-study-in-scarlet/gfx/background-landscape.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Simbul/baker/HEAD/books/a-study-in-scarlet/gfx/background-landscape.png -------------------------------------------------------------------------------- /books/a-study-in-scarlet/gfx/baker-framework-badge.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Simbul/baker/HEAD/books/a-study-in-scarlet/gfx/baker-framework-badge.png -------------------------------------------------------------------------------- /Baker/BakerAssets.xcassets/forward.imageset/forward@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Simbul/baker/HEAD/Baker/BakerAssets.xcassets/forward.imageset/forward@2x.png -------------------------------------------------------------------------------- /Baker/BakerAssets.xcassets/AppIcon.appiconset/iPad App iOS6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Simbul/baker/HEAD/Baker/BakerAssets.xcassets/AppIcon.appiconset/iPad App iOS6.png -------------------------------------------------------------------------------- /Baker/BakerAssets.xcassets/AppIcon.appiconset/iPad App iOS7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Simbul/baker/HEAD/Baker/BakerAssets.xcassets/AppIcon.appiconset/iPad App iOS7.png -------------------------------------------------------------------------------- /Baker/BakerAssets.xcassets/AppIcon.appiconset/iPhone App iOS6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Simbul/baker/HEAD/Baker/BakerAssets.xcassets/AppIcon.appiconset/iPhone App iOS6.png -------------------------------------------------------------------------------- /Baker/BakerAssets.xcassets/AppIcon.appiconset/iPad App iOS6@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Simbul/baker/HEAD/Baker/BakerAssets.xcassets/AppIcon.appiconset/iPad App iOS6@2x.png -------------------------------------------------------------------------------- /Baker/BakerAssets.xcassets/AppIcon.appiconset/iPad App iOS7@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Simbul/baker/HEAD/Baker/BakerAssets.xcassets/AppIcon.appiconset/iPad App iOS7@2x.png -------------------------------------------------------------------------------- /Baker/BakerAssets.xcassets/AppIcon.appiconset/iPhone App iOS6@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Simbul/baker/HEAD/Baker/BakerAssets.xcassets/AppIcon.appiconset/iPhone App iOS6@2x.png -------------------------------------------------------------------------------- /Baker/BakerAssets.xcassets/AppIcon.appiconset/iPhone App iOS7@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Simbul/baker/HEAD/Baker/BakerAssets.xcassets/AppIcon.appiconset/iPhone App iOS7@2x.png -------------------------------------------------------------------------------- /Baker/BakerAssets.xcassets/LaunchImage.launchimage/iPad Landscape iOS7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Simbul/baker/HEAD/Baker/BakerAssets.xcassets/LaunchImage.launchimage/iPad Landscape iOS7.png -------------------------------------------------------------------------------- /Baker/BakerAssets.xcassets/LaunchImage.launchimage/iPad Portrait iOS7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Simbul/baker/HEAD/Baker/BakerAssets.xcassets/LaunchImage.launchimage/iPad Portrait iOS7.png -------------------------------------------------------------------------------- /Baker/BakerAssets.xcassets/navigation-bar-bg.imageset/navigation-bar-bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Simbul/baker/HEAD/Baker/BakerAssets.xcassets/navigation-bar-bg.imageset/navigation-bar-bg.png -------------------------------------------------------------------------------- /Baker/BakerAssets.xcassets/LaunchImage.launchimage/iPad Landscape iOS7@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Simbul/baker/HEAD/Baker/BakerAssets.xcassets/LaunchImage.launchimage/iPad Landscape iOS7@2x.png -------------------------------------------------------------------------------- /Baker/BakerAssets.xcassets/LaunchImage.launchimage/iPad Portrait iOS7@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Simbul/baker/HEAD/Baker/BakerAssets.xcassets/LaunchImage.launchimage/iPad Portrait iOS7@2x.png -------------------------------------------------------------------------------- /Baker/BakerAssets.xcassets/newsstand-app-icon.imageset/newsstand-app-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Simbul/baker/HEAD/Baker/BakerAssets.xcassets/newsstand-app-icon.imageset/newsstand-app-icon.png -------------------------------------------------------------------------------- /Baker/BakerAssets.xcassets/LaunchImage.launchimage/iPhone Portrait iOS7 R4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Simbul/baker/HEAD/Baker/BakerAssets.xcassets/LaunchImage.launchimage/iPhone Portrait iOS7 R4.png -------------------------------------------------------------------------------- /Baker/BakerAssets.xcassets/LaunchImage.launchimage/iPhone Portrait iOS7@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Simbul/baker/HEAD/Baker/BakerAssets.xcassets/LaunchImage.launchimage/iPhone Portrait iOS7@2x.png -------------------------------------------------------------------------------- /Baker/BakerAssets.xcassets/navigation-bar-bg.imageset/navigation-bar-bg@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Simbul/baker/HEAD/Baker/BakerAssets.xcassets/navigation-bar-bg.imageset/navigation-bar-bg@2x.png -------------------------------------------------------------------------------- /Baker/BakerAssets.xcassets/newsstand-app-icon.imageset/newsstand-app-icon@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Simbul/baker/HEAD/Baker/BakerAssets.xcassets/newsstand-app-icon.imageset/newsstand-app-icon@2x.png -------------------------------------------------------------------------------- /Baker/BakerAssets.xcassets/shelf-bg-portrait.imageset/shelf-bg-portrait-568h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Simbul/baker/HEAD/Baker/BakerAssets.xcassets/shelf-bg-portrait.imageset/shelf-bg-portrait-568h.png -------------------------------------------------------------------------------- /Baker/BakerAssets.xcassets/shelf-bg-portrait.imageset/shelf-bg-portrait~ipad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Simbul/baker/HEAD/Baker/BakerAssets.xcassets/shelf-bg-portrait.imageset/shelf-bg-portrait~ipad.png -------------------------------------------------------------------------------- /Baker/BakerAssets.xcassets/shelf-bg-landscape.imageset/shelf-bg-landscape-568h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Simbul/baker/HEAD/Baker/BakerAssets.xcassets/shelf-bg-landscape.imageset/shelf-bg-landscape-568h.png -------------------------------------------------------------------------------- /Baker/BakerAssets.xcassets/shelf-bg-landscape.imageset/shelf-bg-landscape~ipad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Simbul/baker/HEAD/Baker/BakerAssets.xcassets/shelf-bg-landscape.imageset/shelf-bg-landscape~ipad.png -------------------------------------------------------------------------------- /Baker/BakerAssets.xcassets/shelf-bg-portrait.imageset/shelf-bg-portrait~iphone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Simbul/baker/HEAD/Baker/BakerAssets.xcassets/shelf-bg-portrait.imageset/shelf-bg-portrait~iphone.png -------------------------------------------------------------------------------- /Baker/BakerAssets.xcassets/navigation-bar-bg-ios6.imageset/navigation-bar-bg-ios6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Simbul/baker/HEAD/Baker/BakerAssets.xcassets/navigation-bar-bg-ios6.imageset/navigation-bar-bg-ios6.png -------------------------------------------------------------------------------- /Baker/BakerAssets.xcassets/shelf-bg-landscape.imageset/shelf-bg-landscape@2x~ipad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Simbul/baker/HEAD/Baker/BakerAssets.xcassets/shelf-bg-landscape.imageset/shelf-bg-landscape@2x~ipad.png -------------------------------------------------------------------------------- /Baker/BakerAssets.xcassets/shelf-bg-landscape.imageset/shelf-bg-landscape~iphone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Simbul/baker/HEAD/Baker/BakerAssets.xcassets/shelf-bg-landscape.imageset/shelf-bg-landscape~iphone.png -------------------------------------------------------------------------------- /Baker/BakerAssets.xcassets/shelf-bg-portrait.imageset/shelf-bg-portrait@2x~ipad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Simbul/baker/HEAD/Baker/BakerAssets.xcassets/shelf-bg-portrait.imageset/shelf-bg-portrait@2x~ipad.png -------------------------------------------------------------------------------- /Baker/BakerAssets.xcassets/shelf-bg-portrait.imageset/shelf-bg-portrait@2x~iphone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Simbul/baker/HEAD/Baker/BakerAssets.xcassets/shelf-bg-portrait.imageset/shelf-bg-portrait@2x~iphone.png -------------------------------------------------------------------------------- /Baker/BakerAssets.xcassets/LaunchImage.launchimage/iPad Portrait iOS6 no status bar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Simbul/baker/HEAD/Baker/BakerAssets.xcassets/LaunchImage.launchimage/iPad Portrait iOS6 no status bar.png -------------------------------------------------------------------------------- /Baker/BakerAssets.xcassets/shelf-bg-landscape.imageset/shelf-bg-landscape@2x~iphone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Simbul/baker/HEAD/Baker/BakerAssets.xcassets/shelf-bg-landscape.imageset/shelf-bg-landscape@2x~iphone.png -------------------------------------------------------------------------------- /Baker/BakerAssets.xcassets/LaunchImage.launchimage/iPad Landscape iOS6 no status bar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Simbul/baker/HEAD/Baker/BakerAssets.xcassets/LaunchImage.launchimage/iPad Landscape iOS6 no status bar.png -------------------------------------------------------------------------------- /Baker/BakerAssets.xcassets/LaunchImage.launchimage/iPad Portrait iOS6 no status bar@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Simbul/baker/HEAD/Baker/BakerAssets.xcassets/LaunchImage.launchimage/iPad Portrait iOS6 no status bar@2x.png -------------------------------------------------------------------------------- /Baker/BakerAssets.xcassets/navigation-bar-bg-ios6.imageset/navigation-bar-bg-ios6@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Simbul/baker/HEAD/Baker/BakerAssets.xcassets/navigation-bar-bg-ios6.imageset/navigation-bar-bg-ios6@2x.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | Baker.xcodeproj/*.mode1v3 3 | Baker.xcodeproj/*.pbxuser 4 | Baker.xcodeproj/xcuserdata 5 | Baker.xcodeproj/project.xcworkspace/xcuserdata 6 | Baker.xcodeproj/project.xcworkspace/xcshareddata 7 | build/ 8 | -------------------------------------------------------------------------------- /Baker.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Baker/BakerAssets.xcassets/LaunchImage.launchimage/iPad Landscape iOS6 no status bar@2x-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Simbul/baker/HEAD/Baker/BakerAssets.xcassets/LaunchImage.launchimage/iPad Landscape iOS6 no status bar@2x-1.png -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Project Baker 2 | ============= 3 | 4 | This is the original Baker Framework repository by Davide Casali, Marco Colombo and Alessandro Morandi. Note that this repo is not maintained anymore. 5 | 6 | The new official fork can be found at https://github.com/bakerframework/baker/. 7 | -------------------------------------------------------------------------------- /Baker/Baker-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'Baker' target in the 'Baker' project 3 | // 4 | 5 | #import 6 | 7 | #ifndef __IPHONE_3_0 8 | #warning "This project uses features only available in iOS SDK 3.0 and later." 9 | #endif 10 | 11 | #ifdef __OBJC__ 12 | #import 13 | #import 14 | #endif 15 | -------------------------------------------------------------------------------- /Baker/BakerAssets.xcassets/back.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "back.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "back@2x.png" 12 | } 13 | ], 14 | "info" : { 15 | "version" : 1, 16 | "author" : "xcode" 17 | } 18 | } -------------------------------------------------------------------------------- /Baker/BakerAssets.xcassets/forward.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "forward.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "forward@2x.png" 12 | } 13 | ], 14 | "info" : { 15 | "version" : 1, 16 | "author" : "xcode" 17 | } 18 | } -------------------------------------------------------------------------------- /Baker/BakerAssets.xcassets/navigation-bar-bg.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "navigation-bar-bg.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "navigation-bar-bg@2x.png" 12 | } 13 | ], 14 | "info" : { 15 | "version" : 1, 16 | "author" : "xcode" 17 | } 18 | } -------------------------------------------------------------------------------- /Baker/BakerAssets.xcassets/newsstand-app-icon.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "newsstand-app-icon.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "newsstand-app-icon@2x.png" 12 | } 13 | ], 14 | "info" : { 15 | "version" : 1, 16 | "author" : "xcode" 17 | } 18 | } -------------------------------------------------------------------------------- /Baker/BakerAssets.xcassets/navigation-bar-bg-ios6.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "navigation-bar-bg-ios6.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "navigation-bar-bg-ios6@2x.png" 12 | } 13 | ], 14 | "info" : { 15 | "version" : 1, 16 | "author" : "xcode" 17 | } 18 | } -------------------------------------------------------------------------------- /BakerShelf/lib/UIColor+Extensions.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIColor+Extensions.h 3 | // Pirelli 4 | // 5 | // Created by Marco Colombo on 27/09/11. 6 | // Copyright 2011 Marco Natale Colombo. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface UIColor (UIColor_Extensions) 12 | 13 | #pragma mark - Hex color management 14 | + (UIColor *)colorWithRGBHex:(UInt32)hex; 15 | + (UIColor *)colorWithHexString:(NSString *)stringToConvert; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /BakerShelf/info/info.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Baker Framework - Publication Info 6 | 7 | 8 | 9 |

Baker Framework

10 | 11 |

About

12 |

13 | Baker is a HTML5 ebook framework to publish interactive books and magazines on iPad & iPhone using simply open web standards. 14 |

15 | 16 |

How to use it

17 |

18 | Baker uses a format called HPub that is basically a self-contained static HTML5 microsite zipped with some metadata. 19 |

20 | 21 |

22 | 23 |

24 | 25 | -------------------------------------------------------------------------------- /BakerView/lib/minizip/mztools.h: -------------------------------------------------------------------------------- 1 | /* 2 | Additional tools for Minizip 3 | Code: Xavier Roche '2004 4 | License: Same as ZLIB (www.gzip.org) 5 | */ 6 | 7 | #ifndef _zip_tools_H 8 | #define _zip_tools_H 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | #ifndef _ZLIB_H 15 | #include "zlib.h" 16 | #endif 17 | 18 | #include "unzip.h" 19 | 20 | /* Repair a ZIP file (missing central directory) 21 | file: file to recover 22 | fileOut: output file after recovery 23 | fileOutTmp: temporary file name used for recovery 24 | */ 25 | extern int ZEXPORT unzRepair(const char* file, 26 | const char* fileOut, 27 | const char* fileOutTmp, 28 | uLong* nRecovered, 29 | uLong* bytesRecovered); 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /Baker/BakerAssets.xcassets/shelf-bg-portrait.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "scale" : "1x", 6 | "filename" : "shelf-bg-portrait~iphone.png" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "scale" : "2x", 11 | "filename" : "shelf-bg-portrait@2x~iphone.png" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "filename" : "shelf-bg-portrait-568h.png", 16 | "subtype" : "retina4", 17 | "scale" : "2x" 18 | }, 19 | { 20 | "idiom" : "ipad", 21 | "scale" : "1x", 22 | "filename" : "shelf-bg-portrait~ipad.png" 23 | }, 24 | { 25 | "idiom" : "ipad", 26 | "scale" : "2x", 27 | "filename" : "shelf-bg-portrait@2x~ipad.png" 28 | } 29 | ], 30 | "info" : { 31 | "version" : 1, 32 | "author" : "xcode" 33 | } 34 | } -------------------------------------------------------------------------------- /Baker/BakerAssets.xcassets/shelf-bg-landscape.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "scale" : "1x", 6 | "filename" : "shelf-bg-landscape~iphone.png" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "scale" : "2x", 11 | "filename" : "shelf-bg-landscape@2x~iphone.png" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "filename" : "shelf-bg-landscape-568h.png", 16 | "subtype" : "retina4", 17 | "scale" : "2x" 18 | }, 19 | { 20 | "idiom" : "ipad", 21 | "scale" : "1x", 22 | "filename" : "shelf-bg-landscape~ipad.png" 23 | }, 24 | { 25 | "idiom" : "ipad", 26 | "scale" : "2x", 27 | "filename" : "shelf-bg-landscape@2x~ipad.png" 28 | } 29 | ], 30 | "info" : { 31 | "version" : 1, 32 | "author" : "xcode" 33 | } 34 | } -------------------------------------------------------------------------------- /books/a-study-in-scarlet/Book Cover.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | A Study In Scarlet 5 | 6 | 7 | 8 | 14 | 15 | 16 |
17 |

A Study in Scarlet

18 |

by A. Conan Doyle

19 | 20 | 21 |
22 | 23 | 27 |
28 | 29 | -------------------------------------------------------------------------------- /books/a-study-in-scarlet/book.json: -------------------------------------------------------------------------------- 1 | { 2 | "hpub": 1, 3 | "title": "A Study in Scarlet", 4 | "author": ["Arthur Conan Doyle"], 5 | "creator": ["D. Casali", "M. Colombo", "A. Morandi"], 6 | "date": "1887-10-10", 7 | "url": "book://bakerframework.com/newsstand-books/a-study-in-scarlet", 8 | "cover": "a-study-in-scarlet.png", 9 | 10 | "orientation": "both", 11 | "zoomable": false, 12 | 13 | "-baker-background": "#ffffff", 14 | "-baker-vertical-bounce": true, 15 | "-baker-media-autoplay": true, 16 | "-baker-background-image-portrait": "gfx/background-portrait.png", 17 | "-baker-background-image-landscape": "gfx/background-landscape.png", 18 | "-baker-page-numbers-color": "#000000", 19 | 20 | "contents": [ 21 | "Book Cover.html", 22 | "Book Index.html", 23 | "Part1-01.html", 24 | "Part1-02.html", 25 | "Part1-03.html", 26 | "Part1-04.html", 27 | "Part1-05.html", 28 | "Part1-06.html", 29 | "Part1-07.html", 30 | "Part2-01.html", 31 | "Part2-02.html", 32 | "Part2-03.html", 33 | "Part2-04.html", 34 | "Part2-05.html", 35 | "Part2-06.html", 36 | "Part2-07.html", 37 | "Tail.html" 38 | ] 39 | } -------------------------------------------------------------------------------- /BakerShelf/lib/UIColor+Extensions.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIColor+Extensions.m 3 | // Pirelli 4 | // 5 | // Created by Marco Colombo on 27/09/11. 6 | // Copyright 2011 Marco Natale Colombo. All rights reserved. 7 | // 8 | 9 | #import "UIColor+Extensions.h" 10 | 11 | @implementation UIColor (UIColor_Extensions) 12 | 13 | #pragma mark - Hex color management 14 | 15 | + (UIColor *)colorWithRGBHex:(UInt32)hex 16 | { 17 | int r = (hex >> 16) & 0xFF; 18 | int g = (hex >> 8) & 0xFF; 19 | int b = (hex) & 0xFF; 20 | 21 | return [UIColor colorWithRed:r / 255.0f 22 | green:g / 255.0f 23 | blue:b / 255.0f 24 | alpha:1.0f]; 25 | } 26 | + (UIColor *)colorWithHexString:(NSString *)stringToConvert 27 | { 28 | // Returns a UIColor by scanning the string for a hex number and passing that to (UIColor *)colorWithRGBHex:(UInt32)hex 29 | // Skips any leading whitespace and ignores any trailing characters 30 | 31 | NSString *hexString = [stringToConvert stringByReplacingOccurrencesOfString:@"#" withString:@""]; 32 | NSScanner *scanner = [NSScanner scannerWithString:hexString]; 33 | 34 | unsigned hexNum; 35 | if (![scanner scanHexInt:&hexNum]) { 36 | return nil; 37 | } 38 | return [UIColor colorWithRGBHex:hexNum]; 39 | } 40 | 41 | @end 42 | -------------------------------------------------------------------------------- /books/a-study-in-scarlet/Tail.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | A Study In Scarlet 5 | 6 | 7 | 19 | 20 | 21 |
22 | 29 | 30 | Built with Baker Ebook Framework 31 | 32 | 33 |

34 | Originally published in 1887
35 | Baker Ebook 2011 36 |

37 |
38 | 39 | -------------------------------------------------------------------------------- /BakerShelf/lib/NSData+Base64.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSData+Base64.h 3 | // 4 | // Version 1.0.2 5 | // 6 | // Created by Nick Lockwood on 12/01/2012. 7 | // Copyright (C) 2012 Charcoal Design 8 | // 9 | // Distributed under the permissive zlib License 10 | // Get the latest version from here: 11 | // 12 | // https://github.com/nicklockwood/Base64 13 | // 14 | // This software is provided 'as-is', without any express or implied 15 | // warranty. In no event will the authors be held liable for any damages 16 | // arising from the use of this software. 17 | // 18 | // Permission is granted to anyone to use this software for any purpose, 19 | // including commercial applications, and to alter it and redistribute it 20 | // freely, subject to the following restrictions: 21 | // 22 | // 1. The origin of this software must not be misrepresented; you must not 23 | // claim that you wrote the original software. If you use this software 24 | // in a product, an acknowledgment in the product documentation would be 25 | // appreciated but is not required. 26 | // 27 | // 2. Altered source versions must be plainly marked as such, and must not be 28 | // misrepresented as being the original software. 29 | // 30 | // 3. This notice may not be removed or altered from any source distribution. 31 | // 32 | 33 | #import 34 | 35 | @interface NSData (Base64) 36 | 37 | + (NSData *)dataWithBase64EncodedString:(NSString *)string; 38 | - (NSString *)base64EncodedStringWithWrapWidth:(NSUInteger)wrapWidth; 39 | - (NSString *)base64EncodedString; 40 | 41 | @end 42 | 43 | -------------------------------------------------------------------------------- /BakerShelf/UICustomNavigationController.h: -------------------------------------------------------------------------------- 1 | // 2 | // UICustomNavigationController.h 3 | // Baker 4 | // 5 | // ========================================================================================== 6 | // 7 | // Copyright (c) 2010-2013, Davide Casali, Marco Colombo, Alessandro Morandi 8 | // All rights reserved. 9 | // 10 | // Redistribution and use in source and binary forms, with or without modification, are 11 | // permitted provided that the following conditions are met: 12 | // 13 | // Redistributions of source code must retain the above copyright notice, this list of 14 | // conditions and the following disclaimer. 15 | // Redistributions in binary form must reproduce the above copyright notice, this list of 16 | // conditions and the following disclaimer in the documentation and/or other materials 17 | // provided with the distribution. 18 | // Neither the name of the Baker Framework nor the names of its contributors may be used to 19 | // endorse or promote products derived from this software without specific prior written 20 | // permission. 21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 22 | // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 23 | // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 24 | // SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 25 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 26 | // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28 | // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | // 31 | 32 | #import 33 | 34 | @interface UICustomNavigationController : UINavigationController 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /BakerShelf/lib/NSString+UUID.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSString+UUID.h 3 | // Baker 4 | // See: http://oleb.net/blog/2011/09/how-to-replace-the-udid/ 5 | // 6 | // ========================================================================================== 7 | // 8 | // Copyright (c) 2010-2013, Davide Casali, Marco Colombo, Alessandro Morandi 9 | // All rights reserved. 10 | // 11 | // Redistribution and use in source and binary forms, with or without modification, are 12 | // permitted provided that the following conditions are met: 13 | // 14 | // Redistributions of source code must retain the above copyright notice, this list of 15 | // conditions and the following disclaimer. 16 | // Redistributions in binary form must reproduce the above copyright notice, this list of 17 | // conditions and the following disclaimer in the documentation and/or other materials 18 | // provided with the distribution. 19 | // Neither the name of the Baker Framework nor the names of its contributors may be used to 20 | // endorse or promote products derived from this software without specific prior written 21 | // permission. 22 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 23 | // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 24 | // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 25 | // SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 26 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 27 | // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 | // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | // 32 | 33 | #import 34 | 35 | @interface NSString (UUID) 36 | 37 | + (NSString *)uuid; 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /BakerView/InterceptorWindow.h: -------------------------------------------------------------------------------- 1 | // 2 | // InterceptorWindow.h 3 | // Baker 4 | // 5 | // ========================================================================================== 6 | // 7 | // Copyright (c) 2010-2013, Davide Casali, Marco Colombo, Alessandro Morandi 8 | // All rights reserved. 9 | // 10 | // Redistribution and use in source and binary forms, with or without modification, are 11 | // permitted provided that the following conditions are met: 12 | // 13 | // Redistributions of source code must retain the above copyright notice, this list of 14 | // conditions and the following disclaimer. 15 | // Redistributions in binary form must reproduce the above copyright notice, this list of 16 | // conditions and the following disclaimer in the documentation and/or other materials 17 | // provided with the distribution. 18 | // Neither the name of the Baker Framework nor the names of its contributors may be used to 19 | // endorse or promote products derived from this software without specific prior written 20 | // permission. 21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 22 | // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 23 | // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 24 | // SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 25 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 26 | // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28 | // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | // 31 | 32 | #import 33 | 34 | @interface InterceptorWindow : UIWindow 35 | 36 | #pragma mark - Events management 37 | - (void)interceptEvent:(UIEvent *)event; 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /BakerShelf/UICustomNavigationBar.h: -------------------------------------------------------------------------------- 1 | // 2 | // UICustomNavigationBar.h 3 | // Baker 4 | // 5 | // ========================================================================================== 6 | // 7 | // Copyright (c) 2010-2013, Davide Casali, Marco Colombo, Alessandro Morandi 8 | // All rights reserved. 9 | // 10 | // Redistribution and use in source and binary forms, with or without modification, are 11 | // permitted provided that the following conditions are met: 12 | // 13 | // Redistributions of source code must retain the above copyright notice, this list of 14 | // conditions and the following disclaimer. 15 | // Redistributions in binary form must reproduce the above copyright notice, this list of 16 | // conditions and the following disclaimer in the documentation and/or other materials 17 | // provided with the distribution. 18 | // Neither the name of the Baker Framework nor the names of its contributors may be used to 19 | // endorse or promote products derived from this software without specific prior written 20 | // permission. 21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 22 | // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 23 | // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 24 | // SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 25 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 26 | // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28 | // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | // 31 | 32 | #import 33 | 34 | @interface UICustomNavigationBar : UINavigationBar 35 | { 36 | UIImageView *backgroundImageView; 37 | NSMutableDictionary *backgroundImages; 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /Baker/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // Baker 4 | // 5 | // ========================================================================================== 6 | // 7 | // Copyright (c) 2010-2013, Davide Casali, Marco Colombo, Alessandro Morandi 8 | // All rights reserved. 9 | // 10 | // Redistribution and use in source and binary forms, with or without modification, are 11 | // permitted provided that the following conditions are met: 12 | // 13 | // Redistributions of source code must retain the above copyright notice, this list of 14 | // conditions and the following disclaimer. 15 | // Redistributions in binary form must reproduce the above copyright notice, this list of 16 | // conditions and the following disclaimer in the documentation and/or other materials 17 | // provided with the distribution. 18 | // Neither the name of the Baker Framework nor the names of its contributors may be used to 19 | // endorse or promote products derived from this software without specific prior written 20 | // permission. 21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 22 | // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 23 | // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 24 | // SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 25 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 26 | // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28 | // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | // 31 | 32 | #import 33 | 34 | #import "AppDelegate.h" 35 | 36 | int main(int argc, char *argv[]) 37 | { 38 | @autoreleasepool { 39 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /BakerShelf/lib/NSURL+Extensions.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSURL+Extensions.h 3 | // Baker 4 | // See: http://stackoverflow.com/a/6312153/551557 5 | // 6 | // ========================================================================================== 7 | // 8 | // Copyright (c) 2010-2013, Davide Casali, Marco Colombo, Alessandro Morandi 9 | // All rights reserved. 10 | // 11 | // Redistribution and use in source and binary forms, with or without modification, are 12 | // permitted provided that the following conditions are met: 13 | // 14 | // Redistributions of source code must retain the above copyright notice, this list of 15 | // conditions and the following disclaimer. 16 | // Redistributions in binary form must reproduce the above copyright notice, this list of 17 | // conditions and the following disclaimer in the documentation and/or other materials 18 | // provided with the distribution. 19 | // Neither the name of the Baker Framework nor the names of its contributors may be used to 20 | // endorse or promote products derived from this software without specific prior written 21 | // permission. 22 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 23 | // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 24 | // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 25 | // SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 26 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 27 | // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 | // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | // 32 | 33 | #import 34 | 35 | @interface NSURL (Extensions) 36 | 37 | - (NSURL *)URLByAppendingQueryString:(NSString *)queryString; 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /BakerView/lib/SSZipArchive.h: -------------------------------------------------------------------------------- 1 | // 2 | // SSZipArchive.h 3 | // SSZipArchive 4 | // 5 | // Created by Sam Soffes on 7/21/10. 6 | // Copyright (c) Sam Soffes 2010-2013. All rights reserved. 7 | // 8 | 9 | #ifndef _SSZIPARCHIVE_H 10 | #define _SSZIPARCHIVE_H 11 | 12 | #import 13 | #include "minizip/unzip.h" 14 | 15 | @protocol SSZipArchiveDelegate; 16 | 17 | @interface SSZipArchive : NSObject 18 | 19 | // Unzip 20 | + (BOOL)unzipFileAtPath:(NSString *)path toDestination:(NSString *)destination; 21 | + (BOOL)unzipFileAtPath:(NSString *)path toDestination:(NSString *)destination overwrite:(BOOL)overwrite password:(NSString *)password error:(NSError **)error; 22 | 23 | + (BOOL)unzipFileAtPath:(NSString *)path toDestination:(NSString *)destination delegate:(id)delegate; 24 | + (BOOL)unzipFileAtPath:(NSString *)path toDestination:(NSString *)destination overwrite:(BOOL)overwrite password:(NSString *)password error:(NSError **)error delegate:(id)delegate; 25 | 26 | // Zip 27 | + (BOOL)createZipFileAtPath:(NSString *)path withFilesAtPaths:(NSArray *)filenames; 28 | + (BOOL)createZipFileAtPath:(NSString *)path withContentsOfDirectory:(NSString *)directoryPath; 29 | 30 | - (id)initWithPath:(NSString *)path; 31 | - (BOOL)open; 32 | - (BOOL)writeFile:(NSString *)path; 33 | - (BOOL)writeData:(NSData *)data filename:(NSString *)filename; 34 | - (BOOL)close; 35 | 36 | @end 37 | 38 | 39 | @protocol SSZipArchiveDelegate 40 | 41 | @optional 42 | 43 | - (void)zipArchiveWillUnzipArchiveAtPath:(NSString *)path zipInfo:(unz_global_info)zipInfo; 44 | - (void)zipArchiveDidUnzipArchiveAtPath:(NSString *)path zipInfo:(unz_global_info)zipInfo unzippedPath:(NSString *)unzippedPath; 45 | 46 | - (void)zipArchiveWillUnzipFileAtIndex:(NSInteger)fileIndex totalFiles:(NSInteger)totalFiles archivePath:(NSString *)archivePath fileInfo:(unz_file_info)fileInfo; 47 | - (void)zipArchiveDidUnzipFileAtIndex:(NSInteger)fileIndex totalFiles:(NSInteger)totalFiles archivePath:(NSString *)archivePath fileInfo:(unz_file_info)fileInfo; 48 | 49 | @end 50 | 51 | #endif /* _SSZIPARCHIVE_H */ 52 | -------------------------------------------------------------------------------- /BakerView/lib/JSONStatus.h: -------------------------------------------------------------------------------- 1 | // 2 | // JSONStatus.h 3 | // Baker 4 | // 5 | // ========================================================================================== 6 | // 7 | // Copyright (c) 2010-2013, Davide Casali, Marco Colombo, Alessandro Morandi 8 | // All rights reserved. 9 | // 10 | // Redistribution and use in source and binary forms, with or without modification, are 11 | // permitted provided that the following conditions are met: 12 | // 13 | // Redistributions of source code must retain the above copyright notice, this list of 14 | // conditions and the following disclaimer. 15 | // Redistributions in binary form must reproduce the above copyright notice, this list of 16 | // conditions and the following disclaimer in the documentation and/or other materials 17 | // provided with the distribution. 18 | // Neither the name of the Baker Framework nor the names of its contributors may be used to 19 | // endorse or promote products derived from this software without specific prior written 20 | // permission. 21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 22 | // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 23 | // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 24 | // SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 25 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 26 | // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28 | // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | // 31 | 32 | #import 33 | 34 | @interface JSONStatus : NSObject 35 | 36 | @property (copy, nonatomic) NSString *path; 37 | 38 | - (id)initWithJSONPath:(NSString *)JSONPath; 39 | - (void)save:(NSDictionary *)status; 40 | - (NSDictionary *)load; 41 | 42 | @end 43 | -------------------------------------------------------------------------------- /Baker/BakerAssets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "size" : "57x57", 20 | "idiom" : "iphone", 21 | "filename" : "iPhone App iOS6.png", 22 | "scale" : "1x" 23 | }, 24 | { 25 | "size" : "57x57", 26 | "idiom" : "iphone", 27 | "filename" : "iPhone App iOS6@2x.png", 28 | "scale" : "2x" 29 | }, 30 | { 31 | "size" : "60x60", 32 | "idiom" : "iphone", 33 | "filename" : "iPhone App iOS7@2x.png", 34 | "scale" : "2x" 35 | }, 36 | { 37 | "idiom" : "ipad", 38 | "size" : "29x29", 39 | "scale" : "1x" 40 | }, 41 | { 42 | "idiom" : "ipad", 43 | "size" : "29x29", 44 | "scale" : "2x" 45 | }, 46 | { 47 | "idiom" : "ipad", 48 | "size" : "40x40", 49 | "scale" : "1x" 50 | }, 51 | { 52 | "idiom" : "ipad", 53 | "size" : "40x40", 54 | "scale" : "2x" 55 | }, 56 | { 57 | "idiom" : "ipad", 58 | "size" : "50x50", 59 | "scale" : "1x" 60 | }, 61 | { 62 | "idiom" : "ipad", 63 | "size" : "50x50", 64 | "scale" : "2x" 65 | }, 66 | { 67 | "size" : "72x72", 68 | "idiom" : "ipad", 69 | "filename" : "iPad App iOS6.png", 70 | "scale" : "1x" 71 | }, 72 | { 73 | "size" : "72x72", 74 | "idiom" : "ipad", 75 | "filename" : "iPad App iOS6@2x.png", 76 | "scale" : "2x" 77 | }, 78 | { 79 | "size" : "76x76", 80 | "idiom" : "ipad", 81 | "filename" : "iPad App iOS7.png", 82 | "scale" : "1x" 83 | }, 84 | { 85 | "size" : "76x76", 86 | "idiom" : "ipad", 87 | "filename" : "iPad App iOS7@2x.png", 88 | "scale" : "2x" 89 | } 90 | ], 91 | "info" : { 92 | "version" : 1, 93 | "author" : "xcode" 94 | } 95 | } -------------------------------------------------------------------------------- /BakerView/BakerBookStatus.h: -------------------------------------------------------------------------------- 1 | // 2 | // BakerBookStatus.h 3 | // Baker 4 | // 5 | // ========================================================================================== 6 | // 7 | // Copyright (c) 2010-2013, Davide Casali, Marco Colombo, Alessandro Morandi 8 | // All rights reserved. 9 | // 10 | // Redistribution and use in source and binary forms, with or without modification, are 11 | // permitted provided that the following conditions are met: 12 | // 13 | // Redistributions of source code must retain the above copyright notice, this list of 14 | // conditions and the following disclaimer. 15 | // Redistributions in binary form must reproduce the above copyright notice, this list of 16 | // conditions and the following disclaimer in the documentation and/or other materials 17 | // provided with the distribution. 18 | // Neither the name of the Baker Framework nor the names of its contributors may be used to 19 | // endorse or promote products derived from this software without specific prior written 20 | // permission. 21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 22 | // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 23 | // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 24 | // SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 25 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 26 | // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28 | // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | // 31 | 32 | #import 33 | #import "JSONStatus.h" 34 | 35 | @interface BakerBookStatus : JSONStatus 36 | 37 | @property (copy, nonatomic) NSNumber *page; 38 | @property (copy, nonatomic) NSString *scrollIndex; 39 | 40 | - (id)initWithBookId:(NSString *)bookId; 41 | - (void)save; 42 | 43 | @end 44 | -------------------------------------------------------------------------------- /BakerShelf/lib/NSString+Extensions.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSString+Extensions.h 3 | // Baker 4 | // 5 | // ========================================================================================== 6 | // 7 | // Copyright (c) 2010-2013, Davide Casali, Marco Colombo, Alessandro Morandi 8 | // All rights reserved. 9 | // 10 | // Redistribution and use in source and binary forms, with or without modification, are 11 | // permitted provided that the following conditions are met: 12 | // 13 | // Redistributions of source code must retain the above copyright notice, this list of 14 | // conditions and the following disclaimer. 15 | // Redistributions in binary form must reproduce the above copyright notice, this list of 16 | // conditions and the following disclaimer in the documentation and/or other materials 17 | // provided with the distribution. 18 | // Neither the name of the Baker Framework nor the names of its contributors may be used to 19 | // endorse or promote products derived from this software without specific prior written 20 | // permission. 21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 22 | // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 23 | // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 24 | // SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 25 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 26 | // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28 | // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | // 31 | 32 | #import 33 | 34 | @interface NSString (Extensions) 35 | 36 | #pragma mark - SHA management 37 | - (NSString *)stringSHAEncoded; 38 | + (NSString *)encodeSHAString:(NSString *)str; 39 | + (NSString *)stringFromInterfaceOrientation:(UIInterfaceOrientation)orientation; 40 | 41 | @end 42 | -------------------------------------------------------------------------------- /BakerView/ui/PageTitleLabel.h: -------------------------------------------------------------------------------- 1 | // 2 | // PageTitleLabel.h 3 | // Baker 4 | // 5 | // ========================================================================================== 6 | // 7 | // Copyright (c) 2010-2013, Davide Casali, Marco Colombo, Alessandro Morandi 8 | // All rights reserved. 9 | // 10 | // Redistribution and use in source and binary forms, with or without modification, are 11 | // permitted provided that the following conditions are met: 12 | // 13 | // Redistributions of source code must retain the above copyright notice, this list of 14 | // conditions and the following disclaimer. 15 | // Redistributions in binary form must reproduce the above copyright notice, this list of 16 | // conditions and the following disclaimer in the documentation and/or other materials 17 | // provided with the distribution. 18 | // Neither the name of the Baker Framework nor the names of its contributors may be used to 19 | // endorse or promote products derived from this software without specific prior written 20 | // permission. 21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 22 | // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 23 | // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 24 | // SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 25 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 26 | // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28 | // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | // 31 | 32 | #import 33 | 34 | @interface PageTitleLabel : UILabel 35 | 36 | - (id)initWithFile:(NSString *)path color:(UIColor *)color alpha:(float)alpha; 37 | - (id)initWithFileContent:(NSString *)fileContent color:(UIColor *)color alpha:(float)alpha; 38 | - (void)setX:(CGFloat) x Y:(CGFloat) y; 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /BakerShelf/ShelfStatus.h: -------------------------------------------------------------------------------- 1 | // 2 | // ShelfStatus.h 3 | // Baker 4 | // 5 | // ========================================================================================== 6 | // 7 | // Copyright (c) 2010-2013, Davide Casali, Marco Colombo, Alessandro Morandi 8 | // All rights reserved. 9 | // 10 | // Redistribution and use in source and binary forms, with or without modification, are 11 | // permitted provided that the following conditions are met: 12 | // 13 | // Redistributions of source code must retain the above copyright notice, this list of 14 | // conditions and the following disclaimer. 15 | // Redistributions in binary form must reproduce the above copyright notice, this list of 16 | // conditions and the following disclaimer in the documentation and/or other materials 17 | // provided with the distribution. 18 | // Neither the name of the Baker Framework nor the names of its contributors may be used to 19 | // endorse or promote products derived from this software without specific prior written 20 | // permission. 21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 22 | // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 23 | // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 24 | // SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 25 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 26 | // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28 | // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | // 31 | 32 | #import 33 | #import "JSONStatus.h" 34 | 35 | @interface ShelfStatus : JSONStatus 36 | 37 | @property (strong, nonatomic) NSMutableDictionary *prices; 38 | 39 | - (id)init; 40 | - (void)save; 41 | - (NSString *)priceFor:(NSString *)productID; 42 | - (void)setPrice:(NSString *)price for:(NSString *)productID; 43 | 44 | @end 45 | -------------------------------------------------------------------------------- /BakerShelf/lib/NSMutableURLRequest+WebServiceClient.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSMutableURLRequest+WebServiceClient.h 3 | // Baker 4 | // See: http://stackoverflow.com/a/1289735/551557 5 | // 6 | // ========================================================================================== 7 | // 8 | // Copyright (c) 2010-2013, Davide Casali, Marco Colombo, Alessandro Morandi 9 | // All rights reserved. 10 | // 11 | // Redistribution and use in source and binary forms, with or without modification, are 12 | // permitted provided that the following conditions are met: 13 | // 14 | // Redistributions of source code must retain the above copyright notice, this list of 15 | // conditions and the following disclaimer. 16 | // Redistributions in binary form must reproduce the above copyright notice, this list of 17 | // conditions and the following disclaimer in the documentation and/or other materials 18 | // provided with the distribution. 19 | // Neither the name of the Baker Framework nor the names of its contributors may be used to 20 | // endorse or promote products derived from this software without specific prior written 21 | // permission. 22 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 23 | // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 24 | // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 25 | // SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 26 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 27 | // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 | // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | // 32 | 33 | #import 34 | 35 | @interface NSMutableURLRequest (WebServiceClient) 36 | 37 | + (NSString *) encodeFormPostParameters: (NSDictionary *) parameters; 38 | - (void) setFormPostParameters: (NSDictionary *) parameters; 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /Baker/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // Baker 4 | // 5 | // ========================================================================================== 6 | // 7 | // Copyright (c) 2010-2013, Davide Casali, Marco Colombo, Alessandro Morandi 8 | // All rights reserved. 9 | // 10 | // Redistribution and use in source and binary forms, with or without modification, are 11 | // permitted provided that the following conditions are met: 12 | // 13 | // Redistributions of source code must retain the above copyright notice, this list of 14 | // conditions and the following disclaimer. 15 | // Redistributions in binary form must reproduce the above copyright notice, this list of 16 | // conditions and the following disclaimer in the documentation and/or other materials 17 | // provided with the distribution. 18 | // Neither the name of the Baker Framework nor the names of its contributors may be used to 19 | // endorse or promote products derived from this software without specific prior written 20 | // permission. 21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 22 | // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 23 | // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 24 | // SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 25 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 26 | // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28 | // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | // 31 | 32 | #import 33 | 34 | #import "InterceptorWindow.h" 35 | #import "ShelfViewController.h" 36 | 37 | @interface AppDelegate : UIResponder 38 | 39 | @property (strong, nonatomic) InterceptorWindow *window; 40 | @property (strong, nonatomic) UIViewController *rootViewController; 41 | @property (strong, nonatomic) UINavigationController *rootNavigationController; 42 | 43 | @end 44 | -------------------------------------------------------------------------------- /Baker/BakerAnalyticsEvents.h: -------------------------------------------------------------------------------- 1 | // 2 | // BakerAnalyticsEvents.h 3 | // Baker 4 | // 5 | // ========================================================================================== 6 | // 7 | // Copyright (c) 2010-2013, Davide Casali, Marco Colombo, Alessandro Morandi 8 | // All rights reserved. 9 | // 10 | // Redistribution and use in source and binary forms, with or without modification, are 11 | // permitted provided that the following conditions are met: 12 | // 13 | // Redistributions of source code must retain the above copyright notice, this list of 14 | // conditions and the following disclaimer. 15 | // Redistributions in binary form must reproduce the above copyright notice, this list of 16 | // conditions and the following disclaimer in the documentation and/or other materials 17 | // provided with the distribution. 18 | // Neither the name of the Baker Framework nor the names of its contributors may be used to 19 | // endorse or promote products derived from this software without specific prior written 20 | // permission. 21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 22 | // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 23 | // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 24 | // SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 25 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 26 | // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28 | // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | // 31 | 32 | #import 33 | 34 | #import "BakerViewController.h" 35 | #import "ShelfViewController.h" 36 | #import "IssueViewController.h" 37 | 38 | @interface BakerAnalyticsEvents : NSObject { 39 | 40 | id tracker; // Can be used to reference tracking libraries (i.e. Google Analytics, ...) 41 | 42 | } 43 | 44 | #pragma mark - Singleton 45 | 46 | + (BakerAnalyticsEvents *)sharedInstance; 47 | - (id)init; 48 | 49 | @end 50 | -------------------------------------------------------------------------------- /BakerShelf/lib/NSString+UUID.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSString+UUID.m 3 | // Baker 4 | // See: http://oleb.net/blog/2011/09/how-to-replace-the-udid/ 5 | // 6 | // ========================================================================================== 7 | // 8 | // Copyright (c) 2010-2013, Davide Casali, Marco Colombo, Alessandro Morandi 9 | // All rights reserved. 10 | // 11 | // Redistribution and use in source and binary forms, with or without modification, are 12 | // permitted provided that the following conditions are met: 13 | // 14 | // Redistributions of source code must retain the above copyright notice, this list of 15 | // conditions and the following disclaimer. 16 | // Redistributions in binary form must reproduce the above copyright notice, this list of 17 | // conditions and the following disclaimer in the documentation and/or other materials 18 | // provided with the distribution. 19 | // Neither the name of the Baker Framework nor the names of its contributors may be used to 20 | // endorse or promote products derived from this software without specific prior written 21 | // permission. 22 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 23 | // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 24 | // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 25 | // SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 26 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 27 | // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 | // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | // 32 | 33 | #import "NSString+UUID.h" 34 | 35 | @implementation NSString (UUID) 36 | 37 | + (NSString *)uuid 38 | { 39 | NSString *uuidString = nil; 40 | CFUUIDRef uuid = CFUUIDCreate(NULL); 41 | if (uuid) { 42 | uuidString = (NSString *)CFUUIDCreateString(NULL, uuid); 43 | CFRelease(uuid); 44 | } 45 | return [uuidString autorelease]; 46 | } 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /Baker/Baker-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIcons 12 | 13 | UINewsstandIcon 14 | 15 | CFBundleIconFiles 16 | 17 | newsstand-app-icon 18 | 19 | UINewsstandBindingEdge 20 | UINewsstandBindingEdgeLeft 21 | UINewsstandBindingType 22 | UINewsstandBindingTypeMagazine 23 | 24 | 25 | CFBundleIdentifier 26 | com.yourcompany.${PRODUCT_NAME:rfc1034identifier} 27 | CFBundleInfoDictionaryVersion 28 | 6.0 29 | CFBundleName 30 | ${PRODUCT_NAME} 31 | CFBundlePackageType 32 | APPL 33 | CFBundleShortVersionString 34 | 4.2 35 | CFBundleSignature 36 | ???? 37 | CFBundleVersion 38 | 4.2 39 | LSRequiresIPhoneOS 40 | 41 | UIBackgroundModes 42 | 43 | newsstand-content 44 | remote-notification 45 | 46 | UINewsstandApp 47 | 48 | UIRequiredDeviceCapabilities 49 | 50 | armv7 51 | 52 | UISupportedInterfaceOrientations 53 | 54 | UIInterfaceOrientationPortrait 55 | UIInterfaceOrientationLandscapeLeft 56 | UIInterfaceOrientationLandscapeRight 57 | UIInterfaceOrientationPortraitUpsideDown 58 | 59 | UISupportedInterfaceOrientations~ipad 60 | 61 | UIInterfaceOrientationPortrait 62 | UIInterfaceOrientationPortraitUpsideDown 63 | UIInterfaceOrientationLandscapeLeft 64 | UIInterfaceOrientationLandscapeRight 65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /BakerShelf/info/style.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Baker Framework - Info Bos 3 | * last update: 2013-07-15 4 | * 5 | * Copyright (C) 2011-13 by Davide S. Casali 6 | * 7 | */ 8 | 9 | /**************************************************************************************************** 10 | * General 11 | */ 12 | body { 13 | background: #f0f0f0; 14 | font-family: "HelveticaNeue-Light", "HelveticaNeue", Helvetica, Arial, sans-serif; 15 | font-size: 16px; 16 | margin: 0; 17 | padding: 10px; 18 | } 19 | 20 | a { 21 | color: #b50303; 22 | } 23 | 24 | /**************************************************************************************************** 25 | * Typography 26 | */ 27 | p, ul, ol { 28 | font-size: 15px; 29 | } 30 | 31 | h1, h2, h3, h4, h5, h6 { 32 | font-family: "BodoniSvtyTwoOSITCTT-Bold", Times, serif; 33 | font-weight: normal; 34 | text-align: left; 35 | 36 | border: 0; 37 | margin: 0; 38 | padding: 0; 39 | } 40 | 41 | strong { 42 | font-weight: normal; 43 | } 44 | 45 | h1 { 46 | color: #b50303; 47 | font-size: 25px; 48 | padding: 0; 49 | margin: 15px 0 15px 0; 50 | } 51 | 52 | h2 { 53 | margin: 30px 0 8px; 54 | font-size: 20px; 55 | text-transform: uppercase; 56 | } 57 | 58 | /**************************************************************************************************** 59 | * Mini Divider 60 | */ 61 | #minivider { 62 | font-family: "HelveticaNeue", Helvetica, Arial, sans-serif; 63 | font-size: 14px; 64 | text-transform: uppercase; 65 | padding: 25px 0 6px; 66 | } 67 | 68 | #minivider strong { 69 | color: #b50303; 70 | } 71 | 72 | .imageframe-black { 73 | background: #000000; 74 | text-align: center; 75 | padding: 10px; 76 | } 77 | 78 | /**************************************************************************************************** 79 | * Extend 80 | */ 81 | .grid-50 { 82 | padding-left: 0; 83 | padding-right: 20px; 84 | } 85 | 86 | /**************************************************************************************************** 87 | * Buttons 88 | */ 89 | .button { 90 | display: inline-block; 91 | background: #b50303; 92 | color: #ffffff; 93 | padding: 8px 14px; 94 | text-decoration: none; 95 | } 96 | 97 | 98 | 99 | 100 | 101 | 102 | -------------------------------------------------------------------------------- /books/a-study-in-scarlet/Book Index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | A Study In Scarlet 5 | 6 | 7 | 8 | 9 |
10 |

Contents

11 | 12 | 25 | 26 | 39 | 40 |
41 | 42 | -------------------------------------------------------------------------------- /books/a-study-in-scarlet/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Index 5 | 6 | 7 | 8 | 9 | 36 | 37 | -------------------------------------------------------------------------------- /BakerShelf/IssuesManager.h: -------------------------------------------------------------------------------- 1 | // 2 | // IssuesManager.h 3 | // Baker 4 | // 5 | // ========================================================================================== 6 | // 7 | // Copyright (c) 2010-2013, Davide Casali, Marco Colombo, Alessandro Morandi 8 | // All rights reserved. 9 | // 10 | // Redistribution and use in source and binary forms, with or without modification, are 11 | // permitted provided that the following conditions are met: 12 | // 13 | // Redistributions of source code must retain the above copyright notice, this list of 14 | // conditions and the following disclaimer. 15 | // Redistributions in binary form must reproduce the above copyright notice, this list of 16 | // conditions and the following disclaimer in the documentation and/or other materials 17 | // provided with the distribution. 18 | // Neither the name of the Baker Framework nor the names of its contributors may be used to 19 | // endorse or promote products derived from this software without specific prior written 20 | // permission. 21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 22 | // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 23 | // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 24 | // SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 25 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 26 | // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28 | // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | // 31 | 32 | #import 33 | #import 34 | #import "BakerIssue.h" 35 | 36 | @interface IssuesManager : NSObject 37 | 38 | @property (copy, nonatomic) NSArray *issues; 39 | @property (retain, nonatomic) NSString *shelfManifestPath; 40 | 41 | #pragma mark - Singleton 42 | 43 | + (IssuesManager *)sharedInstance; 44 | 45 | #ifdef BAKER_NEWSSTAND 46 | -(void)refresh:(void (^)(BOOL)) callback; 47 | -(NSSet *)productIDs; 48 | -(BOOL)hasProductIDs; 49 | -(BakerIssue *)latestIssue; 50 | #endif 51 | + (NSArray *)localBooksList; 52 | 53 | @end 54 | -------------------------------------------------------------------------------- /BakerShelf/lib/NSURL+Extensions.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSURL+Extensions.m 3 | // Baker 4 | // See: http://stackoverflow.com/a/6312153/551557 5 | // 6 | // ========================================================================================== 7 | // 8 | // Copyright (c) 2010-2013, Davide Casali, Marco Colombo, Alessandro Morandi 9 | // All rights reserved. 10 | // 11 | // Redistribution and use in source and binary forms, with or without modification, are 12 | // permitted provided that the following conditions are met: 13 | // 14 | // Redistributions of source code must retain the above copyright notice, this list of 15 | // conditions and the following disclaimer. 16 | // Redistributions in binary form must reproduce the above copyright notice, this list of 17 | // conditions and the following disclaimer in the documentation and/or other materials 18 | // provided with the distribution. 19 | // Neither the name of the Baker Framework nor the names of its contributors may be used to 20 | // endorse or promote products derived from this software without specific prior written 21 | // permission. 22 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 23 | // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 24 | // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 25 | // SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 26 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 27 | // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 | // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | // 32 | 33 | #import "NSURL+Extensions.h" 34 | 35 | @implementation NSURL (Extensions) 36 | 37 | - (NSURL *)URLByAppendingQueryString:(NSString *)queryString { 38 | if (![queryString length]) { 39 | return self; 40 | } 41 | 42 | NSString *URLString = [[NSString alloc] initWithFormat:@"%@%@%@", [self absoluteString], 43 | [self query] ? @"&" : @"?", queryString]; 44 | NSURL *theURL = [NSURL URLWithString:URLString]; 45 | [URLString release]; 46 | return theURL; 47 | } 48 | 49 | @end 50 | -------------------------------------------------------------------------------- /Baker/BakerAssets.xcassets/LaunchImage.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "orientation" : "portrait", 5 | "idiom" : "iphone", 6 | "extent" : "full-screen", 7 | "minimum-system-version" : "7.0", 8 | "filename" : "iPhone Portrait iOS7@2x.png", 9 | "scale" : "2x" 10 | }, 11 | { 12 | "extent" : "full-screen", 13 | "idiom" : "iphone", 14 | "subtype" : "retina4", 15 | "filename" : "iPhone Portrait iOS7 R4.png", 16 | "minimum-system-version" : "7.0", 17 | "orientation" : "portrait", 18 | "scale" : "2x" 19 | }, 20 | { 21 | "orientation" : "portrait", 22 | "idiom" : "ipad", 23 | "extent" : "full-screen", 24 | "minimum-system-version" : "7.0", 25 | "filename" : "iPad Portrait iOS7.png", 26 | "scale" : "1x" 27 | }, 28 | { 29 | "orientation" : "landscape", 30 | "idiom" : "ipad", 31 | "extent" : "full-screen", 32 | "minimum-system-version" : "7.0", 33 | "filename" : "iPad Landscape iOS7.png", 34 | "scale" : "1x" 35 | }, 36 | { 37 | "orientation" : "portrait", 38 | "idiom" : "ipad", 39 | "extent" : "full-screen", 40 | "minimum-system-version" : "7.0", 41 | "filename" : "iPad Portrait iOS7@2x.png", 42 | "scale" : "2x" 43 | }, 44 | { 45 | "orientation" : "landscape", 46 | "idiom" : "ipad", 47 | "extent" : "full-screen", 48 | "minimum-system-version" : "7.0", 49 | "filename" : "iPad Landscape iOS7@2x.png", 50 | "scale" : "2x" 51 | }, 52 | { 53 | "orientation" : "portrait", 54 | "idiom" : "ipad", 55 | "extent" : "to-status-bar", 56 | "filename" : "iPad Portrait iOS6 no status bar.png", 57 | "scale" : "1x" 58 | }, 59 | { 60 | "orientation" : "landscape", 61 | "idiom" : "ipad", 62 | "extent" : "to-status-bar", 63 | "filename" : "iPad Landscape iOS6 no status bar.png", 64 | "scale" : "1x" 65 | }, 66 | { 67 | "orientation" : "portrait", 68 | "idiom" : "ipad", 69 | "extent" : "to-status-bar", 70 | "filename" : "iPad Portrait iOS6 no status bar@2x.png", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "orientation" : "landscape", 75 | "idiom" : "ipad", 76 | "extent" : "to-status-bar", 77 | "filename" : "iPad Landscape iOS6 no status bar@2x-1.png", 78 | "scale" : "2x" 79 | } 80 | ], 81 | "info" : { 82 | "version" : 1, 83 | "author" : "xcode" 84 | } 85 | } -------------------------------------------------------------------------------- /BakerView/lib/GTMNSString+HTML.h: -------------------------------------------------------------------------------- 1 | // 2 | // GTMNSString+HTML.h 3 | // Dealing with NSStrings that contain HTML 4 | // 5 | // Copyright 2006-2008 Google Inc. 6 | // 7 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 8 | // use this file except in compliance with the License. You may obtain a copy 9 | // of the License at 10 | // 11 | // http://www.apache.org/licenses/LICENSE-2.0 12 | // 13 | // Unless required by applicable law or agreed to in writing, software 14 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 15 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 16 | // License for the specific language governing permissions and limitations under 17 | // the License. 18 | // 19 | 20 | #import 21 | 22 | /// Utilities for NSStrings containing HTML 23 | @interface NSString (GTMNSStringHTMLAdditions) 24 | 25 | /// Get a string where internal characters that need escaping for HTML are escaped 26 | // 27 | /// For example, '&' become '&'. This will only cover characters from table 28 | /// A.2.2 of http://www.w3.org/TR/xhtml1/dtds.html#a_dtd_Special_characters 29 | /// which is what you want for a unicode encoded webpage. If you have a ascii 30 | /// or non-encoded webpage, please use stringByEscapingAsciiHTML which will 31 | /// encode all characters. 32 | /// 33 | /// For obvious reasons this call is only safe once. 34 | // 35 | // Returns: 36 | // Autoreleased NSString 37 | // 38 | - (NSString *)gtm_stringByEscapingForHTML; 39 | 40 | /// Get a string where internal characters that need escaping for HTML are escaped 41 | // 42 | /// For example, '&' become '&' 43 | /// All non-mapped characters (unicode that don't have a &keyword; mapping) 44 | /// will be converted to the appropriate &#xxx; value. If your webpage is 45 | /// unicode encoded (UTF16 or UTF8) use stringByEscapingHTML instead as it is 46 | /// faster, and produces less bloated and more readable HTML (as long as you 47 | /// are using a unicode compliant HTML reader). 48 | /// 49 | /// For obvious reasons this call is only safe once. 50 | // 51 | // Returns: 52 | // Autoreleased NSString 53 | // 54 | - (NSString *)gtm_stringByEscapingForAsciiHTML; 55 | 56 | /// Get a string where internal characters that are escaped for HTML are unescaped 57 | // 58 | /// For example, '&' becomes '&' 59 | /// Handles and 2 cases as well 60 | /// 61 | // Returns: 62 | // Autoreleased NSString 63 | // 64 | - (NSString *)gtm_stringByUnescapingFromHTML; 65 | 66 | @end 67 | -------------------------------------------------------------------------------- /BakerView/InterceptorWindow.m: -------------------------------------------------------------------------------- 1 | // 2 | // InterceptorWindow.m 3 | // Baker 4 | // 5 | // ========================================================================================== 6 | // 7 | // Copyright (c) 2010-2013, Davide Casali, Marco Colombo, Alessandro Morandi 8 | // All rights reserved. 9 | // 10 | // Redistribution and use in source and binary forms, with or without modification, are 11 | // permitted provided that the following conditions are met: 12 | // 13 | // Redistributions of source code must retain the above copyright notice, this list of 14 | // conditions and the following disclaimer. 15 | // Redistributions in binary form must reproduce the above copyright notice, this list of 16 | // conditions and the following disclaimer in the documentation and/or other materials 17 | // provided with the distribution. 18 | // Neither the name of the Baker Framework nor the names of its contributors may be used to 19 | // endorse or promote products derived from this software without specific prior written 20 | // permission. 21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 22 | // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 23 | // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 24 | // SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 25 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 26 | // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28 | // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | // 31 | 32 | #import "InterceptorWindow.h" 33 | 34 | @implementation InterceptorWindow 35 | 36 | #pragma mark - Events management 37 | 38 | - (void)sendEvent:(UIEvent *)event { 39 | 40 | [super sendEvent:event]; 41 | [self interceptEvent:event]; 42 | } 43 | - (void)interceptEvent:(UIEvent *)event { 44 | 45 | if (event.type == UIEventTypeTouches) 46 | { 47 | NSSet *touches = [event allTouches]; 48 | if (touches.count == 1) 49 | { 50 | UITouch *touch = touches.anyObject; 51 | 52 | NSDictionary *userInfo = [NSDictionary dictionaryWithObjectsAndKeys:touch, @"touch", nil]; 53 | [[NSNotificationCenter defaultCenter] postNotificationName:@"notification_touch_intercepted" object:nil userInfo:userInfo]; 54 | } 55 | } 56 | } 57 | 58 | @end 59 | -------------------------------------------------------------------------------- /books/a-study-in-scarlet/js/blood.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Baker Ebook Framework - Basic Book 3 | * last update: 2011-07-18 4 | * 5 | * Copyright (C) 2011 by Davide S. Casali 6 | * 7 | * 8 | * Usage: 9 | * Define the CSS for 'blood-drop'. 10 | * Init with the position of the dripping point: 11 | * 12 | * Blood.init(x, y, timeInterval); 13 | * 14 | */ 15 | 16 | var Blood = { 17 | 18 | sprite: null, 19 | init: { x: 0, y: 0 }, 20 | loopCreate: null, 21 | loop: null, 22 | documentHeight: 0, 23 | accelerometer: { x: 0, y: 0, oldX: null, oldY: null }, 24 | accelerometerSensitivity: 100, 25 | 26 | init: function(x, y, time) { 27 | this.sprite = document.createElement('div'); 28 | this.sprite.setAttribute('class', 'blood-drop'); 29 | this.sprite.style.position = "absolute"; 30 | 31 | // Position 32 | this.init.x = x; 33 | this.init.y = y; 34 | this.positionToCSS(this.init.x, this.init.y, this.sprite); 35 | 36 | // Wait and attach 37 | var self = this; 38 | document.addEventListener("DOMContentLoaded", function() { 39 | self.documentHeight = document.body.offsetHeight; 40 | document.body.appendChild(self.sprite); 41 | }, false); 42 | window.addEventListener("devicemotion", function(e) { 43 | // Process event.acceleration, event.accelerationIncludingGravity, 44 | // event.rotationRate and event.interval 45 | self.accelerometer.x = parseInt(e.accelerationIncludingGravity.x * self.accelerometerSensitivity); 46 | self.accelerometer.y = parseInt(-e.accelerationIncludingGravity.y * self.accelerometerSensitivity); 47 | if (oldX != null && self.accelerometer.x != self.accelerometer.oldX && self.accelerometer.y != self.accelerometer.oldY) { 48 | self.drop(); 49 | } 50 | self.accelerometer.oldX = self.accelerometer.x; 51 | self.accelerometer.oldY = self.accelerometer.y; 52 | }, false); 53 | 54 | if (this.loop) clearTimeout(this.loop); // wrong position 55 | this.loopCreate = setInterval("Blood.drop()", time); 56 | }, 57 | 58 | positionToCSS: function(x, y, sprite) { 59 | if (x >= 0) sprite.style.top = x + "px"; 60 | else sprite.style.bottom = -x + "px"; 61 | if (y >= 0) sprite.style.left = y + "px"; 62 | else sprite.style.right = -y + "px"; 63 | }, 64 | 65 | drop: function() { 66 | if ((this.sprite.offsetTop + this.sprite.offsetHeight) < this.documentHeight) { 67 | this.sprite.style.top = (parseInt(this.sprite.style.top) * 1.038) + "px"; 68 | this.loop = setTimeout("Blood.drop()", 1); 69 | } else { 70 | this.positionToCSS(this.init.x, this.init.y, this.sprite); 71 | } 72 | } 73 | } -------------------------------------------------------------------------------- /BakerShelf/BakerAPI.h: -------------------------------------------------------------------------------- 1 | // 2 | // BakerAPI.h 3 | // Baker 4 | // 5 | // ========================================================================================== 6 | // 7 | // Copyright (c) 2010-2013, Davide Casali, Marco Colombo, Alessandro Morandi 8 | // All rights reserved. 9 | // 10 | // Redistribution and use in source and binary forms, with or without modification, are 11 | // permitted provided that the following conditions are met: 12 | // 13 | // Redistributions of source code must retain the above copyright notice, this list of 14 | // conditions and the following disclaimer. 15 | // Redistributions in binary form must reproduce the above copyright notice, this list of 16 | // conditions and the following disclaimer in the documentation and/or other materials 17 | // provided with the distribution. 18 | // Neither the name of the Baker Framework nor the names of its contributors may be used to 19 | // endorse or promote products derived from this software without specific prior written 20 | // permission. 21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 22 | // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 23 | // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 24 | // SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 25 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 26 | // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28 | // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | // 31 | 32 | #import 33 | 34 | @interface BakerAPI : NSObject 35 | 36 | #pragma mark - Singleton 37 | 38 | + (BakerAPI *)sharedInstance; 39 | 40 | #pragma mark - Shelf 41 | 42 | - (BOOL)canGetShelfJSON; 43 | - (void)getShelfJSON:(void (^)(NSData*)) callback ; 44 | 45 | #pragma mark - Purchases 46 | 47 | - (BOOL)canGetPurchasesJSON; 48 | - (void)getPurchasesJSON:(void (^)(NSData*)) callback ; 49 | 50 | - (BOOL)canPostPurchaseReceipt; 51 | - (BOOL)postPurchaseReceipt:(NSString *)receipt ofType:(NSString *)type; 52 | 53 | #pragma mark - APNS 54 | 55 | - (BOOL)canPostAPNSToken; 56 | - (BOOL)postAPNSToken:(NSString *)apnsToken; 57 | 58 | #pragma mark - User ID 59 | 60 | + (BOOL)generateUUIDOnce; 61 | + (NSString *)UUID; 62 | 63 | #pragma mark - Helpers 64 | 65 | - (NSURLRequest *)requestForURL:(NSURL *)url method:(NSString *)method; 66 | - (NSURLRequest *)requestForURL:(NSURL *)url parameters:(NSDictionary *)parameters method:(NSString *)method cachePolicy:(NSURLRequestCachePolicy)cachePolicy; 67 | 68 | @end 69 | -------------------------------------------------------------------------------- /BakerView/BakerBookStatus.m: -------------------------------------------------------------------------------- 1 | // 2 | // BakerBookStatus.m 3 | // Baker 4 | // 5 | // ========================================================================================== 6 | // 7 | // Copyright (c) 2010-2013, Davide Casali, Marco Colombo, Alessandro Morandi 8 | // All rights reserved. 9 | // 10 | // Redistribution and use in source and binary forms, with or without modification, are 11 | // permitted provided that the following conditions are met: 12 | // 13 | // Redistributions of source code must retain the above copyright notice, this list of 14 | // conditions and the following disclaimer. 15 | // Redistributions in binary form must reproduce the above copyright notice, this list of 16 | // conditions and the following disclaimer in the documentation and/or other materials 17 | // provided with the distribution. 18 | // Neither the name of the Baker Framework nor the names of its contributors may be used to 19 | // endorse or promote products derived from this software without specific prior written 20 | // permission. 21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 22 | // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 23 | // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 24 | // SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 25 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 26 | // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28 | // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | // 31 | 32 | #import "BakerBookStatus.h" 33 | 34 | @implementation BakerBookStatus 35 | 36 | @synthesize page; 37 | @synthesize scrollIndex; 38 | 39 | - (id)initWithBookId:(NSString *)bookId { 40 | NSString *cachePath = [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) objectAtIndex:0]; 41 | NSString *statusPath = [[[cachePath stringByAppendingPathComponent:@"statuses"] stringByAppendingPathComponent:bookId] stringByAppendingPathExtension:@"json"]; 42 | 43 | return [super initWithJSONPath:statusPath]; 44 | } 45 | 46 | - (NSDictionary *)load { 47 | NSDictionary *jsonDict = [super load]; 48 | 49 | self.page = [jsonDict objectForKey:@"page"]; 50 | self.scrollIndex = [jsonDict objectForKey:@"scroll-index"]; 51 | 52 | return jsonDict; 53 | } 54 | 55 | - (void)save { 56 | NSDictionary *jsonDict = [NSDictionary dictionaryWithObjectsAndKeys:page, @"page", scrollIndex, @"scroll-index", nil]; 57 | 58 | [super save:jsonDict]; 59 | } 60 | 61 | - (void)dealloc { 62 | [page release]; 63 | [scrollIndex release]; 64 | 65 | [super dealloc]; 66 | } 67 | 68 | @end 69 | -------------------------------------------------------------------------------- /BakerView/ModalViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ModalViewController.h 3 | // Baker 4 | // 5 | // ========================================================================================== 6 | // 7 | // Copyright (c) 2010-2013, Davide Casali, Marco Colombo, Alessandro Morandi 8 | // All rights reserved. 9 | // 10 | // Redistribution and use in source and binary forms, with or without modification, are 11 | // permitted provided that the following conditions are met: 12 | // 13 | // Redistributions of source code must retain the above copyright notice, this list of 14 | // conditions and the following disclaimer. 15 | // Redistributions in binary form must reproduce the above copyright notice, this list of 16 | // conditions and the following disclaimer in the documentation and/or other materials 17 | // provided with the distribution. 18 | // Neither the name of the Baker Framework nor the names of its contributors may be used to 19 | // endorse or promote products derived from this software without specific prior written 20 | // permission. 21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 22 | // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 23 | // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 24 | // SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 25 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 26 | // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28 | // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | // 31 | 32 | #import 33 | 34 | @protocol modalWebViewDelegate; 35 | 36 | @interface ModalViewController : UIViewController 37 | { 38 | id delegate; 39 | NSURL *myUrl; 40 | } 41 | 42 | @property (assign, nonatomic) id delegate; 43 | @property (strong, nonatomic) UIWebView *webView; 44 | @property (strong, nonatomic) UIToolbar *toolbar; 45 | @property (strong, nonatomic) UIBarButtonItem *btnGoBack; 46 | @property (strong, nonatomic) UIBarButtonItem *btnGoForward; 47 | @property (strong, nonatomic) UIBarButtonItem *btnReload; 48 | @property (strong, nonatomic) UIActivityIndicatorView *spinner; 49 | 50 | - (id)initWithUrl:(NSURL *)url; 51 | - (void)dismissAction; 52 | - (void)goBack; 53 | - (void)goForward; 54 | - (void)reloadPage; 55 | - (void)openInSafari; 56 | 57 | @end 58 | 59 | @protocol modalWebViewDelegate 60 | 61 | - (void)closeModalWebView; 62 | - (void)webView:(UIWebView *)webView setCorrectOrientation:(UIInterfaceOrientation)interfaceOrientation; 63 | - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation; 64 | 65 | @end -------------------------------------------------------------------------------- /BakerShelf/UICustomNavigationController.m: -------------------------------------------------------------------------------- 1 | // 2 | // UICustomNavigationController.m 3 | // Baker 4 | // 5 | // ========================================================================================== 6 | // 7 | // Copyright (c) 2010-2013, Davide Casali, Marco Colombo, Alessandro Morandi 8 | // All rights reserved. 9 | // 10 | // Redistribution and use in source and binary forms, with or without modification, are 11 | // permitted provided that the following conditions are met: 12 | // 13 | // Redistributions of source code must retain the above copyright notice, this list of 14 | // conditions and the following disclaimer. 15 | // Redistributions in binary form must reproduce the above copyright notice, this list of 16 | // conditions and the following disclaimer in the documentation and/or other materials 17 | // provided with the distribution. 18 | // Neither the name of the Baker Framework nor the names of its contributors may be used to 19 | // endorse or promote products derived from this software without specific prior written 20 | // permission. 21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 22 | // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 23 | // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 24 | // SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 25 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 26 | // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28 | // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | // 31 | 32 | #import "UICustomNavigationController.h" 33 | #import "UICustomNavigationBar.h" 34 | 35 | @implementation UICustomNavigationController 36 | 37 | - (id)init 38 | { 39 | self = [super init]; 40 | return [[self updateNavigationBar] retain]; 41 | } 42 | - (id)updateNavigationBar 43 | { 44 | [self navigationBar]; 45 | 46 | NSMutableData *data = [NSMutableData data]; 47 | 48 | NSKeyedArchiver *archiver = [[NSKeyedArchiver alloc] initForWritingWithMutableData:data]; 49 | [archiver encodeObject:self forKey:@"self"]; 50 | [archiver finishEncoding]; 51 | [archiver release]; 52 | 53 | NSKeyedUnarchiver *unarchiver = [[NSKeyedUnarchiver alloc] initForReadingWithData:data]; 54 | [unarchiver setClass:[UICustomNavigationBar class] forClassName:@"UINavigationBar"]; 55 | self = [unarchiver decodeObjectForKey:@"self"]; 56 | [unarchiver finishDecoding]; 57 | [unarchiver release]; 58 | 59 | return self; 60 | } 61 | - (NSUInteger)supportedInterfaceOrientations 62 | { 63 | return [self.topViewController supportedInterfaceOrientations]; 64 | } 65 | - (BOOL)shouldAutorotate 66 | { 67 | return [self.topViewController shouldAutorotate]; 68 | } 69 | 70 | @end -------------------------------------------------------------------------------- /BakerShelf/lib/NSString+Extensions.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSString+Extensions.m 3 | // Baker 4 | // 5 | // ========================================================================================== 6 | // 7 | // Copyright (c) 2010-2013, Davide Casali, Marco Colombo, Alessandro Morandi 8 | // All rights reserved. 9 | // 10 | // Redistribution and use in source and binary forms, with or without modification, are 11 | // permitted provided that the following conditions are met: 12 | // 13 | // Redistributions of source code must retain the above copyright notice, this list of 14 | // conditions and the following disclaimer. 15 | // Redistributions in binary form must reproduce the above copyright notice, this list of 16 | // conditions and the following disclaimer in the documentation and/or other materials 17 | // provided with the distribution. 18 | // Neither the name of the Baker Framework nor the names of its contributors may be used to 19 | // endorse or promote products derived from this software without specific prior written 20 | // permission. 21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 22 | // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 23 | // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 24 | // SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 25 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 26 | // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28 | // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | // 31 | 32 | #import 33 | #import "NSString+Extensions.h" 34 | 35 | @implementation NSString (Extensions) 36 | 37 | #pragma mark - SHA management 38 | 39 | - (NSString *)stringSHAEncoded 40 | { 41 | const char *src = [self UTF8String]; 42 | unsigned char result[CC_SHA1_DIGEST_LENGTH]; 43 | 44 | CC_SHA1(src, strlen(src), result); 45 | NSMutableString *sha = [NSMutableString stringWithCapacity:CC_SHA1_DIGEST_LENGTH * 2]; 46 | 47 | for (int i = 0; i < 8; i++) { 48 | if (result[i]) [sha appendFormat:@"%02X", result[i]]; 49 | } 50 | 51 | return sha; 52 | } 53 | + (NSString *)encodeSHAString:(NSString *)str 54 | { 55 | return [str stringSHAEncoded]; 56 | } 57 | + (NSString *)stringFromInterfaceOrientation:(UIInterfaceOrientation)orientation 58 | { 59 | switch (orientation) { 60 | case UIInterfaceOrientationPortrait: return @"UIInterfaceOrientationPortrait"; 61 | case UIInterfaceOrientationPortraitUpsideDown: return @"UIInterfaceOrientationPortraitUpsideDown"; 62 | case UIInterfaceOrientationLandscapeLeft: return @"UIInterfaceOrientationLandscapeLeft"; 63 | case UIInterfaceOrientationLandscapeRight: return @"UIInterfaceOrientationLandscapeRight"; 64 | } 65 | return nil; 66 | } 67 | 68 | @end 69 | -------------------------------------------------------------------------------- /BakerShelf/ShelfStatus.m: -------------------------------------------------------------------------------- 1 | // 2 | // ShelfStatus.m 3 | // Baker 4 | // 5 | // ========================================================================================== 6 | // 7 | // Copyright (c) 2010-2013, Davide Casali, Marco Colombo, Alessandro Morandi 8 | // All rights reserved. 9 | // 10 | // Redistribution and use in source and binary forms, with or without modification, are 11 | // permitted provided that the following conditions are met: 12 | // 13 | // Redistributions of source code must retain the above copyright notice, this list of 14 | // conditions and the following disclaimer. 15 | // Redistributions in binary form must reproduce the above copyright notice, this list of 16 | // conditions and the following disclaimer in the documentation and/or other materials 17 | // provided with the distribution. 18 | // Neither the name of the Baker Framework nor the names of its contributors may be used to 19 | // endorse or promote products derived from this software without specific prior written 20 | // permission. 21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 22 | // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 23 | // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 24 | // SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 25 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 26 | // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28 | // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | // 31 | 32 | #import "ShelfStatus.h" 33 | 34 | @implementation ShelfStatus 35 | 36 | @synthesize prices; 37 | 38 | - (id)init { 39 | NSString *cachePath = [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) objectAtIndex:0]; 40 | NSString *statusPath = [[cachePath stringByAppendingPathComponent:@"shelf-status"] stringByAppendingPathExtension:@"json"]; 41 | 42 | self = [super initWithJSONPath:statusPath]; 43 | if (self) { 44 | self.prices = [[[NSMutableDictionary alloc] init] autorelease]; 45 | } 46 | return self; 47 | } 48 | 49 | - (NSDictionary *)load { 50 | NSDictionary *jsonDict = [super load]; 51 | 52 | NSDictionary *jsonPrices = [jsonDict objectForKey:@"prices"]; 53 | [jsonPrices enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) { 54 | [self setPrice:obj for:key]; 55 | }]; 56 | 57 | return jsonDict; 58 | } 59 | 60 | - (void)save { 61 | NSDictionary *jsonDict = [NSDictionary dictionaryWithObjectsAndKeys:prices, @"prices", nil]; 62 | 63 | [super save:jsonDict]; 64 | } 65 | 66 | - (NSString *)priceFor:(NSString *)productID { 67 | return [prices objectForKey:productID]; 68 | } 69 | 70 | - (void)setPrice:(NSString *)price for:(NSString *)productID { 71 | [prices setObject:price forKey:productID]; 72 | } 73 | 74 | - (void)dealloc { 75 | [prices release]; 76 | 77 | [super dealloc]; 78 | } 79 | 80 | @end 81 | -------------------------------------------------------------------------------- /BakerShelf/lib/NSMutableURLRequest+WebServiceClient.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSMutableURLRequest+WebServiceClient.m 3 | // Baker 4 | // See: http://stackoverflow.com/a/1289735/551557 5 | // 6 | // ========================================================================================== 7 | // 8 | // Copyright (c) 2010-2013, Davide Casali, Marco Colombo, Alessandro Morandi 9 | // All rights reserved. 10 | // 11 | // Redistribution and use in source and binary forms, with or without modification, are 12 | // permitted provided that the following conditions are met: 13 | // 14 | // Redistributions of source code must retain the above copyright notice, this list of 15 | // conditions and the following disclaimer. 16 | // Redistributions in binary form must reproduce the above copyright notice, this list of 17 | // conditions and the following disclaimer in the documentation and/or other materials 18 | // provided with the distribution. 19 | // Neither the name of the Baker Framework nor the names of its contributors may be used to 20 | // endorse or promote products derived from this software without specific prior written 21 | // permission. 22 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 23 | // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 24 | // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 25 | // SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 26 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 27 | // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 | // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | // 32 | 33 | #import "NSMutableURLRequest+WebServiceClient.h" 34 | 35 | @implementation NSMutableURLRequest (WebServiceClient) 36 | 37 | + (NSString *) encodeFormPostParameters: (NSDictionary *) parameters { 38 | NSMutableString *formPostParams = [[[NSMutableString alloc] init] autorelease]; 39 | 40 | NSEnumerator *keys = [parameters keyEnumerator]; 41 | 42 | NSString *name = [keys nextObject]; 43 | while (nil != name) { 44 | NSString *encodedValue = [((NSString *) CFURLCreateStringByAddingPercentEscapes(NULL, (CFStringRef) [parameters objectForKey: name], NULL, CFSTR("=/:"), kCFStringEncodingUTF8)) autorelease]; 45 | 46 | [formPostParams appendString: name]; 47 | [formPostParams appendString: @"="]; 48 | [formPostParams appendString: encodedValue]; 49 | 50 | name = [keys nextObject]; 51 | 52 | if (nil != name) { 53 | [formPostParams appendString: @"&"]; 54 | } 55 | } 56 | 57 | return formPostParams; 58 | } 59 | 60 | - (void) setFormPostParameters: (NSDictionary *) parameters { 61 | NSString *formPostParams = [NSMutableURLRequest encodeFormPostParameters: parameters]; 62 | 63 | [self setHTTPBody: [formPostParams dataUsingEncoding: NSUTF8StringEncoding]]; 64 | [self setValue: @"application/x-www-form-urlencoded; charset=utf-8" forHTTPHeaderField: @"Content-Type"]; 65 | } 66 | 67 | @end 68 | -------------------------------------------------------------------------------- /BakerView/IndexViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // IndexViewController.h 3 | // Baker 4 | // 5 | // ========================================================================================== 6 | // 7 | // Copyright (c) 2010-2013, Davide Casali, Marco Colombo, Alessandro Morandi 8 | // All rights reserved. 9 | // 10 | // Redistribution and use in source and binary forms, with or without modification, are 11 | // permitted provided that the following conditions are met: 12 | // 13 | // Redistributions of source code must retain the above copyright notice, this list of 14 | // conditions and the following disclaimer. 15 | // Redistributions in binary form must reproduce the above copyright notice, this list of 16 | // conditions and the following disclaimer in the documentation and/or other materials 17 | // provided with the distribution. 18 | // Neither the name of the Baker Framework nor the names of its contributors may be used to 19 | // endorse or promote products derived from this software without specific prior written 20 | // permission. 21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 22 | // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 23 | // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 24 | // SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 25 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 26 | // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28 | // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | // 31 | 32 | #import 33 | #import "BakerBook.h" 34 | 35 | @interface IndexViewController : UIViewController { 36 | 37 | NSString *fileName; 38 | UIScrollView *indexScrollView; 39 | UIViewController *webViewDelegate; 40 | 41 | int pageY; 42 | int pageWidth; 43 | int pageHeight; 44 | int indexWidth; 45 | int indexHeight; 46 | int actualIndexWidth; 47 | int actualIndexHeight; 48 | 49 | BOOL disabled; 50 | BOOL loadedFromBundle; 51 | 52 | CGSize cachedContentSize; 53 | } 54 | 55 | @property (strong, nonatomic) BakerBook *book; 56 | 57 | - (id)initWithBook:(BakerBook *)bakerBook fileName:(NSString *)name webViewDelegate:(UIViewController *)delegate; 58 | - (void)loadContent; 59 | - (void)setBounceForWebView:(UIWebView *)webView bounces:(BOOL)bounces; 60 | - (void)setPageSizeForOrientation:(UIInterfaceOrientation)orientation; 61 | - (BOOL)isIndexViewHidden; 62 | - (BOOL)isDisabled; 63 | - (void)setIndexViewHidden:(BOOL)hidden withAnimation:(BOOL)animation; 64 | - (void)willRotate; 65 | - (void)rotateFromOrientation:(UIInterfaceOrientation)fromInterfaceOrientation toOrientation:(UIInterfaceOrientation)toInterfaceOrientation; 66 | - (void)fadeOut; 67 | - (void)fadeIn; 68 | - (BOOL)stickToLeft; 69 | - (CGSize)sizeFromContentOf:(UIView *)view; 70 | - (void)setActualSize; 71 | - (void)adjustIndexView; 72 | - (void)setViewFrame:(CGRect)frame; 73 | - (NSString *)indexPath; 74 | 75 | @end 76 | -------------------------------------------------------------------------------- /BakerShelf/UIConstants.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIConstants.h 3 | // Baker 4 | // 5 | // ========================================================================================== 6 | // 7 | // Copyright (c) 2010-2013, Davide Casali, Marco Colombo, Alessandro Morandi 8 | // All rights reserved. 9 | // 10 | // Redistribution and use in source and binary forms, with or without modification, are 11 | // permitted provided that the following conditions are met: 12 | // 13 | // Redistributions of source code must retain the above copyright notice, this list of 14 | // conditions and the following disclaimer. 15 | // Redistributions in binary form must reproduce the above copyright notice, this list of 16 | // conditions and the following disclaimer in the documentation and/or other materials 17 | // provided with the distribution. 18 | // Neither the name of the Baker Framework nor the names of its contributors may be used to 19 | // endorse or promote products derived from this software without specific prior written 20 | // permission. 21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 22 | // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 23 | // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 24 | // SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 25 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 26 | // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28 | // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | // 31 | 32 | 33 | #ifndef Baker_UIConstants_h 34 | #define Baker_UIConstants_h 35 | 36 | // Background color for issues cover (before downloading the actual cover) 37 | #define ISSUES_COVER_BACKGROUND_COLOR @"#ffffff" 38 | 39 | // Title for issues in the shelf 40 | // #define ISSUES_TITLE_FONT @"Helvetica" 41 | // #define ISSUES_TITLE_FONT_SIZE 15 42 | #define ISSUES_TITLE_COLOR @"#000000" 43 | 44 | // Info text for issues in the shelf 45 | // #define ISSUES_INFO_FONT @"Helvetica" 46 | // #define ISSUES_INFO_FONT_SIZE 15 47 | #define ISSUES_INFO_COLOR @"#929292" 48 | 49 | #define ISSUES_PRICE_COLOR @"#b72529" 50 | 51 | // Download/read button for issues in the shelf 52 | // #define ISSUES_ACTION_BUTTON_FONT @"Helvetica-Bold" 53 | // #define ISSUES_ACTION_BUTTON_FONT_SIZE 11 54 | #define ISSUES_ACTION_BUTTON_BACKGROUND_COLOR @"#b72529" 55 | #define ISSUES_ACTION_BUTTON_COLOR @"#ffffff" 56 | 57 | // Archive button for issues in the shelf 58 | // #define ISSUES_ARCHIVE_BUTTON_FONT @"Helvetica-Bold" 59 | // #define ISSUES_ARCHIVE_BUTTON_FONT_SIZE 11 60 | #define ISSUES_ARCHIVE_BUTTON_COLOR @"#b72529" 61 | #define ISSUES_ARCHIVE_BUTTON_BACKGROUND_COLOR @"#ffffff" 62 | 63 | // Text and spinner for issues that are being loaded in the shelf 64 | #define ISSUES_LOADING_LABEL_COLOR @"#b72529" 65 | #define ISSUES_LOADING_SPINNER_COLOR @"#929292" 66 | 67 | // Progress bar for issues that are being downloaded in the shelf 68 | #define ISSUES_PROGRESSBAR_TINT_COLOR @"#b72529" 69 | 70 | #endif 71 | -------------------------------------------------------------------------------- /BakerView/lib/Utils.h: -------------------------------------------------------------------------------- 1 | // 2 | // Utils.h 3 | // Baker 4 | // 5 | // ========================================================================================== 6 | // 7 | // Copyright (c) 2010-2013, Davide Casali, Marco Colombo, Alessandro Morandi 8 | // All rights reserved. 9 | // 10 | // Redistribution and use in source and binary forms, with or without modification, are 11 | // permitted provided that the following conditions are met: 12 | // 13 | // Redistributions of source code must retain the above copyright notice, this list of 14 | // conditions and the following disclaimer. 15 | // Redistributions in binary form must reproduce the above copyright notice, this list of 16 | // conditions and the following disclaimer in the documentation and/or other materials 17 | // provided with the distribution. 18 | // Neither the name of the Baker Framework nor the names of its contributors may be used to 19 | // endorse or promote products derived from this software without specific prior written 20 | // permission. 21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 22 | // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 23 | // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 24 | // SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 25 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 26 | // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28 | // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | // 31 | 32 | #import 33 | #import "BakerBook.h" 34 | 35 | // IOS VERSION COMPARISON MACROS 36 | #define SYSTEM_VERSION_EQUAL_TO(version) ([[[UIDevice currentDevice] systemVersion] compare:version options:NSNumericSearch] == NSOrderedSame) 37 | #define SYSTEM_VERSION_GREATER_THAN(version) ([[[UIDevice currentDevice] systemVersion] compare:version options:NSNumericSearch] == NSOrderedDescending) 38 | #define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(version) ([[[UIDevice currentDevice] systemVersion] compare:version options:NSNumericSearch] != NSOrderedAscending) 39 | #define SYSTEM_VERSION_LESS_THAN(version) ([[[UIDevice currentDevice] systemVersion] compare:version options:NSNumericSearch] == NSOrderedAscending) 40 | #define SYSTEM_VERSION_LESS_THAN_OR_EQUAL_TO(version) ([[[UIDevice currentDevice] systemVersion] compare:version options:NSNumericSearch] != NSOrderedDescending) 41 | 42 | @interface Utils : NSObject { 43 | 44 | } 45 | 46 | + (UIColor *)colorWithRGBHex:(UInt32)hex; 47 | + (UIColor *)colorWithHexString:(NSString *)stringToConvert; 48 | + (NSString *)stringFromInterfaceOrientation:(UIInterfaceOrientation)orientation; 49 | + (BOOL)webViewShouldBePaged:(UIWebView*)webView forBook:(BakerBook *)book; 50 | + (NSString *)appID; 51 | + (NSDate *)dateWithFormattedString:(NSString *)string; 52 | + (void)showAlertWithTitle:(NSString *)title message:(NSString *)message buttonTitle:(NSString *)buttonTitle; 53 | + (void)webView:(UIWebView *)webView dispatchHTMLEvent:(NSString *)event; 54 | + (void)webView:(UIWebView *)webView dispatchHTMLEvent:(NSString *)event withParams:(NSDictionary *)params; 55 | 56 | @end 57 | -------------------------------------------------------------------------------- /BakerShelf/PurchasesManager.h: -------------------------------------------------------------------------------- 1 | // 2 | // PurchasesManager.h 3 | // Baker 4 | // 5 | // ========================================================================================== 6 | // 7 | // Copyright (c) 2010-2013, Davide Casali, Marco Colombo, Alessandro Morandi 8 | // All rights reserved. 9 | // 10 | // Redistribution and use in source and binary forms, with or without modification, are 11 | // permitted provided that the following conditions are met: 12 | // 13 | // Redistributions of source code must retain the above copyright notice, this list of 14 | // conditions and the following disclaimer. 15 | // Redistributions in binary form must reproduce the above copyright notice, this list of 16 | // conditions and the following disclaimer in the documentation and/or other materials 17 | // provided with the distribution. 18 | // Neither the name of the Baker Framework nor the names of its contributors may be used to 19 | // endorse or promote products derived from this software without specific prior written 20 | // permission. 21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 22 | // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 23 | // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 24 | // SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 25 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 26 | // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28 | // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | // 31 | 32 | #import "Constants.h" 33 | #import 34 | #import 35 | 36 | #ifdef BAKER_NEWSSTAND 37 | @interface PurchasesManager : NSObject { 38 | NSMutableDictionary *_purchases; 39 | BOOL _enableProductRequestFailureNotifications; 40 | } 41 | 42 | @property (retain, nonatomic) NSMutableDictionary *products; 43 | @property (retain, nonatomic) NSNumberFormatter *numberFormatter; 44 | @property (nonatomic) BOOL subscribed; 45 | 46 | #pragma mark - Singleton 47 | 48 | + (PurchasesManager *)sharedInstance; 49 | 50 | #pragma mark - Purchased flag 51 | 52 | - (BOOL)isMarkedAsPurchased:(NSString *)productID; 53 | - (void)markAsPurchased:(NSString *)productID; 54 | 55 | #pragma mark - Prices 56 | 57 | - (void)retrievePricesFor:(NSSet *)productIDs; 58 | - (void)retrievePricesFor:(NSSet *)productIDs andEnableFailureNotifications:(BOOL)enable; 59 | 60 | - (void)retrievePriceFor:(NSString *)productID; 61 | - (void)retrievePriceFor:(NSString *)productID andEnableFailureNotification:(BOOL)enable; 62 | 63 | - (NSString *)priceFor:(NSString *)productID; 64 | 65 | #pragma mark - Purchases 66 | 67 | - (BOOL)purchase:(NSString *)productID; 68 | - (BOOL)finishTransaction:(SKPaymentTransaction *)transaction; 69 | - (void)restore; 70 | - (void)retrievePurchasesFor:(NSSet *)productIDs withCallback:(void (^)(NSDictionary*))callback; 71 | - (BOOL)isPurchased:(NSString *)productID; 72 | 73 | #pragma mark - Products 74 | 75 | - (SKProduct *)productFor:(NSString *)productID; 76 | 77 | #pragma mark - Subscriptions 78 | 79 | - (BOOL)hasSubscriptions; 80 | 81 | @end 82 | #endif 83 | -------------------------------------------------------------------------------- /books/a-study-in-scarlet/css/index.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Baker Ebook Framework - Basic Book 3 | * last update: 2011-10-10 4 | * 5 | * Copyright (C) 2011 by Davide S. Casali 6 | * 7 | */ 8 | 9 | 10 | 11 | /**************************************************************************************************** 12 | * General 13 | */ 14 | body { 15 | font-family: Helvetica, Arial, sans-serif; 16 | font-size: 16px; 17 | margin: 0; 18 | padding: 25px; 19 | background: rgba(240, 240, 240, 0.9); 20 | 21 | width: 2800px; 22 | } 23 | 24 | a { 25 | color: #b50303; 26 | } 27 | 28 | 29 | /**************************************************************************************************** 30 | * Typography 31 | */ 32 | p, ul, ol { 33 | font-size: 18px; 34 | line-height: 40px; 35 | } 36 | 37 | h1, h2, h3, h4, h5, h6 { 38 | font-family: "BodoniSvtyTwoITCTT-Book", Times, serif; 39 | font-weight: normal; 40 | text-align: center; 41 | 42 | border: 0; 43 | margin: 0; 44 | padding: 0; 45 | } 46 | 47 | /**************************************************************************************************** 48 | * Index 49 | */ 50 | #index .navigation h6, 51 | #index .navigation ol li a small { 52 | display: none; 53 | } 54 | 55 | #index .navigation ol { 56 | display: inline; 57 | padding: 0; 58 | margin-right: 60px; 59 | } 60 | 61 | #index .navigation h5 { 62 | background: #cf0000; 63 | color: #ffffff; 64 | display: inline-block; 65 | font-size: 20px; 66 | 67 | padding: 5px; 68 | width: 55px; 69 | height: 140px; 70 | } 71 | 72 | #index .navigation li { 73 | background: #ffffff url(../images/1-01-a.gif) -30px 0; 74 | display: inline-block; 75 | 76 | margin-left: 30px; 77 | overflow: hidden; 78 | position: relative; 79 | 80 | padding: 0; 81 | width: 150px; 82 | height: 150px; 83 | 84 | vertical-align: top; 85 | } 86 | 87 | #index .navigation li a { 88 | font-family: "BodoniSvtyTwoITCTT-Book", Times, serif; 89 | font-weight: normal; 90 | text-align: center; 91 | text-decoration: none; 92 | display: block; 93 | width: 150px; 94 | height: 150px; 95 | } 96 | 97 | #index .navigation li a h7 { 98 | background: rgba(255, 255, 255, 0.9); 99 | font-size: 30px; 100 | padding-top: 8px; 101 | 102 | position: absolute; 103 | bottom: 0; 104 | 105 | width: 100%; 106 | height: 47px; 107 | } 108 | 109 | 110 | /****** Images */ 111 | #index .navigation li.p1-01 { background: #ffffff url(../images/1-01-b.gif) -30px -72px; } 112 | #index .navigation li.p1-02 { background: #ffffff url(../images/1-02-a.gif) -30px -30px; } 113 | #index .navigation li.p1-03 { background: #ffffff url(../images/1-03-a.gif) -60px -180px; } 114 | #index .navigation li.p1-04 { background: #ffffff url(../images/1-04-a.gif) -20px -80px; } 115 | #index .navigation li.p1-05 { background: #ffffff url(../images/1-05-a.gif) -30px -60px; } 116 | #index .navigation li.p1-06 { background: #ffffff url(../images/1-06-a.gif) -60px -45px; } 117 | #index .navigation li.p1-07 { background: #ffffff url(../images/1-07-b.gif) -75px -40px; } 118 | 119 | #index .navigation li.p2-01 { background: #ffffff url(../images/2-01-a.gif) -30px 0; } 120 | #index .navigation li.p2-02 { background: #ffffff url(../images/2-02-b.gif) -30px -80px; } 121 | #index .navigation li.p2-03 { background: #ffffff url(../images/2-03-a.gif) -10px -60px; } 122 | #index .navigation li.p2-04 { background: #ffffff url(../images/2-04-b.gif) -40px -130px; } 123 | #index .navigation li.p2-05 { background: #ffffff url(../images/2-05-a.gif) -60px -80px; } 124 | #index .navigation li.p2-06 { background: #ffffff url(../images/2-06-a.gif) -70px -60px; } 125 | #index .navigation li.p2-07 { background: #ffffff url(../images/2-07-a.gif) -60px -80px; } 126 | 127 | 128 | 129 | 130 | -------------------------------------------------------------------------------- /BakerShelf/lib/Reachability.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2011, Tony Million. 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | 8 | 1. Redistributions of source code must retain the above copyright notice, this 9 | list of conditions and the following disclaimer. 10 | 11 | 2. Redistributions in binary form must reproduce the above copyright notice, 12 | this list of conditions and the following disclaimer in the documentation 13 | and/or other materials provided with the distribution. 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 19 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #import 29 | #import 30 | 31 | #import 32 | #import 33 | #import 34 | #import 35 | #import 36 | #import 37 | 38 | /** 39 | * Does ARC support support GCD objects? 40 | * It does if the minimum deployment target is iOS 6+ or Mac OS X 8+ 41 | * 42 | * @see http://opensource.apple.com/source/libdispatch/libdispatch-228.18/os/object.h 43 | **/ 44 | #if OS_OBJECT_USE_OBJC 45 | #define NEEDS_DISPATCH_RETAIN_RELEASE 0 46 | #else 47 | #define NEEDS_DISPATCH_RETAIN_RELEASE 1 48 | #endif 49 | 50 | 51 | extern NSString *const kReachabilityChangedNotification; 52 | 53 | typedef enum 54 | { 55 | // Apple NetworkStatus Compatible Names. 56 | NotReachable = 0, 57 | ReachableViaWiFi = 2, 58 | ReachableViaWWAN = 1 59 | } NetworkStatus; 60 | 61 | @class Reachability; 62 | 63 | typedef void (^NetworkReachable)(Reachability * reachability); 64 | typedef void (^NetworkUnreachable)(Reachability * reachability); 65 | 66 | @interface Reachability : NSObject 67 | 68 | @property (nonatomic, copy) NetworkReachable reachableBlock; 69 | @property (nonatomic, copy) NetworkUnreachable unreachableBlock; 70 | 71 | 72 | @property (nonatomic, assign) BOOL reachableOnWWAN; 73 | 74 | +(Reachability*)reachabilityWithHostname:(NSString*)hostname; 75 | +(Reachability*)reachabilityForInternetConnection; 76 | +(Reachability*)reachabilityWithAddress:(const struct sockaddr_in*)hostAddress; 77 | +(Reachability*)reachabilityForLocalWiFi; 78 | 79 | -(Reachability *)initWithReachabilityRef:(SCNetworkReachabilityRef)ref; 80 | 81 | -(BOOL)startNotifier; 82 | -(void)stopNotifier; 83 | 84 | -(BOOL)isReachable; 85 | -(BOOL)isReachableViaWWAN; 86 | -(BOOL)isReachableViaWiFi; 87 | 88 | // WWAN may be available, but not active until a connection has been established. 89 | // WiFi may require a connection for VPN on Demand. 90 | -(BOOL)isConnectionRequired; // Identical DDG variant. 91 | -(BOOL)connectionRequired; // Apple's routine. 92 | // Dynamic, on demand connection? 93 | -(BOOL)isConnectionOnDemand; 94 | // Is user intervention required? 95 | -(BOOL)isInterventionRequired; 96 | 97 | -(NetworkStatus)currentReachabilityStatus; 98 | -(SCNetworkReachabilityFlags)reachabilityFlags; 99 | -(NSString*)currentReachabilityString; 100 | -(NSString*)currentReachabilityFlags; 101 | 102 | @end 103 | -------------------------------------------------------------------------------- /BakerShelf/BakerIssue.h: -------------------------------------------------------------------------------- 1 | // 2 | // BakerIssue.h 3 | // Baker 4 | // 5 | // ========================================================================================== 6 | // 7 | // Copyright (c) 2010-2013, Davide Casali, Marco Colombo, Alessandro Morandi 8 | // All rights reserved. 9 | // 10 | // Redistribution and use in source and binary forms, with or without modification, are 11 | // permitted provided that the following conditions are met: 12 | // 13 | // Redistributions of source code must retain the above copyright notice, this list of 14 | // conditions and the following disclaimer. 15 | // Redistributions in binary form must reproduce the above copyright notice, this list of 16 | // conditions and the following disclaimer in the documentation and/or other materials 17 | // provided with the distribution. 18 | // Neither the name of the Baker Framework nor the names of its contributors may be used to 19 | // endorse or promote products derived from this software without specific prior written 20 | // permission. 21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 22 | // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 23 | // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 24 | // SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 25 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 26 | // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28 | // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | // 31 | 32 | #import "Constants.h" 33 | #import 34 | 35 | #ifdef BAKER_NEWSSTAND 36 | #import 37 | #import "PurchasesManager.h" 38 | #endif 39 | 40 | #import "BakerBook.h" 41 | 42 | typedef enum transientStates { 43 | BakerIssueTransientStatusNone, 44 | BakerIssueTransientStatusDownloading, 45 | BakerIssueTransientStatusOpening, 46 | BakerIssueTransientStatusPurchasing, 47 | BakerIssueTransientStatusUnpriced 48 | } BakerIssueTransientStatus; 49 | 50 | #ifdef BAKER_NEWSSTAND 51 | @interface BakerIssue : NSObject { 52 | PurchasesManager *purchasesManager; 53 | } 54 | #else 55 | @interface BakerIssue : NSObject 56 | #endif 57 | 58 | @property (copy, nonatomic) NSString *ID; 59 | @property (copy, nonatomic) NSString *title; 60 | @property (copy, nonatomic) NSString *info; 61 | @property (copy, nonatomic) NSString *date; 62 | @property (copy, nonatomic) NSURL *url; 63 | @property (copy, nonatomic) NSString *path; 64 | 65 | @property (copy, nonatomic) NSString *coverPath; 66 | @property (copy, nonatomic) NSURL *coverURL; 67 | 68 | @property (copy, nonatomic) NSString *productID; 69 | @property (copy, nonatomic) NSString *price; 70 | 71 | @property (retain, nonatomic) BakerBook *bakerBook; 72 | 73 | @property (assign, nonatomic) BakerIssueTransientStatus transientStatus; 74 | 75 | @property (copy, nonatomic) NSString *notificationDownloadStartedName; 76 | @property (copy, nonatomic) NSString *notificationDownloadProgressingName; 77 | @property (copy, nonatomic) NSString *notificationDownloadFinishedName; 78 | @property (copy, nonatomic) NSString *notificationDownloadErrorName; 79 | @property (copy, nonatomic) NSString *notificationUnzipErrorName; 80 | 81 | -(id)initWithBakerBook:(BakerBook *)bakerBook; 82 | -(void)getCoverWithCache:(bool)cache andBlock:(void(^)(UIImage *img))completionBlock; 83 | -(NSString *)getStatus; 84 | 85 | #ifdef BAKER_NEWSSTAND 86 | -(id)initWithIssueData:(NSDictionary *)issueData; 87 | -(void)download; 88 | -(void)downloadWithAsset:(NKAssetDownload *)asset; 89 | #endif 90 | 91 | @end 92 | -------------------------------------------------------------------------------- /BakerShelf/UICustomNavigationBar.m: -------------------------------------------------------------------------------- 1 | // 2 | // UICustomNavigationBar.m 3 | // Baker 4 | // 5 | // ========================================================================================== 6 | // 7 | // Copyright (c) 2010-2013, Davide Casali, Marco Colombo, Alessandro Morandi 8 | // All rights reserved. 9 | // 10 | // Redistribution and use in source and binary forms, with or without modification, are 11 | // permitted provided that the following conditions are met: 12 | // 13 | // Redistributions of source code must retain the above copyright notice, this list of 14 | // conditions and the following disclaimer. 15 | // Redistributions in binary form must reproduce the above copyright notice, this list of 16 | // conditions and the following disclaimer in the documentation and/or other materials 17 | // provided with the distribution. 18 | // Neither the name of the Baker Framework nor the names of its contributors may be used to 19 | // endorse or promote products derived from this software without specific prior written 20 | // permission. 21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 22 | // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 23 | // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 24 | // SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 25 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 26 | // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28 | // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | // 31 | 32 | #import "UICustomNavigationBar.h" 33 | 34 | @implementation UICustomNavigationBar 35 | 36 | - (void)dealloc 37 | { 38 | [backgroundImages release]; 39 | [backgroundImageView release]; 40 | 41 | [super dealloc]; 42 | } 43 | 44 | - (NSMutableDictionary *)backgroundImages 45 | { 46 | if (!backgroundImages) { 47 | backgroundImages = [[NSMutableDictionary alloc] init]; 48 | } 49 | return backgroundImages; 50 | } 51 | - (UIImageView *)backgroundImageView 52 | { 53 | if (!backgroundImageView) { 54 | backgroundImageView = [[UIImageView alloc] initWithFrame:[self bounds]]; 55 | [backgroundImageView setAutoresizingMask:UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight]; 56 | [self insertSubview:backgroundImageView atIndex:0]; 57 | } 58 | return backgroundImageView; 59 | } 60 | - (void)setBackgroundImage:(UIImage *)backgroundImage forBarMetrics:(UIBarMetrics)barMetrics 61 | { 62 | if ([UINavigationBar instancesRespondToSelector:@selector(setBackgroundImage:forBarMetrics:)]) { 63 | [super setBackgroundImage:backgroundImage forBarMetrics:barMetrics]; 64 | } else { 65 | [[self backgroundImages] setObject:backgroundImage forKey:[NSNumber numberWithInt:barMetrics]]; 66 | [self updateBackgroundImage]; 67 | } 68 | } 69 | - (void)updateBackgroundImage 70 | { 71 | UIBarMetrics metrics = UIBarMetricsLandscapePhone; 72 | if ([self bounds].size.height > 40) { 73 | metrics = UIBarMetricsDefault; 74 | } 75 | 76 | UIImage *image = [[self backgroundImages] objectForKey:[NSNumber numberWithInt:metrics]]; 77 | if (!image && metrics != UIBarMetricsDefault) { 78 | image = [[self backgroundImages] objectForKey:[NSNumber numberWithInt:UIBarMetricsDefault]]; 79 | } 80 | 81 | if (image) { 82 | [[self backgroundImageView] setImage:image]; 83 | } 84 | } 85 | 86 | - (void)layoutSubviews 87 | { 88 | [super layoutSubviews]; 89 | 90 | if (backgroundImageView) { 91 | [self updateBackgroundImage]; 92 | [self sendSubviewToBack:backgroundImageView]; 93 | } 94 | } 95 | 96 | @end 97 | -------------------------------------------------------------------------------- /BakerShelf/IssueViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // IssueViewController.h 3 | // Baker 4 | // 5 | // ========================================================================================== 6 | // 7 | // Copyright (c) 2010-2013, Davide Casali, Marco Colombo, Alessandro Morandi 8 | // All rights reserved. 9 | // 10 | // Redistribution and use in source and binary forms, with or without modification, are 11 | // permitted provided that the following conditions are met: 12 | // 13 | // Redistributions of source code must retain the above copyright notice, this list of 14 | // conditions and the following disclaimer. 15 | // Redistributions in binary form must reproduce the above copyright notice, this list of 16 | // conditions and the following disclaimer in the documentation and/or other materials 17 | // provided with the distribution. 18 | // Neither the name of the Baker Framework nor the names of its contributors may be used to 19 | // endorse or promote products derived from this software without specific prior written 20 | // permission. 21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 22 | // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 23 | // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 24 | // SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 25 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 26 | // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28 | // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | // 31 | 32 | #import 33 | #import "BakerIssue.h" 34 | #ifdef BAKER_NEWSSTAND 35 | #import "PurchasesManager.h" 36 | #endif 37 | 38 | @interface IssueViewController : UIViewController { 39 | NSString *currentAction; 40 | BOOL purchaseDelayed; 41 | #ifdef BAKER_NEWSSTAND 42 | PurchasesManager *purchasesManager; 43 | #endif 44 | } 45 | 46 | @property (strong, nonatomic) BakerIssue *issue; 47 | @property (strong, nonatomic) UIButton *actionButton; 48 | @property (strong, nonatomic) UIButton *archiveButton; 49 | @property (strong, nonatomic) UIProgressView *progressBar; 50 | @property (strong, nonatomic) UIActivityIndicatorView *spinner; 51 | @property (strong, nonatomic) UILabel *loadingLabel; 52 | @property (strong, nonatomic) UILabel *priceLabel; 53 | 54 | @property (strong, nonatomic) UIButton *issueCover; 55 | @property (strong, nonatomic) UILabel *titleLabel; 56 | @property (strong, nonatomic) UILabel *infoLabel; 57 | 58 | @property (copy, nonatomic) NSString *currentStatus; 59 | 60 | #pragma mark - Structs 61 | typedef struct { 62 | int cellPadding; 63 | int thumbWidth; 64 | int thumbHeight; 65 | int contentOffset; 66 | } UI; 67 | 68 | #pragma mark - Init 69 | - (id)initWithBakerIssue:(BakerIssue *)bakerIssue; 70 | 71 | #pragma mark - View Lifecycle 72 | - (void)refresh; 73 | - (void)refresh:(NSString *)status; 74 | - (void)refreshContentWithCache:(bool)cache; 75 | - (void)preferredContentSizeChanged:(NSNotification *)notification; 76 | 77 | #pragma mark - Issue management 78 | - (void)actionButtonPressed:(UIButton *)sender; 79 | #ifdef BAKER_NEWSSTAND 80 | - (void)download; 81 | - (void)setPrice:(NSString *)price; 82 | - (void)buy; 83 | #endif 84 | - (void)read; 85 | 86 | #pragma mark - Newsstand archive management 87 | #ifdef BAKER_NEWSSTAND 88 | - (void)archiveButtonPressed:(UIButton *)sender; 89 | #endif 90 | 91 | #pragma mark - Helper methods 92 | + (UI)getIssueContentMeasures; 93 | + (int)getIssueCellHeight; 94 | + (CGSize)getIssueCellSize; 95 | 96 | @end 97 | 98 | #ifdef BAKER_NEWSSTAND 99 | @interface alertView: UIAlertView { 100 | 101 | } 102 | @end 103 | #endif 104 | -------------------------------------------------------------------------------- /BakerShelf/ShelfViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ShelfViewController.h 3 | // Baker 4 | // 5 | // ========================================================================================== 6 | // 7 | // Copyright (c) 2010-2013, Davide Casali, Marco Colombo, Alessandro Morandi 8 | // All rights reserved. 9 | // 10 | // Redistribution and use in source and binary forms, with or without modification, are 11 | // permitted provided that the following conditions are met: 12 | // 13 | // Redistributions of source code must retain the above copyright notice, this list of 14 | // conditions and the following disclaimer. 15 | // Redistributions in binary form must reproduce the above copyright notice, this list of 16 | // conditions and the following disclaimer in the documentation and/or other materials 17 | // provided with the distribution. 18 | // Neither the name of the Baker Framework nor the names of its contributors may be used to 19 | // endorse or promote products derived from this software without specific prior written 20 | // permission. 21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 22 | // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 23 | // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 24 | // SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 25 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 26 | // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28 | // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | // 31 | 32 | #import 33 | #import 34 | 35 | #import "BakerIssue.h" 36 | #import "IssuesManager.h" 37 | #import "ShelfStatus.h" 38 | #import "BakerAPI.h" 39 | #ifdef BAKER_NEWSSTAND 40 | #import "PurchasesManager.h" 41 | #endif 42 | 43 | @interface ShelfViewController : UIViewController { 44 | BakerAPI *api; 45 | IssuesManager *issuesManager; 46 | NSMutableArray *notRecognisedTransactions; 47 | __weak UIPopoverController *infoPopover; 48 | 49 | #ifdef BAKER_NEWSSTAND 50 | PurchasesManager *purchasesManager; 51 | #endif 52 | } 53 | 54 | @property (copy, nonatomic) NSArray *issues; 55 | @property (copy, nonatomic) NSArray *supportedOrientation; 56 | 57 | @property (retain, nonatomic) NSMutableArray *issueViewControllers; 58 | @property (retain, nonatomic) ShelfStatus *shelfStatus; 59 | 60 | @property (strong, nonatomic) UICollectionView *gridView; 61 | @property (strong, nonatomic) UIImageView *background; 62 | @property (strong, nonatomic) UIBarButtonItem *refreshButton; 63 | @property (strong, nonatomic) UIBarButtonItem *subscribeButton; 64 | 65 | @property (strong, nonatomic) UIActionSheet *subscriptionsActionSheet; 66 | @property (strong, nonatomic) NSArray *subscriptionsActionSheetActions; 67 | @property (strong, nonatomic) UIAlertView *blockingProgressView; 68 | 69 | @property (copy, nonatomic) NSString *bookToBeProcessed; 70 | 71 | #pragma mark - Init 72 | - (id)init; 73 | - (id)initWithBooks:(NSArray *)currentBooks; 74 | 75 | #pragma mark - Shelf data source 76 | #ifdef BAKER_NEWSSTAND 77 | - (void)handleRefresh:(NSNotification *)notification; 78 | 79 | #pragma mark - Store Kit 80 | - (void)handleSubscription:(NSNotification *)notification; 81 | #endif 82 | 83 | #pragma mark - Navigation management 84 | - (void)readIssue:(BakerIssue *)issue; 85 | - (void)handleReadIssue:(NSNotification *)notification; 86 | - (void)receiveBookProtocolNotification:(NSNotification *)notification; 87 | - (void)handleBookToBeProcessed; 88 | - (void)pushViewControllerWithBook:(BakerBook *)book; 89 | 90 | #pragma mark - Buttons management 91 | -(void)setrefreshButtonEnabled:(BOOL)enabled; 92 | -(void)setSubscribeButtonEnabled:(BOOL)enabled; 93 | 94 | #pragma mark - Helper methods 95 | + (int)getBannerHeight; 96 | 97 | @end 98 | -------------------------------------------------------------------------------- /BakerView/lib/JSONStatus.m: -------------------------------------------------------------------------------- 1 | // 2 | // JSONStatus.m 3 | // Baker 4 | // 5 | // ========================================================================================== 6 | // 7 | // Copyright (c) 2010-2013, Davide Casali, Marco Colombo, Alessandro Morandi 8 | // All rights reserved. 9 | // 10 | // Redistribution and use in source and binary forms, with or without modification, are 11 | // permitted provided that the following conditions are met: 12 | // 13 | // Redistributions of source code must retain the above copyright notice, this list of 14 | // conditions and the following disclaimer. 15 | // Redistributions in binary form must reproduce the above copyright notice, this list of 16 | // conditions and the following disclaimer in the documentation and/or other materials 17 | // provided with the distribution. 18 | // Neither the name of the Baker Framework nor the names of its contributors may be used to 19 | // endorse or promote products derived from this software without specific prior written 20 | // permission. 21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 22 | // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 23 | // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 24 | // SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 25 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 26 | // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28 | // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | // 31 | 32 | #import "JSONStatus.h" 33 | #import "Utils.h" 34 | 35 | @implementation JSONStatus 36 | 37 | @synthesize path; 38 | 39 | - (id)initWithJSONPath:(NSString *)JSONPath 40 | { 41 | self = [super init]; 42 | 43 | if (self) { 44 | path = [JSONPath retain]; 45 | [self createFileIfMissing]; 46 | [self load]; 47 | } 48 | 49 | return self; 50 | } 51 | 52 | - (NSDictionary *)load { 53 | NSError *error = nil; 54 | NSData* json = [NSData dataWithContentsOfFile:self.path options:0 error:&error]; 55 | if (error) { 56 | NSLog(@"[JSONStatus] Error when loading JSON status: %@", error); 57 | } 58 | NSDictionary* retv = [NSJSONSerialization JSONObjectWithData:json 59 | options:0 60 | error:&error]; 61 | // TODO: deal with error 62 | return retv; 63 | } 64 | 65 | - (void)save:(NSDictionary *)status { 66 | NSError* error = nil; 67 | NSData* json = [NSJSONSerialization dataWithJSONObject:status 68 | options:0 69 | error:&error]; 70 | // TODO: deal with error 71 | 72 | [json writeToFile:path options:NSDataWritingAtomic error:&error]; 73 | 74 | if (error) { 75 | NSLog(@"[JSONStatus] Error when saving JSON status: %@", error); 76 | } 77 | } 78 | 79 | - (void)createFileIfMissing { 80 | NSError *error = nil; 81 | 82 | NSString *dirPath = [path stringByDeletingLastPathComponent]; 83 | if (![[NSFileManager defaultManager] fileExistsAtPath:dirPath]) { 84 | [[NSFileManager defaultManager] createDirectoryAtPath:dirPath withIntermediateDirectories:YES attributes:nil error:&error]; 85 | if (error) { 86 | NSLog(@"[JSONStatus] Error when creating JSON status folder: %@", error); 87 | } 88 | } 89 | 90 | if (![[NSFileManager defaultManager] fileExistsAtPath:path]) { 91 | if (![[NSFileManager defaultManager] createFileAtPath:path contents:nil attributes:nil]) { 92 | NSLog(@"[JSONStatus] JSON status file could not be created at %@", path); 93 | } 94 | 95 | } 96 | } 97 | 98 | - (void)dealloc { 99 | [path release]; 100 | 101 | [super dealloc]; 102 | } 103 | 104 | @end 105 | -------------------------------------------------------------------------------- /BakerView/ui/PageTitleLabel.m: -------------------------------------------------------------------------------- 1 | // 2 | // PageTitleLabel.m 3 | // Baker 4 | // 5 | // ========================================================================================== 6 | // 7 | // Copyright (c) 2010-2013, Davide Casali, Marco Colombo, Alessandro Morandi 8 | // All rights reserved. 9 | // 10 | // Redistribution and use in source and binary forms, with or without modification, are 11 | // permitted provided that the following conditions are met: 12 | // 13 | // Redistributions of source code must retain the above copyright notice, this list of 14 | // conditions and the following disclaimer. 15 | // Redistributions in binary form must reproduce the above copyright notice, this list of 16 | // conditions and the following disclaimer in the documentation and/or other materials 17 | // provided with the distribution. 18 | // Neither the name of the Baker Framework nor the names of its contributors may be used to 19 | // endorse or promote products derived from this software without specific prior written 20 | // permission. 21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 22 | // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 23 | // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 24 | // SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 25 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 26 | // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28 | // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | // 31 | 32 | #import "PageTitleLabel.h" 33 | #import "Utils.h" 34 | #import "GTMNSString+HTML.h" 35 | 36 | @implementation PageTitleLabel 37 | 38 | - (id)initWithFile:(NSString *)path color:(UIColor *)color alpha:(float)alpha { 39 | NSError *error = nil; 40 | NSString *fileContent = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:&error]; 41 | if (error == nil) { 42 | return [self initWithFileContent:fileContent color:(UIColor *)color alpha:(float)alpha]; 43 | } else { 44 | NSLog(@"Error while loading %@ : %@ : Check that encoding is UTF8 for the file.", path, [error localizedDescription]); 45 | return [super init]; 46 | } 47 | } 48 | 49 | - (id)initWithFileContent:(NSString *)fileContent color:(UIColor *)color alpha:(float)alpha { 50 | 51 | self = [super init]; 52 | if (self) { 53 | NSRegularExpression *titleRegex = [NSRegularExpression regularExpressionWithPattern:@"(.*)" options:NSRegularExpressionCaseInsensitive error:NULL]; 54 | NSRange matchRange = [[titleRegex firstMatchInString:fileContent options:0 range:NSMakeRange(0, [fileContent length])] rangeAtIndex:1]; 55 | if (!NSEqualRanges(matchRange, NSMakeRange(NSNotFound, 0))) { 56 | NSString *titleText = [[fileContent substringWithRange:matchRange] gtm_stringByUnescapingFromHTML]; 57 | 58 | CGSize titleDimension = CGSizeMake(672, 330); 59 | UIFont *titleFont = [UIFont fontWithName:@"Helvetica" size:24.0]; 60 | 61 | CGRect screenBounds = [[UIScreen mainScreen] bounds]; 62 | if (screenBounds.size.width < 768) { 63 | titleDimension = CGSizeMake(280, 134); 64 | titleFont = [UIFont fontWithName:@"Helvetica" size:15.0]; 65 | } 66 | 67 | CGSize titleTextSize = [titleText sizeWithFont:titleFont constrainedToSize:titleDimension lineBreakMode:NSLineBreakByTruncatingTail]; 68 | 69 | self.frame = CGRectMake(0, 0, titleTextSize.width, titleTextSize.height); 70 | self.backgroundColor = [UIColor clearColor]; 71 | self.textAlignment = NSTextAlignmentCenter; 72 | self.lineBreakMode = NSLineBreakByTruncatingTail; 73 | self.numberOfLines = 0; 74 | self.textColor = color; 75 | self.alpha = alpha; 76 | self.font = titleFont; 77 | self.text = titleText; 78 | } 79 | } 80 | return self; 81 | } 82 | - (void)setX:(CGFloat)x Y:(CGFloat)y { 83 | CGRect titleFrame = self.frame; 84 | titleFrame.origin.x = x; 85 | titleFrame.origin.y = y; 86 | self.frame = titleFrame; 87 | } 88 | 89 | @end 90 | -------------------------------------------------------------------------------- /Baker/en.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | 2 | // Shelf Navigation Title at the top of the main Issues List 3 | "SHELF_NAVIGATION_TITLE" = "Baker Shelf"; 4 | 5 | // Products alert 6 | "PRODUCTS_REQUEST_FAILED_TITLE" = "Failure connecting to the App Store"; 7 | "PRODUCTS_REQUEST_FAILED_CLOSE" = "Close"; 8 | 9 | // Info button 10 | "INFO_BUTTON_TEXT" = "Info"; 11 | 12 | // Subscription button 13 | "SUBSCRIBE_BUTTON_TEXT" = "Subscribe"; 14 | "SUBSCRIBE_BUTTON_DISABLED_TEXT" = "Subscribing..."; 15 | "SUBSCRIBE_BUTTON_SUBSCRIBED_TEXT" = "Subscribed"; 16 | 17 | "SUBSCRIPTIONS_SHEET_FREE" = "Subscribe for free"; 18 | "SUBSCRIPTIONS_SHEET_RESTORE" = "Restore purchases"; 19 | "SUBSCRIPTIONS_SHEET_CLOSE" = "Close"; 20 | 21 | "SUBSCRIPTIONS_SHEET_GENERIC" = "Subscription options"; 22 | "SUBSCRIPTIONS_SHEET_SUBSCRIBED" = "You are subscribed"; 23 | "SUBSCRIPTIONS_SHEET_NOT_SUBSCRIBED" = "You are not subscribed"; 24 | 25 | // Subscription alerts 26 | "SUBSCRIPTION_SUCCESSFUL_TITLE" = "Subscribed successfully"; 27 | "SUBSCRIPTION_SUCCESSFUL_MESSAGE" = "You have successfully subscribed"; 28 | "SUBSCRIPTION_SUCCESSFUL_CLOSE" = "Close"; 29 | "SUBSCRIPTION_FAILED_TITLE" = "Subscription failure"; 30 | "SUBSCRIPTION_FAILED_CLOSE" = "Close"; 31 | 32 | // Issue purchase alerts 33 | "ISSUE_PURCHASE_SUCCESSFUL_TITLE" = "Purchase successful"; 34 | "ISSUE_PURCHASE_SUCCESSFUL_MESSAGE" = "You have successfully purchased %@"; 35 | "ISSUE_PURCHASE_SUCCESSFUL_CLOSE" = "Close"; 36 | "ISSUE_PURCHASE_FAILED_TITLE" = "Purchase failure"; 37 | "ISSUE_PURCHASE_FAILED_CLOSE" = "Close"; 38 | 39 | // Restore alerts 40 | "RESTORE_FAILED_TITLE" = "Restore failure"; 41 | "RESTORE_FAILED_CLOSE" = "Close"; 42 | 43 | "RESTORED_ISSUE_NOT_RECOGNISED_TITLE" = "Some issues could not be restored"; 44 | "RESTORED_ISSUE_NOT_RECOGNISED_MESSAGE" = "The following product IDs are not defined and the corresponding issues could not be restored:\n%@.\n\nContact the app creator for more info."; 45 | "RESTORED_ISSUE_NOT_RECOGNISED_CLOSE" = "Close"; 46 | 47 | // Download alert 48 | "DOWNLOAD_FAILED_TITLE" = "Download failed"; 49 | "DOWNLOAD_FAILED_MESSAGE" = "The issue could not be downloaded"; 50 | "DOWNLOAD_FAILED_CLOSE" = "Close"; 51 | 52 | // Unzip alert 53 | "UNZIP_FAILED_TITLE" = "Opening failed"; 54 | "UNZIP_FAILED_MESSAGE" = "The issue could not be opened"; 55 | "UNZIP_FAILED_CLOSE" = "Close"; 56 | 57 | // Connection alert 58 | "INTERNET_CONNECTION_UNAVAILABLE_TITLE" = "No Internet Connection"; 59 | "INTERNET_CONNECTION_UNAVAILABLE_MESSAGE" = "An Internet connection is unavailable. Some features of this application require an active connection."; 60 | "INTERNET_CONNECTION_UNAVAILABLE_CLOSE" = "OK"; 61 | 62 | // Issue buttons 63 | "ACTION_REMOTE_TEXT" = "DOWNLOAD"; 64 | "ACTION_DOWNLOADED_TEXT" = "READ"; 65 | "ACTION_BUY_TEXT" = "BUY"; 66 | "ARCHIVE_TEXT" = "ARCHIVE"; 67 | "CONNECTING_TEXT" = "CONNECTING..."; 68 | "DOWNLOADING_TEXT" = "DOWNLOADING ..."; 69 | "OPENING_TEXT" = "Loading..."; 70 | "BUYING_TEXT" = "BUYING..."; 71 | "RETRIEVING_TEXT" = "UPDATING PRICE..."; 72 | 73 | // Issue states 74 | "FREE_TEXT" = "FREE"; 75 | "PURCHASED_TEXT" = "PURCHASED"; 76 | 77 | // Archiving alert 78 | "ARCHIVE_ALERT_TITLE" = "Are you sure you want to archive this issue?"; 79 | "ARCHIVE_ALERT_MESSAGE" = "This issue will be removed from your device. You may download it at anytime for free."; 80 | "ARCHIVE_ALERT_BUTTON_CANCEL" = "Cancel"; 81 | "ARCHIVE_ALERT_BUTTON_OK" = "Archive"; 82 | 83 | // Mail alert 84 | "MAILTO_ALERT_TITLE" = "Failure"; 85 | "MAILTO_ALERT_MESSAGE" = "Your device doesn't support the sending of emails!"; 86 | "MAILTO_ALERT_CLOSE" = "OK"; 87 | 88 | // Modal web view 89 | "WEB_MODAL_FAILURE_MESSAGE" = "Unable to connect."; 90 | "WEB_MODAL_CLOSE_BUTTON_TEXT" = "Back"; 91 | 92 | // Transaction recording alert 93 | "TRANSACTION_RECORDING_FAILED_TITLE" = "Could not confirm purchase with remote server"; 94 | "TRANSACTION_RECORDING_FAILED_MESSAGE" = "The operation will be retried until it is successful"; 95 | "TRANSACTION_RECORDING_FAILED_CLOSE" = "Close"; 96 | 97 | // Issue opening failure alert 98 | "ISSUE_OPENING_FAILED_TITLE" = "Could not open issue"; 99 | "ISSUE_OPENING_FAILED_MESSAGE" = "There was an error opening this issue. Try downloading it again or contact the publisher."; 100 | "ISSUE_OPENING_FAILED_CLOSE" = "Close"; 101 | 102 | // Subscriptions 103 | // (These are just examples: you'll need to provide your own product IDs and names) 104 | //"com.example.MyBook.subscription.3months" = "3 Months Subscription"; 105 | //"com.example.MyBook.subscription.6months" = "Half Year Subscription"; 106 | -------------------------------------------------------------------------------- /BakerView/BakerBook.h: -------------------------------------------------------------------------------- 1 | // 2 | // BakerBook.h 3 | // Baker 4 | // 5 | // ========================================================================================== 6 | // 7 | // Copyright (c) 2010-2013, Davide Casali, Marco Colombo, Alessandro Morandi 8 | // All rights reserved. 9 | // 10 | // Redistribution and use in source and binary forms, with or without modification, are 11 | // permitted provided that the following conditions are met: 12 | // 13 | // Redistributions of source code must retain the above copyright notice, this list of 14 | // conditions and the following disclaimer. 15 | // Redistributions in binary form must reproduce the above copyright notice, this list of 16 | // conditions and the following disclaimer in the documentation and/or other materials 17 | // provided with the distribution. 18 | // Neither the name of the Baker Framework nor the names of its contributors may be used to 19 | // endorse or promote products derived from this software without specific prior written 20 | // permission. 21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 22 | // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 23 | // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 24 | // SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 25 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 26 | // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28 | // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | // 31 | 32 | #import 33 | 34 | @interface BakerBook : NSObject 35 | 36 | #pragma mark - HPub Parameters Properties 37 | 38 | @property (copy, nonatomic) NSNumber *hpub; 39 | @property (copy, nonatomic) NSString *title; 40 | @property (copy, nonatomic) NSString *date; 41 | 42 | @property (copy, nonatomic) NSArray *author; 43 | @property (copy, nonatomic) NSArray *creator; 44 | @property (copy, nonatomic) NSString *publisher; 45 | 46 | @property (copy, nonatomic) NSString *url; 47 | @property (copy, nonatomic) NSString *cover; 48 | 49 | @property (copy, nonatomic) NSString *orientation; 50 | @property (copy, nonatomic) NSNumber *zoomable; 51 | 52 | @property (strong, nonatomic) NSMutableArray *contents; 53 | 54 | #pragma mark - Baker HPub Extensions Properties 55 | 56 | @property (copy, nonatomic) NSString *bakerBackground; 57 | @property (copy, nonatomic) NSString *bakerBackgroundImagePortrait; 58 | @property (copy, nonatomic) NSString *bakerBackgroundImageLandscape; 59 | @property (copy, nonatomic) NSString *bakerPageNumbersColor; 60 | @property (copy, nonatomic) NSNumber *bakerPageNumbersAlpha; 61 | @property (copy, nonatomic) NSString *bakerPageScreenshots; 62 | 63 | @property (copy, nonatomic) NSString *bakerRendering; 64 | @property (copy, nonatomic) NSNumber *bakerVerticalBounce; 65 | @property (copy, nonatomic) NSNumber *bakerVerticalPagination; 66 | @property (copy, nonatomic) NSNumber *bakerPageTurnTap; 67 | @property (copy, nonatomic) NSNumber *bakerPageTurnSwipe; 68 | @property (copy, nonatomic) NSNumber *bakerMediaAutoplay; 69 | 70 | @property (copy, nonatomic) NSNumber *bakerIndexWidth; 71 | @property (copy, nonatomic) NSNumber *bakerIndexHeight; 72 | @property (copy, nonatomic) NSNumber *bakerIndexBounce; 73 | @property (copy, nonatomic) NSNumber *bakerStartAtPage; 74 | 75 | #pragma mark - Book Status Properties 76 | 77 | @property (copy, nonatomic) NSString *ID; 78 | @property (copy, nonatomic) NSString *path; 79 | @property (copy, nonatomic) NSNumber *isBundled; 80 | @property (copy, nonatomic) NSString *screenshotsPath; 81 | @property (copy, nonatomic) NSNumber *screenshotsWritable; 82 | @property (copy, nonatomic) NSNumber *currentPage; 83 | @property (copy, nonatomic) NSNumber *lastScrollIndex; 84 | @property (copy, nonatomic) NSDate *lastOpenedDate; 85 | 86 | #pragma mark - Init 87 | 88 | - (id)initWithBookPath:(NSString *)bookPath bundled:(BOOL)bundled; 89 | - (id)initWithBookJSONPath:(NSString *)bookJSONPath; 90 | - (id)initWithBookData:(NSDictionary *)bookData; 91 | - (BOOL)loadBookData:(NSDictionary *)bookData; 92 | 93 | #pragma mark - HPub validation 94 | 95 | - (BOOL)validateBookJSON:(NSDictionary *)bookData withRequirements:(NSArray *)requirements; 96 | - (BOOL)validateArray:(NSArray *)array forParam:(NSString *)param; 97 | - (BOOL)validateString:(NSString *)string forParam:(NSString *)param; 98 | - (BOOL)validateNumber:(NSNumber *)number forParam:(NSString *)param; 99 | - (BOOL)matchParam:(NSString *)param againstParamsArray:(NSArray *)paramsArray; 100 | 101 | #pragma mark - Book status management 102 | 103 | - (BOOL)updateBookPath:(NSString *)bookPath bundled:(BOOL)bundled; 104 | - (void)openBook; 105 | - (void)closeBook; 106 | 107 | @end 108 | -------------------------------------------------------------------------------- /books/a-study-in-scarlet/css/book.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Baker Ebook Framework - Basic Book 3 | * last update: 2011-10-10 4 | * 5 | * Copyright (C) 2011 by Davide S. Casali 6 | * 7 | */ 8 | 9 | /**************************************************************************************************** 10 | * General 11 | */ 12 | body { 13 | background: #ffffff url(../gfx/background.jpg); 14 | font-family: Helvetica, Arial, sans-serif; 15 | font-size: 16px; 16 | margin: 0; 17 | padding: 0; 18 | } 19 | 20 | a { 21 | color: #b50303; 22 | } 23 | 24 | /**************************************************************************************************** 25 | * Typography 26 | */ 27 | p, ul, ol { 28 | font-size: 18px; 29 | line-height: 40px; 30 | } 31 | 32 | h1, h2, h3, h4, h5, h6 { 33 | font-family: "BodoniSvtyTwoITCTT-Book", Times, serif; 34 | font-weight: normal; 35 | text-align: center; 36 | 37 | border: 0; 38 | margin: 0; 39 | padding: 0; 40 | } 41 | 42 | h1 { 43 | border-bottom: 1px solid #cf0000; 44 | color: #cf0000; 45 | font-size: 70px; 46 | 47 | height: 264px; 48 | position: relative; 49 | } 50 | h1 div { 51 | width: 100%; 52 | position: absolute; 53 | bottom: 0; 54 | margin: 0 0 20px; 55 | } 56 | 57 | h2 { 58 | font-size: 50px; 59 | letter-spacing: -2px; 60 | margin: 8px 0 2px; 61 | padding: 5px 0 2px; 62 | } 63 | 64 | ul, ol { 65 | line-height: 1.25em; 66 | } 67 | 68 | img.right { 69 | float: right; 70 | margin: 8px -100px 8px 25px; 71 | padding: 15px 0 15px 0; 72 | } 73 | 74 | /**************************************************************************************************** 75 | * Pages 76 | */ 77 | #page { 78 | background: #ffffff url(../gfx/background.jpg); 79 | min-height: 1024px; 80 | overflow: hidden; 81 | margin: 0 auto; 82 | } 83 | 84 | /****** Blood */ 85 | #blood { 86 | background: transparent url(../gfx/blood.png) no-repeat; 87 | width: 17px; 88 | height: 55px; 89 | 90 | position: absolute; 91 | top: 0; 92 | right: 20px; 93 | 94 | -webkit-tap-highlight-color: rgba(0,0,0,0); 95 | } 96 | 97 | .blood-drop { 98 | background: transparent url(../gfx/blood-drop.png) no-repeat; 99 | display: block; 100 | width: 10px; 101 | height: 26px; 102 | } 103 | 104 | 105 | /**************************************************************************************************** 106 | * Book Cover 107 | */ 108 | #page.cover img.central { 109 | display: block; 110 | margin: 70px auto 50px; 111 | } 112 | 113 | #page.cover .footer { 114 | text-align: center; 115 | } 116 | 117 | #page.cover .footer p { 118 | font-size: 12px; 119 | padding: 15px 0 5px; 120 | } 121 | 122 | 123 | /**************************************************************************************************** 124 | * Book Index 125 | */ 126 | #page.index .menu { 127 | margin: 30px auto; 128 | width: 670px; 129 | } 130 | 131 | #page.index .menu small { 132 | display: block; 133 | text-align: center; 134 | width: 400px; 135 | margin: 0 auto; 136 | } 137 | 138 | #page.index .menu ol { 139 | list-style: none; 140 | padding: 0; 141 | } 142 | 143 | #page.index .menu li { 144 | position: relative; 145 | background: transparent url(../gfx/dots-menu.png) repeat-x -1px; 146 | } 147 | 148 | #page.index .menu li a .count { 149 | background: #ffffff url(../gfx/background.jpg); 150 | padding-left: 3px; 151 | position: absolute; 152 | right: 0; 153 | } 154 | 155 | #page.index .menu li a { 156 | background: #ffffff url(../gfx/background.jpg); 157 | color: #000000; 158 | text-decoration: none; 159 | 160 | -webkit-transition: color 0.4s ease; 161 | -moz-transition: color 0.4s ease; 162 | -o-transition: color 0.4s ease; 163 | transition: color 0.4s ease; 164 | } 165 | #page.index .menu li a:hover { 166 | color: #b50303; 167 | } 168 | 169 | /**************************************************************************************************** 170 | * Chapter 171 | */ 172 | #page.chapter h1 { 173 | font-size: 42px; 174 | } 175 | 176 | #page.chapter #content { 177 | min-height: 1024px; 178 | width: 530px; 179 | 180 | margin: 120px auto; 181 | } 182 | 183 | #page.chapter p, 184 | #page.chapter ol, 185 | #page.chapter ul { 186 | font-size: 22px; 187 | text-align: justify; 188 | text-indent: 1em; 189 | line-height: 1.6em; 190 | } 191 | 192 | 193 | /**************************************************************************************************** 194 | * Media queries 195 | */ 196 | @media only screen and (max-device-width : 768px) and (orientation : portrait) { 197 | /* Rules only for iPad - Portrait */ 198 | 199 | } 200 | 201 | @media only screen and (max-device-width : 1024px) and (orientation : landscape) { 202 | /* Rules only for iPad - Landscape */ 203 | #page.cover img.central { 204 | display: none; 205 | } 206 | 207 | #page { 208 | min-height: 768px; 209 | } 210 | 211 | #page.cover .footer { 212 | margin-top: 240px; 213 | } 214 | } 215 | 216 | 217 | -------------------------------------------------------------------------------- /BakerView/lib/minizip/crypt.h: -------------------------------------------------------------------------------- 1 | /* crypt.h -- base code for crypt/uncrypt ZIPfile 2 | 3 | 4 | Version 1.01e, February 12th, 2005 5 | 6 | Copyright (C) 1998-2005 Gilles Vollant 7 | 8 | This code is a modified version of crypting code in Infozip distribution 9 | 10 | The encryption/decryption parts of this source code (as opposed to the 11 | non-echoing password parts) were originally written in Europe. The 12 | whole source package can be freely distributed, including from the USA. 13 | (Prior to January 2000, re-export from the US was a violation of US law.) 14 | 15 | This encryption code is a direct transcription of the algorithm from 16 | Roger Schlafly, described by Phil Katz in the file appnote.txt. This 17 | file (appnote.txt) is distributed with the PKZIP program (even in the 18 | version without encryption capabilities). 19 | 20 | If you don't need crypting in your application, just define symbols 21 | NOCRYPT and NOUNCRYPT. 22 | 23 | This code support the "Traditional PKWARE Encryption". 24 | 25 | The new AES encryption added on Zip format by Winzip (see the page 26 | http://www.winzip.com/aes_info.htm ) and PKWare PKZip 5.x Strong 27 | Encryption is not supported. 28 | */ 29 | 30 | #define CRC32(c, b) ((*(pcrc_32_tab+(((int)(c) ^ (b)) & 0xff))) ^ ((c) >> 8)) 31 | 32 | /*********************************************************************** 33 | * Return the next byte in the pseudo-random sequence 34 | */ 35 | static int decrypt_byte(unsigned long* pkeys, const unsigned long* pcrc_32_tab) 36 | { 37 | unsigned temp; /* POTENTIAL BUG: temp*(temp^1) may overflow in an 38 | * unpredictable manner on 16-bit systems; not a problem 39 | * with any known compiler so far, though */ 40 | 41 | temp = ((unsigned)(*(pkeys+2)) & 0xffff) | 2; 42 | return (int)(((temp * (temp ^ 1)) >> 8) & 0xff); 43 | } 44 | 45 | /*********************************************************************** 46 | * Update the encryption keys with the next byte of plain text 47 | */ 48 | static int update_keys(unsigned long* pkeys,const unsigned long* pcrc_32_tab,int c) 49 | { 50 | (*(pkeys+0)) = CRC32((*(pkeys+0)), c); 51 | (*(pkeys+1)) += (*(pkeys+0)) & 0xff; 52 | (*(pkeys+1)) = (*(pkeys+1)) * 134775813L + 1; 53 | { 54 | register int keyshift = (int)((*(pkeys+1)) >> 24); 55 | (*(pkeys+2)) = CRC32((*(pkeys+2)), keyshift); 56 | } 57 | return c; 58 | } 59 | 60 | 61 | /*********************************************************************** 62 | * Initialize the encryption keys and the random header according to 63 | * the given password. 64 | */ 65 | static void init_keys(const char* passwd,unsigned long* pkeys,const unsigned long* pcrc_32_tab) 66 | { 67 | *(pkeys+0) = 305419896L; 68 | *(pkeys+1) = 591751049L; 69 | *(pkeys+2) = 878082192L; 70 | while (*passwd != '\0') { 71 | update_keys(pkeys,pcrc_32_tab,(int)*passwd); 72 | passwd++; 73 | } 74 | } 75 | 76 | #define zdecode(pkeys,pcrc_32_tab,c) \ 77 | (update_keys(pkeys,pcrc_32_tab,c ^= decrypt_byte(pkeys,pcrc_32_tab))) 78 | 79 | #define zencode(pkeys,pcrc_32_tab,c,t) \ 80 | (t=decrypt_byte(pkeys,pcrc_32_tab), update_keys(pkeys,pcrc_32_tab,c), t^(c)) 81 | 82 | #ifdef INCLUDECRYPTINGCODE_IFCRYPTALLOWED 83 | 84 | #define RAND_HEAD_LEN 12 85 | /* "last resort" source for second part of crypt seed pattern */ 86 | # ifndef ZCR_SEED2 87 | # define ZCR_SEED2 3141592654UL /* use PI as default pattern */ 88 | # endif 89 | 90 | static int crypthead(const char* passwd, /* password string */ 91 | unsigned char* buf, /* where to write header */ 92 | int bufSize, 93 | unsigned long* pkeys, 94 | const unsigned long* pcrc_32_tab, 95 | unsigned long crcForCrypting) 96 | { 97 | int n; /* index in random header */ 98 | int t; /* temporary */ 99 | int c; /* random byte */ 100 | unsigned char header[RAND_HEAD_LEN-2]; /* random header */ 101 | static unsigned calls = 0; /* ensure different random header each time */ 102 | 103 | if (bufSize> 7) & 0xff; 118 | header[n] = (unsigned char)zencode(pkeys, pcrc_32_tab, c, t); 119 | } 120 | /* Encrypt random header (last two bytes is high word of crc) */ 121 | init_keys(passwd, pkeys, pcrc_32_tab); 122 | for (n = 0; n < RAND_HEAD_LEN-2; n++) 123 | { 124 | buf[n] = (unsigned char)zencode(pkeys, pcrc_32_tab, header[n], t); 125 | } 126 | buf[n++] = (unsigned char)zencode(pkeys, pcrc_32_tab, (int)(crcForCrypting >> 16) & 0xff, t); 127 | buf[n++] = (unsigned char)zencode(pkeys, pcrc_32_tab, (int)(crcForCrypting >> 24) & 0xff, t); 128 | return n; 129 | } 130 | 131 | #endif 132 | -------------------------------------------------------------------------------- /BakerShelf/Constants.h: -------------------------------------------------------------------------------- 1 | // 2 | // Constants.h 3 | // Baker 4 | // 5 | // ========================================================================================== 6 | // 7 | // Copyright (c) 2010-2013, Davide Casali, Marco Colombo, Alessandro Morandi 8 | // All rights reserved. 9 | // 10 | // Redistribution and use in source and binary forms, with or without modification, are 11 | // permitted provided that the following conditions are met: 12 | // 13 | // Redistributions of source code must retain the above copyright notice, this list of 14 | // conditions and the following disclaimer. 15 | // Redistributions in binary form must reproduce the above copyright notice, this list of 16 | // conditions and the following disclaimer in the documentation and/or other materials 17 | // provided with the distribution. 18 | // Neither the name of the Baker Framework nor the names of its contributors may be used to 19 | // endorse or promote products derived from this software without specific prior written 20 | // permission. 21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 22 | // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 23 | // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 24 | // SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 25 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 26 | // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28 | // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | // 31 | 32 | 33 | #ifndef Baker_Constants_h 34 | #define Baker_Constants_h 35 | 36 | // ---------------------------------------------------------------------------------------------------- 37 | // NEWSSTAND SUPPORT 38 | // The following line, together with other settings, enables Newsstand mode. 39 | // Remove this, remove the NewsstandKit.framework and the Newsstand entries in Baker-Info.plist to disable it. 40 | // See: https://github.com/Simbul/baker/wiki/Newsstand-vs-Bundled-publications-support-in-Baker-4.0 41 | #define BAKER_NEWSSTAND 42 | 43 | #ifdef BAKER_NEWSSTAND 44 | 45 | // ---------------------------------------------------------------------------------------------------- 46 | // Mandatory - This constant defines where the JSON file containing all the publications is located. 47 | // For more information on this file, see: https://github.com/Simbul/baker/wiki/Newsstand-shelf-JSON 48 | // E.g. @"http://example.com/shelf.json" 49 | #define NEWSSTAND_MANIFEST_URL @"http://bakerframework.com/demo/shelf.json" 50 | 51 | // ---------------------------------------------------------------------------------------------------- 52 | // Optional - This constant specifies the URL to ping back when a user purchases an issue or a subscription. 53 | // For more information, see: https://github.com/Simbul/baker/wiki/Baker-Server-API 54 | // E.g. @"http://example.com/purchased" 55 | #define PURCHASE_CONFIRMATION_URL @"" 56 | 57 | // ---------------------------------------------------------------------------------------------------- 58 | // Optional - This constant specifies a URL that will be used to retrieve the list of purchased issues. 59 | // For more information, see: https://github.com/Simbul/baker/wiki/Baker-Server-API 60 | // E.g. @"http://example.com/purchases" 61 | #define PURCHASES_URL @"" 62 | 63 | // ---------------------------------------------------------------------------------------------------- 64 | // Optional - This constant specifies the URL to ping back when a user enables push notifications. 65 | // For more information, see: https://github.com/Simbul/baker/wiki/Baker-Server-API 66 | // E.g. @"http://example.com/post_apns_token" 67 | #define POST_APNS_TOKEN_URL @"" 68 | 69 | // ---------------------------------------------------------------------------------------------------- 70 | // Mandatory - The following two constants identify the subscriptions you set up in iTunesConnect. 71 | // See: iTunes Connect -> Manage Your Application -> (Your application) -> Manage In App Purchases 72 | // You *have* to set at least one among FREE_SUBSCRIPTION_PRODUCT_ID and AUTO_RENEWABLE_SUBSCRIPTION_PRODUCT_IDS. 73 | 74 | // This constant identifies a free subscription. 75 | // E.g. @"com.example.MyBook.subscription.free" 76 | #define FREE_SUBSCRIPTION_PRODUCT_ID @"" 77 | 78 | // This constant identifies one or more auto-renewable subscriptions. 79 | // E.g.: 80 | // #define AUTO_RENEWABLE_SUBSCRIPTION_PRODUCT_IDS [NSArray arrayWithObjects: \ 81 | // @"com.example.MyBook.subscription.3months", \ 82 | // @"com.example.MyBook.subscription.6months", \ 83 | // nil] 84 | #define AUTO_RENEWABLE_SUBSCRIPTION_PRODUCT_IDS [NSArray arrayWithObjects: \ 85 | nil] 86 | 87 | #endif 88 | 89 | // Timeout for most network requests (in seconds) 90 | #define REQUEST_TIMEOUT 15 91 | 92 | #endif 93 | -------------------------------------------------------------------------------- /Baker/BakerAnalyticsEvents.m: -------------------------------------------------------------------------------- 1 | // 2 | // BakerAnalyticsEvents.m 3 | // Baker 4 | // 5 | // ========================================================================================== 6 | // 7 | // Copyright (c) 2010-2013, Davide Casali, Marco Colombo, Alessandro Morandi 8 | // All rights reserved. 9 | // 10 | // Redistribution and use in source and binary forms, with or without modification, are 11 | // permitted provided that the following conditions are met: 12 | // 13 | // Redistributions of source code must retain the above copyright notice, this list of 14 | // conditions and the following disclaimer. 15 | // Redistributions in binary form must reproduce the above copyright notice, this list of 16 | // conditions and the following disclaimer in the documentation and/or other materials 17 | // provided with the distribution. 18 | // Neither the name of the Baker Framework nor the names of its contributors may be used to 19 | // endorse or promote products derived from this software without specific prior written 20 | // permission. 21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 22 | // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 23 | // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 24 | // SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 25 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 26 | // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28 | // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | // 31 | 32 | #import "BakerAnalyticsEvents.h" 33 | 34 | 35 | @implementation BakerAnalyticsEvents 36 | 37 | 38 | #pragma mark - Singleton 39 | 40 | + (BakerAnalyticsEvents *)sharedInstance { 41 | static dispatch_once_t once; 42 | static BakerAnalyticsEvents *sharedInstance; 43 | dispatch_once(&once, ^{ 44 | sharedInstance = [[self alloc] init]; 45 | }); 46 | return sharedInstance; 47 | } 48 | 49 | - (id)init { 50 | 51 | self = [super init]; 52 | 53 | // ****** Add here your analytics code 54 | // tracker = [[GAI sharedInstance] trackerWithTrackingId:@"ADD_HERE_YOUR_TRACKING_CODE"]; 55 | 56 | 57 | // ****** Register to handle events 58 | [self registerEvents]; 59 | 60 | return self; 61 | } 62 | 63 | - (void) dealloc { 64 | [[NSNotificationCenter defaultCenter] removeObserver:self]; 65 | [super dealloc]; 66 | } 67 | 68 | 69 | #pragma mark - Events 70 | 71 | - (void)registerEvents { 72 | // Register the analytics event that are going to be tracked by Baker. 73 | 74 | NSArray *analyticEvents = [NSArray arrayWithObjects: 75 | @"BakerApplicationStart", 76 | @"BakerIssueDownload", 77 | @"BakerIssueOpen", 78 | @"BakerIssueClose", 79 | @"BakerIssuePurchase", 80 | @"BakerIssueArchive", 81 | @"BakerSubscriptionPurchase", 82 | @"BakerViewPage", 83 | @"BakerViewIndexOpen", 84 | @"BakerViewModalBrowser", 85 | nil]; 86 | 87 | for (NSString *eventName in analyticEvents) { 88 | [[NSNotificationCenter defaultCenter] addObserver:self 89 | selector:@selector(receiveEvent:) 90 | name:eventName 91 | object:nil]; 92 | } 93 | 94 | 95 | } 96 | 97 | - (void)receiveEvent:(NSNotification *)notification { 98 | //NSLog(@"[BakerAnalyticsEvent] Received event %@", [notification name]); // Uncomment this to debug 99 | 100 | // If you want, you can handle differently the various events 101 | if ([[notification name] isEqualToString:@"BakerApplicationStart"]) { 102 | // Track here when the Baker app opens 103 | } else if ([[notification name] isEqualToString:@"BakerIssueDownload"]) { 104 | // Track here when a issue download is requested 105 | } else if ([[notification name] isEqualToString:@"BakerIssueOpen"]) { 106 | // Track here when a issue is opened to be read 107 | } else if ([[notification name] isEqualToString:@"BakerIssueClose"]) { 108 | // Track here when a issue that was being read is closed 109 | } else if ([[notification name] isEqualToString:@"BakerIssuePurchase"]) { 110 | // Track here when a issue purchase is requested 111 | } else if ([[notification name] isEqualToString:@"BakerIssueArchive"]) { 112 | // Track here when a issue archival is requested 113 | } else if ([[notification name] isEqualToString:@"BakerSubscriptionPurchase"]) { 114 | // Track here when a subscription purchased is requested 115 | } else if ([[notification name] isEqualToString:@"BakerViewPage"]) { 116 | // Track here when a specific page is opened 117 | // BakerViewController *bakerview = [notification object]; // Uncomment this to get the BakerViewController object and get its properties 118 | //NSLog(@" - Tracking page %d", bakerview.currentPageNumber); // This is useful to check if it works 119 | } else if ([[notification name] isEqualToString:@"BakerViewIndexOpen"]) { 120 | // Track here the opening of the index and status bar 121 | } else if ([[notification name] isEqualToString:@"BakerViewModalBrowser"]) { 122 | // Track here the opening of the modal view 123 | } else { 124 | 125 | } 126 | } 127 | 128 | 129 | @end 130 | -------------------------------------------------------------------------------- /BakerView/lib/Utils.m: -------------------------------------------------------------------------------- 1 | // 2 | // Utils.m 3 | // Baker 4 | // 5 | // ========================================================================================== 6 | // 7 | // Copyright (c) 2010-2013, Davide Casali, Marco Colombo, Alessandro Morandi 8 | // All rights reserved. 9 | // 10 | // Redistribution and use in source and binary forms, with or without modification, are 11 | // permitted provided that the following conditions are met: 12 | // 13 | // Redistributions of source code must retain the above copyright notice, this list of 14 | // conditions and the following disclaimer. 15 | // Redistributions in binary form must reproduce the above copyright notice, this list of 16 | // conditions and the following disclaimer in the documentation and/or other materials 17 | // provided with the distribution. 18 | // Neither the name of the Baker Framework nor the names of its contributors may be used to 19 | // endorse or promote products derived from this software without specific prior written 20 | // permission. 21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 22 | // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 23 | // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 24 | // SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 25 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 26 | // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28 | // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | // 31 | 32 | #define ISPAGED_JS_SNIPPET @"\ 33 | var elem = document.getElementsByName('paged')[0];\ 34 | if (elem) {\ 35 | elem.getAttribute('content');\ 36 | }" 37 | 38 | #import "Utils.h" 39 | #import 40 | 41 | @implementation Utils 42 | 43 | + (UIColor *)colorWithRGBHex:(UInt32)hex { 44 | int r = (hex >> 16) & 0xFF; 45 | int g = (hex >> 8) & 0xFF; 46 | int b = (hex) & 0xFF; 47 | 48 | return [UIColor colorWithRed:r / 255.0f 49 | green:g / 255.0f 50 | blue:b / 255.0f 51 | alpha:1.0f]; 52 | } 53 | + (UIColor *)colorWithHexString:(NSString *)stringToConvert { 54 | // Returns a UIColor by scanning the string for a hex number and passing that to (UIColor *)colorWithRGBHex:(UInt32)hex 55 | // Skips any leading whitespace and ignores any trailing characters 56 | 57 | NSString *hexString = [stringToConvert stringByReplacingOccurrencesOfString:@"#" withString:@""]; 58 | NSScanner *scanner = [NSScanner scannerWithString:hexString]; 59 | 60 | unsigned hexNum; 61 | if (![scanner scanHexInt:&hexNum]) { 62 | return nil; 63 | } 64 | return [Utils colorWithRGBHex:hexNum]; 65 | } 66 | + (NSString *)stringFromInterfaceOrientation:(UIInterfaceOrientation)orientation { 67 | switch (orientation) { 68 | case UIInterfaceOrientationPortrait: return @"UIInterfaceOrientationPortrait"; 69 | case UIInterfaceOrientationPortraitUpsideDown: return @"UIInterfaceOrientationPortraitUpsideDown"; 70 | case UIInterfaceOrientationLandscapeLeft: return @"UIInterfaceOrientationLandscapeLeft"; 71 | case UIInterfaceOrientationLandscapeRight: return @"UIInterfaceOrientationLandscapeRight"; 72 | } 73 | return nil; 74 | } 75 | + (BOOL)webViewShouldBePaged:(UIWebView*)webView forBook:(BakerBook *)book { 76 | BOOL shouldBePaged = NO; 77 | 78 | NSString *pagePagination = [webView stringByEvaluatingJavaScriptFromString:ISPAGED_JS_SNIPPET]; 79 | if ([pagePagination length] > 0) { 80 | shouldBePaged = [pagePagination boolValue]; 81 | } else { 82 | shouldBePaged = [book.bakerVerticalPagination boolValue]; 83 | } 84 | //NSLog(@"[Utils] Current page Pagination Mode status = %d", shouldBePaged); 85 | 86 | return shouldBePaged; 87 | } 88 | + (NSString *)appID { 89 | return [[NSBundle mainBundle] bundleIdentifier]; 90 | } 91 | 92 | + (NSDate *)dateWithFormattedString:(NSString *)string { 93 | static NSDateFormatter *dateFormat = nil; 94 | if (dateFormat == nil) { 95 | dateFormat = [[NSDateFormatter alloc] init]; 96 | NSLocale *enUSPOSIXLocale = [[[NSLocale alloc] initWithLocaleIdentifier:@"en_US_POSIX"] autorelease]; 97 | [dateFormat setLocale:enUSPOSIXLocale]; 98 | [dateFormat setDateFormat:@"yyyy-MM-dd HH:mm:ss"]; 99 | [dateFormat setTimeZone:[NSTimeZone timeZoneForSecondsFromGMT:0]]; 100 | } 101 | return [dateFormat dateFromString:string]; 102 | } 103 | 104 | + (void)showAlertWithTitle:(NSString *)title message:(NSString *)message buttonTitle:(NSString *)buttonTitle { 105 | UIAlertView *alert = [[UIAlertView alloc] initWithTitle:title 106 | message:message 107 | delegate:nil 108 | cancelButtonTitle:buttonTitle 109 | otherButtonTitles:nil]; 110 | [alert show]; 111 | [alert release]; 112 | } 113 | 114 | + (void)webView:(UIWebView *)webView dispatchHTMLEvent:(NSString *)event { 115 | [Utils webView:webView dispatchHTMLEvent:event withParams:[NSDictionary dictionary]]; 116 | } 117 | + (void)webView:(UIWebView *)webView dispatchHTMLEvent:(NSString *)event withParams:(NSDictionary *)params { 118 | __block NSMutableString *jsDispatchEvent = [NSMutableString stringWithFormat: 119 | @"var bakerDispatchedEvent = document.createEvent('Events');\ 120 | bakerDispatchedEvent.initEvent('%@', false, false);", event]; 121 | [params enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) { 122 | NSString *jsParamSet = [NSString stringWithFormat:@"bakerDispatchedEvent.%@='%@';\n", key, obj]; 123 | [jsDispatchEvent appendString:jsParamSet]; 124 | }]; 125 | [jsDispatchEvent appendString:@"window.dispatchEvent(bakerDispatchedEvent);"]; 126 | 127 | [webView stringByEvaluatingJavaScriptFromString:jsDispatchEvent]; 128 | } 129 | 130 | @end 131 | -------------------------------------------------------------------------------- /BakerShelf/lib/NSData+Base64.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSData+Base64.m 3 | // 4 | // Version 1.0.2 5 | // 6 | // Created by Nick Lockwood on 12/01/2012. 7 | // Copyright (C) 2012 Charcoal Design 8 | // 9 | // Distributed under the permissive zlib License 10 | // Get the latest version from here: 11 | // 12 | // https://github.com/nicklockwood/Base64 13 | // 14 | // This software is provided 'as-is', without any express or implied 15 | // warranty. In no event will the authors be held liable for any damages 16 | // arising from the use of this software. 17 | // 18 | // Permission is granted to anyone to use this software for any purpose, 19 | // including commercial applications, and to alter it and redistribute it 20 | // freely, subject to the following restrictions: 21 | // 22 | // 1. The origin of this software must not be misrepresented; you must not 23 | // claim that you wrote the original software. If you use this software 24 | // in a product, an acknowledgment in the product documentation would be 25 | // appreciated but is not required. 26 | // 27 | // 2. Altered source versions must be plainly marked as such, and must not be 28 | // misrepresented as being the original software. 29 | // 30 | // 3. This notice may not be removed or altered from any source distribution. 31 | // 32 | 33 | #import "NSData+Base64.h" 34 | 35 | @implementation NSData (Base64) 36 | 37 | + (NSData *)dataWithBase64EncodedString:(NSString *)string 38 | { 39 | const char lookup[] = 40 | { 41 | 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 42 | 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 43 | 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 62, 99, 99, 99, 63, 44 | 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 99, 99, 99, 99, 99, 99, 45 | 99, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 46 | 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 99, 99, 99, 99, 99, 47 | 99, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 48 | 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 99, 99, 99, 99, 99 49 | }; 50 | 51 | NSData *inputData = [string dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES]; 52 | long long inputLength = [inputData length]; 53 | const unsigned char *inputBytes = [inputData bytes]; 54 | 55 | long long maxOutputLength = (inputLength / 4 + 1) * 3; 56 | NSMutableData *outputData = [NSMutableData dataWithLength:maxOutputLength]; 57 | unsigned char *outputBytes = (unsigned char *)[outputData mutableBytes]; 58 | 59 | int accumulator = 0; 60 | long long outputLength = 0; 61 | unsigned char accumulated[] = {0, 0, 0, 0}; 62 | for (long long i = 0; i < inputLength; i++) 63 | { 64 | unsigned char decoded = lookup[inputBytes[i] & 0x7F]; 65 | if (decoded != 99) 66 | { 67 | accumulated[accumulator] = decoded; 68 | if (accumulator == 3) 69 | { 70 | outputBytes[outputLength++] = (accumulated[0] << 2) | (accumulated[1] >> 4); 71 | outputBytes[outputLength++] = (accumulated[1] << 4) | (accumulated[2] >> 2); 72 | outputBytes[outputLength++] = (accumulated[2] << 6) | accumulated[3]; 73 | } 74 | accumulator = (accumulator + 1) % 4; 75 | } 76 | } 77 | 78 | //handle left-over data 79 | if (accumulator > 0) outputBytes[outputLength] = (accumulated[0] << 2) | (accumulated[1] >> 4); 80 | if (accumulator > 1) outputBytes[++outputLength] = (accumulated[1] << 4) | (accumulated[2] >> 2); 81 | if (accumulator > 2) outputLength++; 82 | 83 | //truncate data to match actual output length 84 | outputData.length = outputLength; 85 | return outputLength? outputData: nil; 86 | } 87 | 88 | - (NSString *)base64EncodedStringWithWrapWidth:(NSUInteger)wrapWidth 89 | { 90 | //ensure wrapWidth is a multiple of 4 91 | wrapWidth = (wrapWidth / 4) * 4; 92 | 93 | const char lookup[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; 94 | 95 | long long inputLength = [self length]; 96 | const unsigned char *inputBytes = [self bytes]; 97 | 98 | long long maxOutputLength = (inputLength / 3 + 1) * 4; 99 | maxOutputLength += wrapWidth? (maxOutputLength / wrapWidth) * 2: 0; 100 | unsigned char *outputBytes = (unsigned char *)malloc(maxOutputLength); 101 | 102 | long long i; 103 | long long outputLength = 0; 104 | for (i = 0; i < inputLength - 2; i += 3) 105 | { 106 | outputBytes[outputLength++] = lookup[(inputBytes[i] & 0xFC) >> 2]; 107 | outputBytes[outputLength++] = lookup[((inputBytes[i] & 0x03) << 4) | ((inputBytes[i + 1] & 0xF0) >> 4)]; 108 | outputBytes[outputLength++] = lookup[((inputBytes[i + 1] & 0x0F) << 2) | ((inputBytes[i + 2] & 0xC0) >> 6)]; 109 | outputBytes[outputLength++] = lookup[inputBytes[i + 2] & 0x3F]; 110 | 111 | //add line break 112 | if (wrapWidth && (outputLength + 2) % (wrapWidth + 2) == 0) 113 | { 114 | outputBytes[outputLength++] = '\r'; 115 | outputBytes[outputLength++] = '\n'; 116 | } 117 | } 118 | 119 | //handle left-over data 120 | if (i == inputLength - 2) 121 | { 122 | // = terminator 123 | outputBytes[outputLength++] = lookup[(inputBytes[i] & 0xFC) >> 2]; 124 | outputBytes[outputLength++] = lookup[((inputBytes[i] & 0x03) << 4) | ((inputBytes[i + 1] & 0xF0) >> 4)]; 125 | outputBytes[outputLength++] = lookup[(inputBytes[i + 1] & 0x0F) << 2]; 126 | outputBytes[outputLength++] = '='; 127 | } 128 | else if (i == inputLength - 1) 129 | { 130 | // == terminator 131 | outputBytes[outputLength++] = lookup[(inputBytes[i] & 0xFC) >> 2]; 132 | outputBytes[outputLength++] = lookup[(inputBytes[i] & 0x03) << 4]; 133 | outputBytes[outputLength++] = '='; 134 | outputBytes[outputLength++] = '='; 135 | } 136 | 137 | //truncate data to match actual output length 138 | outputBytes = realloc(outputBytes, outputLength); 139 | NSString *result = [[NSString alloc] initWithBytesNoCopy:outputBytes length:outputLength encoding:NSASCIIStringEncoding freeWhenDone:YES]; 140 | 141 | #if !__has_feature(objc_arc) 142 | [result autorelease]; 143 | #endif 144 | 145 | return (outputLength >= 4)? result: nil; 146 | } 147 | 148 | - (NSString *)base64EncodedString 149 | { 150 | return [self base64EncodedStringWithWrapWidth:0]; 151 | } 152 | 153 | @end 154 | 155 | -------------------------------------------------------------------------------- /BakerView/BakerViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // RootViewController.h 3 | // Baker 4 | // 5 | // ========================================================================================== 6 | // 7 | // Copyright (c) 2010-2013, Davide Casali, Marco Colombo, Alessandro Morandi 8 | // All rights reserved. 9 | // 10 | // Redistribution and use in source and binary forms, with or without modification, are 11 | // permitted provided that the following conditions are met: 12 | // 13 | // Redistributions of source code must retain the above copyright notice, this list of 14 | // conditions and the following disclaimer. 15 | // Redistributions in binary form must reproduce the above copyright notice, this list of 16 | // conditions and the following disclaimer in the documentation and/or other materials 17 | // provided with the distribution. 18 | // Neither the name of the Baker Framework nor the names of its contributors may be used to 19 | // endorse or promote products derived from this software without specific prior written 20 | // permission. 21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 22 | // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 23 | // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 24 | // SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 25 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 26 | // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28 | // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | // 31 | 32 | 33 | #import 34 | #import 35 | #import "IndexViewController.h" 36 | #import "ModalViewController.h" 37 | #import "BakerBook.h" 38 | #import "BakerBookStatus.h" 39 | 40 | 41 | @class Downloader; 42 | 43 | @interface BakerViewController : UIViewController { 44 | 45 | CGRect screenBounds; 46 | 47 | NSArray *supportedOrientation; 48 | 49 | NSString *defaultScreeshotsPath; 50 | NSString *cachedScreenshotsPath; 51 | 52 | NSString *renderingType; 53 | 54 | NSMutableArray *pages; 55 | NSMutableArray *toLoad; 56 | 57 | NSMutableArray *pageDetails; 58 | NSMutableDictionary *attachedScreenshotPortrait; 59 | NSMutableDictionary *attachedScreenshotLandscape; 60 | 61 | UIImage *backgroundImageLandscape; 62 | UIImage *backgroundImagePortrait; 63 | 64 | NSString *pageNameFromURL; 65 | NSString *anchorFromURL; 66 | 67 | int tapNumber; 68 | int stackedScrollingAnimations; 69 | 70 | BOOL currentPageFirstLoading; 71 | BOOL currentPageIsDelayingLoading; 72 | BOOL currentPageHasChanged; 73 | BOOL currentPageIsLocked; 74 | BOOL currentPageWillAppearUnderModal; 75 | 76 | BOOL userIsScrolling; 77 | BOOL shouldPropagateInterceptedTouch; 78 | BOOL shouldForceOrientationUpdate; 79 | 80 | BOOL adjustViewsOnAppDidBecomeActive; 81 | 82 | UIScrollView *scrollView; 83 | UIWebView *prevPage; 84 | UIWebView *currPage; 85 | UIWebView *nextPage; 86 | 87 | UIColor *webViewBackground; 88 | 89 | CGRect upTapArea; 90 | CGRect downTapArea; 91 | CGRect leftTapArea; 92 | CGRect rightTapArea; 93 | 94 | int totalPages; 95 | int lastPageNumber; 96 | int currentPageNumber; 97 | 98 | int pageWidth; 99 | int pageHeight; 100 | int currentPageHeight; 101 | 102 | NSString *URLDownload; 103 | Downloader *downloader; 104 | UIAlertView *feedbackAlert; 105 | 106 | IndexViewController *indexViewController; 107 | ModalViewController *myModalViewController; 108 | 109 | BakerBookStatus *bookStatus; 110 | } 111 | 112 | #pragma mark - PROPERTIES 113 | @property (strong, nonatomic) BakerBook *book; 114 | @property (nonatomic, retain) UIScrollView *scrollView; 115 | @property (nonatomic, retain) UIWebView *currPage; 116 | 117 | @property int currentPageNumber; 118 | @property BOOL barsHidden; 119 | 120 | #pragma mark - INIT 121 | - (id)initWithBook:(BakerBook *)bakerBook; 122 | - (BOOL)loadBookWithBookPath:(NSString *)bookPath; 123 | - (void)cleanupBookEnvironment; 124 | - (void)resetPageSlots; 125 | - (void)resetPageDetails; 126 | - (void)buildPageArray; 127 | - (void)startReading; 128 | - (void)buildPageDetails; 129 | - (void)setImageFor:(UIImageView *)view; 130 | - (void)updateBookLayout; 131 | - (void)adjustScrollViewPosition; 132 | - (void)setPageSize:(NSString *)orientation; 133 | - (void)setTappableAreaSize; 134 | - (void)showPageDetails; 135 | - (void)setFrame:(CGRect)frame forPage:(UIWebView *)page; 136 | - (void)setupWebView:(UIWebView *)webView; 137 | - (void)removeWebViewDoubleTapGestureRecognizer:(UIView *)view; 138 | 139 | #pragma mark - LOADING 140 | - (BOOL)changePage:(int)page; 141 | - (void)gotoPageDelayer; 142 | - (void)gotoPage; 143 | - (void)lockPage:(NSNumber *)lock; 144 | - (void)addPageLoading:(int)slot; 145 | - (void)handlePageLoading; 146 | - (void)loadSlot:(int)slot withPage:(int)page; 147 | - (BOOL)loadWebView:(UIWebView *)webview withPage:(int)page; 148 | 149 | #pragma mark - MODAL WEBVIEW 150 | - (void)loadModalWebView:(NSURL *)url; 151 | - (void)closeModalWebView; 152 | 153 | #pragma mark - SCROLLVIEW 154 | - (CGRect)frameForPage:(int)page; 155 | 156 | #pragma mark - WEBVIEW 157 | - (void)webView:(UIWebView *)webView hidden:(BOOL)status animating:(BOOL)animating; 158 | - (void)webViewDidAppear:(UIWebView *)webView animating:(BOOL)animating; 159 | - (void)webView:(UIWebView *)webView setCorrectOrientation:(UIInterfaceOrientation)interfaceOrientation; 160 | 161 | #pragma mark - SCREENSHOTS 162 | - (void)removeScreenshots; 163 | - (void)updateScreenshots; 164 | - (BOOL)checkScreeshotForPage:(int)pageNumber andOrientation:(NSString *)interfaceOrientation; 165 | - (void)takeScreenshotFromView:(UIWebView *)webView forPage:(int)pageNumber andOrientation:(NSString *)interfaceOrientation; 166 | - (void)placeScreenshotForView:(UIWebView *)webView andPage:(int)pageNumber andOrientation:(NSString *)interfaceOrientation; 167 | 168 | #pragma mark - GESTURES 169 | - (void)handleInterceptedTouch:(NSNotification *)notification; 170 | - (void)userDidTap:(UITouch *)touch; 171 | - (void)userDidScroll:(UITouch *)touch; 172 | 173 | #pragma mark - PAGE SCROLLING 174 | - (void)setCurrentPageHeight; 175 | - (int)getCurrentPageOffset; 176 | - (void)scrollUpCurrentPage:(int)offset animating:(BOOL)animating; 177 | - (void)scrollDownCurrentPage:(int)offset animating:(BOOL)animating; 178 | - (void)scrollPage:(UIWebView *)webView to:(NSString *)offset animating:(BOOL)animating; 179 | - (void)handleAnchor:(BOOL)animating; 180 | 181 | #pragma mark - BARS VISIBILITY 182 | - (CGRect)getNewNavigationFrame:(BOOL)hidden; 183 | - (void)toggleBars; 184 | - (void)showBars; 185 | - (void)showNavigationBar; 186 | - (void)hideBars:(NSNumber *)animated; 187 | - (void)handleBookProtocol:(NSURL *)url; 188 | 189 | #pragma mark - ORIENTATION 190 | - (NSString *)getCurrentInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation; 191 | 192 | #pragma mark - INDEX VIEW 193 | - (BOOL)isIndexView:(UIWebView *)webView; 194 | 195 | @end 196 | -------------------------------------------------------------------------------- /BakerView/lib/minizip/ioapi.h: -------------------------------------------------------------------------------- 1 | /* ioapi.h -- IO base function header for compress/uncompress .zip 2 | part of the MiniZip project - ( http://www.winimage.com/zLibDll/minizip.html ) 3 | 4 | Copyright (C) 1998-2010 Gilles Vollant (minizip) ( http://www.winimage.com/zLibDll/minizip.html ) 5 | 6 | Modifications for Zip64 support 7 | Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com ) 8 | 9 | For more info read MiniZip_info.txt 10 | 11 | Changes 12 | 13 | Oct-2009 - Defined ZPOS64_T to fpos_t on windows and u_int64_t on linux. (might need to find a better why for this) 14 | Oct-2009 - Change to fseeko64, ftello64 and fopen64 so large files would work on linux. 15 | More if/def section may be needed to support other platforms 16 | Oct-2009 - Defined fxxxx64 calls to normal fopen/ftell/fseek so they would compile on windows. 17 | (but you should use iowin32.c for windows instead) 18 | 19 | */ 20 | 21 | #ifndef _ZLIBIOAPI64_H 22 | #define _ZLIBIOAPI64_H 23 | 24 | #if (!defined(_WIN32)) && (!defined(WIN32)) 25 | 26 | // Linux needs this to support file operation on files larger then 4+GB 27 | // But might need better if/def to select just the platforms that needs them. 28 | 29 | #ifndef __USE_FILE_OFFSET64 30 | #define __USE_FILE_OFFSET64 31 | #endif 32 | #ifndef __USE_LARGEFILE64 33 | #define __USE_LARGEFILE64 34 | #endif 35 | #ifndef _LARGEFILE64_SOURCE 36 | #define _LARGEFILE64_SOURCE 37 | #endif 38 | #ifndef _FILE_OFFSET_BIT 39 | #define _FILE_OFFSET_BIT 64 40 | #endif 41 | #endif 42 | 43 | #include 44 | #include 45 | #include "zlib.h" 46 | 47 | #define USE_FILE32API 48 | #if defined(USE_FILE32API) 49 | #define fopen64 fopen 50 | #define ftello64 ftell 51 | #define fseeko64 fseek 52 | #else 53 | #ifdef _MSC_VER 54 | #define fopen64 fopen 55 | #if (_MSC_VER >= 1400) && (!(defined(NO_MSCVER_FILE64_FUNC))) 56 | #define ftello64 _ftelli64 57 | #define fseeko64 _fseeki64 58 | #else // old MSC 59 | #define ftello64 ftell 60 | #define fseeko64 fseek 61 | #endif 62 | #endif 63 | #endif 64 | 65 | /* 66 | #ifndef ZPOS64_T 67 | #ifdef _WIN32 68 | #define ZPOS64_T fpos_t 69 | #else 70 | #include 71 | #define ZPOS64_T uint64_t 72 | #endif 73 | #endif 74 | */ 75 | 76 | #ifdef HAVE_MINIZIP64_CONF_H 77 | #include "mz64conf.h" 78 | #endif 79 | 80 | /* a type choosen by DEFINE */ 81 | #ifdef HAVE_64BIT_INT_CUSTOM 82 | typedef 64BIT_INT_CUSTOM_TYPE ZPOS64_T; 83 | #else 84 | #ifdef HAS_STDINT_H 85 | #include "stdint.h" 86 | typedef uint64_t ZPOS64_T; 87 | #else 88 | 89 | 90 | #if defined(_MSC_VER) || defined(__BORLANDC__) 91 | typedef unsigned __int64 ZPOS64_T; 92 | #else 93 | typedef unsigned long long int ZPOS64_T; 94 | #endif 95 | #endif 96 | #endif 97 | 98 | 99 | 100 | #ifdef __cplusplus 101 | extern "C" { 102 | #endif 103 | 104 | 105 | #define ZLIB_FILEFUNC_SEEK_CUR (1) 106 | #define ZLIB_FILEFUNC_SEEK_END (2) 107 | #define ZLIB_FILEFUNC_SEEK_SET (0) 108 | 109 | #define ZLIB_FILEFUNC_MODE_READ (1) 110 | #define ZLIB_FILEFUNC_MODE_WRITE (2) 111 | #define ZLIB_FILEFUNC_MODE_READWRITEFILTER (3) 112 | 113 | #define ZLIB_FILEFUNC_MODE_EXISTING (4) 114 | #define ZLIB_FILEFUNC_MODE_CREATE (8) 115 | 116 | 117 | #ifndef ZCALLBACK 118 | #if (defined(WIN32) || defined(_WIN32) || defined (WINDOWS) || defined (_WINDOWS)) && defined(CALLBACK) && defined (USEWINDOWS_CALLBACK) 119 | #define ZCALLBACK CALLBACK 120 | #else 121 | #define ZCALLBACK 122 | #endif 123 | #endif 124 | 125 | 126 | 127 | 128 | typedef voidpf (ZCALLBACK *open_file_func) OF((voidpf opaque, const char* filename, int mode)); 129 | typedef uLong (ZCALLBACK *read_file_func) OF((voidpf opaque, voidpf stream, void* buf, uLong size)); 130 | typedef uLong (ZCALLBACK *write_file_func) OF((voidpf opaque, voidpf stream, const void* buf, uLong size)); 131 | typedef int (ZCALLBACK *close_file_func) OF((voidpf opaque, voidpf stream)); 132 | typedef int (ZCALLBACK *testerror_file_func) OF((voidpf opaque, voidpf stream)); 133 | 134 | typedef long (ZCALLBACK *tell_file_func) OF((voidpf opaque, voidpf stream)); 135 | typedef long (ZCALLBACK *seek_file_func) OF((voidpf opaque, voidpf stream, uLong offset, int origin)); 136 | 137 | 138 | /* here is the "old" 32 bits structure structure */ 139 | typedef struct zlib_filefunc_def_s 140 | { 141 | open_file_func zopen_file; 142 | read_file_func zread_file; 143 | write_file_func zwrite_file; 144 | tell_file_func ztell_file; 145 | seek_file_func zseek_file; 146 | close_file_func zclose_file; 147 | testerror_file_func zerror_file; 148 | voidpf opaque; 149 | } zlib_filefunc_def; 150 | 151 | typedef ZPOS64_T (ZCALLBACK *tell64_file_func) OF((voidpf opaque, voidpf stream)); 152 | typedef long (ZCALLBACK *seek64_file_func) OF((voidpf opaque, voidpf stream, ZPOS64_T offset, int origin)); 153 | typedef voidpf (ZCALLBACK *open64_file_func) OF((voidpf opaque, const void* filename, int mode)); 154 | 155 | typedef struct zlib_filefunc64_def_s 156 | { 157 | open64_file_func zopen64_file; 158 | read_file_func zread_file; 159 | write_file_func zwrite_file; 160 | tell64_file_func ztell64_file; 161 | seek64_file_func zseek64_file; 162 | close_file_func zclose_file; 163 | testerror_file_func zerror_file; 164 | voidpf opaque; 165 | } zlib_filefunc64_def; 166 | 167 | void fill_fopen64_filefunc OF((zlib_filefunc64_def* pzlib_filefunc_def)); 168 | void fill_fopen_filefunc OF((zlib_filefunc_def* pzlib_filefunc_def)); 169 | 170 | /* now internal definition, only for zip.c and unzip.h */ 171 | typedef struct zlib_filefunc64_32_def_s 172 | { 173 | zlib_filefunc64_def zfile_func64; 174 | open_file_func zopen32_file; 175 | tell_file_func ztell32_file; 176 | seek_file_func zseek32_file; 177 | } zlib_filefunc64_32_def; 178 | 179 | 180 | #define ZREAD64(filefunc,filestream,buf,size) ((*((filefunc).zfile_func64.zread_file)) ((filefunc).zfile_func64.opaque,filestream,buf,size)) 181 | #define ZWRITE64(filefunc,filestream,buf,size) ((*((filefunc).zfile_func64.zwrite_file)) ((filefunc).zfile_func64.opaque,filestream,buf,size)) 182 | //#define ZTELL64(filefunc,filestream) ((*((filefunc).ztell64_file)) ((filefunc).opaque,filestream)) 183 | //#define ZSEEK64(filefunc,filestream,pos,mode) ((*((filefunc).zseek64_file)) ((filefunc).opaque,filestream,pos,mode)) 184 | #define ZCLOSE64(filefunc,filestream) ((*((filefunc).zfile_func64.zclose_file)) ((filefunc).zfile_func64.opaque,filestream)) 185 | #define ZERROR64(filefunc,filestream) ((*((filefunc).zfile_func64.zerror_file)) ((filefunc).zfile_func64.opaque,filestream)) 186 | 187 | voidpf call_zopen64 OF((const zlib_filefunc64_32_def* pfilefunc,const void*filename,int mode)); 188 | long call_zseek64 OF((const zlib_filefunc64_32_def* pfilefunc,voidpf filestream, ZPOS64_T offset, int origin)); 189 | ZPOS64_T call_ztell64 OF((const zlib_filefunc64_32_def* pfilefunc,voidpf filestream)); 190 | 191 | void fill_zlib_filefunc64_32_def_from_filefunc32(zlib_filefunc64_32_def* p_filefunc64_32,const zlib_filefunc_def* p_filefunc32); 192 | 193 | #define ZOPEN64(filefunc,filename,mode) (call_zopen64((&(filefunc)),(filename),(mode))) 194 | #define ZTELL64(filefunc,filestream) (call_ztell64((&(filefunc)),(filestream))) 195 | #define ZSEEK64(filefunc,filestream,pos,mode) (call_zseek64((&(filefunc)),(filestream),(pos),(mode))) 196 | 197 | #ifdef __cplusplus 198 | } 199 | #endif 200 | 201 | #endif 202 | --------------------------------------------------------------------------------