Created
February 22, 2020 22:27
-
-
Save BandarHL/61e0edcd02636256bbf6da87e88464e9 to your computer and use it in GitHub Desktop.
CCFLEXible
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import "CCFLEXible.h" | |
#import <objc/runtime.h> | |
#include <dlfcn.h> | |
@interface FLEXManager : NSObject | |
+ (instancetype)sharedManager; | |
- (void)showExplorer; | |
- (void)hideExplorer; | |
- (void)toggleExplorer; | |
@end | |
@implementation CCFLEXible | |
//Return the icon of your module here | |
- (UIImage *)iconGlyph | |
{ | |
return [UIImage imageNamed:@"FLEXibleIcon" inBundle:[NSBundle bundleForClass:[self class]] compatibleWithTraitCollection:nil]; | |
} | |
//Return the color selection color of your module here | |
- (UIColor *)selectedColor | |
{ | |
UIWindow *window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; | |
return window.tintColor; | |
} | |
- (BOOL)isSelected | |
{ | |
return _selected; | |
} | |
- (void)setSelected:(BOOL)selected | |
{ | |
_selected = selected; | |
[super refreshState]; | |
if(_selected) | |
{ | |
//Your module got selected, do something | |
void *handle = dlopen("/usr/lib/CCFLEXible/FLEX.dylib", RTLD_LAZY); | |
if (handle != NULL) { | |
[[objc_getClass("FLEXManager") sharedManager] showExplorer]; | |
dlclose(handle); | |
} | |
} | |
else | |
{ | |
//Your module got unselected, do something | |
void *handle = dlopen("/usr/lib/CCFLEXible/FLEX.dylib", RTLD_LAZY); | |
if (handle != NULL) { | |
[[objc_getClass("FLEXManager") sharedManager] hideExplorer]; | |
dlclose(handle); | |
} | |
} | |
} | |
@end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CCFLEXible_CFLAGS = -fobjc-arc -Wno-error -Wno-deprecated-declarations -Wimplicit-function-declaration |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment