Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
000353d
commit 5989fcb
Showing
20 changed files
with
232 additions
and
68 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#import <Foundation/Foundation.h> | ||
#import <UIKit/UIKit.h> | ||
|
||
#define SYSTEM_VERSION_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedSame) | ||
#define SYSTEM_VERSION_GREATER_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedDescending) | ||
#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending) | ||
#define SYSTEM_VERSION_LESS_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending) | ||
#define SYSTEM_VERSION_LESS_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedDescending) | ||
|
||
#define TLLog(fmt, ...) NSLog(@"-----> " fmt, ##__VA_ARGS__) | ||
|
||
#if __LP64__ | ||
#define NSInt "ld" | ||
#define NSUInt "lu" | ||
#else | ||
#define NSInt "d" | ||
#define NSUInt "u" | ||
#endif /* __LP64__ */ | ||
|
||
#define LC_BUNDLE_PATH @"/System/Library/WeeAppPlugins/LunarCalendarWidget.bundle" | ||
|
||
NS_INLINE NSBundle *LunarCalendarBundle() | ||
{ | ||
static NSBundle *bundle = nil; | ||
static dispatch_once_t onceToken; | ||
dispatch_once(&onceToken, ^{ | ||
bundle = [[NSBundle bundleWithPath:LC_BUNDLE_PATH] retain]; | ||
}); | ||
return bundle; | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#import <UIKit/UIKit.h> | ||
#import "BBWeeAppController-Protocol.h" | ||
|
||
@class TLLunarCalendarWeeView; | ||
|
||
@interface LunarCalendarWidgetController: NSObject <BBWeeAppController> { | ||
TLLunarCalendarWeeView *_view; | ||
} | ||
|
||
@property (nonatomic, readonly) UIView *view; | ||
|
||
- (CGFloat)viewWidth; | ||
- (CGFloat)viewHeight; | ||
|
||
@end |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#import <UIKit/UIKit.h> | ||
@protocol _SBUIWidgetHost <NSObject> | ||
-(void)invalidatePreferredViewSize; | ||
-(void)requestLaunchOfURL:(id)url; | ||
-(void)requestPresentationOfViewController:(id)viewController presentationStyle:(int)style context:(id)context completion:(id)completion; | ||
@end | ||
|
||
|
||
|
||
@interface _SBUIWidgetViewController : UIViewController <_SBUIWidgetHost> { | ||
id<_SBUIWidgetHost> *_widgetHost; | ||
NSString *_widgetIdentifier; | ||
int _widgetIdiom; | ||
NSString *_widgetidentifier; | ||
} | ||
|
||
//@property(readonly) CGSize preferredViewSize; | ||
//@property id<_SBUIWidgetHost> * widgetHost; | ||
//@property(copy) NSString * widgetIdentifier; | ||
//@property int widgetIdiom; | ||
|
||
+ (id)_exportedInterface; | ||
+ (id)_remoteViewControllerInterface; | ||
|
||
- (void)__hostDidDismiss; | ||
- (void)__hostDidPresent; | ||
- (void)__hostWillDismiss; | ||
- (void)__hostWillPresent; | ||
- (void)__requestPreferredViewSizeWithReplyHandler:(id)arg1; | ||
- (void)__setWidgetIdentifier:(id)arg1; | ||
- (void)__setWidgetIdiom:(int)arg1; | ||
- (void)dealloc; | ||
- (void)hostDidDismiss; | ||
- (void)hostDidPresent; | ||
- (void)hostWillDismiss; | ||
- (void)hostWillPresent; | ||
- (void)invalidatePreferredViewSize; | ||
- (CGSize)preferredViewSize; | ||
- (void)requestLaunchOfURL:(id)arg1; | ||
- (void)requestPresentationOfViewController:(id)arg1 presentationStyle:(int)arg2 context:(id)arg3 completion:(id)arg4; | ||
- (void)setWidgetHost:(id<_SBUIWidgetHost>)arg1; | ||
- (void)setWidgetIdentifier:(NSString *)arg1; | ||
- (void)setWidgetIdiom:(int)arg1; | ||
- (id)widgetHost; | ||
- (id)widgetIdentifier; | ||
- (int)widgetIdiom; | ||
-(void)unloadView; | ||
|
||
@end |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#import "LunarCalendarWidgetController.h" | ||
#import "SBUIWidgetViewController.h" | ||
|
||
@interface NSObject(SBWidgetHostDelegate) | ||
|
||
- (void)widget:(id)arg1 didUpdatePreferredSize:(struct CGSize)arg2; | ||
|
||
@end | ||
|
||
@interface TLCCWidgetViewController : _SBUIWidgetViewController { | ||
LunarCalendarWidgetController *_controller; | ||
} | ||
@end | ||
|
||
@implementation TLCCWidgetViewController | ||
|
||
- (id)initWithNibName:(NSString *)nibName bundle:(NSBundle *)nibBundle | ||
{ | ||
if ( (self = [super initWithNibName:nibName bundle:nibBundle]) ) { | ||
_controller = [[LunarCalendarWidgetController alloc] init]; | ||
} | ||
return self; | ||
} | ||
|
||
- (void)dealloc | ||
{ | ||
[_controller release]; | ||
_controller = nil; | ||
[super dealloc]; | ||
} | ||
|
||
- (void)loadView | ||
{ | ||
self.view = [_controller view]; | ||
} | ||
|
||
- (CGSize)preferredViewSize | ||
{ | ||
return CGSizeMake([_controller viewWidth], [_controller viewHeight]); | ||
} | ||
|
||
- (void)hostDidPresent | ||
{ | ||
[super hostDidPresent]; | ||
[_controller loadFullView]; | ||
|
||
if (self.view.bounds.size.height != [_controller viewHeight]) { | ||
[[[self widgetHost] delegate] widget:[self widgetHost] didUpdatePreferredSize:[self preferredViewSize]]; | ||
} | ||
} | ||
|
||
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration | ||
{ | ||
[super willRotateToInterfaceOrientation:toInterfaceOrientation duration:duration]; | ||
[_controller willRotateToInterfaceOrientation:toInterfaceOrientation]; | ||
} | ||
|
||
@end |
Oops, something went wrong.