Skip to content

Commit

Permalink
Refactor classes
Browse files Browse the repository at this point in the history
  • Loading branch information
Yasuhiro Asaka committed Sep 3, 2013
1 parent b134252 commit 5ac665f
Show file tree
Hide file tree
Showing 16 changed files with 488 additions and 244 deletions.
66 changes: 53 additions & 13 deletions generika.xcodeproj/project.pbxproj
Expand Up @@ -68,6 +68,10 @@
819E165917B20E8B00B315B3 /* Constant.m in Sources */ = {isa = PBXBuildFile; fileRef = 819E165817B20E8B00B315B3 /* Constant.m */; };
819E165A17B20E8B00B315B3 /* Constant.m in Sources */ = {isa = PBXBuildFile; fileRef = 819E165817B20E8B00B315B3 /* Constant.m */; };
81B86220153704330054EA0A /* WebViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 81B8621F153704330054EA0A /* WebViewController.m */; };
81B8CEB917D46EDE00DF463B /* Product.m in Sources */ = {isa = PBXBuildFile; fileRef = 81B8CEB817D46EDE00DF463B /* Product.m */; };
81B8CEBA17D46EDE00DF463B /* Product.m in Sources */ = {isa = PBXBuildFile; fileRef = 81B8CEB817D46EDE00DF463B /* Product.m */; };
81B8CEC017D4767500DF463B /* ProductManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 81B8CEBF17D4767500DF463B /* ProductManager.m */; };
81B8CEC117D4767500DF463B /* ProductManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 81B8CEBF17D4767500DF463B /* ProductManager.m */; };
81F2DEE817B877490058AC62 /* fontawesome-webfont.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 81F2DEE517B877490058AC62 /* fontawesome-webfont.ttf */; };
81F2DEE917B877490058AC62 /* fontawesome-webfont.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 81F2DEE517B877490058AC62 /* fontawesome-webfont.ttf */; };
81F2DEF117B879EB0058AC62 /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 81F2DEF017B879EB0058AC62 /* Default-568h@2x.png */; };
Expand Down Expand Up @@ -170,6 +174,10 @@
819E165817B20E8B00B315B3 /* Constant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Constant.m; sourceTree = "<group>"; };
81B8621E153704330054EA0A /* WebViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebViewController.h; sourceTree = "<group>"; };
81B8621F153704330054EA0A /* WebViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WebViewController.m; sourceTree = "<group>"; };
81B8CEB717D46EDE00DF463B /* Product.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Product.h; sourceTree = "<group>"; };
81B8CEB817D46EDE00DF463B /* Product.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Product.m; sourceTree = "<group>"; };
81B8CEBE17D4767500DF463B /* ProductManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProductManager.h; sourceTree = "<group>"; };
81B8CEBF17D4767500DF463B /* ProductManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ProductManager.m; sourceTree = "<group>"; };
81F2DEE517B877490058AC62 /* fontawesome-webfont.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = "fontawesome-webfont.ttf"; path = "resources/fontawesome-webfont.ttf"; sourceTree = "<group>"; };
81F2DEF017B879EB0058AC62 /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Default-568h@2x.png"; path = "resources/Default-568h@2x.png"; sourceTree = "<group>"; };
/* End PBXFileReference section */
Expand Down Expand Up @@ -351,20 +359,12 @@
8192736D1535D56E0060859C /* generika */ = {
isa = PBXGroup;
children = (
819E165717B20E8B00B315B3 /* Constant.h */,
819E165817B20E8B00B315B3 /* Constant.m */,
81B8CEBC17D473C300DF463B /* Controller */,
81B8CEBB17D4724E00DF463B /* Model */,
81B8CEBD17D4762600DF463B /* Util */,
819273761535D56E0060859C /* AppDelegate.h */,
819273771535D56E0060859C /* AppDelegate.m */,
8192737F1535D56E0060859C /* MasterViewController.h */,
819273801535D56E0060859C /* MasterViewController.m */,
81B8621E153704330054EA0A /* WebViewController.h */,
81B8621F153704330054EA0A /* WebViewController.m */,
812B9A4B17AF7DF50001A5A8 /* SettingsViewController.h */,
812B9A4C17AF7DF50001A5A8 /* SettingsViewController.m */,
8148C65917B0B9530037EE81 /* SettingsDetailViewController.h */,
8148C65A17B0B9530037EE81 /* SettingsDetailViewController.m */,
8129BA54153D46F100CB5896 /* Reachability.h */,
8129BA55153D46F100CB5896 /* Reachability.m */,
819273731535D56E0060859C /* main.m */,
81FEDA1F1538962900756CAE /* Resources */,
8192736E1535D56E0060859C /* Supporting Files */,
);
Expand All @@ -376,7 +376,6 @@
children = (
8192736F1535D56E0060859C /* generika-Info.plist */,
819273701535D56E0060859C /* InfoPlist.strings */,
819273731535D56E0060859C /* main.m */,
819273751535D56E0060859C /* generika-Prefix.pch */,
);
name = "Supporting Files";
Expand All @@ -401,6 +400,43 @@
name = "Supporting Files";
sourceTree = "<group>";
};
81B8CEBB17D4724E00DF463B /* Model */ = {
isa = PBXGroup;
children = (
81B8CEB717D46EDE00DF463B /* Product.h */,
81B8CEB817D46EDE00DF463B /* Product.m */,
81B8CEBE17D4767500DF463B /* ProductManager.h */,
81B8CEBF17D4767500DF463B /* ProductManager.m */,
);
name = Model;
sourceTree = "<group>";
};
81B8CEBC17D473C300DF463B /* Controller */ = {
isa = PBXGroup;
children = (
8192737F1535D56E0060859C /* MasterViewController.h */,
819273801535D56E0060859C /* MasterViewController.m */,
81B8621E153704330054EA0A /* WebViewController.h */,
81B8621F153704330054EA0A /* WebViewController.m */,
812B9A4B17AF7DF50001A5A8 /* SettingsViewController.h */,
812B9A4C17AF7DF50001A5A8 /* SettingsViewController.m */,
8148C65917B0B9530037EE81 /* SettingsDetailViewController.h */,
8148C65A17B0B9530037EE81 /* SettingsDetailViewController.m */,
);
name = Controller;
sourceTree = "<group>";
};
81B8CEBD17D4762600DF463B /* Util */ = {
isa = PBXGroup;
children = (
819E165717B20E8B00B315B3 /* Constant.h */,
819E165817B20E8B00B315B3 /* Constant.m */,
8129BA54153D46F100CB5896 /* Reachability.h */,
8129BA55153D46F100CB5896 /* Reachability.m */,
);
name = Util;
sourceTree = "<group>";
};
81FEDA1F1538962900756CAE /* Resources */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -537,6 +573,7 @@
files = (
819273741535D56E0060859C /* main.m in Sources */,
819273781535D56E0060859C /* AppDelegate.m in Sources */,
81B8CEB917D46EDE00DF463B /* Product.m in Sources */,
819273811535D56E0060859C /* MasterViewController.m in Sources */,
81B86220153704330054EA0A /* WebViewController.m in Sources */,
812C922E153880D100B355F9 /* JSONKit.m in Sources */,
Expand All @@ -545,6 +582,7 @@
810A926C179CD1C500DAA963 /* AFHTTPClient.m in Sources */,
810A926E179CD1C500DAA963 /* AFHTTPRequestOperation.m in Sources */,
810A9270179CD1C500DAA963 /* AFImageRequestOperation.m in Sources */,
81B8CEC017D4767500DF463B /* ProductManager.m in Sources */,
810A9272179CD1C500DAA963 /* AFJSONRequestOperation.m in Sources */,
810A9274179CD1C500DAA963 /* AFNetworkActivityIndicatorManager.m in Sources */,
810A9276179CD1C500DAA963 /* AFPropertyListRequestOperation.m in Sources */,
Expand All @@ -561,12 +599,14 @@
buildActionMask = 2147483647;
files = (
8148C65C17B0B9530037EE81 /* SettingsDetailViewController.m in Sources */,
81B8CEC117D4767500DF463B /* ProductManager.m in Sources */,
819273991535D56E0060859C /* generikaTests.m in Sources */,
810A926D179CD1C500DAA963 /* AFHTTPClient.m in Sources */,
810A926F179CD1C500DAA963 /* AFHTTPRequestOperation.m in Sources */,
810A9271179CD1C500DAA963 /* AFImageRequestOperation.m in Sources */,
810A9273179CD1C500DAA963 /* AFJSONRequestOperation.m in Sources */,
810A9275179CD1C500DAA963 /* AFNetworkActivityIndicatorManager.m in Sources */,
81B8CEBA17D46EDE00DF463B /* Product.m in Sources */,
819E165A17B20E8B00B315B3 /* Constant.m in Sources */,
810A9277179CD1C500DAA963 /* AFPropertyListRequestOperation.m in Sources */,
810A9279179CD1C500DAA963 /* AFURLConnectionOperation.m in Sources */,
Expand Down
4 changes: 3 additions & 1 deletion generika/AppDelegate.m
Expand Up @@ -7,6 +7,7 @@
//

#import "AppDelegate.h"
#import "ProductManager.h"
#import "MasterViewController.h"

@implementation AppDelegate
Expand All @@ -29,10 +30,11 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
[NSNumber numberWithInteger:0], @"search.result.lang",
nil];
[[NSUserDefaults standardUserDefaults] registerDefaults:userDefaultsDefaults];
// products
[[ProductManager sharedManager] load];
// view
CGRect screenBounds = [[UIScreen mainScreen] bounds];
_window = [[UIWindow alloc] initWithFrame:screenBounds];

MasterViewController *masterViewController = [[MasterViewController alloc] init];
_navigationController = [[UINavigationController alloc] initWithRootViewController:masterViewController];
_navigationController.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
Expand Down
2 changes: 2 additions & 0 deletions generika/Constant.h
Expand Up @@ -6,6 +6,7 @@
// Copyright (c) 2013 ywesee GmbH. All rights reserved.
//


extern CGFloat const kVersionNumber_iOS_6_1;

extern NSString *const kOddbBaseURL;
Expand All @@ -27,4 +28,5 @@ extern NSString *const kOddbMobileFlavorUserAgent;
+ (NSArray *)searchTypes;
+ (NSArray *)searchLanguages;
+ (NSArray *)searchLangs;

@end
1 change: 1 addition & 0 deletions generika/Constant.m
Expand Up @@ -8,6 +8,7 @@

#import "Constant.h"


CGFloat const kVersionNumber_iOS_6_1 = 993.00; // NSFoundationVersionNumber_iOS_6_1

NSString *const kOddbBaseURL = @"http://ch.oddb.org";
Expand Down
31 changes: 1 addition & 30 deletions generika/MasterViewController.h
Expand Up @@ -6,39 +6,10 @@
// Copyright (c) 2012 ywesee GmbH. All rights reserved.
//

#import <UIKit/UIKit.h>

@class Product;
@class Reachability, WebViewController, SettingsViewController, ZBarReaderViewController;

@interface MasterViewController : UITableViewController <ZBarReaderDelegate, UISearchDisplayDelegate, UISearchBarDelegate>
{
Reachability *_reachability;
ZBarReaderViewController *_reader;
WebViewController *_browser;
SettingsViewController *_settings;
UISearchDisplayController *_search;

NSUserDefaults *_userDefaults;

UITableView *_productsView;
NSMutableArray *_products;
NSMutableArray *_filtered;
}

@property (nonatomic, strong, readonly) Reachability *reachability;
@property (nonatomic, strong, readonly) ZBarReaderViewController *reader;
@property (nonatomic, strong, readonly) WebViewController *browser;
@property (nonatomic, strong, readonly) SettingsViewController *settings;
@property (nonatomic, strong, readonly) UISearchDisplayController *search;
@property (nonatomic, strong, readonly) NSUserDefaults *userDefaults;
@property (nonatomic, strong, readonly) UITableView *productsView;
@property (nonatomic, strong, readonly) NSMutableArray *products;
@property (nonatomic, strong, readonly) NSMutableArray *filtered;

- (void)scanButtonTapped:(UIButton *)button;
- (void)settingsButtonTapped:(UIButton *)button;

- (void)openReader;
- (void)searchInfoForProduct:(NSDictionary *)product;

@end

0 comments on commit 5ac665f

Please sign in to comment.