Skip to content

Commit 21d31af

Browse files
author
Mads Møller
authored
Merge pull request #211 from hansemannn/refactor-ios
Refactor iOS project
2 parents 228e573 + aa03a12 commit 21d31af

File tree

90 files changed

+7170
-1217
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+7170
-1217
lines changed

.gitmodules

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +0,0 @@
1-
[submodule "ios/MMDrawerController"]
2-
path = ios/MMDrawerController
3-
url = https://[email protected]/mutualmobile/MMDrawerController

LICENSE

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Copyright (c) 2010-2013 Mads Møller
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy
4+
of this software and associated documentation files (the "Software"), to deal
5+
in the Software without restriction, including without limitation the rights
6+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
copies of the Software, and to permit persons to whom the Software is
8+
furnished to do so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in
11+
all copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19+
THE SOFTWARE.

android/CHANGELOG.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

android/LICENSE

Lines changed: 0 additions & 1 deletion
This file was deleted.

android/LICENSE.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

ios/.clang-format

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
---
2+
# BasedOnStyle: WebKit
3+
AccessModifierOffset: -4
4+
AlignAfterOpenBracket: DontAlign
5+
AlignConsecutiveAssignments: false
6+
AlignConsecutiveDeclarations: false
7+
AlignEscapedNewlinesLeft: false
8+
AlignOperands: false
9+
AlignTrailingComments: false
10+
AllowAllParametersOfDeclarationOnNextLine: true
11+
AllowShortBlocksOnASingleLine: false
12+
AllowShortCaseLabelsOnASingleLine: false
13+
AllowShortFunctionsOnASingleLine: All
14+
AllowShortIfStatementsOnASingleLine: false
15+
AllowShortLoopsOnASingleLine: false
16+
AlwaysBreakAfterDefinitionReturnType: None
17+
AlwaysBreakAfterReturnType: None
18+
AlwaysBreakBeforeMultilineStrings: false
19+
AlwaysBreakTemplateDeclarations: false
20+
BinPackArguments: true
21+
BinPackParameters: true
22+
BraceWrapping:
23+
AfterClass: false
24+
AfterControlStatement: false
25+
AfterEnum: false
26+
AfterFunction: true
27+
AfterNamespace: false
28+
AfterObjCDeclaration: false
29+
AfterStruct: false
30+
AfterUnion: false
31+
BeforeCatch: false
32+
BeforeElse: false
33+
IndentBraces: false
34+
BreakBeforeBinaryOperators: All
35+
BreakBeforeBraces: WebKit
36+
BreakBeforeTernaryOperators: true
37+
BreakConstructorInitializersBeforeComma: true
38+
BreakAfterJavaFieldAnnotations: false
39+
BreakStringLiterals: true
40+
ColumnLimit: 0
41+
CommentPragmas: '^ IWYU pragma:'
42+
BreakBeforeInheritanceComma: false
43+
ConstructorInitializerAllOnOneLineOrOnePerLine: false
44+
ConstructorInitializerIndentWidth: 4
45+
ContinuationIndentWidth: 4
46+
Cpp11BracedListStyle: false
47+
DerivePointerAlignment: false
48+
DisableFormat: false
49+
ExperimentalAutoDetectBinPacking: false
50+
FixNamespaceComments: false
51+
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
52+
IncludeCategories:
53+
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
54+
Priority: 2
55+
- Regex: '^(<|"(gtest|isl|json)/)'
56+
Priority: 3
57+
- Regex: '.*'
58+
Priority: 1
59+
IncludeIsMainRegex: '$'
60+
IndentCaseLabels: false
61+
IndentWidth: 2
62+
IndentWrappedFunctionNames: false
63+
JavaScriptQuotes: Leave
64+
JavaScriptWrapImports: true
65+
KeepEmptyLinesAtTheStartOfBlocks: true
66+
MacroBlockBegin: ''
67+
MacroBlockEnd: ''
68+
MaxEmptyLinesToKeep: 1
69+
NamespaceIndentation: Inner
70+
ObjCBlockIndentWidth: 2
71+
ObjCSpaceAfterProperty: true
72+
ObjCSpaceBeforeProtocolList: true
73+
PenaltyBreakBeforeFirstCallParameter: 19
74+
PenaltyBreakComment: 300
75+
PenaltyBreakFirstLessLess: 120
76+
PenaltyBreakString: 1000
77+
PenaltyExcessCharacter: 1000000
78+
PenaltyReturnTypeOnItsOwnLine: 60
79+
PointerAlignment: Right
80+
ReflowComments: true
81+
SortIncludes: true
82+
SpaceAfterCStyleCast: false
83+
SpaceAfterTemplateKeyword: true
84+
SpaceBeforeAssignmentOperators: true
85+
SpaceBeforeParens: ControlStatements
86+
SpaceInEmptyParentheses: false
87+
SpacesBeforeTrailingComments: 1
88+
SpacesInAngles: false
89+
SpacesInContainerLiterals: true
90+
SpacesInCStyleCastParentheses: false
91+
SpacesInParentheses: false
92+
SpacesInSquareBrackets: false
93+
Standard: Cpp11
94+
TabWidth: 8
95+
UseTab: Never
96+
...

ios/CHANGELOG.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

ios/Classes/CustomMMDrawerController.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,10 @@
1313

1414
typedef void windowAppearanceChange;
1515

16-
@interface CustomMMDrawerController : MMDrawerController
17-
{
18-
void (^_callback)(NSString *state);
16+
@interface CustomMMDrawerController : MMDrawerController {
17+
void (^_callback)(NSString *state);
1918
}
2019

21-
-(void)setWindowAppearanceCallback:(void(^)(NSString*))callback;
20+
- (void)setWindowAppearanceCallback:(void (^)(NSString *))callback;
2221

2322
@end

ios/Classes/CustomMMDrawerController.m

Lines changed: 28 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -13,43 +13,42 @@
1313

1414
@implementation CustomMMDrawerController
1515

16-
-(void)openDrawerSide:(MMDrawerSide)drawerSide animated:(BOOL)animated completion:(void (^)(BOOL finished))completion
16+
- (void)openDrawerSide:(MMDrawerSide)drawerSide animated:(BOOL)animated completion:(void (^)(BOOL finished))completion
1717
{
18-
[super openDrawerSide:drawerSide animated:animated completion:^(BOOL finished) {
19-
if (finished){
20-
_callback(@"open");
21-
}
22-
}];
18+
[super openDrawerSide:drawerSide
19+
animated:animated
20+
completion:^(BOOL finished) {
21+
if (finished) {
22+
_callback(@"open");
23+
}
24+
}];
2325
}
2426

25-
-(void)closeDrawerAnimated:(BOOL)animated completion:(void (^)(BOOL finished))completion
27+
- (void)closeDrawerAnimated:(BOOL)animated completion:(void (^)(BOOL finished))completion
2628
{
27-
[super closeDrawerAnimated:animated completion:^(BOOL finished) {
28-
if (finished){
29-
_callback(@"close");
30-
}
31-
}];
29+
[super closeDrawerAnimated:animated
30+
completion:^(BOOL finished) {
31+
if (finished) {
32+
_callback(@"close");
33+
}
34+
}];
3235
}
3336

34-
-(void)setWindowAppearanceCallback:(void(^)(NSString*))callback
37+
- (void)setWindowAppearanceCallback:(void (^)(NSString *))callback
3538
{
36-
_callback = [callback copy];
37-
38-
// add callback for the gestures
39-
[super setGestureCompletionBlock:^(MMDrawerController *controller, UIGestureRecognizer *gesture) {
40-
if(controller.openSide == MMDrawerSideNone){
41-
_callback(@"close");
42-
} else {
43-
_callback(@"open");
44-
}
45-
}];
46-
}
39+
_callback = [callback copy];
40+
__weak __typeof__(self) weakSelf = self;
4741

48-
-(void)dealloc
49-
{
50-
[super dealloc];
51-
[_callback release];
52-
_callback = nil;
42+
// add callback for the gestures
43+
[super setGestureCompletionBlock:^(MMDrawerController *controller, UIGestureRecognizer *gesture) {
44+
__typeof__(self) strongSelf = weakSelf;
45+
46+
if (controller.openSide == MMDrawerSideNone) {
47+
strongSelf->_callback(@"close");
48+
} else {
49+
strongSelf->_callback(@"open");
50+
}
51+
}];
5352
}
5453

5554
@end

ios/Classes/DkNappDrawerDrawer.h

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,37 +7,38 @@
77
* and licensed under the Apache Public License (version 2)
88
*/
99

10-
#import "TiBase.h"
11-
#import "TiUIView.h"
1210
#import "CustomMMDrawerController.h"
1311
#import "NappDrawerVisualState.h"
12+
#import "TiBase.h"
13+
#import "TiUIView.h"
1414
#import "TiUIiOSNavWindowProxy.h"
1515

1616
#import <QuartzCore/QuartzCore.h>
1717

1818
@interface DkNappDrawerDrawer : TiUIView {
19-
@private
20-
CustomMMDrawerController *controller;
21-
TiUIiOSNavWindowProxy *navProxy;
22-
23-
NSMutableArray* _accessibleElements;
24-
25-
UIView* controllerView_;
26-
27-
UIView* leftView_;
28-
UIView* rightView_;
29-
UIView* centerView_;
19+
@private
20+
CustomMMDrawerController *controller;
21+
TiUIiOSNavWindowProxy *navProxy;
22+
23+
NSMutableArray *_accessibleElements;
24+
25+
UIView *controllerView_;
26+
27+
UIView *leftView_;
28+
UIView *rightView_;
29+
UIView *centerView_;
3030
}
3131

32-
-(CustomMMDrawerController*)controller;
32+
- (CustomMMDrawerController *)controller;
33+
34+
// Public APIs
3335

34-
//API
35-
-(void)toggleLeftWindow:(id)args;
36-
-(void)toggleRightWindow:(id)args;
37-
-(void)bounceLeftWindow:(id)args;
38-
-(void)bounceRightWindow:(id)args;
39-
-(NSNumber*)isAnyWindowOpen:(id)args;
40-
-(NSNumber*)isLeftWindowOpen:(id)args;
41-
-(NSNumber*)isRightWindowOpen:(id)args;
36+
- (void)toggleLeftWindow:(id)args;
37+
- (void)toggleRightWindow:(id)args;
38+
- (void)bounceLeftWindow:(id)args;
39+
- (void)bounceRightWindow:(id)args;
40+
- (NSNumber *)isAnyWindowOpen:(id)args;
41+
- (NSNumber *)isLeftWindowOpen:(id)args;
42+
- (NSNumber *)isRightWindowOpen:(id)args;
4243

4344
@end

0 commit comments

Comments
 (0)