From b274f9e1eef40625933151953faaf22b606fa1a4 Mon Sep 17 00:00:00 2001 From: Florian Strauss Date: Thu, 4 Jul 2013 13:10:16 +0200 Subject: [PATCH] Searching --- .gitmodules | 3 + Lodestone.xcodeproj/project.pbxproj | 78 +++++++- Lodestone/Base.lproj/Main_iPad.storyboard | 10 +- Lodestone/Base.lproj/Main_iPhone.storyboard | 177 +++++++++++++++++- Lodestone/CharacterCell.h | 17 ++ Lodestone/CharacterCell.m | 15 ++ ...iewController.h => DetailViewController.h} | 4 +- ...iewController.m => DetailViewController.m} | 20 +- Lodestone/FFCharacter.h | 4 +- Lodestone/FFCharacter.m | 4 + Lodestone/FFLodestone.h | 7 +- Lodestone/FFLodestone.m | 63 ++++++- Lodestone/SearchViewController.h | 15 ++ Lodestone/SearchViewController.m | 91 +++++++++ Lodestone/SidePanelViewController.h | 13 ++ Lodestone/SidePanelViewController.m | 23 +++ Lodestone/libs/JASidePanels | 1 + README.md | 33 ++++ 18 files changed, 548 insertions(+), 30 deletions(-) create mode 100644 Lodestone/CharacterCell.h create mode 100644 Lodestone/CharacterCell.m rename Lodestone/{ViewController.h => DetailViewController.h} (79%) rename Lodestone/{ViewController.m => DetailViewController.m} (65%) create mode 100644 Lodestone/SearchViewController.h create mode 100644 Lodestone/SearchViewController.m create mode 100644 Lodestone/SidePanelViewController.h create mode 100644 Lodestone/SidePanelViewController.m create mode 160000 Lodestone/libs/JASidePanels diff --git a/.gitmodules b/.gitmodules index 64d2371..33db12d 100644 --- a/.gitmodules +++ b/.gitmodules @@ -7,3 +7,6 @@ [submodule "Lodestone/libs/SDWebImage"] path = Lodestone/libs/SDWebImage url = https://github.com/rs/SDWebImage.git +[submodule "Lodestone/libs/JASidePanels"] + path = Lodestone/libs/JASidePanels + url = https://github.com/gotosleep/JASidePanels.git diff --git a/Lodestone.xcodeproj/project.pbxproj b/Lodestone.xcodeproj/project.pbxproj index bd3e9b6..d9a3a21 100644 --- a/Lodestone.xcodeproj/project.pbxproj +++ b/Lodestone.xcodeproj/project.pbxproj @@ -7,6 +7,9 @@ objects = { /* Begin PBXBuildFile section */ + 4814837417858E8600FF3EDB /* README.md in Resources */ = {isa = PBXBuildFile; fileRef = 4814837317858E8600FF3EDB /* README.md */; }; + 48520BED17858BB400AA48F5 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 48520BEC17858BB400AA48F5 /* QuartzCore.framework */; }; + 48520BEF17858BD200AA48F5 /* CoreImage.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 48520BEE17858BD200AA48F5 /* CoreImage.framework */; }; 48615A021784441100443BFE /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 48615A011784441100443BFE /* Foundation.framework */; }; 48615A041784441100443BFE /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 48615A031784441100443BFE /* CoreGraphics.framework */; }; 48615A061784441100443BFE /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 48615A051784441100443BFE /* UIKit.framework */; }; @@ -15,9 +18,9 @@ 48615A121784441100443BFE /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 48615A111784441100443BFE /* AppDelegate.m */; }; 48615A151784441100443BFE /* Main_iPhone.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 48615A131784441100443BFE /* Main_iPhone.storyboard */; }; 48615A181784441100443BFE /* Main_iPad.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 48615A161784441100443BFE /* Main_iPad.storyboard */; }; - 48615A1B1784441100443BFE /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 48615A1A1784441100443BFE /* ViewController.m */; }; + 48615A1B1784441100443BFE /* DetailViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 48615A1A1784441100443BFE /* DetailViewController.m */; }; 48615A1D1784441100443BFE /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 48615A1C1784441100443BFE /* Images.xcassets */; }; - 48615A241784441100443BFE /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 48615A231784441100443BFE /* XCTest.framework */; }; + 48615A241784441100443BFE /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 48615A231784441100443BFE /* XCTest.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; 48615A251784441100443BFE /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 48615A011784441100443BFE /* Foundation.framework */; }; 48615A261784441100443BFE /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 48615A051784441100443BFE /* UIKit.framework */; }; 48615A2E1784441100443BFE /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 48615A2C1784441100443BFE /* InfoPlist.strings */; }; @@ -53,6 +56,12 @@ 48615B2617844C5B00443BFE /* XPathQuery.m in Sources */ = {isa = PBXBuildFile; fileRef = 48615B2117844C5B00443BFE /* XPathQuery.m */; }; 48615B2717844C5B00443BFE /* XPathQuery.m in Sources */ = {isa = PBXBuildFile; fileRef = 48615B2117844C5B00443BFE /* XPathQuery.m */; }; 48615B2917844C6D00443BFE /* libxml2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 48615B2817844C6D00443BFE /* libxml2.dylib */; }; + 4899D71D17858147009FF634 /* CharacterCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 4899D71C17858147009FF634 /* CharacterCell.m */; }; + 4899D725178582C5009FF634 /* JASidePanelController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4899D722178582C5009FF634 /* JASidePanelController.m */; }; + 4899D726178582C5009FF634 /* UIViewController+JASidePanel.m in Sources */ = {isa = PBXBuildFile; fileRef = 4899D724178582C5009FF634 /* UIViewController+JASidePanel.m */; }; + 4899D72917858378009FF634 /* SidePanelViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4899D728178582E2009FF634 /* SidePanelViewController.m */; }; + 4899D72A1785877B009FF634 /* SearchViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4899D71F17858195009FF634 /* SearchViewController.m */; }; + 48B38B2917858D4700EE65D4 /* MapKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 48B38B2817858D4700EE65D4 /* MapKit.framework */; }; 48C5CA97178565F400865676 /* UIViewController+Loading.m in Sources */ = {isa = PBXBuildFile; fileRef = 48C5CA90178565F400865676 /* UIViewController+Loading.m */; }; 48C5CA98178565F400865676 /* UIViewController+Loading.m in Sources */ = {isa = PBXBuildFile; fileRef = 48C5CA90178565F400865676 /* UIViewController+Loading.m */; }; 48C5CA9B178565F400865676 /* UIColor+TKCategory.m in Sources */ = {isa = PBXBuildFile; fileRef = 48C5CA94178565F400865676 /* UIColor+TKCategory.m */; }; @@ -88,6 +97,9 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ + 4814837317858E8600FF3EDB /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README.md; sourceTree = ""; }; + 48520BEC17858BB400AA48F5 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; + 48520BEE17858BD200AA48F5 /* CoreImage.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreImage.framework; path = System/Library/Frameworks/CoreImage.framework; sourceTree = SDKROOT; }; 486159FE1784441100443BFE /* Lodestone.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Lodestone.app; sourceTree = BUILT_PRODUCTS_DIR; }; 48615A011784441100443BFE /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 48615A031784441100443BFE /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; @@ -100,8 +112,8 @@ 48615A111784441100443BFE /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 48615A141784441100443BFE /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main_iPhone.storyboard; sourceTree = ""; }; 48615A171784441100443BFE /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main_iPad.storyboard; sourceTree = ""; }; - 48615A191784441100443BFE /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; - 48615A1A1784441100443BFE /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; + 48615A191784441100443BFE /* DetailViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DetailViewController.h; sourceTree = ""; }; + 48615A1A1784441100443BFE /* DetailViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DetailViewController.m; sourceTree = ""; }; 48615A1C1784441100443BFE /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 48615A221784441100443BFE /* LodestoneTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = LodestoneTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 48615A231784441100443BFE /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; }; @@ -140,6 +152,17 @@ 48615B2017844C5B00443BFE /* XPathQuery.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = XPathQuery.h; path = hpple/XPathQuery.h; sourceTree = ""; }; 48615B2117844C5B00443BFE /* XPathQuery.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = XPathQuery.m; path = hpple/XPathQuery.m; sourceTree = ""; }; 48615B2817844C6D00443BFE /* libxml2.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libxml2.dylib; path = usr/lib/libxml2.dylib; sourceTree = SDKROOT; }; + 4899D71B17858147009FF634 /* CharacterCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CharacterCell.h; sourceTree = ""; }; + 4899D71C17858147009FF634 /* CharacterCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CharacterCell.m; sourceTree = ""; }; + 4899D71E17858195009FF634 /* SearchViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SearchViewController.h; sourceTree = ""; }; + 4899D71F17858195009FF634 /* SearchViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SearchViewController.m; sourceTree = ""; }; + 4899D721178582C5009FF634 /* JASidePanelController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JASidePanelController.h; path = JASidePanels/JASidePanels/Source/JASidePanelController.h; sourceTree = ""; }; + 4899D722178582C5009FF634 /* JASidePanelController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = JASidePanelController.m; path = JASidePanels/JASidePanels/Source/JASidePanelController.m; sourceTree = ""; }; + 4899D723178582C5009FF634 /* UIViewController+JASidePanel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "UIViewController+JASidePanel.h"; path = "JASidePanels/JASidePanels/Source/UIViewController+JASidePanel.h"; sourceTree = ""; }; + 4899D724178582C5009FF634 /* UIViewController+JASidePanel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "UIViewController+JASidePanel.m"; path = "JASidePanels/JASidePanels/Source/UIViewController+JASidePanel.m"; sourceTree = ""; }; + 4899D727178582E2009FF634 /* SidePanelViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SidePanelViewController.h; sourceTree = ""; }; + 4899D728178582E2009FF634 /* SidePanelViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SidePanelViewController.m; sourceTree = ""; }; + 48B38B2817858D4700EE65D4 /* MapKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MapKit.framework; path = System/Library/Frameworks/MapKit.framework; sourceTree = SDKROOT; }; 48C5CA8F178565F400865676 /* UIViewController+Loading.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIViewController+Loading.h"; sourceTree = ""; }; 48C5CA90178565F400865676 /* UIViewController+Loading.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIViewController+Loading.m"; sourceTree = ""; }; 48C5CA93178565F400865676 /* UIColor+TKCategory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIColor+TKCategory.h"; sourceTree = ""; }; @@ -184,6 +207,9 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 48B38B2917858D4700EE65D4 /* MapKit.framework in Frameworks */, + 48520BEF17858BD200AA48F5 /* CoreImage.framework in Frameworks */, + 48520BED17858BB400AA48F5 /* QuartzCore.framework in Frameworks */, 48615B2917844C6D00443BFE /* libxml2.dylib in Frameworks */, 48615B1A1784448000443BFE /* MobileCoreServices.framework in Frameworks */, 48615B181784447900443BFE /* SystemConfiguration.framework in Frameworks */, @@ -214,6 +240,7 @@ 48615A391784444400443BFE /* libs */, 48615A001784441100443BFE /* Frameworks */, 486159FF1784441100443BFE /* Products */, + 4814837317858E8600FF3EDB /* README.md */, ); sourceTree = ""; }; @@ -229,6 +256,9 @@ 48615A001784441100443BFE /* Frameworks */ = { isa = PBXGroup; children = ( + 48B38B2817858D4700EE65D4 /* MapKit.framework */, + 48520BEE17858BD200AA48F5 /* CoreImage.framework */, + 48520BEC17858BB400AA48F5 /* QuartzCore.framework */, 48615B2817844C6D00443BFE /* libxml2.dylib */, 48615B191784448000443BFE /* MobileCoreServices.framework */, 48615B171784447900443BFE /* SystemConfiguration.framework */, @@ -245,13 +275,12 @@ children = ( 48C5CA9F1785660200865676 /* Views */, 48C5CA8E178565D600865676 /* Categories */, + 4899D71A17856E96009FF634 /* Controller */, 48615B0E1784444B00443BFE /* Lodestone */, 48615A101784441100443BFE /* AppDelegate.h */, 48615A111784441100443BFE /* AppDelegate.m */, 48615A131784441100443BFE /* Main_iPhone.storyboard */, 48615A161784441100443BFE /* Main_iPad.storyboard */, - 48615A191784441100443BFE /* ViewController.h */, - 48615A1A1784441100443BFE /* ViewController.m */, 48615A1C1784441100443BFE /* Images.xcassets */, 48615A081784441100443BFE /* Supporting Files */, ); @@ -290,6 +319,7 @@ 48615A391784444400443BFE /* libs */ = { isa = PBXGroup; children = ( + 4899D720178582BC009FF634 /* JASidePanels */, 48D820DC178567B900C8EE68 /* SDWebImage */, 48615B1B17844C4D00443BFE /* hpple */, 48615A3D1784444400443BFE /* AFNetworking */, @@ -349,6 +379,30 @@ name = hpple; sourceTree = ""; }; + 4899D71A17856E96009FF634 /* Controller */ = { + isa = PBXGroup; + children = ( + 48615A191784441100443BFE /* DetailViewController.h */, + 48615A1A1784441100443BFE /* DetailViewController.m */, + 4899D71E17858195009FF634 /* SearchViewController.h */, + 4899D71F17858195009FF634 /* SearchViewController.m */, + 4899D727178582E2009FF634 /* SidePanelViewController.h */, + 4899D728178582E2009FF634 /* SidePanelViewController.m */, + ); + name = Controller; + sourceTree = ""; + }; + 4899D720178582BC009FF634 /* JASidePanels */ = { + isa = PBXGroup; + children = ( + 4899D721178582C5009FF634 /* JASidePanelController.h */, + 4899D722178582C5009FF634 /* JASidePanelController.m */, + 4899D723178582C5009FF634 /* UIViewController+JASidePanel.h */, + 4899D724178582C5009FF634 /* UIViewController+JASidePanel.m */, + ); + name = JASidePanels; + sourceTree = ""; + }; 48C5CA8E178565D600865676 /* Categories */ = { isa = PBXGroup; children = ( @@ -367,6 +421,8 @@ children = ( 48C5CAA01785660D00865676 /* DDProgressView.h */, 48C5CAA11785660D00865676 /* DDProgressView.m */, + 4899D71B17858147009FF634 /* CharacterCell.h */, + 4899D71C17858147009FF634 /* CharacterCell.m */, ); name = Views; sourceTree = ""; @@ -486,6 +542,7 @@ files = ( 48615A181784441100443BFE /* Main_iPad.storyboard in Resources */, 48615A1D1784441100443BFE /* Images.xcassets in Resources */, + 4814837417858E8600FF3EDB /* README.md in Resources */, 48615A151784441100443BFE /* Main_iPhone.storyboard in Resources */, 48615A0C1784441100443BFE /* InfoPlist.strings in Resources */, ); @@ -511,12 +568,15 @@ 48D820FA178567B900C8EE68 /* MKAnnotationView+WebCache.m in Sources */, 48C5CA9D178565F400865676 /* UIViewController+Error.m in Sources */, 48615AA01784444500443BFE /* AFImageRequestOperation.m in Sources */, + 4899D726178582C5009FF634 /* UIViewController+JASidePanel.m in Sources */, 48D820FB178567B900C8EE68 /* NSData+GIF.m in Sources */, - 48615A1B1784441100443BFE /* ViewController.m in Sources */, + 48615A1B1784441100443BFE /* DetailViewController.m in Sources */, 48615AA61784444500443BFE /* AFPropertyListRequestOperation.m in Sources */, 48D820FD178567B900C8EE68 /* SDWebImageCompat.m in Sources */, 48D820FC178567B900C8EE68 /* SDImageCache.m in Sources */, 48D82105178567B900C8EE68 /* UIImage+MultiFormat.m in Sources */, + 4899D72917858378009FF634 /* SidePanelViewController.m in Sources */, + 4899D725178582C5009FF634 /* JASidePanelController.m in Sources */, 48D82104178567B900C8EE68 /* UIImage+GIF.m in Sources */, 48D820FF178567B900C8EE68 /* SDWebImageDownloader.m in Sources */, 48615A121784441100443BFE /* AppDelegate.m in Sources */, @@ -525,6 +585,7 @@ 48C5CAA21785660D00865676 /* DDProgressView.m in Sources */, 48615B131784445400443BFE /* FFCharacter.m in Sources */, 48615AAA1784444500443BFE /* AFXMLRequestOperation.m in Sources */, + 4899D72A1785877B009FF634 /* SearchViewController.m in Sources */, 48615AA21784444500443BFE /* AFJSONRequestOperation.m in Sources */, 48615B2417844C5B00443BFE /* TFHppleElement.m in Sources */, 48D82100178567B900C8EE68 /* SDWebImageDownloaderOperation.m in Sources */, @@ -533,6 +594,7 @@ 48D82102178567B900C8EE68 /* SDWebImagePrefetcher.m in Sources */, 48D82106178567B900C8EE68 /* UIImage+WebP.m in Sources */, 48D82101178567B900C8EE68 /* SDWebImageManager.m in Sources */, + 4899D71D17858147009FF634 /* CharacterCell.m in Sources */, 48615B2217844C5B00443BFE /* TFHpple.m in Sources */, 48615A9E1784444500443BFE /* AFHTTPRequestOperation.m in Sources */, 48615B151784445400443BFE /* FFLodestone.m in Sources */, @@ -695,6 +757,7 @@ GCC_PREFIX_HEADER = "Lodestone/Lodestone-Prefix.pch"; HEADER_SEARCH_PATHS = "$(SDKROOT)/usr/include/libxml2"; INFOPLIST_FILE = "Lodestone/Lodestone-Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 6.0; PRODUCT_NAME = "$(TARGET_NAME)"; WRAPPER_EXTENSION = app; }; @@ -709,6 +772,7 @@ GCC_PREFIX_HEADER = "Lodestone/Lodestone-Prefix.pch"; HEADER_SEARCH_PATHS = "$(SDKROOT)/usr/include/libxml2"; INFOPLIST_FILE = "Lodestone/Lodestone-Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 6.0; PRODUCT_NAME = "$(TARGET_NAME)"; WRAPPER_EXTENSION = app; }; diff --git a/Lodestone/Base.lproj/Main_iPad.storyboard b/Lodestone/Base.lproj/Main_iPad.storyboard index a185e8a..b7a08a7 100644 --- a/Lodestone/Base.lproj/Main_iPad.storyboard +++ b/Lodestone/Base.lproj/Main_iPad.storyboard @@ -1,18 +1,20 @@ - + - + + - + - + + diff --git a/Lodestone/Base.lproj/Main_iPhone.storyboard b/Lodestone/Base.lproj/Main_iPhone.storyboard index a299b28..27c2ae7 100644 --- a/Lodestone/Base.lproj/Main_iPhone.storyboard +++ b/Lodestone/Base.lproj/Main_iPhone.storyboard @@ -1,13 +1,14 @@ - + + - + - + @@ -29,7 +30,7 @@ - + @@ -41,18 +42,158 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + @@ -60,6 +201,28 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/Lodestone/CharacterCell.h b/Lodestone/CharacterCell.h new file mode 100644 index 0000000..472ec55 --- /dev/null +++ b/Lodestone/CharacterCell.h @@ -0,0 +1,17 @@ +// +// CharacterCell.h +// Lodestone +// +// Created by Florian Strauss on 04.07.13. +// Copyright (c) 2013 Orlyapps Janzen & Strauß GbR. All rights reserved. +// + +#import + +@interface CharacterCell : UITableViewCell + +@property (weak, nonatomic) IBOutlet UILabel *nameLabel; +@property (weak, nonatomic) IBOutlet UILabel *serverLabel; +@property (weak, nonatomic) IBOutlet UIImageView *thumbnailImage; + +@end diff --git a/Lodestone/CharacterCell.m b/Lodestone/CharacterCell.m new file mode 100644 index 0000000..63c49df --- /dev/null +++ b/Lodestone/CharacterCell.m @@ -0,0 +1,15 @@ +// +// CharacterCell.m +// Lodestone +// +// Created by Florian Strauss on 04.07.13. +// Copyright (c) 2013 Orlyapps Janzen & Strauß GbR. All rights reserved. +// + +#import "CharacterCell.h" + +@implementation CharacterCell + + + +@end diff --git a/Lodestone/ViewController.h b/Lodestone/DetailViewController.h similarity index 79% rename from Lodestone/ViewController.h rename to Lodestone/DetailViewController.h index 85083cd..e2dc716 100644 --- a/Lodestone/ViewController.h +++ b/Lodestone/DetailViewController.h @@ -9,9 +9,9 @@ #import #import "FFLodestone.h" -@interface ViewController : UIViewController +@interface DetailViewController : UIViewController -@property (weak, nonatomic) FFCharacter *character; +@property (strong, nonatomic) FFCharacter *character; @property (weak, nonatomic) IBOutlet UILabel *nameLabel; @property (weak, nonatomic) IBOutlet UILabel *serverLabel; @property (weak, nonatomic) IBOutlet UIImageView *thumbnailImage; diff --git a/Lodestone/ViewController.m b/Lodestone/DetailViewController.m similarity index 65% rename from Lodestone/ViewController.m rename to Lodestone/DetailViewController.m index 0bb6265..b9f0a46 100644 --- a/Lodestone/ViewController.m +++ b/Lodestone/DetailViewController.m @@ -6,31 +6,39 @@ // Copyright (c) 2013 Orlyapps Janzen & Strauß GbR. All rights reserved. // -#import "ViewController.h" +#import "DetailViewController.h" -@interface ViewController () +@interface DetailViewController () @end -@implementation ViewController +@implementation DetailViewController - (void)viewDidLoad { [super viewDidLoad]; + + +} +- (void)setCharacter:(FFCharacter *)character { + + [self loading:YES]; - [[FFLodestone sharedInstance] fetchCharacterWithId:@"1674571" completionHandler:^(FFCharacter *character, NSError *error) { + [[FFLodestone sharedInstance] fetchCharacterWithId:character.identifier completionHandler:^(FFCharacter *character, NSError *error) { + if(error != nil) { [self displayError:error]; return; } + [self loading:NO]; - self.character = character; + _character = character; [self setupContent]; }]; + } - - (void)setupContent { self.title = self.character.name; self.nameLabel.text = self.character.name; diff --git a/Lodestone/FFCharacter.h b/Lodestone/FFCharacter.h index a33d0f4..8bdb394 100644 --- a/Lodestone/FFCharacter.h +++ b/Lodestone/FFCharacter.h @@ -14,9 +14,11 @@ @interface FFCharacter : NSObject +@property (nonatomic, strong) NSString *identifier; @property (nonatomic, strong) NSString *name; @property (nonatomic, strong) NSString *server; @property (nonatomic, strong) NSString *mainLVL; +@property (nonatomic, strong) NSString *region; @property (nonatomic, strong) NSString *race; @property (nonatomic, strong) NSString *nameday; @property (nonatomic, strong) NSString *guardian; @@ -24,10 +26,8 @@ @property (nonatomic, strong) NSString *grandCompany; // TODO @property (nonatomic, strong) NSString *gcRank; // TODO @property (nonatomic, strong) NSString *freeCompany; // TODO - @property (nonatomic, strong) NSURL *picture; @property (nonatomic, strong) NSURL *thumbnail; - @property (nonatomic, strong) NSDictionary *stats; @property (nonatomic, strong) NSDictionary *attributes; @property (nonatomic, strong) NSDictionary *elements; diff --git a/Lodestone/FFCharacter.m b/Lodestone/FFCharacter.m index 3f6ceef..6c7167f 100644 --- a/Lodestone/FFCharacter.m +++ b/Lodestone/FFCharacter.m @@ -132,5 +132,9 @@ + (id)characterWithData:(NSData *)data { return character; } +- (NSString *)description { + return [NSString stringWithFormat:@"%@ - %@", self.name, self.server]; +} + @end diff --git a/Lodestone/FFLodestone.h b/Lodestone/FFLodestone.h index 8242c3d..80d2051 100644 --- a/Lodestone/FFLodestone.h +++ b/Lodestone/FFLodestone.h @@ -14,6 +14,7 @@ #define kFFLodestoneUserAgent @"Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1468.0 Safari/537.36" typedef void(^FFLodestoneCharacterHandler)(FFCharacter *character, NSError *error); +typedef void(^FFLodestoneCharacterSearchHandler)(NSArray *characters, NSError *error); @interface FFLodestone : NSObject @@ -21,6 +22,10 @@ typedef void(^FFLodestoneCharacterHandler)(FFCharacter *character, NSError *erro + (FFLodestone *)sharedInstance; -- (void)fetchCharacterWithId:(NSString *)characterID completionHandler:(FFLodestoneCharacterHandler)handler; +- (AFHTTPRequestOperation *)fetchCharacterWithId:(NSString *)characterID + completionHandler:(FFLodestoneCharacterHandler)handler; + +- (AFHTTPRequestOperation *)searchCharacterWithName:(NSString *)name worldName:(NSString *)world + classjob:(NSString *)classjob completionHandler:(FFLodestoneCharacterSearchHandler)handler; @end diff --git a/Lodestone/FFLodestone.m b/Lodestone/FFLodestone.m index 0d413d7..ed96c30 100644 --- a/Lodestone/FFLodestone.m +++ b/Lodestone/FFLodestone.m @@ -8,6 +8,7 @@ #import "FFLodestone.h" #import "FFCharacter.h" +#import "TFHpple.h" @interface FFLodestone() @@ -47,7 +48,7 @@ - (id)init return self; } -- (void)fetchCharacterWithId:(NSString *)characterID completionHandler:(FFLodestoneCharacterHandler)handler { +- (AFHTTPRequestOperation *)fetchCharacterWithId:(NSString *)characterID completionHandler:(FFLodestoneCharacterHandler)handler { NSURLRequest *request = [self.client requestWithMethod:@"GET" @@ -66,6 +67,66 @@ - (void)fetchCharacterWithId:(NSString *)characterID completionHandler:(FFLodest }]; [operation start]; + return operation; +} + +- (AFHTTPRequestOperation *)searchCharacterWithName:(NSString *)name worldName:(NSString *)world + classjob:(NSString *)classjob completionHandler:(FFLodestoneCharacterSearchHandler)handler { + + if(world == nil) world = @""; + if(classjob == nil) classjob = @""; + + NSURLRequest *request = [self.client requestWithMethod:@"GET" + path:[NSString stringWithFormat:@"%@",kFFLodestoneCharacterURLPath, nil] + parameters:@{@"q": name, @"worldname" : world, @"classjob": classjob}]; + + AFHTTPRequestOperation *operation = [[AFHTTPRequestOperation alloc] initWithRequest:request]; + [operation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) { + + NSData *data = (NSData *)responseObject; + + + NSMutableArray *result = [NSMutableArray array]; + + TFHpple *page = [TFHpple hppleWithHTMLData:data]; + + NSArray *characters = [page searchWithXPathQuery:@"//div[@class='table_black_border_bottom']//tr"]; + + for (TFHppleElement *characterElement in characters) { + + NSData *characterData = [characterElement.raw dataUsingEncoding:NSUTF8StringEncoding]; + TFHpple *characterRow = [TFHpple hppleWithHTMLData:characterData]; + + TFHppleElement *nameElement = [[characterRow searchWithXPathQuery:@"//a"] objectAtIndex:0]; + + TFHppleElement *serverElement = [[characterRow searchWithXPathQuery:@"//h4/span"] objectAtIndex:0]; + NSCharacterSet *delimiters = [NSCharacterSet characterSetWithCharactersInString:@"()"]; + NSArray *serverStringArray = [[serverElement text] componentsSeparatedByCharactersInSet:delimiters]; + + TFHppleElement *thumbnailElement = [[characterRow searchWithXPathQuery:@"//div[@class='thumb_cont_black_50']/img"] objectAtIndex:0]; + + TFHppleElement *regionElement = [[characterRow searchWithXPathQuery:@"//div[@class='player_name_area']/span"] objectAtIndex:0]; + + FFCharacter *character = [FFCharacter new]; + character.name = nameElement.text; + character.server = [serverStringArray objectAtIndex:1]; + character.thumbnail = [NSURL URLWithString:[thumbnailElement objectForKey:@"src"]]; + character.region = regionElement.text; + character.identifier = [[nameElement objectForKey:@"href"] stringByReplacingOccurrencesOfString:kFFLodestoneCharacterURLPath withString:@""]; + character.identifier = [character.identifier stringByReplacingOccurrencesOfString:@"/" withString:@""]; + [result addObject:character]; + } + + handler(result, nil); + + + + } failure:^(AFHTTPRequestOperation *operation, NSError *error) { + handler(nil, error); + }]; + [operation start]; + + return operation; } @end diff --git a/Lodestone/SearchViewController.h b/Lodestone/SearchViewController.h new file mode 100644 index 0000000..3bd3290 --- /dev/null +++ b/Lodestone/SearchViewController.h @@ -0,0 +1,15 @@ +// +// SearchViewController.h +// Lodestone +// +// Created by Florian Strauss on 04.07.13. +// Copyright (c) 2013 Orlyapps Janzen & Strauß GbR. All rights reserved. +// + +#import + +@interface SearchViewController : UITableViewController + +@property (weak, nonatomic) IBOutlet UISearchBar *searchBar; + +@end diff --git a/Lodestone/SearchViewController.m b/Lodestone/SearchViewController.m new file mode 100644 index 0000000..86e151a --- /dev/null +++ b/Lodestone/SearchViewController.m @@ -0,0 +1,91 @@ +// +// SearchViewController.m +// Lodestone +// +// Created by Florian Strauss on 04.07.13. +// Copyright (c) 2013 Orlyapps Janzen & Strauß GbR. All rights reserved. +// + +#import "SearchViewController.h" +#import "DetailViewController.h" + +#import "CharacterCell.h" +#import "FFLodestone.h" + +@interface SearchViewController () + +@property (strong, nonatomic) NSArray *characters; +@property (strong, nonatomic) AFHTTPRequestOperation *operation; + + +@end + +@implementation SearchViewController + + +- (void)viewDidLoad +{ + [super viewDidLoad]; + + self.characters = [NSArray array]; + + self.clearsSelectionOnViewWillAppear = NO; + +} + +#pragma mark - Table view data source + +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView +{ + + return 1; +} + +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section +{ + + return [self.characters count]; +} + +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath +{ + static NSString *CellIdentifier = @"CharacterCell"; + CharacterCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath]; + + FFCharacter *character = [self.characters objectAtIndex:indexPath.row]; + + cell.nameLabel.text = character.name; + cell.serverLabel.text = character.server; + [cell.thumbnailImage setImageWithURL:character.thumbnail + placeholderImage:nil]; + + return cell; +} + + + +#pragma mark - Navigation + +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { + NSIndexPath *path = [self.tableView indexPathForSelectedRow]; + FFCharacter *character = [self.characters objectAtIndex:path.row]; + + [segue.destinationViewController setCharacter:character]; +} + + +#pragma mark - UISearchBar delegate +- (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText { + + // Stop old operation + if(self.operation != nil) { + [self.operation cancel]; + } + self.operation = [[FFLodestone sharedInstance] searchCharacterWithName:searchText worldName:nil classjob:nil completionHandler:^(NSArray *characters, NSError *error) { + self.characters = characters; + [self.tableView reloadData]; + }]; +} + + +@end diff --git a/Lodestone/SidePanelViewController.h b/Lodestone/SidePanelViewController.h new file mode 100644 index 0000000..6b70d32 --- /dev/null +++ b/Lodestone/SidePanelViewController.h @@ -0,0 +1,13 @@ +// +// SidePanelViewController.h +// Lodestone +// +// Created by Florian Strauss on 04.07.13. +// Copyright (c) 2013 Orlyapps Janzen & Strauß GbR. All rights reserved. +// + +#import "JASidePanelController.h" + +@interface SidePanelViewController : JASidePanelController + +@end diff --git a/Lodestone/SidePanelViewController.m b/Lodestone/SidePanelViewController.m new file mode 100644 index 0000000..7e7f25a --- /dev/null +++ b/Lodestone/SidePanelViewController.m @@ -0,0 +1,23 @@ +// +// SidePanelViewController.m +// Lodestone +// +// Created by Florian Strauss on 04.07.13. +// Copyright (c) 2013 Orlyapps Janzen & Strauß GbR. All rights reserved. +// + +#import "SidePanelViewController.h" + +@interface SidePanelViewController () + +@end + +@implementation SidePanelViewController + +- (void)awakeFromNib { + [self setLeftPanel:[self.storyboard instantiateViewControllerWithIdentifier:@"leftViewController"]]; + [self setCenterPanel:[self.storyboard instantiateViewControllerWithIdentifier:@"centerViewController"]]; + +} + +@end diff --git a/Lodestone/libs/JASidePanels b/Lodestone/libs/JASidePanels new file mode 160000 index 0000000..eb9c6da --- /dev/null +++ b/Lodestone/libs/JASidePanels @@ -0,0 +1 @@ +Subproject commit eb9c6dac6a664eb397ea575b72c91ea424bd8554 diff --git a/README.md b/README.md index 80d26aa..fbc1c1b 100644 --- a/README.md +++ b/README.md @@ -2,3 +2,36 @@ FFXIV-Lodestone =============== FFXIV-Lodestone for iOS + +Features +---------- + +- Search Characters +- Find Characters By Id + + +TODO +---------- + +- Retrieve a Linkshell from Lodestone +- Retrieve a Free Company from Lodestone + + +EXAMPLE +---------- + +Searching + +```objective-c + [[FFLodestone sharedInstance] searchCharacterWithName:@"Hackfrag" worldName:nil classjob:nil completionHandler:^(NSArray *characters, NSError *error) { + NSLog(@"%@", characters); + }]; +``` + +Fetching + +```objective-c + [[FFLodestone sharedInstance] fetchCharacterWithId:@"1674571" completionHandler:^(FFCharacter *character, NSError *error) { + NSLog(@"%@", character); + }]; +``` \ No newline at end of file