authoriztion through username and password

This commit is contained in:
lizj0505 2013-07-16 17:11:08 +08:00
parent 4a155eb9bd
commit 720bfe7ac9
14 changed files with 576 additions and 173 deletions

View File

@ -12,6 +12,7 @@
2B9968B01794FC0A0086F115 /* OZLProjectCreateViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 2B9968AE1794FC0A0086F115 /* OZLProjectCreateViewController.xib */; }; 2B9968B01794FC0A0086F115 /* OZLProjectCreateViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 2B9968AE1794FC0A0086F115 /* OZLProjectCreateViewController.xib */; };
2B9968B417951A5C0086F115 /* OZLIssueCreateViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2B9968B217951A5C0086F115 /* OZLIssueCreateViewController.m */; }; 2B9968B417951A5C0086F115 /* OZLIssueCreateViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2B9968B217951A5C0086F115 /* OZLIssueCreateViewController.m */; };
2B9968B517951A5C0086F115 /* OZLIssueCreateViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 2B9968B317951A5C0086F115 /* OZLIssueCreateViewController.xib */; }; 2B9968B517951A5C0086F115 /* OZLIssueCreateViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 2B9968B317951A5C0086F115 /* OZLIssueCreateViewController.xib */; };
2BCCA0541795312E00FA8B1A /* OZLConstants.m in Sources */ = {isa = PBXBuildFile; fileRef = 2BCCA0531795312E00FA8B1A /* OZLConstants.m */; };
2BCF880C1793A26A006FC859 /* MBProgressHUD.m in Sources */ = {isa = PBXBuildFile; fileRef = 2BCF880B1793A26A006FC859 /* MBProgressHUD.m */; }; 2BCF880C1793A26A006FC859 /* MBProgressHUD.m in Sources */ = {isa = PBXBuildFile; fileRef = 2BCF880B1793A26A006FC859 /* MBProgressHUD.m */; };
2BCF88101793ABA0006FC859 /* Reachability.m in Sources */ = {isa = PBXBuildFile; fileRef = 2BCF880F1793ABA0006FC859 /* Reachability.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; 2BCF88101793ABA0006FC859 /* Reachability.m in Sources */ = {isa = PBXBuildFile; fileRef = 2BCF880F1793ABA0006FC859 /* Reachability.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
2BCF88121793CB4F006FC859 /* CFNetwork.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2BCF88111793CB4F006FC859 /* CFNetwork.framework */; }; 2BCF88121793CB4F006FC859 /* CFNetwork.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2BCF88111793CB4F006FC859 /* CFNetwork.framework */; };
@ -68,6 +69,8 @@
2B9968B117951A5C0086F115 /* OZLIssueCreateViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OZLIssueCreateViewController.h; path = ViewControllers/OZLIssueCreateViewController.h; sourceTree = "<group>"; }; 2B9968B117951A5C0086F115 /* OZLIssueCreateViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OZLIssueCreateViewController.h; path = ViewControllers/OZLIssueCreateViewController.h; sourceTree = "<group>"; };
2B9968B217951A5C0086F115 /* OZLIssueCreateViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OZLIssueCreateViewController.m; path = ViewControllers/OZLIssueCreateViewController.m; sourceTree = "<group>"; }; 2B9968B217951A5C0086F115 /* OZLIssueCreateViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OZLIssueCreateViewController.m; path = ViewControllers/OZLIssueCreateViewController.m; sourceTree = "<group>"; };
2B9968B317951A5C0086F115 /* OZLIssueCreateViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = OZLIssueCreateViewController.xib; path = ViewControllers/OZLIssueCreateViewController.xib; sourceTree = "<group>"; }; 2B9968B317951A5C0086F115 /* OZLIssueCreateViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = OZLIssueCreateViewController.xib; path = ViewControllers/OZLIssueCreateViewController.xib; sourceTree = "<group>"; };
2BCCA0521795312E00FA8B1A /* OZLConstants.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OZLConstants.h; path = Models/OZLConstants.h; sourceTree = "<group>"; };
2BCCA0531795312E00FA8B1A /* OZLConstants.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OZLConstants.m; path = Models/OZLConstants.m; sourceTree = "<group>"; };
2BCF880A1793A26A006FC859 /* MBProgressHUD.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MBProgressHUD.h; sourceTree = "<group>"; }; 2BCF880A1793A26A006FC859 /* MBProgressHUD.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MBProgressHUD.h; sourceTree = "<group>"; };
2BCF880B1793A26A006FC859 /* MBProgressHUD.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MBProgressHUD.m; sourceTree = "<group>"; }; 2BCF880B1793A26A006FC859 /* MBProgressHUD.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MBProgressHUD.m; sourceTree = "<group>"; };
2BCF880E1793ABA0006FC859 /* Reachability.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Reachability.h; sourceTree = "<group>"; }; 2BCF880E1793ABA0006FC859 /* Reachability.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Reachability.h; sourceTree = "<group>"; };
@ -361,6 +364,8 @@
D5DB80B917930C830081662A /* OZLNetworkBase.m */, D5DB80B917930C830081662A /* OZLNetworkBase.m */,
D5DB80BB17930ECD0081662A /* OZLSingleton.h */, D5DB80BB17930ECD0081662A /* OZLSingleton.h */,
D5DB80BC17930ECD0081662A /* OZLSingleton.m */, D5DB80BC17930ECD0081662A /* OZLSingleton.m */,
2BCCA0521795312E00FA8B1A /* OZLConstants.h */,
2BCCA0531795312E00FA8B1A /* OZLConstants.m */,
); );
name = Utils; name = Utils;
sourceTree = "<group>"; sourceTree = "<group>";
@ -493,6 +498,7 @@
2B9968AB1794F71B0086F115 /* OZLModelIssueCategory.m in Sources */, 2B9968AB1794F71B0086F115 /* OZLModelIssueCategory.m in Sources */,
2B9968AF1794FC0A0086F115 /* OZLProjectCreateViewController.m in Sources */, 2B9968AF1794FC0A0086F115 /* OZLProjectCreateViewController.m in Sources */,
2B9968B417951A5C0086F115 /* OZLIssueCreateViewController.m in Sources */, 2B9968B417951A5C0086F115 /* OZLIssueCreateViewController.m in Sources */,
2BCCA0541795312E00FA8B1A /* OZLConstants.m in Sources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };

View File

@ -0,0 +1,15 @@
//
// OZLConstants.h
// RedmineMobile
//
// Created by lizhijie on 7/16/13.
// Copyright (c) 2013 Lee Zhijie. All rights reserved.
//
#import <Foundation/Foundation.h>
extern const NSString* NOTIFICATION_REDMINE_ACCOUNT_CHANGED;
@interface OZLConstants : NSObject
@end

View File

@ -0,0 +1,16 @@
//
// OZLConstants.m
// RedmineMobile
//
// Created by lizhijie on 7/16/13.
// Copyright (c) 2013 Lee Zhijie. All rights reserved.
//
#import "OZLConstants.h"
const NSString* NOTIFICATION_REDMINE_ACCOUNT_CHANGED = @"NOTIFICATION_REDMINE_ACCOUNT_CHANGED";
@implementation OZLConstants
@end

View File

@ -62,6 +62,18 @@
*/ */
OZLProjectListViewController* projectList = [[OZLProjectListViewController alloc] initWithNibName:@"OZLProjectListViewController" bundle:nil]; OZLProjectListViewController* projectList = [[OZLProjectListViewController alloc] initWithNibName:@"OZLProjectListViewController" bundle:nil];
_navigationController = [[UINavigationController alloc] initWithRootViewController:projectList]; _navigationController = [[UINavigationController alloc] initWithRootViewController:projectList];
int lastProjectID = [[OZLSingleton sharedInstance] lastProjectID];
if (lastProjectID < 0) {
}else {
OZLProjectViewController* projectview = [[OZLProjectViewController alloc] initWithNibName:@"OZLProjectViewController" bundle:nil];
OZLModelProject* data = [[OZLModelProject alloc] init];
data.index = lastProjectID;
[projectview setProjectData:data];
[_navigationController pushViewController:projectview animated:NO];
}
self.window.rootViewController = _navigationController; self.window.rootViewController = _navigationController;
self.window.backgroundColor = [UIColor whiteColor]; self.window.backgroundColor = [UIColor whiteColor];
@ -100,7 +112,6 @@
return PPRevealSideDirectionLeft ; return PPRevealSideDirectionLeft ;
} }
- (void)applicationWillResignActive:(UIApplication *)application - (void)applicationWillResignActive:(UIApplication *)application
{ {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.

View File

@ -30,6 +30,7 @@
#import "OZLNetworkBase.h" #import "OZLNetworkBase.h"
#import "AFHTTPRequestOperation.h" #import "AFHTTPRequestOperation.h"
#import "JSONKit.h" #import "JSONKit.h"
#import "OZLSingleton.h"
@implementation OZLNetwork @implementation OZLNetwork
@ -38,7 +39,14 @@
+(void)getProjectListWithParams:(NSDictionary*)params andBlock:(void (^)(NSArray *result, NSError *error))block; +(void)getProjectListWithParams:(NSDictionary*)params andBlock:(void (^)(NSArray *result, NSError *error))block;
{ {
NSString* path = @"/projects.json"; NSString* path = @"/projects.json";
[[OZLNetworkBase sharedClient] getPath:path parameters:params success:^(AFHTTPRequestOperation *operation, id responseObject) { NSMutableDictionary* paramsDic = [[NSMutableDictionary alloc] initWithDictionary:params];
NSString* accessKey = [[OZLSingleton sharedInstance] redmineUserKey];
if (accessKey.length > 0) {
[paramsDic setObject:accessKey forKey:@"key"];
}
[[OZLNetworkBase sharedClient] setAuthorizationHeader];
[[OZLNetworkBase sharedClient] getPath:path parameters:paramsDic success:^(AFHTTPRequestOperation *operation, id responseObject) {
if (block) { if (block) {
NSLog(@"the repsonse:%@",responseObject); NSLog(@"the repsonse:%@",responseObject);
@ -63,7 +71,13 @@
+(void)getDetailForProject:(int)projectid withParams:(NSDictionary*)params andBlock:(void (^)(OZLModelProject *result, NSError *error))block +(void)getDetailForProject:(int)projectid withParams:(NSDictionary*)params andBlock:(void (^)(OZLModelProject *result, NSError *error))block
{ {
NSString* path = [NSString stringWithFormat:@"/projects/%d.json",projectid]; NSString* path = [NSString stringWithFormat:@"/projects/%d.json",projectid];
[[OZLNetworkBase sharedClient] getPath:path parameters:params success:^(AFHTTPRequestOperation *operation, id responseObject) { NSMutableDictionary* paramsDic = [[NSMutableDictionary alloc] initWithDictionary:params];
NSString* accessKey = [[OZLSingleton sharedInstance] redmineUserKey];
if (accessKey.length > 0) {
[paramsDic setObject:accessKey forKey:@"key"];
}
[[OZLNetworkBase sharedClient] getPath:path parameters:paramsDic success:^(AFHTTPRequestOperation *operation, id responseObject) {
if (block) { if (block) {
NSLog(@"the repsonse:%@",responseObject); NSLog(@"the repsonse:%@",responseObject);
@ -82,6 +96,7 @@
}]; }];
} }
+(void)createProject:(OZLModelProject*)projectData withParams:(NSDictionary*)params andBlock:(void (^)(BOOL success, NSError *error))block +(void)createProject:(OZLModelProject*)projectData withParams:(NSDictionary*)params andBlock:(void (^)(BOOL success, NSError *error))block
{ {
NSString* path = @"/projects.json"; NSString* path = @"/projects.json";
@ -90,6 +105,11 @@
NSMutableDictionary* projectDic = [projectData toParametersDic]; NSMutableDictionary* projectDic = [projectData toParametersDic];
[projectDic addEntriesFromDictionary:params]; [projectDic addEntriesFromDictionary:params];
NSString* accessKey = [[OZLSingleton sharedInstance] redmineUserKey];
if (accessKey.length > 0) {
[projectDic setObject:accessKey forKey:@"key"];
}
[[OZLNetworkBase sharedClient] postPath:path parameters:projectDic success:^(AFHTTPRequestOperation *operation, id responseObject) { [[OZLNetworkBase sharedClient] postPath:path parameters:projectDic success:^(AFHTTPRequestOperation *operation, id responseObject) {
if (block) { if (block) {
@ -106,6 +126,7 @@
}]; }];
} }
+(void)updateProject:(OZLModelProject*)projectData withParams:(NSDictionary*)params andBlock:(void (^)(BOOL success, NSError *error))block +(void)updateProject:(OZLModelProject*)projectData withParams:(NSDictionary*)params andBlock:(void (^)(BOOL success, NSError *error))block
{ {
NSString* path = [NSString stringWithFormat:@"/projects/%d.json",projectData.index]; NSString* path = [NSString stringWithFormat:@"/projects/%d.json",projectData.index];
@ -114,6 +135,11 @@
NSMutableDictionary* projectDic = [projectData toParametersDic]; NSMutableDictionary* projectDic = [projectData toParametersDic];
[projectDic addEntriesFromDictionary:params]; [projectDic addEntriesFromDictionary:params];
NSString* accessKey = [[OZLSingleton sharedInstance] redmineUserKey];
if (accessKey.length > 0) {
[projectDic setObject:accessKey forKey:@"key"];
}
[[OZLNetworkBase sharedClient] putPath:path parameters:projectDic success:^(AFHTTPRequestOperation *operation, id responseObject) { [[OZLNetworkBase sharedClient] putPath:path parameters:projectDic success:^(AFHTTPRequestOperation *operation, id responseObject) {
if (block) { if (block) {
@ -124,7 +150,6 @@
} failure:^(AFHTTPRequestOperation *operation, NSError *error) { } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
if (block) { if (block) {
block(NO, error); block(NO, error);
} }
@ -132,11 +157,17 @@
}]; }];
} }
+(void)deleteProject:(int)projectid withParams:(NSDictionary*)params andBlock:(void (^)(BOOL success, NSError *error))block +(void)deleteProject:(int)projectid withParams:(NSDictionary*)params andBlock:(void (^)(BOOL success, NSError *error))block
{ {
NSString* path = [NSString stringWithFormat:@"/projects/%d.json",projectid]; NSString* path = [NSString stringWithFormat:@"/projects/%d.json",projectid];
NSMutableDictionary* paramsDic = [[NSMutableDictionary alloc] initWithDictionary:params];
NSString* accessKey = [[OZLSingleton sharedInstance] redmineUserKey];
if (accessKey.length > 0) {
[paramsDic setObject:accessKey forKey:@"key"];
}
[[OZLNetworkBase sharedClient] deletePath:path parameters:params success:^(AFHTTPRequestOperation *operation, id responseObject) { [[OZLNetworkBase sharedClient] deletePath:path parameters:paramsDic success:^(AFHTTPRequestOperation *operation, id responseObject) {
if (block) { if (block) {
NSLog(@"the repsonse:%@",responseObject); NSLog(@"the repsonse:%@",responseObject);
@ -146,7 +177,6 @@
} failure:^(AFHTTPRequestOperation *operation, NSError *error) { } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
if (block) { if (block) {
block(NO, error); block(NO, error);
} }
@ -160,10 +190,14 @@
+(void)getIssueListForProject:(int)projectid withParams:(NSDictionary*)params andBlock:(void (^)(NSArray *result, NSError *error))block +(void)getIssueListForProject:(int)projectid withParams:(NSDictionary*)params andBlock:(void (^)(NSArray *result, NSError *error))block
{ {
NSString* path = [NSString stringWithFormat:@"/issues.json"]; NSString* path = [NSString stringWithFormat:@"/issues.json"];
NSMutableDictionary* dic = [[NSMutableDictionary alloc] initWithDictionary:params]; NSMutableDictionary* paramsDic = [[NSMutableDictionary alloc] initWithDictionary:params];
[dic setObject:[NSNumber numberWithInt:projectid] forKey:@"project_id"]; [paramsDic setObject:[NSNumber numberWithInt:projectid] forKey:@"project_id"];
NSString* accessKey = [[OZLSingleton sharedInstance] redmineUserKey];
if (accessKey.length > 0) {
[paramsDic setObject:accessKey forKey:@"key"];
}
[[OZLNetworkBase sharedClient] getPath:path parameters:dic success:^(AFHTTPRequestOperation *operation, id responseObject) { [[OZLNetworkBase sharedClient] getPath:path parameters:paramsDic success:^(AFHTTPRequestOperation *operation, id responseObject) {
if (block) { if (block) {
NSLog(@"the repsonse:%@",responseObject); NSLog(@"the repsonse:%@",responseObject);
@ -189,7 +223,14 @@
+(void)getDetailFoIssue:(int)issueid withParams:(NSDictionary*)params andBlock:(void (^)(OZLModelIssue *result, NSError *error))block +(void)getDetailFoIssue:(int)issueid withParams:(NSDictionary*)params andBlock:(void (^)(OZLModelIssue *result, NSError *error))block
{ {
NSString* path = [NSString stringWithFormat:@"/issues/%d.json",issueid]; NSString* path = [NSString stringWithFormat:@"/issues/%d.json",issueid];
[[OZLNetworkBase sharedClient] getPath:path parameters:params success:^(AFHTTPRequestOperation *operation, id responseObject) {
NSMutableDictionary* paramsDic = [[NSMutableDictionary alloc] initWithDictionary:params];
NSString* accessKey = [[OZLSingleton sharedInstance] redmineUserKey];
if (accessKey.length > 0) {
[paramsDic setObject:accessKey forKey:@"key"];
}
[[OZLNetworkBase sharedClient] getPath:path parameters:paramsDic success:^(AFHTTPRequestOperation *operation, id responseObject) {
if (block) { if (block) {
NSLog(@"the repsonse:%@",responseObject); NSLog(@"the repsonse:%@",responseObject);
@ -218,6 +259,11 @@
NSMutableDictionary* paramsDic = [[NSMutableDictionary alloc] initWithDictionary:params]; NSMutableDictionary* paramsDic = [[NSMutableDictionary alloc] initWithDictionary:params];
[paramsDic addEntriesFromDictionary:[issueData toParametersDic]]; [paramsDic addEntriesFromDictionary:[issueData toParametersDic]];
NSString* accessKey = [[OZLSingleton sharedInstance] redmineUserKey];
if (accessKey.length > 0) {
[paramsDic setObject:accessKey forKey:@"key"];
}
[[OZLNetworkBase sharedClient] postPath:path parameters:paramsDic success:^(AFHTTPRequestOperation *operation, id responseObject) { [[OZLNetworkBase sharedClient] postPath:path parameters:paramsDic success:^(AFHTTPRequestOperation *operation, id responseObject) {
if (block) { if (block) {
@ -242,6 +288,11 @@
NSMutableDictionary* paramsDic = [[NSMutableDictionary alloc] initWithDictionary:params]; NSMutableDictionary* paramsDic = [[NSMutableDictionary alloc] initWithDictionary:params];
[paramsDic addEntriesFromDictionary:[issueData toParametersDic]]; [paramsDic addEntriesFromDictionary:[issueData toParametersDic]];
NSString* accessKey = [[OZLSingleton sharedInstance] redmineUserKey];
if (accessKey.length > 0) {
[paramsDic setObject:accessKey forKey:@"key"];
}
[[OZLNetworkBase sharedClient] putPath:path parameters:paramsDic success:^(AFHTTPRequestOperation *operation, id responseObject) { [[OZLNetworkBase sharedClient] putPath:path parameters:paramsDic success:^(AFHTTPRequestOperation *operation, id responseObject) {
if (block) { if (block) {
@ -263,7 +314,13 @@
{ {
NSString* path = [NSString stringWithFormat:@"/issues/%d.json",issueid]; NSString* path = [NSString stringWithFormat:@"/issues/%d.json",issueid];
[[OZLNetworkBase sharedClient] deletePath:path parameters:params success:^(AFHTTPRequestOperation *operation, id responseObject) { NSMutableDictionary* paramsDic = [[NSMutableDictionary alloc] initWithDictionary:params];
NSString* accessKey = [[OZLSingleton sharedInstance] redmineUserKey];
if (accessKey.length > 0) {
[paramsDic setObject:accessKey forKey:@"key"];
}
[[OZLNetworkBase sharedClient] deletePath:path parameters:paramsDic success:^(AFHTTPRequestOperation *operation, id responseObject) {
if (block) { if (block) {
NSLog(@"the repsonse:%@",responseObject); NSLog(@"the repsonse:%@",responseObject);

View File

@ -32,5 +32,6 @@
@interface OZLNetworkBase : AFHTTPClient @interface OZLNetworkBase : AFHTTPClient
+(OZLNetworkBase *)sharedClient; +(OZLNetworkBase *)sharedClient;
-(void)setAuthorizationHeader;
@end @end

View File

@ -29,13 +29,13 @@
#import "OZLNetworkBase.h" #import "OZLNetworkBase.h"
#import "AFJSONRequestOperation.h" #import "AFJSONRequestOperation.h"
#import "OZLSingleton.h" #import "OZLSingleton.h"
#import "OZLConstants.h"
@implementation OZLNetworkBase @implementation OZLNetworkBase
static OZLNetworkBase *_sharedClient = nil;
+(OZLNetworkBase *)sharedClient +(OZLNetworkBase *)sharedClient
{ {
static OZLNetworkBase *_sharedClient = nil;
if (_sharedClient == nil) { if (_sharedClient == nil) {
_sharedClient = [[OZLNetworkBase alloc] initWithBaseURL:[NSURL URLWithString:[[OZLSingleton sharedInstance] redmineHomeURL]]]; _sharedClient = [[OZLNetworkBase alloc] initWithBaseURL:[NSURL URLWithString:[[OZLSingleton sharedInstance] redmineHomeURL]]];
@ -56,7 +56,28 @@
// Accept HTTP Header; see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.1 // Accept HTTP Header; see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.1
[self setDefaultHeader:@"Accept" value:@"application/json"]; [self setDefaultHeader:@"Accept" value:@"application/json"];
NSNotificationCenter* center = [NSNotificationCenter defaultCenter];
[center addObserver:self selector:@selector(accountChanged) name:NOTIFICATION_REDMINE_ACCOUNT_CHANGED object:nil];
[self setAuthorizationHeader];
return self; return self;
} }
-(void)setAuthorizationHeader
{
[self clearAuthorizationHeader];
NSString* username = [[OZLSingleton sharedInstance] redmineUserName];
NSString* password = [[OZLSingleton sharedInstance] redminePassword];
[self setAuthorizationHeaderWithUsername:username password:password];
}
-(void)accountChanged
{
_sharedClient = nil;
NSNotificationCenter* center = [NSNotificationCenter defaultCenter];
[center removeObserver:self];
}
@end @end

View File

@ -35,6 +35,8 @@
//network //network
@property(nonatomic,strong) NSString* redmineHomeURL; @property(nonatomic,strong) NSString* redmineHomeURL;
@property(nonatomic,strong) NSString* redmineUserKey; @property(nonatomic,strong) NSString* redmineUserKey;
@property(nonatomic,strong) NSString* redmineUserName;
@property(nonatomic,strong) NSString* redminePassword;
//app status //app status
@property(nonatomic) int lastProjectID;// last viewed project id @property(nonatomic) int lastProjectID;// last viewed project id

View File

@ -27,13 +27,15 @@
// THE SOFTWARE. // THE SOFTWARE.
#import "OZLSingleton.h" #import "OZLSingleton.h"
#import "OZLConstants.h"
@implementation OZLSingleton @implementation OZLSingleton
NSString* USER_DEFUALTS_REDMINE_HOME_URL = @"USER_DEFUALTS_REDMINE_HOME_URL"; NSString* USER_DEFUALTS_REDMINE_HOME_URL = @"USER_DEFUALTS_REDMINE_HOME_URL";
NSString* USER_DEFUALTS_REDMINE_USER_KEY = @"USER_DEFUALTS_REDMINE_USER_KEY"; NSString* USER_DEFUALTS_REDMINE_USER_KEY = @"USER_DEFUALTS_REDMINE_USER_KEY";
NSString* USER_DEFUALTS_LAST_PROJECT_ID = @"USER_DEFUALTS_LAST_PROJECT_ID"; NSString* USER_DEFUALTS_LAST_PROJECT_ID = @"USER_DEFUALTS_LAST_PROJECT_ID";
NSString* USER_DEFUALTS_REDMINE_USER_NAME = @"USER_DEFUALTS_REDMINE_USER_NAME";
NSString* USER_DEFUALTS_REDMINE_PASSWORD = @"USER_DEFUALTS_REDMINE_PASSWORD";
static OZLSingleton* sharedInstance = nil; static OZLSingleton* sharedInstance = nil;
+(OZLSingleton*) sharedInstance +(OZLSingleton*) sharedInstance
@ -46,6 +48,8 @@ static OZLSingleton* sharedInstance = nil;
@"http://demo.redmine.org/",USER_DEFUALTS_REDMINE_HOME_URL, @"http://demo.redmine.org/",USER_DEFUALTS_REDMINE_HOME_URL,
@"",USER_DEFUALTS_REDMINE_USER_KEY, @"",USER_DEFUALTS_REDMINE_USER_KEY,
[NSNumber numberWithInt:-1],USER_DEFUALTS_LAST_PROJECT_ID, [NSNumber numberWithInt:-1],USER_DEFUALTS_LAST_PROJECT_ID,
@"",USER_DEFUALTS_REDMINE_USER_NAME,
@"",USER_DEFUALTS_REDMINE_PASSWORD,
nil]; nil];
[defaults registerDefaults:dic]; [defaults registerDefaults:dic];
} }
@ -62,6 +66,7 @@ static OZLSingleton* sharedInstance = nil;
NSUserDefaults* userdefaults = [NSUserDefaults standardUserDefaults]; NSUserDefaults* userdefaults = [NSUserDefaults standardUserDefaults];
[userdefaults setObject:redmineHomeURL forKey:USER_DEFUALTS_REDMINE_HOME_URL]; [userdefaults setObject:redmineHomeURL forKey:USER_DEFUALTS_REDMINE_HOME_URL];
[userdefaults synchronize]; [userdefaults synchronize];
} }
-(NSString*)redmineUserKey -(NSString*)redmineUserKey
{ {
@ -86,4 +91,29 @@ static OZLSingleton* sharedInstance = nil;
[userdefaults synchronize]; [userdefaults synchronize];
} }
-(NSString*)redmineUserName
{
NSUserDefaults* userdefaults = [NSUserDefaults standardUserDefaults];
return [userdefaults objectForKey:USER_DEFUALTS_REDMINE_USER_NAME];
}
-(void)setRedmineUserName:(NSString *)redmineUserName
{
NSUserDefaults* userdefaults = [NSUserDefaults standardUserDefaults];
[userdefaults setObject:redmineUserName forKey:USER_DEFUALTS_REDMINE_USER_NAME];
[userdefaults synchronize];
}
-(NSString*)redminePassword
{
NSUserDefaults* userdefaults = [NSUserDefaults standardUserDefaults];
return [userdefaults objectForKey:USER_DEFUALTS_REDMINE_PASSWORD];
}
-(void)setRedminePassword:(NSString *)redminePassword
{
NSUserDefaults* userdefaults = [NSUserDefaults standardUserDefaults];
[userdefaults setObject:redminePassword forKey:USER_DEFUALTS_REDMINE_PASSWORD];
[userdefaults synchronize];
}
@end @end

View File

@ -32,6 +32,10 @@
@property (strong, nonatomic) IBOutlet UITextField *redmineHomeURL; @property (strong, nonatomic) IBOutlet UITextField *redmineHomeURL;
@property (strong, nonatomic) IBOutlet UITextField *redmineUserKey; @property (strong, nonatomic) IBOutlet UITextField *redmineUserKey;
@property (weak, nonatomic) IBOutlet UITextField *username;
@property (weak, nonatomic) IBOutlet UITextField *password;
- (IBAction)onOk:(id)sender; - (IBAction)onOk:(id)sender;
@end @end

View File

@ -30,6 +30,7 @@
#import "PPRevealSideViewController.h" #import "PPRevealSideViewController.h"
#import "OZLProjectListViewController.h" #import "OZLProjectListViewController.h"
#import "OZLSingleton.h" #import "OZLSingleton.h"
#import "OZLConstants.h"
#import "OZLNetwork.h" #import "OZLNetwork.h"
@interface OZLAccountViewController (){ @interface OZLAccountViewController (){
@ -59,8 +60,17 @@
_redmineHomeURL.text = [[OZLSingleton sharedInstance] redmineHomeURL]; _redmineHomeURL.text = [[OZLSingleton sharedInstance] redmineHomeURL];
_redmineUserKey.text = [[OZLSingleton sharedInstance] redmineUserKey]; _redmineUserKey.text = [[OZLSingleton sharedInstance] redmineUserKey];
_username.text = [[OZLSingleton sharedInstance] redmineUserName];
_password.text = [[OZLSingleton sharedInstance] redminePassword];
UITapGestureRecognizer* tapper = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(backgroundTapped)];
[self.view addGestureRecognizer:tapper];
} }
-(void)backgroundTapped
{
[self.view endEditing:YES];
}
- (void) preloadLeft { - (void) preloadLeft {
OZLProjectListViewController *c = [[OZLProjectListViewController alloc] initWithNibName:@"OZLProjectListViewController" bundle:nil]; OZLProjectListViewController *c = [[OZLProjectListViewController alloc] initWithNibName:@"OZLProjectListViewController" bundle:nil];
@ -106,11 +116,19 @@
- (void)viewDidUnload { - (void)viewDidUnload {
[self setRedmineHomeURL:nil]; [self setRedmineHomeURL:nil];
[self setRedmineUserKey:nil]; [self setRedmineUserKey:nil];
[self setUsername:nil];
[self setPassword:nil];
[super viewDidUnload]; [super viewDidUnload];
} }
- (IBAction)onOk:(id)sender { - (IBAction)onOk:(id)sender {
[[OZLSingleton sharedInstance] setRedmineUserKey:_redmineUserKey.text]; [[OZLSingleton sharedInstance] setRedmineUserKey:_redmineUserKey.text];
[[OZLSingleton sharedInstance] setRedmineHomeURL:_redmineHomeURL.text]; [[OZLSingleton sharedInstance] setRedmineHomeURL:_redmineHomeURL.text];
[[OZLSingleton sharedInstance] setRedmineUserName:_username.text];
[[OZLSingleton sharedInstance] setRedminePassword:_password.text];
[[OZLSingleton sharedInstance] setLastProjectID:-1];
NSNotificationCenter* center = [NSNotificationCenter defaultCenter];
[center postNotificationName:NOTIFICATION_REDMINE_ACCOUNT_CHANGED object:nil];
[self showProjectList]; [self showProjectList];
} }

View File

@ -2,10 +2,10 @@
<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="8.00"> <archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="8.00">
<data> <data>
<int key="IBDocument.SystemTarget">1552</int> <int key="IBDocument.SystemTarget">1552</int>
<string key="IBDocument.SystemVersion">12E55</string> <string key="IBDocument.SystemVersion">11G63</string>
<string key="IBDocument.InterfaceBuilderVersion">3084</string> <string key="IBDocument.InterfaceBuilderVersion">3084</string>
<string key="IBDocument.AppKitVersion">1187.39</string> <string key="IBDocument.AppKitVersion">1138.51</string>
<string key="IBDocument.HIToolboxVersion">626.00</string> <string key="IBDocument.HIToolboxVersion">569.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions"> <object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> <string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="NS.object.0">2083</string> <string key="NS.object.0">2083</string>
@ -14,6 +14,7 @@
<string>IBProxyObject</string> <string>IBProxyObject</string>
<string>IBUIButton</string> <string>IBUIButton</string>
<string>IBUILabel</string> <string>IBUILabel</string>
<string>IBUIScrollView</string>
<string>IBUITextField</string> <string>IBUITextField</string>
<string>IBUIView</string> <string>IBUIView</string>
</array> </array>
@ -37,155 +38,271 @@
<reference key="NSNextResponder"/> <reference key="NSNextResponder"/>
<int key="NSvFlags">274</int> <int key="NSvFlags">274</int>
<array class="NSMutableArray" key="NSSubviews"> <array class="NSMutableArray" key="NSSubviews">
<object class="IBUITextField" id="648072806"> <object class="IBUIScrollView" id="96590248">
<reference key="NSNextResponder" ref="191373211"/> <reference key="NSNextResponder" ref="191373211"/>
<int key="NSvFlags">292</int> <int key="NSvFlags">274</int>
<string key="NSFrame">{{20, 49}, {280, 30}}</string> <array class="NSMutableArray" key="NSSubviews">
<reference key="NSSuperview" ref="191373211"/> <object class="IBUITextField" id="648072806">
<reference key="NSNextKeyView" ref="306516395"/> <reference key="NSNextResponder" ref="96590248"/>
<string key="NSReuseIdentifierKey">_NS:9</string> <int key="NSvFlags">292</int>
<bool key="IBUIOpaque">NO</bool> <string key="NSFrame">{{20, 49}, {280, 30}}</string>
<bool key="IBUIClipsSubviews">YES</bool> <reference key="NSSuperview" ref="96590248"/>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string> <reference key="NSWindow"/>
<int key="IBUIContentVerticalAlignment">0</int> <reference key="NSNextKeyView" ref="306516395"/>
<string key="IBUIText"/> <string key="NSReuseIdentifierKey">_NS:9</string>
<int key="IBUIBorderStyle">3</int> <bool key="IBUIOpaque">NO</bool>
<object class="NSColor" key="IBUITextColor"> <bool key="IBUIClipsSubviews">YES</bool>
<int key="NSColorSpace">3</int> <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<bytes key="NSWhite">MAA</bytes> <int key="IBUIContentVerticalAlignment">0</int>
<object class="NSColorSpace" key="NSCustomColorSpace" id="914078253"> <string key="IBUIText"/>
<int key="NSID">2</int> <int key="IBUIBorderStyle">3</int>
<object class="NSColor" key="IBUITextColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MAA</bytes>
<object class="NSColorSpace" key="NSCustomColorSpace" id="914078253">
<int key="NSID">2</int>
</object>
</object>
<bool key="IBUIAdjustsFontSizeToFit">YES</bool>
<float key="IBUIMinimumFontSize">17</float>
<object class="IBUITextInputTraits" key="IBUITextInputTraits">
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
<object class="IBUIFontDescription" key="IBUIFontDescription" id="261617552">
<int key="type">1</int>
<double key="pointSize">14</double>
</object>
<object class="NSFont" key="IBUIFont" id="314854636">
<string key="NSName">Helvetica</string>
<double key="NSSize">14</double>
<int key="NSfFlags">16</int>
</object>
</object> </object>
</object> <object class="IBUILabel" id="69099942">
<bool key="IBUIAdjustsFontSizeToFit">YES</bool> <reference key="NSNextResponder" ref="96590248"/>
<float key="IBUIMinimumFontSize">17</float> <int key="NSvFlags">292</int>
<object class="IBUITextInputTraits" key="IBUITextInputTraits"> <string key="NSFrame">{{20, 20}, {42, 21}}</string>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string> <reference key="NSSuperview" ref="96590248"/>
</object> <reference key="NSWindow"/>
<object class="IBUIFontDescription" key="IBUIFontDescription" id="261617552"> <reference key="NSNextKeyView" ref="648072806"/>
<int key="type">1</int> <string key="NSReuseIdentifierKey">_NS:9</string>
<double key="pointSize">14</double> <bool key="IBUIOpaque">NO</bool>
</object> <bool key="IBUIClipsSubviews">YES</bool>
<object class="NSFont" key="IBUIFont" id="314854636"> <int key="IBUIContentMode">7</int>
<string key="NSName">Helvetica</string> <bool key="IBUIUserInteractionEnabled">NO</bool>
<double key="NSSize">14</double> <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<int key="NSfFlags">16</int> <string key="IBUIText">url:</string>
</object> <object class="NSColor" key="IBUITextColor" id="318933935">
</object> <int key="NSColorSpace">1</int>
<object class="IBUILabel" id="69099942"> <bytes key="NSRGB">MCAwIDAAA</bytes>
<reference key="NSNextResponder" ref="191373211"/> <string key="IBUIColorCocoaTouchKeyPath">darkTextColor</string>
<int key="NSvFlags">292</int> </object>
<string key="NSFrame">{{20, 20}, {42, 21}}</string> <nil key="IBUIHighlightedColor"/>
<int key="IBUIBaselineAdjustment">0</int>
<object class="IBUIFontDescription" key="IBUIFontDescription" id="911262389">
<int key="type">1</int>
<double key="pointSize">17</double>
</object>
<object class="NSFont" key="IBUIFont" id="357473706">
<string key="NSName">Helvetica</string>
<double key="NSSize">17</double>
<int key="NSfFlags">16</int>
</object>
<bool key="IBUIAdjustsFontSizeToFit">NO</bool>
</object>
<object class="IBUITextField" id="77126379">
<reference key="NSNextResponder" ref="96590248"/>
<int key="NSvFlags">-2147483356</int>
<string key="NSFrame">{{20, 454}, {280, 30}}</string>
<reference key="NSSuperview" ref="96590248"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="978568037"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<int key="IBUIContentVerticalAlignment">0</int>
<string key="IBUIText"/>
<int key="IBUIBorderStyle">3</int>
<object class="NSColor" key="IBUITextColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MAA</bytes>
<reference key="NSCustomColorSpace" ref="914078253"/>
</object>
<bool key="IBUIAdjustsFontSizeToFit">YES</bool>
<float key="IBUIMinimumFontSize">17</float>
<object class="IBUITextInputTraits" key="IBUITextInputTraits">
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
<reference key="IBUIFontDescription" ref="261617552"/>
<reference key="IBUIFont" ref="314854636"/>
</object>
<object class="IBUILabel" id="306516395">
<reference key="NSNextResponder" ref="96590248"/>
<int key="NSvFlags">-2147483356</int>
<string key="NSFrame">{{20, 425}, {42, 21}}</string>
<reference key="NSSuperview" ref="96590248"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="77126379"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<int key="IBUIContentMode">7</int>
<bool key="IBUIUserInteractionEnabled">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<string key="IBUIText">key:</string>
<reference key="IBUITextColor" ref="318933935"/>
<nil key="IBUIHighlightedColor"/>
<int key="IBUIBaselineAdjustment">0</int>
<reference key="IBUIFontDescription" ref="911262389"/>
<reference key="IBUIFont" ref="357473706"/>
<bool key="IBUIAdjustsFontSizeToFit">NO</bool>
</object>
<object class="IBUIButton" id="92070635">
<reference key="NSNextResponder" ref="96590248"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{20, 241}, {280, 44}}</string>
<reference key="NSSuperview" ref="96590248"/>
<reference key="NSWindow"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="IBUIOpaque">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<int key="IBUIContentHorizontalAlignment">0</int>
<int key="IBUIContentVerticalAlignment">0</int>
<int key="IBUIButtonType">1</int>
<string key="IBUINormalTitle">OK</string>
<object class="NSColor" key="IBUIHighlightedTitleColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MQA</bytes>
</object>
<object class="NSColor" key="IBUINormalTitleColor">
<int key="NSColorSpace">1</int>
<bytes key="NSRGB">MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA</bytes>
</object>
<object class="NSColor" key="IBUINormalTitleShadowColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MC41AA</bytes>
</object>
<object class="IBUIFontDescription" key="IBUIFontDescription">
<int key="type">2</int>
<double key="pointSize">15</double>
</object>
<object class="NSFont" key="IBUIFont">
<string key="NSName">Helvetica-Bold</string>
<double key="NSSize">15</double>
<int key="NSfFlags">16</int>
</object>
</object>
<object class="IBUITextField" id="758743336">
<reference key="NSNextResponder" ref="96590248"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{20, 116}, {280, 30}}</string>
<reference key="NSSuperview" ref="96590248"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="694956235"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<int key="IBUIContentVerticalAlignment">0</int>
<string key="IBUIText"/>
<int key="IBUIBorderStyle">3</int>
<object class="NSColor" key="IBUITextColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MAA</bytes>
<reference key="NSCustomColorSpace" ref="914078253"/>
</object>
<bool key="IBUIAdjustsFontSizeToFit">YES</bool>
<float key="IBUIMinimumFontSize">17</float>
<object class="IBUITextInputTraits" key="IBUITextInputTraits">
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
<reference key="IBUIFontDescription" ref="261617552"/>
<reference key="IBUIFont" ref="314854636"/>
</object>
<object class="IBUILabel" id="978568037">
<reference key="NSNextResponder" ref="96590248"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{20, 87}, {102, 21}}</string>
<reference key="NSSuperview" ref="96590248"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="758743336"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<int key="IBUIContentMode">7</int>
<bool key="IBUIUserInteractionEnabled">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<string key="IBUIText">username:</string>
<reference key="IBUITextColor" ref="318933935"/>
<nil key="IBUIHighlightedColor"/>
<int key="IBUIBaselineAdjustment">0</int>
<reference key="IBUIFontDescription" ref="911262389"/>
<reference key="IBUIFont" ref="357473706"/>
<bool key="IBUIAdjustsFontSizeToFit">NO</bool>
</object>
<object class="IBUITextField" id="993802756">
<reference key="NSNextResponder" ref="96590248"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{20, 183}, {280, 30}}</string>
<reference key="NSSuperview" ref="96590248"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="92070635"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<int key="IBUIContentVerticalAlignment">0</int>
<string key="IBUIText"/>
<int key="IBUIBorderStyle">3</int>
<object class="NSColor" key="IBUITextColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MAA</bytes>
<reference key="NSCustomColorSpace" ref="914078253"/>
</object>
<bool key="IBUIAdjustsFontSizeToFit">YES</bool>
<float key="IBUIMinimumFontSize">17</float>
<object class="IBUITextInputTraits" key="IBUITextInputTraits">
<bool key="IBUISecureTextEntry">YES</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
<reference key="IBUIFontDescription" ref="261617552"/>
<reference key="IBUIFont" ref="314854636"/>
</object>
<object class="IBUILabel" id="694956235">
<reference key="NSNextResponder" ref="96590248"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{20, 154}, {102, 21}}</string>
<reference key="NSSuperview" ref="96590248"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="993802756"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<int key="IBUIContentMode">7</int>
<bool key="IBUIUserInteractionEnabled">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<string key="IBUIText">password:</string>
<reference key="IBUITextColor" ref="318933935"/>
<nil key="IBUIHighlightedColor"/>
<int key="IBUIBaselineAdjustment">0</int>
<reference key="IBUIFontDescription" ref="911262389"/>
<reference key="IBUIFont" ref="357473706"/>
<bool key="IBUIAdjustsFontSizeToFit">NO</bool>
</object>
</array>
<string key="NSFrameSize">{320, 504}</string>
<reference key="NSSuperview" ref="191373211"/> <reference key="NSSuperview" ref="191373211"/>
<reference key="NSNextKeyView" ref="648072806"/> <reference key="NSWindow"/>
<string key="NSReuseIdentifierKey">_NS:9</string> <string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool> <bool key="IBUIClipsSubviews">YES</bool>
<int key="IBUIContentMode">7</int> <bool key="IBUIMultipleTouchEnabled">YES</bool>
<bool key="IBUIUserInteractionEnabled">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string> <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<string key="IBUIText">url:</string>
<object class="NSColor" key="IBUITextColor" id="318933935">
<int key="NSColorSpace">1</int>
<bytes key="NSRGB">MCAwIDAAA</bytes>
<string key="IBUIColorCocoaTouchKeyPath">darkTextColor</string>
</object>
<nil key="IBUIHighlightedColor"/>
<int key="IBUIBaselineAdjustment">0</int>
<object class="IBUIFontDescription" key="IBUIFontDescription" id="911262389">
<int key="type">1</int>
<double key="pointSize">17</double>
</object>
<object class="NSFont" key="IBUIFont" id="357473706">
<string key="NSName">Helvetica</string>
<double key="NSSize">17</double>
<int key="NSfFlags">16</int>
</object>
<bool key="IBUIAdjustsFontSizeToFit">NO</bool>
</object>
<object class="IBUITextField" id="77126379">
<reference key="NSNextResponder" ref="191373211"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{20, 116}, {280, 30}}</string>
<reference key="NSSuperview" ref="191373211"/>
<reference key="NSNextKeyView" ref="92070635"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<int key="IBUIContentVerticalAlignment">0</int>
<string key="IBUIText"/>
<int key="IBUIBorderStyle">3</int>
<object class="NSColor" key="IBUITextColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MAA</bytes>
<reference key="NSCustomColorSpace" ref="914078253"/>
</object>
<bool key="IBUIAdjustsFontSizeToFit">YES</bool>
<float key="IBUIMinimumFontSize">17</float>
<object class="IBUITextInputTraits" key="IBUITextInputTraits">
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
<reference key="IBUIFontDescription" ref="261617552"/>
<reference key="IBUIFont" ref="314854636"/>
</object>
<object class="IBUILabel" id="306516395">
<reference key="NSNextResponder" ref="191373211"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{20, 87}, {42, 21}}</string>
<reference key="NSSuperview" ref="191373211"/>
<reference key="NSNextKeyView" ref="77126379"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<int key="IBUIContentMode">7</int>
<bool key="IBUIUserInteractionEnabled">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<string key="IBUIText">key:</string>
<reference key="IBUITextColor" ref="318933935"/>
<nil key="IBUIHighlightedColor"/>
<int key="IBUIBaselineAdjustment">0</int>
<reference key="IBUIFontDescription" ref="911262389"/>
<reference key="IBUIFont" ref="357473706"/>
<bool key="IBUIAdjustsFontSizeToFit">NO</bool>
</object>
<object class="IBUIButton" id="92070635">
<reference key="NSNextResponder" ref="191373211"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{20, 154}, {280, 44}}</string>
<reference key="NSSuperview" ref="191373211"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="IBUIOpaque">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<int key="IBUIContentHorizontalAlignment">0</int>
<int key="IBUIContentVerticalAlignment">0</int>
<int key="IBUIButtonType">1</int>
<string key="IBUINormalTitle">OK</string>
<object class="NSColor" key="IBUIHighlightedTitleColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MQA</bytes>
</object>
<object class="NSColor" key="IBUINormalTitleColor">
<int key="NSColorSpace">1</int>
<bytes key="NSRGB">MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA</bytes>
</object>
<object class="NSColor" key="IBUINormalTitleShadowColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MC41AA</bytes>
</object>
<object class="IBUIFontDescription" key="IBUIFontDescription">
<int key="type">2</int>
<double key="pointSize">15</double>
</object>
<object class="NSFont" key="IBUIFont">
<string key="NSName">Helvetica-Bold</string>
<double key="NSSize">15</double>
<int key="NSfFlags">16</int>
</object>
</object> </object>
</array> </array>
<string key="NSFrame">{{0, 64}, {320, 504}}</string> <string key="NSFrame">{{0, 64}, {320, 504}}</string>
<reference key="NSSuperview"/> <reference key="NSSuperview"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="69099942"/> <reference key="NSNextKeyView" ref="69099942"/>
<object class="NSColor" key="IBUIBackgroundColor"> <object class="NSColor" key="IBUIBackgroundColor">
<int key="NSColorSpace">3</int> <int key="NSColorSpace">3</int>
@ -226,6 +343,14 @@
</object> </object>
<int key="connectionID">3</int> <int key="connectionID">3</int>
</object> </object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">username</string>
<reference key="source" ref="372490531"/>
<reference key="destination" ref="758743336"/>
</object>
<int key="connectionID">16</int>
</object>
<object class="IBConnectionRecord"> <object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection"> <object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">redmineHomeURL</string> <string key="label">redmineHomeURL</string>
@ -242,6 +367,14 @@
</object> </object>
<int key="connectionID">10</int> <int key="connectionID">10</int>
</object> </object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">password</string>
<reference key="source" ref="372490531"/>
<reference key="destination" ref="993802756"/>
</object>
<int key="connectionID">17</int>
</object>
<object class="IBConnectionRecord"> <object class="IBConnectionRecord">
<object class="IBCocoaTouchEventConnection" key="connection"> <object class="IBCocoaTouchEventConnection" key="connection">
<string key="label">onOk:</string> <string key="label">onOk:</string>
@ -264,11 +397,7 @@
<int key="objectID">1</int> <int key="objectID">1</int>
<reference key="object" ref="191373211"/> <reference key="object" ref="191373211"/>
<array class="NSMutableArray" key="children"> <array class="NSMutableArray" key="children">
<reference ref="69099942"/> <reference ref="96590248"/>
<reference ref="648072806"/>
<reference ref="77126379"/>
<reference ref="306516395"/>
<reference ref="92070635"/>
</array> </array>
<reference key="parent" ref="0"/> <reference key="parent" ref="0"/>
</object> </object>
@ -283,30 +412,66 @@
<reference key="object" ref="975951072"/> <reference key="object" ref="975951072"/>
<reference key="parent" ref="0"/> <reference key="parent" ref="0"/>
</object> </object>
<object class="IBObjectRecord">
<int key="objectID">18</int>
<reference key="object" ref="96590248"/>
<array class="NSMutableArray" key="children">
<reference ref="648072806"/>
<reference ref="69099942"/>
<reference ref="77126379"/>
<reference ref="306516395"/>
<reference ref="92070635"/>
<reference ref="758743336"/>
<reference ref="978568037"/>
<reference ref="993802756"/>
<reference ref="694956235"/>
</array>
<reference key="parent" ref="191373211"/>
</object>
<object class="IBObjectRecord"> <object class="IBObjectRecord">
<int key="objectID">4</int> <int key="objectID">4</int>
<reference key="object" ref="648072806"/> <reference key="object" ref="648072806"/>
<reference key="parent" ref="191373211"/> <reference key="parent" ref="96590248"/>
</object> </object>
<object class="IBObjectRecord"> <object class="IBObjectRecord">
<int key="objectID">5</int> <int key="objectID">5</int>
<reference key="object" ref="69099942"/> <reference key="object" ref="69099942"/>
<reference key="parent" ref="191373211"/> <reference key="parent" ref="96590248"/>
</object> </object>
<object class="IBObjectRecord"> <object class="IBObjectRecord">
<int key="objectID">6</int> <int key="objectID">6</int>
<reference key="object" ref="77126379"/> <reference key="object" ref="77126379"/>
<reference key="parent" ref="191373211"/> <reference key="parent" ref="96590248"/>
</object> </object>
<object class="IBObjectRecord"> <object class="IBObjectRecord">
<int key="objectID">7</int> <int key="objectID">7</int>
<reference key="object" ref="306516395"/> <reference key="object" ref="306516395"/>
<reference key="parent" ref="191373211"/> <reference key="parent" ref="96590248"/>
</object> </object>
<object class="IBObjectRecord"> <object class="IBObjectRecord">
<int key="objectID">8</int> <int key="objectID">8</int>
<reference key="object" ref="92070635"/> <reference key="object" ref="92070635"/>
<reference key="parent" ref="191373211"/> <reference key="parent" ref="96590248"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">12</int>
<reference key="object" ref="758743336"/>
<reference key="parent" ref="96590248"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">13</int>
<reference key="object" ref="978568037"/>
<reference key="parent" ref="96590248"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">14</int>
<reference key="object" ref="993802756"/>
<reference key="parent" ref="96590248"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">15</int>
<reference key="object" ref="694956235"/>
<reference key="parent" ref="96590248"/>
</object> </object>
</array> </array>
</object> </object>
@ -316,6 +481,11 @@
<string key="-2.CustomClassName">UIResponder</string> <string key="-2.CustomClassName">UIResponder</string>
<string key="-2.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> <string key="-2.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="1.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> <string key="1.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="12.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="13.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="14.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="15.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="18.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="4.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> <string key="4.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="5.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> <string key="5.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="6.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> <string key="6.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
@ -326,9 +496,55 @@
<nil key="activeLocalization"/> <nil key="activeLocalization"/>
<dictionary class="NSMutableDictionary" key="localizations"/> <dictionary class="NSMutableDictionary" key="localizations"/>
<nil key="sourceID"/> <nil key="sourceID"/>
<int key="maxID">11</int> <int key="maxID">30</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
<object class="IBPartialClassDescription">
<string key="className">OZLAccountViewController</string>
<string key="superclassName">UIViewController</string>
<object class="NSMutableDictionary" key="actions">
<string key="NS.key.0">onOk:</string>
<string key="NS.object.0">id</string>
</object>
<object class="NSMutableDictionary" key="actionInfosByName">
<string key="NS.key.0">onOk:</string>
<object class="IBActionInfo" key="NS.object.0">
<string key="name">onOk:</string>
<string key="candidateClassName">id</string>
</object>
</object>
<dictionary class="NSMutableDictionary" key="outlets">
<string key="password">UITextField</string>
<string key="redmineHomeURL">UITextField</string>
<string key="redmineUserKey">UITextField</string>
<string key="username">UITextField</string>
</dictionary>
<dictionary class="NSMutableDictionary" key="toOneOutletInfosByName">
<object class="IBToOneOutletInfo" key="password">
<string key="name">password</string>
<string key="candidateClassName">UITextField</string>
</object>
<object class="IBToOneOutletInfo" key="redmineHomeURL">
<string key="name">redmineHomeURL</string>
<string key="candidateClassName">UITextField</string>
</object>
<object class="IBToOneOutletInfo" key="redmineUserKey">
<string key="name">redmineUserKey</string>
<string key="candidateClassName">UITextField</string>
</object>
<object class="IBToOneOutletInfo" key="username">
<string key="name">username</string>
<string key="candidateClassName">UITextField</string>
</object>
</dictionary>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/OZLAccountViewController.h</string>
</object>
</object>
</array>
</object> </object>
<object class="IBClassDescriber" key="IBDocument.Classes"/>
<int key="IBDocument.localizationMode">0</int> <int key="IBDocument.localizationMode">0</int>
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaTouchFramework</string> <string key="IBDocument.TargetRuntimeIdentifier">IBCocoaTouchFramework</string>
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool> <bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>

View File

@ -34,6 +34,7 @@
#import "OZLNetwork.h" #import "OZLNetwork.h"
#import "OZLModelProject.h" #import "OZLModelProject.h"
#import "MBProgressHUD.h" #import "MBProgressHUD.h"
#import "OZLSingleton.h"
@interface OZLProjectListViewController (){ @interface OZLProjectListViewController (){
NSMutableArray* _projectList; NSMutableArray* _projectList;
@ -67,6 +68,8 @@
[self.navigationItem setLeftBarButtonItem:accountBtn]; [self.navigationItem setLeftBarButtonItem:accountBtn];
[self.navigationItem setTitle:@"Projects"]; [self.navigationItem setTitle:@"Projects"];
[[OZLSingleton sharedInstance] setLastProjectID:-1];
} }
-(void) viewWillAppear:(BOOL)animated -(void) viewWillAppear:(BOOL)animated

View File

@ -34,6 +34,7 @@
#import "OZLProjectDetailViewController.h" #import "OZLProjectDetailViewController.h"
#import "OZLIssueDetailViewController.h" #import "OZLIssueDetailViewController.h"
#import "OZLIssueCreateViewController.h" #import "OZLIssueCreateViewController.h"
#import "OZLSingleton.h"
@interface OZLProjectViewController () { @interface OZLProjectViewController () {
@ -71,6 +72,8 @@
_HUD.labelText = @"Loading..."; _HUD.labelText = @"Loading...";
[self reloadData]; [self reloadData];
[[OZLSingleton sharedInstance] setLastProjectID:_projectData.index];
} }
-(void) reloadData -(void) reloadData