Skip to content

Commit

Permalink
v. 1.1.4 - Gesture Events & close method
Browse files Browse the repository at this point in the history
  • Loading branch information
Mads Møller committed Jan 19, 2014
1 parent fddae52 commit b96fd29
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 17 deletions.
17 changes: 10 additions & 7 deletions ios/Classes/CustomMMDrawerController.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
//
// CustomMMDrawerController.h
// NappDrawer
//
// Created by Azwan b. Amit on 12/31/13.
//
//
/**
* Module developed by Napp ApS
* www.napp.dk
* Mads Møller
*
* CustomMMDrawerController - PR from Azwan b. Amit
*
* Appcelerator Titanium is Copyright (c) 2009-2010 by Appcelerator, Inc.
* and licensed under the Apache Public License (version 2)
*/

#import "MMDrawerController.h"

Expand Down
26 changes: 19 additions & 7 deletions ios/Classes/CustomMMDrawerController.m
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
//
// CustomMMDrawerController.m
// NappDrawer
//
// Created by Azwan b. Amit on 12/31/13.
//
//
/**
* Module developed by Napp ApS
* www.napp.dk
* Mads Møller
*
* CustomMMDrawerController - PR from Azwan b. Amit
*
* Appcelerator Titanium is Copyright (c) 2009-2010 by Appcelerator, Inc.
* and licensed under the Apache Public License (version 2)
*/

#import "CustomMMDrawerController.h"

Expand All @@ -31,6 +34,15 @@ -(void)closeDrawerAnimated:(BOOL)animated completion:(void (^)(BOOL finished))co
-(void)setWindowAppearanceCallback:(void(^)(NSString*))callback
{
_callback = [callback copy];

// add callback for the gestures
[super setGestureCompletionBlock:^(MMDrawerController *controller, UIGestureRecognizer *gesture) {
if(controller.openSide == MMDrawerSideNone){
_callback(@"close");
} else {
_callback(@"open");
}
}];
}

-(void)dealloc
Expand Down
1 change: 1 addition & 0 deletions ios/Classes/DkNappDrawerDrawer.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,6 @@
-(NSNumber*)isAnyWindowOpen:(id)args;
-(NSNumber*)isLeftWindowOpen:(id)args;
-(NSNumber*)isRightWindowOpen:(id)args;
-(void)close:(id)args;

@end
8 changes: 6 additions & 2 deletions ios/Classes/DkNappDrawerDrawer.m
Original file line number Diff line number Diff line change
Expand Up @@ -305,8 +305,6 @@ -(void)setAnimationMode_:(id)args
}




// API
-(void)toggleLeftWindow:(id)args
{
Expand Down Expand Up @@ -347,4 +345,10 @@ -(NSNumber*)isRightWindowOpen:(id)args
return NUMBOOL(controller.openSide == MMDrawerSideLeft);
}

-(void)close:(id)args {
[self dealloc];
}



@end
4 changes: 4 additions & 0 deletions ios/Classes/DkNappDrawerDrawerProxy.m
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,9 @@ -(NSNumber*)isRightWindowOpen:(id)args {
return [(DkNappDrawerDrawer*)[self view] isRightWindowOpen:args];
}

-(void)close:(id)args {
TiThreadPerformOnMainThread(^{[(DkNappDrawerDrawer*)[self view] close:args];}, NO);
}


@end
4 changes: 4 additions & 0 deletions ios/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,10 @@ mainWindow.addEventListener("windowDidClose", function(e) {
## Changelog
* v1.1.4
* Added gesture events for open and close the drawer.
* Added `close()` method to remove the Drawer completely.
* v1.1.3
* Added `statusBarStyle` to help iOS7 and the LIGHT CONTENT bug. Thanks to @adrianopaladini.
Expand Down
Binary file added ios/dist/dk.napp.drawer-iphone-1.1.4.zip
Binary file not shown.
2 changes: 1 addition & 1 deletion ios/manifest
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# this is your module manifest and used by Titanium
# during compilation, packaging, distribution, etc.
#
version: 1.1.3
version: 1.1.4
apiversion: 2
description: Drawer controller
author: Mads Møller
Expand Down

0 comments on commit b96fd29

Please sign in to comment.