Skip to content

Commit

Permalink
Merge branch 'feature-iPad-universal' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
lealife committed Nov 8, 2015
2 parents 2568449 + 1f5bc4b commit d810141
Show file tree
Hide file tree
Showing 48 changed files with 496 additions and 1,716 deletions.
19 changes: 9 additions & 10 deletions Leanote.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -175,12 +175,11 @@
1CB6C10C1B5B8A4C004F61DD /* CategoryViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1CB6C10B1B5B8A4C004F61DD /* CategoryViewController.m */; };
1CBE20761B3FD4CA00133EA1 /* BaseViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1CBE20751B3FD4CA00133EA1 /* BaseViewController.m */; };
1CC8FFD21B1B26DD00269072 /* NoteViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1CC8FFD11B1B26DD00269072 /* NoteViewController.m */; };
1CD58CD51BEF2C59003B71BF /* Launch Screen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 1CD58CD41BEF2C59003B71BF /* Launch Screen.storyboard */; settings = {ASSET_TAGS = (); }; };
1CD6AF5B1B3288DE0098CE96 /* NoteController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1CD6AF5A1B3288DE0098CE96 /* NoteController.m */; };
1CD7C2CC1B2DCB6500AB25FF /* File.m in Sources */ = {isa = PBXBuildFile; fileRef = 1CD7C2CB1B2DCB6500AB25FF /* File.m */; };
1CD7C2CF1B2DCBA200AB25FF /* FileService.m in Sources */ = {isa = PBXBuildFile; fileRef = 1CD7C2CE1B2DCBA200AB25FF /* FileService.m */; };
1CD7C2D41B2DD43B00AB25FF /* README.md in Sources */ = {isa = PBXBuildFile; fileRef = 1CD7C2D31B2DD43B00AB25FF /* README.md */; };
1CD878111B5F5E1D002E5F7B /* Launch Screen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1CD878101B5F5E1D002E5F7B /* Launch Screen.xib */; };
1CD878131B5F62DA002E5F7B /* Launch Screen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 1CD878121B5F62DA002E5F7B /* Launch Screen.storyboard */; };
1CDB4FAE1B305C7C007CC245 /* MeController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1CDB4FAB1B305C7C007CC245 /* MeController.m */; };
1CDB4FAF1B305C7C007CC245 /* MeTab.m in Sources */ = {isa = PBXBuildFile; fileRef = 1CDB4FAD1B305C7C007CC245 /* MeTab.m */; };
1CDCB1731B52B77E00838D17 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 1CDCB1751B52B77E00838D17 /* Localizable.strings */; };
Expand Down Expand Up @@ -500,15 +499,14 @@
1CBE20751B3FD4CA00133EA1 /* BaseViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BaseViewController.m; sourceTree = "<group>"; };
1CC8FFD01B1B26DD00269072 /* NoteViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NoteViewController.h; sourceTree = "<group>"; };
1CC8FFD11B1B26DD00269072 /* NoteViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NoteViewController.m; sourceTree = "<group>"; };
1CD58CD41BEF2C59003B71BF /* Launch Screen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = "Launch Screen.storyboard"; sourceTree = "<group>"; };
1CD6AF591B3288DE0098CE96 /* NoteController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NoteController.h; sourceTree = "<group>"; };
1CD6AF5A1B3288DE0098CE96 /* NoteController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NoteController.m; sourceTree = "<group>"; };
1CD7C2CA1B2DCB6500AB25FF /* File.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = File.h; sourceTree = "<group>"; };
1CD7C2CB1B2DCB6500AB25FF /* File.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = File.m; sourceTree = "<group>"; };
1CD7C2CD1B2DCBA200AB25FF /* FileService.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileService.h; sourceTree = "<group>"; };
1CD7C2CE1B2DCBA200AB25FF /* FileService.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FileService.m; sourceTree = "<group>"; };
1CD7C2D31B2DD43B00AB25FF /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; };
1CD878101B5F5E1D002E5F7B /* Launch Screen.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = "Launch Screen.xib"; sourceTree = "<group>"; };
1CD878121B5F62DA002E5F7B /* Launch Screen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = "Launch Screen.storyboard"; sourceTree = "<group>"; };
1CDB4FAA1B305C7C007CC245 /* MeController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MeController.h; sourceTree = "<group>"; };
1CDB4FAB1B305C7C007CC245 /* MeController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MeController.m; sourceTree = "<group>"; };
1CDB4FAC1B305C7C007CC245 /* MeTab.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MeTab.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1066,9 +1064,8 @@
1CDCB1441B50E66700838D17 /* ui */ = {
isa = PBXGroup;
children = (
1CD58CD41BEF2C59003B71BF /* Launch Screen.storyboard */,
1C3DA98F1BE6667C00B4FFDA /* LeaWebViewController.xib */,
1CD878101B5F5E1D002E5F7B /* Launch Screen.xib */,
1CD878121B5F62DA002E5F7B /* Launch Screen.storyboard */,
);
path = ui;
sourceTree = "<group>";
Expand Down Expand Up @@ -1430,6 +1427,9 @@
CreatedOnToolsVersion = 6.3.1;
TestTargetID = 1D921D98173CB5BD00168A77;
};
1D921D98173CB5BD00168A77 = {
DevelopmentTeam = 926WD5ZF5V;
};
};
};
buildConfigurationList = 1D921D94173CB5BD00168A77 /* Build configuration list for PBXProject "Leanote" */;
Expand Down Expand Up @@ -1484,7 +1484,6 @@
1CA4CEEB1B68D91200E500F4 /* icon_format_media.png in Resources */,
1CA4CEC91B68D91200E500F4 /* icon-posts-editor-inspector.png in Resources */,
1CA4CF481B68D91200E500F4 /* [email protected] in Resources */,
1CD878111B5F5E1D002E5F7B /* Launch Screen.xib in Resources */,
1CA4CF341B68D91200E500F4 /* ZSSh1.png in Resources */,
1CA4CECF1B68D91200E500F4 /* icon_format_bold.png in Resources */,
1CA4CEDD1B68D91200E500F4 /* [email protected] in Resources */,
Expand All @@ -1494,6 +1493,7 @@
1CEF0CAB1B876B2200C2B2F3 /* SVProgressHUD.bundle in Resources */,
1CF4A4A21B1D844200FC0F50 /* AppImages.xcassets in Resources */,
1D921DB8173CB5BD00168A77 /* MainStoryboard_iPhone.storyboard in Resources */,
1CD58CD51BEF2C59003B71BF /* Launch Screen.storyboard in Resources */,
1CEF0DC51B876D8400C2B2F3 /* icon_session-8.png in Resources */,
1CA4CF091B68D91200E500F4 /* icon_format_ul.png in Resources */,
1CA4CF031B68D91200E500F4 /* icon_format_strikethrough.png in Resources */,
Expand All @@ -1511,7 +1511,6 @@
1CA4CEED1B68D91200E500F4 /* [email protected] in Resources */,
1CA4CEEE1B68D91200E500F4 /* icon_format_media_highlighted.png in Resources */,
1CA4CF2B1B68D91200E500F4 /* ZSSbgcolor.png in Resources */,
1CD878131B5F62DA002E5F7B /* Launch Screen.storyboard in Resources */,
1CA4CEF31B68D91200E500F4 /* [email protected] in Resources */,
1CA4CF3A1B68D91200E500F4 /* ZSSh4.png in Resources */,
1CA4CF131B68D91200E500F4 /* icon_format_unlink.png in Resources */,
Expand Down Expand Up @@ -1979,7 +1978,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "iPhone Developer";
CODE_SIGN_IDENTITY = "iPhone Distribution: Tie Li (926WD5ZF5V)";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution: Tie Li (926WD5ZF5V)";
ENABLE_BITCODE = NO;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
Expand Down Expand Up @@ -2018,7 +2017,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "iPhone Developer";
CODE_SIGN_IDENTITY = "iPhone Distribution: Tie Li (926WD5ZF5V)";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution: Tie Li (926WD5ZF5V)";
ENABLE_BITCODE = NO;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
Expand Down
10 changes: 5 additions & 5 deletions Leanote/Images.xcassets/LaunchImage.launchimage/Contents.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
{
"orientation" : "portrait",
"idiom" : "iphone",
"filename" : "start-retina.png",
"extent" : "full-screen",
"minimum-system-version" : "7.0",
"filename" : "start-retina.png",
"scale" : "2x"
},
{
Expand All @@ -20,33 +20,33 @@
{
"orientation" : "portrait",
"idiom" : "ipad",
"filename" : "Portrait~ipad-1.png",
"extent" : "full-screen",
"minimum-system-version" : "7.0",
"filename" : "Default-Portrait~ipad.png",
"scale" : "1x"
},
{
"orientation" : "landscape",
"idiom" : "ipad",
"filename" : "Landscape~ipad-1.png",
"extent" : "full-screen",
"minimum-system-version" : "7.0",
"filename" : "Default-Landscape~ipad.png",
"scale" : "1x"
},
{
"orientation" : "portrait",
"idiom" : "ipad",
"filename" : "[email protected]",
"extent" : "full-screen",
"minimum-system-version" : "7.0",
"filename" : "Default-Portrait@2x~ipad.png",
"scale" : "2x"
},
{
"orientation" : "landscape",
"idiom" : "ipad",
"filename" : "Landscape@2x~ipad-1.png",
"extent" : "full-screen",
"minimum-system-version" : "7.0",
"filename" : "Default-Landscape@2x~ipad.png",
"scale" : "2x"
}
],
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion Leanote/Leanote-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>949</string>
<string>963</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSAppTransportSecurity</key>
Expand Down
2 changes: 1 addition & 1 deletion Leanote/Settings.bundle/Root.plist
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<key>AutocorrectionType</key>
<string>No</string>
<key>DefaultValue</key>
<string>1.0 (949)</string>
<string>1.0 (963)</string>
<key>IsSecure</key>
<false/>
<key>Key</key>
Expand Down
24 changes: 23 additions & 1 deletion Leanote/controller/BaseViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ - (void) removeUISearchBarBackgroundInViewHierarchy:(UIView *)view

-(void)setBarStyle
{
if(self.isSelectOnSearch) {
if(self.isSelectOnSearch && !IS_IPAD) {
[self setBarStyleBlack];
}
else {
Expand Down Expand Up @@ -152,6 +152,15 @@ -(void) setTableStyle:(UITableView *) tableView
[WPStyleGuide configureColorsForView:self.view andTableView:tableView];
// footer不要有分割线, 防止断片
tableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectMake(0.0, 0.0, 0.0, 44.0)]; // add some vertical padding

// 为了解决左侧少15px 分隔线
if ([tableView respondsToSelector:@selector(setSeparatorInset:)]) {
[tableView setSeparatorInset:UIEdgeInsetsZero];
}

if ([tableView respondsToSelector:@selector(setLayoutMargins:)]) {
[tableView setLayoutMargins:UIEdgeInsetsZero];
}
}

-(UIView *) iniNoResultView:(UITableView *) tableView
Expand Down Expand Up @@ -181,4 +190,17 @@ -(UIView *) iniNoResultView:(UITableView *) tableView
return nomatchesView;
}

// 为了解决分隔线左侧少15px的情况, iphone, ipad都会存在

-(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{
if ([cell respondsToSelector:@selector(setSeparatorInset:)]) {
[cell setSeparatorInset:UIEdgeInsetsZero];
}

if ([cell respondsToSelector:@selector(setLayoutMargins:)]) {
[cell setLayoutMargins:UIEdgeInsetsZero];
}
}

@end
17 changes: 12 additions & 5 deletions Leanote/controller/me/MeController.m
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,15 @@ - (void)didReceiveMemoryWarning
[super didReceiveMemoryWarning];
}

- (void) addUserSync
{
[Common showProgressWithStatus:NSLocalizedString(@"Add account successful and Synchronizing...", nil)];
// 同步
[SyncService incrSync:^(BOOL ok) {
[Common hideProgress];
} progress:nil];
}

- (void) notifyChangeUser:(BOOL) isAdd
{
// 取得ios系统唯一的全局的广播站 通知中心
Expand Down Expand Up @@ -97,11 +106,9 @@ - (void) notifyChangeUser:(BOOL) isAdd

// UITableViewRowAnimationBottom
if(isAdd) {
[Common showProgressWithStatus:NSLocalizedString(@"Add account successful and Synchronizing...", nil)];
// 同步
[SyncService incrSync:^(BOOL ok) {
[Common hideProgress];
} progress:nil];
[self addUserSync];
// 1s后同步
// [self performSelector:@selector(addUserSync) withObject:nil afterDelay:1.0f];
}
else {
[self showSuccessMsg:NSLocalizedString(@"Toggle account successful", nil)];
Expand Down
54 changes: 41 additions & 13 deletions Leanote/controller/note/NoteController.m
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

#import <SGNavigationProgress/UINavigationController+SGProgress.h>

@interface NoteController ()<SWTableViewCellDelegate>
@interface NoteController()

@property (strong, nonatomic) NSIndexPath *indexPathToBeDeleted;
@property (strong, nonatomic) NSFetchedResultsController *searchedResultsController;
Expand Down Expand Up @@ -155,8 +155,9 @@ - (void)viewDidLoad
// 放这里
[self.tableView reloadData];

// table的样式
// table的样式, 包括search table view
[self setTableStyle:self.tableView];
// [self setTableStyle:self.searchDisplayController.searchResultsTableView];

// isBlog ?
if(self.isBlog) {
Expand Down Expand Up @@ -405,6 +406,7 @@ - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger
return count;
}


// 每行显示什么
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
Expand Down Expand Up @@ -725,9 +727,6 @@ - (void)controller:(NSFetchedResultsController *)controller
[tableView deleteSections:[NSIndexSet indexSetWithIndex:sectionIndex]
withRowAnimation:UITableViewRowAnimationFade];
break;
case NSFetchedResultsChangeUpdate:
case NSFetchedResultsChangeMove:
break;
}

}
Expand Down Expand Up @@ -846,15 +845,40 @@ - (NSUInteger)titleLength
return titleLen;
}

// 搜索
// ipad下search bar上移, 但navigation却不隐藏
// ipad下模拟没有navigationController, 但是SWTableViewCell selectCell 要用到
// http://stackoverflow.com/a/5860412/4269908
//- (UINavigationController *)navigationController {
// if (IS_IPAD) {
// return nil;
// } else {
// return self.navigationController;
// }
//}
- (UINavigationController *)navigationController {
if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
NSString *sourceString = [[NSThread callStackSymbols] objectAtIndex:1];
// Example: 1 UIKit 0x00540c89 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1163
NSCharacterSet *separatorSet = [NSCharacterSet characterSetWithCharactersInString:@" -[]+?.,"];
NSMutableArray *array = [NSMutableArray arrayWithArray:[sourceString componentsSeparatedByCharactersInSet:separatorSet]];
[array removeObject:@""];

// Array[3] == class caller
if([array[3] isEqualToString:@"UISearchDisplayController"]) {
return nil;
}
}
return [super navigationController];
}

// 搜索
#pragma mark - UISearchDisplayDelegate Methods

- (BOOL)searchDisplayController:(UISearchDisplayController *)controller shouldReloadTableForSearchString:(NSString *)searchString
{
NSLog(@"[%@ %@]", NSStringFromClass([self class]), NSStringFromSelector(_cmd));
// NSLog(@"[%@ %@]", NSStringFromClass([self class]), NSStringFromSelector(_cmd));

NSString *searchPredicate = [NSString stringWithFormat:@"title contains[cd] '%@' or content contains[cd] '%@'", searchString, searchString];
NSString *searchPredicate = [NSString stringWithFormat:@"(title contains[cd] '%@' or content contains[cd] '%@')", searchString, searchString];

self.searchedResultsController = [Leas.note fetchedResultsControllerWithPredicate:searchPredicate
withController:self
Expand All @@ -868,8 +892,10 @@ - (BOOL)searchDisplayController:(UISearchDisplayController *)controller shouldRe

- (void)searchDisplayControllerWillBeginSearch:(UISearchDisplayController *)controller
{
[self setBarStyleBlack];
self.isSelectOnSearch = YES;
if (!IS_IPAD) {
[self setBarStyleBlack];
self.isSelectOnSearch = YES;
}
}

- (void)searchDisplayControllerWillEndSearch:(UISearchDisplayController *)controller
Expand All @@ -881,9 +907,11 @@ - (void)searchDisplayControllerWillEndSearch:(UISearchDisplayController *)contro

// 为什么要reload ?
// [self.tableView reloadData];

[self restoreBarStyle];
self.isSelectOnSearch = NO;
if (!IS_IPAD) {
[self restoreBarStyle];

self.isSelectOnSearch = NO;
}
}

#pragma mark - UISearchBarDelegate Methods
Expand Down
18 changes: 16 additions & 2 deletions Leanote/controller/note/NoteViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ @interface NoteViewController () <CTAssetsPickerControllerDelegate, UINavigation
@property (nonatomic) BOOL isMarkdown;

@property (nonatomic) BOOL edited;
@property (nonatomic) BOOL isClosed;

@property BOOL isInited;

Expand Down Expand Up @@ -222,7 +223,7 @@ -(void) viewWillDisappear:(BOOL)animated {

// 一直在loading 内容
[self hideProgress];

self.isClosed = YES;
[super viewWillDisappear:animated];
}

Expand Down Expand Up @@ -405,13 +406,26 @@ - (void)editorDidFinishLoadingDOM:(WPEditorViewController *)editorController
[self showProgress];

[Leas.note getNoteContent:self.note success:^(NSString * content) {
// 如果已经不在本页了 不要设置
if(self.isClosed) {
return;
}
[self setBodyText:content];
[self enableRightButtons];
[self hideProgress];
} fail:^{
// 如果已经不在本页了, 不要alert
if(self.isClosed) {
return;
}
[self hideProgress];
[LeaAlert showAlertWithTitle:NSLocalizedString(@"Error", nil) message:NSLocalizedString(@"Cannot fetch note's content", nil) withSupportButton:NO okPressedBlock:^(UIAlertView *alertView) {

[LeaAlert showAlertWithTitle:NSLocalizedString(@"Error", nil) message:NSLocalizedString(@"Cannot fetch note's content", nil) withSupportButton:NO okPressedBlock:^() {
if(self.isClosed) {
return;
}
// 返回
// 这里, 可能已不是本页
[self.navigationController popViewControllerAnimated:YES];
}];
}];
Expand Down
Loading

0 comments on commit d810141

Please sign in to comment.