Merge branch 'redmine-ios'

This commit is contained in:
zhijie 2013-07-30 14:30:09 +08:00
parent 22c3c48d00
commit 1119d13549
7 changed files with 86 additions and 72 deletions

View File

@ -38,28 +38,7 @@
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = PP_AUTORELEASE([[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]);
/*
id main = nil;
int lastProjectID = [[OZLSingleton sharedInstance] lastProjectID];
if (lastProjectID < 0) {
main = [[OZLAccountViewController alloc] initWithNibName:@"OZLAccountViewController" bundle:nil];
}else {
main = [[OZLProjectViewController alloc] initWithNibName:@"OZLProjectViewController" bundle:nil];
OZLModelProject* data = [[OZLModelProject alloc] init];
data.index = lastProjectID;
[main setProjectData:data];
}
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:main];
_revealSideViewController = [[PPRevealSideViewController alloc] initWithRootViewController:nav];
_revealSideViewController.delegate = self;
self.window.rootViewController = _revealSideViewController;
PP_RELEASE(main);
PP_RELEASE(nav);
*/
OZLProjectListViewController* projectList = [[OZLProjectListViewController alloc] initWithNibName:@"OZLProjectListViewController" bundle:nil];
_navigationController = [[UINavigationController alloc] initWithRootViewController:projectList];
@ -76,7 +55,7 @@
self.window.rootViewController = _navigationController;
self.window.backgroundColor = [UIColor whiteColor];
self.window.backgroundColor = [UIColor blackColor];
[self.window makeKeyAndVisible];
return YES;
}

View File

@ -27,7 +27,6 @@
// THE SOFTWARE.
#import "OZLAccountViewController.h"
#import "PPRevealSideViewController.h"
#import "OZLProjectListViewController.h"
#import "OZLSingleton.h"
#import "OZLConstants.h"
@ -53,10 +52,12 @@
- (void)viewDidLoad
{
[super viewDidLoad];
// [self changeSideViewOffset:40];
// UIBarButtonItem* projectListBtn = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemBookmarks target:self action:@selector(showProjectList)];
// [self.navigationItem setLeftBarButtonItem:projectListBtn];
UIBarButtonItem* doneBtn = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(onOk:)];
[self.navigationItem setRightBarButtonItem:doneBtn];
UIBarButtonItem* cancelBtn = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(showProjectList)];
[self.navigationItem setLeftBarButtonItem:cancelBtn];
_redmineHomeURL.text = [[OZLSingleton sharedInstance] redmineHomeURL];
_redmineUserKey.text = [[OZLSingleton sharedInstance] redmineUserKey];
@ -72,39 +73,13 @@
[self.view endEditing:YES];
}
- (void) preloadLeft {
OZLProjectListViewController *c = [[OZLProjectListViewController alloc] initWithNibName:@"OZLProjectListViewController" bundle:nil];
[self.revealSideViewController preloadViewController:c
forSide:PPRevealSideDirectionLeft
withOffset:_sideviewOffset];
PP_RELEASE(c);
}
- (void) viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
[NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(preloadLeft) object:nil];
[self performSelector:@selector(preloadLeft) withObject:nil afterDelay:0.3];
}
- (void) showProjectList {
[self.navigationController popViewControllerAnimated:YES];
// OZLProjectListViewController *c = [[OZLProjectListViewController alloc] initWithNibName:@"OZLProjectListViewController" bundle:nil];
// [c setNeedRefresh:YES];
// UINavigationController* navigationController = [[UINavigationController alloc] initWithRootViewController:c];
// [self.revealSideViewController pushViewController:navigationController onDirection:PPRevealSideDirectionLeft withOffset:_sideviewOffset animated:YES];
// PP_RELEASE(c);
}
- (IBAction)changeSideViewOffset:(int)offset {
_sideviewOffset = offset;
[self.revealSideViewController changeOffset:_sideviewOffset
forDirection:PPRevealSideDirectionRight];
[self.revealSideViewController changeOffset:_sideviewOffset
forDirection:PPRevealSideDirectionLeft];
[self.revealSideViewController changeOffset:_sideviewOffset
forDirection:PPRevealSideDirectionTop];
[self.revealSideViewController changeOffset:_sideviewOffset
forDirection:PPRevealSideDirectionBottom];
[UIView animateWithDuration:0.75
animations:^{
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:self.navigationController.view cache:NO];
}];
[self.navigationController popViewControllerAnimated:NO];
}
- (void)didReceiveMemoryWarning
@ -120,6 +95,7 @@
[self setPassword:nil];
[super viewDidUnload];
}
- (IBAction)onOk:(id)sender {
[[OZLSingleton sharedInstance] setRedmineUserKey:_redmineUserKey.text];
[[OZLSingleton sharedInstance] setRedmineHomeURL:_redmineHomeURL.text];
@ -129,7 +105,7 @@
NSNotificationCenter* center = [NSNotificationCenter defaultCenter];
[center postNotificationName:NOTIFICATION_REDMINE_ACCOUNT_CHANGED object:nil];
[self showProjectList];
}
@end

View File

@ -48,7 +48,7 @@
<string key="NSFrame">{{20, 49}, {280, 30}}</string>
<reference key="NSSuperview" ref="96590248"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="306516395"/>
<reference key="NSNextKeyView" ref="978568037"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
@ -116,7 +116,7 @@
<string key="NSFrame">{{20, 454}, {280, 30}}</string>
<reference key="NSSuperview" ref="96590248"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="978568037"/>
<reference key="NSNextKeyView"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
@ -160,10 +160,11 @@
</object>
<object class="IBUIButton" id="92070635">
<reference key="NSNextResponder" ref="96590248"/>
<int key="NSvFlags">292</int>
<int key="NSvFlags">-2147483356</int>
<string key="NSFrame">{{20, 241}, {280, 44}}</string>
<reference key="NSSuperview" ref="96590248"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="306516395"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="IBUIOpaque">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
@ -294,6 +295,7 @@
<string key="NSFrameSize">{320, 504}</string>
<reference key="NSSuperview" ref="191373211"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="69099942"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="IBUIClipsSubviews">YES</bool>
<bool key="IBUIMultipleTouchEnabled">YES</bool>
@ -303,7 +305,7 @@
<string key="NSFrame">{{0, 64}, {320, 504}}</string>
<reference key="NSSuperview"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="69099942"/>
<reference key="NSNextKeyView" ref="96590248"/>
<object class="NSColor" key="IBUIBackgroundColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MQA</bytes>

View File

@ -3,8 +3,28 @@
// RedmineMobile
//
// Created by lizhijie on 7/23/13.
// Copyright (c) 2013 Lee Zhijie. All rights reserved.
// This code is distributed under the terms and conditions of the MIT license.
// Copyright (c) 2013 Zhijie Lee(onezeros.lee@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import <UIKit/UIKit.h>
#import "OZLModelIssue.h"

View File

@ -3,8 +3,28 @@
// RedmineMobile
//
// Created by lizhijie on 7/23/13.
// Copyright (c) 2013 Lee Zhijie. All rights reserved.
// This code is distributed under the terms and conditions of the MIT license.
// Copyright (c) 2013 Zhijie Lee(onezeros.lee@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import "OZLIssueLogtimeViewController.h"
#import "MBProgressHUD.h"

View File

@ -102,7 +102,11 @@
- (IBAction)onCancel:(id)sender {
[self.navigationController popViewControllerAnimated:YES];
if (_viewMode == OZLProjectInfoViewModeCreate) {
[self.navigationController dismissModalViewControllerAnimated:YES];
}else {
[self.navigationController popViewControllerAnimated:YES];
}
}
- (IBAction)onSave:(id)sender {
@ -141,10 +145,15 @@
[OZLNetwork createProject:projectData withParams:nil andBlock:^(BOOL success, NSError *error) {
if (error) {
NSLog(@"create project error: %@",error.description);
_HUD.mode = MBProgressHUDModeText;
_HUD.labelText = @"Connection Failed";
_HUD.detailsLabelText = @" Please check network connection or your account setting.";
[_HUD hide:YES afterDelay:3];
}else {
[_HUD hide:YES];
[self onCancel:nil];
}
[_HUD hide:YES];
}];
}

View File

@ -125,8 +125,13 @@
- (IBAction)showAccountView:(id)sender {
OZLAccountViewController *c = [[OZLAccountViewController alloc] initWithNibName:@"OZLAccountViewController" bundle:nil];
[self.navigationController pushViewController:c animated:YES];
[UIView animateWithDuration:0.75
animations:^{
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[self.navigationController pushViewController:c animated:NO];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:self.navigationController.view cache:NO];
}];
// UINavigationController *n = [[UINavigationController alloc] initWithRootViewController:c];
// [self.revealSideViewController popViewControllerWithNewCenterController:n
// animated:YES];
@ -167,7 +172,10 @@
OZLProjectInfoViewController* creator = [tableViewStoryboard instantiateViewControllerWithIdentifier:@"OZLProjectInfoViewController"];
[creator setProjectList:_projectList];
[creator setViewMode:OZLProjectInfoViewModeCreate];
[self.navigationController pushViewController:creator animated:YES];
UINavigationController *nav=[[UINavigationController alloc]initWithRootViewController:creator];
[self.navigationController presentModalViewController:nav animated:YES];
}
- (void)viewDidUnload {