Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CCLoader Plugin template #6

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions CCLoader Plugin.xctemplate/CCSection-Protocol.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>

@protocol CCSectionDelegate <NSObject>

- (void)updateStatusText:(NSString *)text;
- (void)requestControlCenterDismissal;
- (void)sectionHeightChanged;
- (void)showViewController:(UIViewController *)vc animated:(BOOL)animated completion:(void (^)(void))completion;

@end

@protocol CCSection <NSObject>

@required
- (UIView *)view;

- (CGFloat)sectionHeight;

@optional
- (void)setDelegate:(UIViewController <CCSectionDelegate> *)delegate;

- (void)controlCenterWillAppear;

- (void)controlCenterDidDisappear;

@end
32 changes: 32 additions & 0 deletions CCLoader Plugin.xctemplate/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleName</key>
<string>___PACKAGENAME___</string>
<key>CFBundleIdentifier</key>
<string>___VARIABLE_bundleIdentifierPrefix:bundleIdentifier___.___VARIABLE_productName:RFC1034Identifier___</string>
<key>CFBundleDisplayName</key>
<string>___PACKAGENAME___</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.0.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>DTPlatformName</key>
<string>iphoneos</string>
<key>MinimumOSVersion</key>
<string>7.0</string>
<key>CCReplacingStockSectionID</key>
<string>___VARIABLE_REPLACESECTION___</string>
<key>NSPrincipalClass</key>
<string>___PACKAGENAME___Section</string>
</dict>
</plist>
Binary file added CCLoader Plugin.xctemplate/TemplateIcon.icns
Binary file not shown.
146 changes: 146 additions & 0 deletions CCLoader Plugin.xctemplate/TemplateInfo.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Kind</key>
<string>Xcode.Xcode3.ProjectTemplateUnitKind</string>
<key>Identifier</key>
<string>de.j-gessner.ccloader.iosopendevtemplate</string>
<key>Concrete</key>
<true/>
<key>Description</key>
<string>Template for a CCLoader Control Center section.</string>
<key>Ancestors</key>
<array>
<string>com.kokoabim.iosopendev.base</string>
</array>
<key>Targets</key>
<array>
<dict>
<key>ProductType</key>
<string>com.apple.product-type.bundle</string>
<key>SharedSettings</key>
<dict>
<key>GCC_PREFIX_HEADER</key>
<string>___PACKAGENAME___/___PACKAGENAME___-Prefix.pch</string>
<key>GCC_PRECOMPILE_PREFIX_HEADER</key>
<string>YES</string>
<key>INFOPLIST_FILE</key>
<string>___PACKAGENAME___/Info.plist</string>
<key>WRAPPER_EXTENSION</key>
<string>bundle</string>
<key>INSTALL_PATH</key>
<string>/Library/CCLoader/Bundles</string>
</dict>
<key>BuildPhases</key>
<array>
<dict>
<key>Class</key>
<string>Sources</string>
</dict>
<dict>
<key>Class</key>
<string>Frameworks</string>
</dict>
<dict>
<key>Class</key>
<string>Headers</string>
</dict>
<dict>
<key>ShellScript</key>
<string>/opt/iOSOpenDev/bin/iosod --xcbp</string>
<key>ShellPath</key>
<string>/bin/sh</string>
<key>RunOnlyForDeploymentPostprocessing</key>
<false/>
<key>Class</key>
<string>ShellScript</string>
</dict>
</array>
<key>Frameworks</key>
<array>
<string>Foundation</string>
<string>UIKit</string>
</array>
</dict>
</array>
<key>Nodes</key>
<array>
<string>___PACKAGENAME___-Prefix.pch:objC:importFoundation</string>
<string>___PACKAGENAME___-Prefix.pch:objC:importCocoa</string>
<string>___PACKAGENAMEASIDENTIFIER___Section.h</string>
<string>___PACKAGENAMEASIDENTIFIER___Section.m</string>
<string>___PACKAGENAMEASIDENTIFIER___SectionView.h</string>
<string>___PACKAGENAMEASIDENTIFIER___SectionView.m</string>
<string>Package/DEBIAN/control:debianControl:section</string>
<string>Package/DEBIAN/control:debianControl:depends</string>
<string>Info.plist</string>
<string>CCSection-Protocol.h</string>
</array>
<key>Options</key>
<array>
<dict>
<key>Identifier</key>
<string>REPLACESECTION</string>
<key>Required</key>
<true/>
<key>Name</key>
<string>Replace a stock Control Center section?</string>
<key>Description</key>
<string>Stock Control Center section to replace. Select &apos;None&apos; to create an additional section for Control Center.</string>
<key>Type</key>
<string>popup</string>
<key>Default</key>
<string>None</string>
<key>Values</key>
<array>
<string>None</string>
<string>com.apple.controlcenter.brightness</string>
<string>com.apple.controlcenter.settings</string>
<string>com.apple.controlcenter.media-controls</string>
<string>com.apple.controlcenter.air-stuff</string>
<string>com.apple.controlcenter.quick-launch</string>
</array>
</dict>
</array>
<key>Definitions</key>
<dict>
<key>___PACKAGENAMEASIDENTIFIER___Section.h</key>
<dict>
<key>Path</key>
<string>___PACKAGENAMEASIDENTIFIER___Section.h</string>
</dict>
<key>___PACKAGENAMEASIDENTIFIER___Section.m</key>
<dict>
<key>Path</key>
<string>___PACKAGENAMEASIDENTIFIER___Section.m</string>
</dict>
<key>___PACKAGENAMEASIDENTIFIER___SectionView.h</key>
<dict>
<key>Path</key>
<string>___PACKAGENAMEASIDENTIFIER___SectionView.h</string>
</dict>
<key>___PACKAGENAMEASIDENTIFIER___SectionView.m</key>
<dict>
<key>Path</key>
<string>___PACKAGENAMEASIDENTIFIER___SectionView.m</string>
</dict>
<key>CCSection-Protocol.h</key>
<dict>
<key>Path</key>
<string>CCSection-Protocol.h</string>
</dict>
<key>Info.plist</key>
<dict>
<key>Group</key>
<string>Supporting Files</string>
<key>Path</key>
<string>Info.plist</string>
</dict>
<key>*:debianControl:section</key>
<string>Section: Addons (ControlCenter)</string>
<key>*:debianControl:depends</key>
<string>Depends: de.j-gessner.ccloader, firmware (&gt;= 7.0)</string>
</dict>
</dict>
</plist>
14 changes: 14 additions & 0 deletions CCLoader Plugin.xctemplate/___PACKAGENAMEASIDENTIFIER___Section.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//
// ___FILENAME___
// ___PACKAGENAME___
//
// Created by ___FULLUSERNAME___ on ___DATE___.
// Copyright (c) ___YEAR___ ___ORGANIZATIONNAME___. All rights reserved.
//

#import "CCSection-Protocol.h"
#import "___PACKAGENAMEASIDENTIFIER___SectionView.h"

@interface ___PACKAGENAMEASIDENTIFIER___Section : NSObject <CCSection>

@end
81 changes: 81 additions & 0 deletions CCLoader Plugin.xctemplate/___PACKAGENAMEASIDENTIFIER___Section.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
//
// ___FILENAME___
// ___PACKAGENAME___
//
// Created by ___FULLUSERNAME___ on ___DATE___.
// Copyright (c) ___YEAR___ ___ORGANIZATIONNAME___. All rights reserved.
//

#define MRC !__has_feature(objc_arc)

#if MRC

#define CC_Strong retain
#define CC_Weak assign

#else

#define CC_Strong strong
#define CC_Weak weak

#endif

#import "___PACKAGENAMEASIDENTIFIER___Section.h"

@interface ___PACKAGENAMEASIDENTIFIER___Section ()

@property (nonatomic, CC_Strong) NSBundle *bundle;
@property (nonatomic, CC_Strong) ___PACKAGENAMEASIDENTIFIER___SectionView *view;

@property (nonatomic, CC_Weak) UIViewController <CCSectionDelegate> *delegate;

@end

@implementation ___PACKAGENAMEASIDENTIFIER___Section

- (instancetype)init {
self = [super init];
if (self) {
self.bundle = [NSBundle bundleForClass:[self class]];
}
return self;
}

- (CGFloat)sectionHeight {
return 50.0f;
}

- (void)loadView {
self.view = [[___PACKAGENAMEASIDENTIFIER___SectionView alloc] init];
}

- (UIView *)view {
if (!_view) {
[self loadView];
}

return _view;
}

- (void)dealloc {
#if MRC
[self.view release];
#endif
self.view = nil;
self.bundle = nil;


#if MRC
[super dealloc];
#endif
}

- (void)controlCenterWillAppear {

}

- (void)controlCenterDidDisappear {

}

@end
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//
// ___FILENAME___
// ___PACKAGENAME___
//
// Created by ___FULLUSERNAME___ on ___DATE___.
// Copyright (c) ___YEAR___ ___ORGANIZATIONNAME___. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>

@interface ___PACKAGENAMEASIDENTIFIER___SectionView : UIView

@end
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
//
// ___FILENAME___
// ___PACKAGENAME___
//
// Created by ___FULLUSERNAME___ on ___DATE___.
// Copyright (c) ___YEAR___ ___ORGANIZATIONNAME___. All rights reserved.
//

#import "___PACKAGENAMEASIDENTIFIER___SectionView.h"

@implementation ___PACKAGENAMEASIDENTIFIER___SectionView

- (instancetype)init {
self = [super init];
if (self) {
//Load additional views
}
return self;
}

- (void)layoutSubviews {
[super layoutSubviews];
//Layout any subviews
}

@end