Skip to content

Commit

Permalink
update Flipswitch headers:
Browse files Browse the repository at this point in the history
  • Loading branch information
hewigovens committed Aug 3, 2014
1 parent 5f29f55 commit 9ec22a9
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 8 deletions.
Binary file added extra/gtar
Binary file not shown.
30 changes: 25 additions & 5 deletions goagent-flipswitch/FSSwitchDataSource.h
@@ -1,5 +1,6 @@
#import <UIKit/UIKit.h>
#import "FSSwitchState.h"
#import "FSSwitchSettingsViewController.h"

@protocol FSSwitchDataSource <NSObject>
@optional
Expand All @@ -24,15 +25,14 @@
// Returns the localized title for the switch.
// By default reads the CFBundleDisplayName out of the switch's bundle.

- (BOOL)shouldShowSwitchIdentifier:(NSString *)switchIdentifier;
// Returns wether the switch should be shown.
// By default returns YES or the value from GraphicsServices for the capability specified in the "required-capability-key" of the switch's bundle
// E.g. You would detect if the device has the required capability (3G, flash etc)

- (id)glyphImageDescriptorOfState:(FSSwitchState)switchState size:(CGFloat)size scale:(CGFloat)scale forSwitchIdentifier:(NSString *)switchIdentifier;
// Provide an image descriptor that best displays at the requested size and scale
// By default looks through the bundle to find a glyph image

- (id)glyphImageDescriptorOfState:(FSSwitchState)switchState variant:(NSString *)variant size:(CGFloat)size scale:(CGFloat)scale forSwitchIdentifier:(NSString *)switchIdentifier;
// Provide a modern image descriptor that best displays at the requested size and scale (1.0.4)
// By default looks through the bundle to find a modern glyph image, falling back to using the standard glyph image descriptor

- (NSBundle *)bundleForSwitchIdentifier:(NSString *)switchIdentifier;
// Provides a bundle to look for localizations/images in
// By default returns the bundle for the current class
Expand All @@ -51,4 +51,24 @@
// Applies the alternate or "hold" action
// By default launches the URL stored in the "alternate-action-url" key of the switch's bundle

- (BOOL)switchWithIdentifierIsEnabled:(NSString *)switchIdentifier;
// Gets whether or not the switch is enabled
// Must override if switch can be disabled
// By default returns YES

- (void)beginPrewarmingForSwitchIdentifier:(NSString *)switchIdentifier;
// Prepares switch for state changes (1.0.3 or later)

- (void)cancelPrewarmingForSwitchIdentifier:(NSString *)switchIdentifier;
// Cancels previously requested prewarm (1.0.3 or later)

- (NSString *)descriptionOfState:(FSSwitchState)state forSwitchIdentifier:(NSString *)switchIdentifier;
// Requests a description of a specific state, in the context of a specific switch identifier (1.0.3 or later)

- (Class <FSSwitchSettingsViewController>)settingsViewControllerClassForSwitchIdentifier:(NSString *)switchIdentifier;
// Requests the class to handle configuration for the specified switch (1.0.3)

- (BOOL)switchWithIdentifierIsSimpleAction:(NSString *)switchIdentifier;
// Gets whether or not the switch is a simple "button" (1.0.4)

@end
34 changes: 32 additions & 2 deletions goagent-flipswitch/FSSwitchPanel.h
@@ -1,5 +1,6 @@
#import <UIKit/UIKit.h>
#import "FSSwitchState.h"
#import "FSSwitchSettingsViewController.h"

@interface FSSwitchPanel : NSObject

Expand All @@ -8,6 +9,9 @@
@property (nonatomic, readonly, copy) NSArray *switchIdentifiers;
// Returns a list of identifying all switches installed on the device

@property (nonatomic, readonly, copy) NSArray *sortedSwitchIdentifiers;
// Returns a list of identifying all switches installed on the device sorted by localized title (1.0.3 or later)

- (NSString *)titleForSwitchIdentifier:(NSString *)switchIdentifier;
// Returns the localized title for a specific switch

Expand All @@ -19,8 +23,9 @@
- (UIImage *)imageOfSwitchState:(FSSwitchState)state controlState:(UIControlState)controlState scale:(CGFloat)scale forSwitchIdentifier:(NSString *)switchIdentifier usingTemplate:(NSBundle *)templateBundle;
// Returns an image representing how a specific switch would look in a particular state when styled with the provided template

- (id)glyphImageDescriptorOfState:(FSSwitchState)switchState size:(CGFloat)size scale:(CGFloat)scale forSwitchIdentifier:(NSString *)switchIdentifier;
// Returns the raw glyph identifier as retrieved from the backing FSSwitch instance
- (BOOL)hasCachedImageOfSwitchState:(FSSwitchState)state controlState:(UIControlState)controlState forSwitchIdentifier:(NSString *)switchIdentifier usingTemplate:(NSBundle *)templateBundle;
- (BOOL)hasCachedImageOfSwitchState:(FSSwitchState)state controlState:(UIControlState)controlState scale:(CGFloat)scale forSwitchIdentifier:(NSString *)switchIdentifier usingTemplate:(NSBundle *)templateBundle;
// Returns YES if an image representing the state is loaded

- (FSSwitchState)stateForSwitchIdentifier:(NSString *)switchIdentifier;
// Returns the current state of a particualr switch
Expand All @@ -37,6 +42,27 @@
- (void)openURLAsAlternateAction:(NSURL *)url;
// Helper method to open a particular URL as if it were launched from an alternate action

- (BOOL)switchWithIdentifierIsEnabled:(NSString *)switchIdentifier;
// Returns YES if the switch is enabled (1.0.1 or later)

- (void)beginPrewarmingForSwitchIdentifier:(NSString *)switchIdentifier;
// Prepares switch for state changes (1.0.3 or later)

- (void)cancelPrewarmingForSwitchIdentifier:(NSString *)switchIdentifier;
// Cancels previously requested prewarm (1.0.3 or later)

- (NSString *)descriptionOfState:(FSSwitchState)state forSwitchIdentifier:(NSString *)switchIdentifier;
// Requests a description of a specific state, in the context of a specific switch identifier (1.0.3 or later)

- (Class <FSSwitchSettingsViewController>)settingsViewControllerClassForSwitchIdentifier:(NSString *)switchIdentifier;
// Retrieves the settings view controller class for a specific switch identifier (1.0.3 or later)

- (UIViewController <FSSwitchSettingsViewController> *)settingsViewControllerForSwitchIdentifier:(NSString *)switchIdentifier;
// Retrieves a settings view controller for a specific switch identifier (1.0.3 or later)

- (BOOL)switchWithIdentifierIsSimpleAction:(NSString *)switchIdentifier;
// Gets whether or not the switch is a simple "button" (1.0.4 or later)

@end

@protocol FSSwitchDataSource;
Expand All @@ -56,3 +82,7 @@ extern NSString * const FSSwitchPanelSwitchStateChangedNotification;
extern NSString * const FSSwitchPanelSwitchIdentifierKey;

extern NSString * const FSSwitchPanelSwitchWillOpenURLNotification;

@interface FSSwitchPanel (LayerEffects)
- (void)applyEffectsToLayer:(CALayer *)layer forSwitchState:(FSSwitchState)state controlState:(UIControlState)controlState usingTemplate:(NSBundle *)templateBundle;
@end
6 changes: 6 additions & 0 deletions goagent-flipswitch/FSSwitchSettingsViewController.h
@@ -0,0 +1,6 @@
#import <UIKit/UIKit.h>

@protocol FSSwitchSettingsViewController <NSObject> // Must be a UIViewController subclass
@optional
- (id)initWithSwitchIdentifier:(NSString *)switchIdentifier;
@end
4 changes: 4 additions & 0 deletions goagent-flipswitch/Flipswitch.h
@@ -0,0 +1,4 @@
#import "FSSwitchPanel.h"
#import "FSSwitchDataSource.h"
#import "FSSwitchState.h"
#import "FSSwitchSettingsViewController.h"
2 changes: 1 addition & 1 deletion goagent-flipswitch/control
@@ -1,7 +1,7 @@
Package: org.goagent.goagentswitch
Name: GoAgent Switch
Depends: mobilesubstrate, com.a3tweaks.flipswitch, org.goagent.local.ios
Version: 0.0.2
Version: 0.0.3
Architecture: iphoneos-arm
Description: A Flipswitch for GoAgent iOS
Maintainer: @hewigovens
Expand Down

0 comments on commit 9ec22a9

Please sign in to comment.