Added pragma marks, new clang-format
This commit is contained in:
parent
f0365779b1
commit
ba0ba5f706
@ -1,65 +1,51 @@
|
|||||||
---
|
---
|
||||||
Language: Cpp
|
Language: Cpp
|
||||||
# BasedOnStyle: LLVM
|
|
||||||
AccessModifierOffset: -2
|
AccessModifierOffset: -2
|
||||||
AlignAfterOpenBracket: true
|
|
||||||
AlignEscapedNewlinesLeft: false
|
AlignEscapedNewlinesLeft: false
|
||||||
AlignOperands: true
|
|
||||||
AlignTrailingComments: true
|
AlignTrailingComments: true
|
||||||
|
AlignAfterOpenBracket: true
|
||||||
AllowAllParametersOfDeclarationOnNextLine: true
|
AllowAllParametersOfDeclarationOnNextLine: true
|
||||||
AllowShortBlocksOnASingleLine: false
|
AllowShortFunctionsOnASingleLine: false
|
||||||
AllowShortCaseLabelsOnASingleLine: false
|
|
||||||
AllowShortIfStatementsOnASingleLine: false
|
AllowShortIfStatementsOnASingleLine: false
|
||||||
AllowShortLoopsOnASingleLine: false
|
AllowShortLoopsOnASingleLine: false
|
||||||
AllowShortFunctionsOnASingleLine: All
|
|
||||||
AlwaysBreakAfterDefinitionReturnType: false
|
|
||||||
AlwaysBreakTemplateDeclarations: false
|
|
||||||
AlwaysBreakBeforeMultilineStrings: false
|
AlwaysBreakBeforeMultilineStrings: false
|
||||||
BreakBeforeBinaryOperators: None
|
AlwaysBreakTemplateDeclarations: false
|
||||||
|
BinPackParameters: true
|
||||||
|
BreakBeforeBinaryOperators: false
|
||||||
|
BreakBeforeBraces: Linux
|
||||||
BreakBeforeTernaryOperators: true
|
BreakBeforeTernaryOperators: true
|
||||||
BreakConstructorInitializersBeforeComma: false
|
BreakConstructorInitializersBeforeComma: false
|
||||||
BinPackParameters: true
|
|
||||||
BinPackArguments: true
|
|
||||||
ColumnLimit: 80
|
ColumnLimit: 80
|
||||||
|
CommentPragmas: '^ IWYU pragma:'
|
||||||
ConstructorInitializerAllOnOneLineOrOnePerLine: false
|
ConstructorInitializerAllOnOneLineOrOnePerLine: false
|
||||||
ConstructorInitializerIndentWidth: 4
|
ConstructorInitializerIndentWidth: 4
|
||||||
DerivePointerAlignment: false
|
ContinuationIndentWidth: 4
|
||||||
|
Cpp11BracedListStyle: true
|
||||||
|
DerivePointerBinding: false
|
||||||
ExperimentalAutoDetectBinPacking: false
|
ExperimentalAutoDetectBinPacking: false
|
||||||
IndentCaseLabels: false
|
IndentCaseLabels: true
|
||||||
IndentWrappedFunctionNames: false
|
IndentFunctionDeclarationAfterType: true
|
||||||
IndentFunctionDeclarationAfterType: false
|
IndentWidth: 4
|
||||||
MaxEmptyLinesToKeep: 1
|
MaxEmptyLinesToKeep: 2
|
||||||
KeepEmptyLinesAtTheStartOfBlocks: true
|
|
||||||
NamespaceIndentation: None
|
NamespaceIndentation: None
|
||||||
ObjCBlockIndentWidth: 4
|
ObjCSpaceAfterProperty: true
|
||||||
ObjCSpaceAfterProperty: false
|
|
||||||
ObjCSpaceBeforeProtocolList: true
|
ObjCSpaceBeforeProtocolList: true
|
||||||
|
ObjCBlockIndentWidth: 4
|
||||||
PenaltyBreakBeforeFirstCallParameter: 19
|
PenaltyBreakBeforeFirstCallParameter: 19
|
||||||
PenaltyBreakComment: 300
|
PenaltyBreakComment: 300
|
||||||
PenaltyBreakString: 1000
|
|
||||||
PenaltyBreakFirstLessLess: 120
|
PenaltyBreakFirstLessLess: 120
|
||||||
|
PenaltyBreakString: 1000
|
||||||
PenaltyExcessCharacter: 1000000
|
PenaltyExcessCharacter: 1000000
|
||||||
PenaltyReturnTypeOnItsOwnLine: 60
|
PenaltyReturnTypeOnItsOwnLine: 60
|
||||||
PointerAlignment: Right
|
PointerBindsToType: false
|
||||||
|
SpaceBeforeAssignmentOperators: true
|
||||||
|
SpaceBeforeParens: ControlStatements
|
||||||
|
SpaceInEmptyParentheses: false
|
||||||
SpacesBeforeTrailingComments: 1
|
SpacesBeforeTrailingComments: 1
|
||||||
Cpp11BracedListStyle: true
|
SpacesInAngles: false
|
||||||
|
SpacesInContainerLiterals: true
|
||||||
|
SpacesInCStyleCastParentheses: false
|
||||||
|
SpacesInParentheses: false
|
||||||
Standard: Cpp11
|
Standard: Cpp11
|
||||||
IndentWidth: 4
|
|
||||||
TabWidth: 8
|
TabWidth: 8
|
||||||
UseTab: Never
|
UseTab: Never
|
||||||
BreakBeforeBraces: Attach
|
|
||||||
SpacesInParentheses: false
|
|
||||||
SpacesInSquareBrackets: false
|
|
||||||
SpacesInAngles: false
|
|
||||||
SpaceInEmptyParentheses: false
|
|
||||||
SpacesInCStyleCastParentheses: false
|
|
||||||
SpaceAfterCStyleCast: false
|
|
||||||
SpacesInContainerLiterals: true
|
|
||||||
SpaceBeforeAssignmentOperators: true
|
|
||||||
ContinuationIndentWidth: 4
|
|
||||||
CommentPragmas: '^ IWYU pragma:'
|
|
||||||
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
|
|
||||||
SpaceBeforeParens: ControlStatements
|
|
||||||
DisableFormat: false
|
|
||||||
...
|
|
||||||
|
|
||||||
|
|||||||
@ -12,8 +12,14 @@
|
|||||||
|
|
||||||
@interface AppDelegate : UIResponder <UIApplicationDelegate>
|
@interface AppDelegate : UIResponder <UIApplicationDelegate>
|
||||||
|
|
||||||
@property(strong, nonatomic) UIWindow *window;
|
@property (strong, nonatomic) UIWindow *window;
|
||||||
@property(strong, nonatomic) DropboxV2ObjC *dbClient;
|
|
||||||
@property(strong, nonatomic) UIViewController *smWebView;
|
#pragma mark - Shared Dropbox client
|
||||||
|
/// Shared Dropbox client
|
||||||
|
@property (strong, nonatomic) DropboxV2ObjC *dbClient;
|
||||||
|
|
||||||
|
#pragma mark - Refrence to authentication web view in order to dismiss it
|
||||||
|
|
||||||
|
@property (strong, nonatomic) UIViewController *smWebView;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@ -10,8 +10,11 @@
|
|||||||
|
|
||||||
@implementation AppDelegate
|
@implementation AppDelegate
|
||||||
|
|
||||||
|
#pragma mark - Application lifecycle delegate methods
|
||||||
|
|
||||||
- (BOOL)application:(UIApplication *)application
|
- (BOOL)application:(UIApplication *)application
|
||||||
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
|
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
|
||||||
|
{
|
||||||
// Override point for customization after application launch.
|
// Override point for customization after application launch.
|
||||||
_dbClient = [[DropboxV2ObjC alloc] init];
|
_dbClient = [[DropboxV2ObjC alloc] init];
|
||||||
NSDictionary *credentials =
|
NSDictionary *credentials =
|
||||||
@ -22,7 +25,8 @@
|
|||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)applicationWillResignActive:(UIApplication *)application {
|
- (void)applicationWillResignActive:(UIApplication *)application
|
||||||
|
{
|
||||||
// Sent when the application is about to move from active to inactive state.
|
// Sent when the application is about to move from active to inactive state.
|
||||||
// This can occur for certain types of temporary interruptions (such as an
|
// This can occur for certain types of temporary interruptions (such as an
|
||||||
// incoming phone call or SMS message) or when the user quits the
|
// incoming phone call or SMS message) or when the user quits the
|
||||||
@ -31,7 +35,8 @@
|
|||||||
// OpenGL ES frame rates. Games should use this method to pause the game.
|
// OpenGL ES frame rates. Games should use this method to pause the game.
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)applicationDidEnterBackground:(UIApplication *)application {
|
- (void)applicationDidEnterBackground:(UIApplication *)application
|
||||||
|
{
|
||||||
// Use this method to release shared resources, save user data, invalidate
|
// Use this method to release shared resources, save user data, invalidate
|
||||||
// timers, and store enough application state information to restore your
|
// timers, and store enough application state information to restore your
|
||||||
// application to its current state in case it is terminated later.
|
// application to its current state in case it is terminated later.
|
||||||
@ -39,24 +44,30 @@
|
|||||||
// instead of applicationWillTerminate: when the user quits.
|
// instead of applicationWillTerminate: when the user quits.
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)applicationWillEnterForeground:(UIApplication *)application {
|
- (void)applicationWillEnterForeground:(UIApplication *)application
|
||||||
|
{
|
||||||
// Called as part of the transition from the background to the inactive
|
// Called as part of the transition from the background to the inactive
|
||||||
// state; here you can undo many of the changes made on entering the
|
// state; here you can undo many of the changes made on entering the
|
||||||
// background.
|
// background.
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)applicationDidBecomeActive:(UIApplication *)application {
|
- (void)applicationDidBecomeActive:(UIApplication *)application
|
||||||
|
{
|
||||||
// Restart any tasks that were paused (or not yet started) while the
|
// Restart any tasks that were paused (or not yet started) while the
|
||||||
// application was inactive. If the application was previously in the
|
// application was inactive. If the application was previously in the
|
||||||
// background, optionally refresh the user interface.
|
// background, optionally refresh the user interface.
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)applicationWillTerminate:(UIApplication *)application {
|
- (void)applicationWillTerminate:(UIApplication *)application
|
||||||
|
{
|
||||||
// Called when the application is about to terminate. Save data if
|
// Called when the application is about to terminate. Save data if
|
||||||
// appropriate. See also applicationDidEnterBackground:.
|
// appropriate. See also applicationDidEnterBackground:.
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url {
|
#pragma mark - URL scheme handling
|
||||||
|
|
||||||
|
- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url
|
||||||
|
{
|
||||||
// Display text
|
// Display text
|
||||||
[_dbClient authorizeUserWithToke:url
|
[_dbClient authorizeUserWithToke:url
|
||||||
completion:^(void) {
|
completion:^(void) {
|
||||||
|
|||||||
@ -12,17 +12,28 @@
|
|||||||
|
|
||||||
@interface DropboxV2ObjC : NSObject
|
@interface DropboxV2ObjC : NSObject
|
||||||
|
|
||||||
@property(strong, nonatomic) NSString *token;
|
#pragma mark Client fields
|
||||||
|
|
||||||
|
@property (strong, nonatomic) NSString *token;
|
||||||
/// No trailing slash
|
/// No trailing slash
|
||||||
@property(strong, nonatomic) NSString *rootDirectory;
|
@property (strong, nonatomic) NSString *rootDirectory;
|
||||||
@property(strong, nonatomic) NSData *kJSONNullObject;
|
@property (strong, nonatomic) NSData *kJSONNullObject;
|
||||||
@property(strong, nonatomic) NSURLProtectionSpace *kDropboxProtectionSpace;
|
@property (strong, nonatomic) NSURLProtectionSpace *kDropboxProtectionSpace;
|
||||||
|
|
||||||
|
#pragma mark - Authorization methods
|
||||||
|
|
||||||
- (BOOL)authorizeUserWithToke:(NSURL *)token completion:(void (^)(void))handler;
|
- (BOOL)authorizeUserWithToke:(NSURL *)token completion:(void (^)(void))handler;
|
||||||
|
- (void)deauthorizeUser;
|
||||||
|
|
||||||
|
#pragma mark - File and directory methods
|
||||||
|
|
||||||
- (void)downloadFromDropbox:(NSArray *)files;
|
- (void)downloadFromDropbox:(NSArray *)files;
|
||||||
- (void)uploadToDropbox:(NSData *)data;
|
- (void)uploadToDropbox:(NSData *)data;
|
||||||
- (NSArray *)contentsOfPath:(NSString *)path;
|
- (NSArray *)contentsOfPath:(NSString *)path;
|
||||||
|
|
||||||
|
#pragma mark - Other methods
|
||||||
|
|
||||||
- (NSDictionary *)getUserInfo;
|
- (NSDictionary *)getUserInfo;
|
||||||
- (void)deauthorizeUser;
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
@ -9,7 +9,9 @@
|
|||||||
#import "DropboxV2ObjC.h"
|
#import "DropboxV2ObjC.h"
|
||||||
|
|
||||||
@implementation DropboxV2ObjC
|
@implementation DropboxV2ObjC
|
||||||
- (DropboxV2ObjC *)init {
|
|
||||||
|
- (DropboxV2ObjC *)init
|
||||||
|
{
|
||||||
self = [super init];
|
self = [super init];
|
||||||
self.rootDirectory = @"";
|
self.rootDirectory = @"";
|
||||||
self.kJSONNullObject = [@"null" dataUsingEncoding:NSASCIIStringEncoding];
|
self.kJSONNullObject = [@"null" dataUsingEncoding:NSASCIIStringEncoding];
|
||||||
@ -23,8 +25,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - OAuth stuff
|
#pragma mark - OAuth stuff
|
||||||
- (BOOL)authorizeUserWithToke:(NSURL *)token
|
- (BOOL)authorizeUserWithToke:(NSURL *)token completion:(void (^)(void))handler
|
||||||
completion:(void (^)(void))handler {
|
{
|
||||||
NSScanner *scan = [NSScanner scannerWithString:token.absoluteString];
|
NSScanner *scan = [NSScanner scannerWithString:token.absoluteString];
|
||||||
NSString *error = [[NSString alloc] init];
|
NSString *error = [[NSString alloc] init];
|
||||||
[scan scanUpToString:@"&error=" intoString:&error];
|
[scan scanUpToString:@"&error=" intoString:&error];
|
||||||
@ -50,7 +52,8 @@
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)deauthorizeUser {
|
- (void)deauthorizeUser
|
||||||
|
{
|
||||||
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init];
|
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init];
|
||||||
request.URL = [NSURL
|
request.URL = [NSURL
|
||||||
URLWithString:@"https://api.dropboxapi.com/1/disable_access_token"];
|
URLWithString:@"https://api.dropboxapi.com/1/disable_access_token"];
|
||||||
@ -65,15 +68,15 @@
|
|||||||
request.HTTPMethod = @"POST";
|
request.HTTPMethod = @"POST";
|
||||||
request.HTTPBody = _kJSONNullObject;
|
request.HTTPBody = _kJSONNullObject;
|
||||||
|
|
||||||
[NSURLConnection sendAsynchronousRequest:request
|
[NSURLConnection
|
||||||
|
sendAsynchronousRequest:request
|
||||||
queue:[[NSOperationQueue alloc] init]
|
queue:[[NSOperationQueue alloc] init]
|
||||||
completionHandler:^(NSURLResponse *response,
|
completionHandler:^(NSURLResponse *response, NSData *data,
|
||||||
NSData *data, NSError *error) {
|
NSError *error) {
|
||||||
if ([[NSJSONSerialization
|
if ([[NSJSONSerialization JSONObjectWithData:data
|
||||||
JSONObjectWithData:data
|
|
||||||
options:0
|
options:0
|
||||||
error:nil] isEqualToDictionary
|
error:nil]
|
||||||
: @{}]) {
|
isEqualToDictionary:@{}]) {
|
||||||
NSDictionary *credentials =
|
NSDictionary *credentials =
|
||||||
[[NSURLCredentialStorage sharedCredentialStorage]
|
[[NSURLCredentialStorage sharedCredentialStorage]
|
||||||
credentialsForProtectionSpace:
|
credentialsForProtectionSpace:
|
||||||
@ -93,11 +96,14 @@
|
|||||||
* Pass nil as path for root dir
|
* Pass nil as path for root dir
|
||||||
* @return Content of directory at path or nil if error
|
* @return Content of directory at path or nil if error
|
||||||
*/
|
*/
|
||||||
- (NSArray *)contentsOfPath:(NSString *)path {
|
#warning make async
|
||||||
|
- (NSArray *)contentsOfPath:(NSString *)path
|
||||||
|
{
|
||||||
|
|
||||||
if (path == nil) {
|
if (path == nil) {
|
||||||
path = _rootDirectory;
|
path = _rootDirectory;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
path = [path
|
path = [path
|
||||||
stringByAppendingString:[NSString stringWithFormat:@"/%@", path]];
|
stringByAppendingString:[NSString stringWithFormat:@"/%@", path]];
|
||||||
}
|
}
|
||||||
@ -131,12 +137,14 @@
|
|||||||
error:&error]];
|
error:&error]];
|
||||||
if ([dataOut isKindOfClass:[NSDictionary class]]) {
|
if ([dataOut isKindOfClass:[NSDictionary class]]) {
|
||||||
return [dataOut valueForKey:@"entries"];
|
return [dataOut valueForKey:@"entries"];
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)downloadFromDropbox:(NSArray *)files {
|
- (void)downloadFromDropbox:(NSArray *)files
|
||||||
|
{
|
||||||
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init];
|
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init];
|
||||||
request.URL = [NSURL
|
request.URL = [NSURL
|
||||||
URLWithString:@"https://content.dropboxapi.com/2/files/download"];
|
URLWithString:@"https://content.dropboxapi.com/2/files/download"];
|
||||||
@ -166,19 +174,26 @@
|
|||||||
forHTTPHeaderField:(@"Dropbox-API-Arg")
|
forHTTPHeaderField:(@"Dropbox-API-Arg")
|
||||||
.precomposedStringWithCanonicalMapping];
|
.precomposedStringWithCanonicalMapping];
|
||||||
|
|
||||||
NSURLResponse *response = nil;
|
[NSURLConnection
|
||||||
NSError *error = nil;
|
sendAsynchronousRequest:request
|
||||||
NSData *dataOut = [NSURLConnection sendSynchronousRequest:request
|
queue:[[NSOperationQueue alloc] init]
|
||||||
returningResponse:&response
|
completionHandler:^(NSURLResponse *response, NSData *data,
|
||||||
error:&error];
|
NSError *error) {
|
||||||
[dataOut writeToFile:[SharedDeclerations savePathForFile:string]
|
if (error == nil) {
|
||||||
|
[data writeToFile:[SharedDeclerations
|
||||||
|
savePathForFile:string]
|
||||||
atomically:YES];
|
atomically:YES];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - Other operations
|
#pragma mark - Other operations
|
||||||
|
|
||||||
- (NSDictionary *)getUserInfo {
|
#warning make async
|
||||||
|
- (NSDictionary *)getUserInfo
|
||||||
|
{
|
||||||
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init];
|
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init];
|
||||||
request.URL =
|
request.URL =
|
||||||
[NSURL URLWithString:
|
[NSURL URLWithString:
|
||||||
@ -201,20 +216,23 @@
|
|||||||
error:&error]];
|
error:&error]];
|
||||||
if ([data isKindOfClass:[NSDictionary class]]) {
|
if ([data isKindOfClass:[NSDictionary class]]) {
|
||||||
return data;
|
return data;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - Helper methods
|
#pragma mark - Helper methods
|
||||||
|
|
||||||
- (id)parseJSON:(NSData *)data {
|
- (id)parseJSON:(NSData *)data
|
||||||
|
{
|
||||||
NSError *error = nil;
|
NSError *error = nil;
|
||||||
id object =
|
id object =
|
||||||
[NSJSONSerialization JSONObjectWithData:data options:0 error:&error];
|
[NSJSONSerialization JSONObjectWithData:data options:0 error:&error];
|
||||||
if (error == nil) {
|
if (error == nil) {
|
||||||
return object;
|
return object;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
return
|
return
|
||||||
[[NSString alloc] initWithData:data encoding:NSASCIIStringEncoding];
|
[[NSString alloc] initWithData:data encoding:NSASCIIStringEncoding];
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,6 +7,11 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
#import <UIKit/UIKit.h>
|
#import <UIKit/UIKit.h>
|
||||||
|
|
||||||
|
@interface SharedDeclerations : NSObject
|
||||||
|
|
||||||
|
#pragma mark - Route page management macros
|
||||||
|
|
||||||
#define FOO1 NEXTRTEPAGE
|
#define FOO1 NEXTRTEPAGE
|
||||||
#define STRINGIZE(x) #x
|
#define STRINGIZE(x) #x
|
||||||
#define STRINGIZE2(x) STRINGIZE(x)
|
#define STRINGIZE2(x) STRINGIZE(x)
|
||||||
@ -16,12 +21,14 @@
|
|||||||
#define STRINGIZE2(x) STRINGIZE(x)
|
#define STRINGIZE2(x) STRINGIZE(x)
|
||||||
#define FMCFIRSTRTEPAGE @STRINGIZE2(FOO2)
|
#define FMCFIRSTRTEPAGE @STRINGIZE2(FOO2)
|
||||||
|
|
||||||
@interface SharedDeclerations : NSObject
|
#pragma mark - Adaptive font size method
|
||||||
|
|
||||||
+ (UIFont *)findAdaptiveFontForUILabelSize:(CGSize)labelSize
|
+ (UIFont *)findAdaptiveFontForUILabelSize:(CGSize)labelSize
|
||||||
withMinimumSize:(NSInteger)minSize
|
withMinimumSize:(NSInteger)minSize
|
||||||
withMod:(float)mod;
|
withMod:(float)mod;
|
||||||
|
|
||||||
|
#pragma mark - Savepath method
|
||||||
|
|
||||||
+ (NSString *)savePathForFile:(NSString *)file;
|
+ (NSString *)savePathForFile:(NSString *)file;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@ -10,9 +10,12 @@
|
|||||||
|
|
||||||
@implementation SharedDeclerations
|
@implementation SharedDeclerations
|
||||||
|
|
||||||
|
#pragma mark - Adaptive font size method
|
||||||
|
|
||||||
+ (UIFont *)findAdaptiveFontForUILabelSize:(CGSize)labelSize
|
+ (UIFont *)findAdaptiveFontForUILabelSize:(CGSize)labelSize
|
||||||
withMinimumSize:(NSInteger)minSize
|
withMinimumSize:(NSInteger)minSize
|
||||||
withMod:(float)mod {
|
withMod:(float)mod
|
||||||
|
{
|
||||||
UIFont *tempFont = nil;
|
UIFont *tempFont = nil;
|
||||||
NSString *testString =
|
NSString *testString =
|
||||||
@"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
@"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||||
@ -39,9 +42,11 @@
|
|||||||
|
|
||||||
if (difference < 0) {
|
if (difference < 0) {
|
||||||
tempMax = mid - 1;
|
tempMax = mid - 1;
|
||||||
} else if (difference > 0) {
|
}
|
||||||
|
else if (difference > 0) {
|
||||||
tempMin = mid + 1;
|
tempMin = mid + 1;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
return [UIFont systemFontOfSize:mid];
|
return [UIFont systemFontOfSize:mid];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -49,7 +54,10 @@
|
|||||||
return [UIFont systemFontOfSize:mid];
|
return [UIFont systemFontOfSize:mid];
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (NSString *)savePathForFile:(NSString *)file {
|
#pragma mark - Savepath method
|
||||||
|
|
||||||
|
+ (NSString *)savePathForFile:(NSString *)file
|
||||||
|
{
|
||||||
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,
|
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,
|
||||||
NSUserDomainMask, YES);
|
NSUserDomainMask, YES);
|
||||||
NSString *documentsPath = paths[0];
|
NSString *documentsPath = paths[0];
|
||||||
|
|||||||
@ -13,8 +13,12 @@
|
|||||||
@class ViewController;
|
@class ViewController;
|
||||||
@interface TableViewController : UITableViewController
|
@interface TableViewController : UITableViewController
|
||||||
|
|
||||||
@property(strong, nonatomic) ViewController *main;
|
#pragma mark - Refrence to other views in app
|
||||||
|
|
||||||
@property(strong, nonatomic) NSMutableArray *dataSource;
|
@property (strong, nonatomic) ViewController *main;
|
||||||
|
|
||||||
|
#pragma mark - Table view data source
|
||||||
|
|
||||||
|
@property (strong, nonatomic) NSMutableArray *dataSource;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@ -10,7 +10,10 @@
|
|||||||
|
|
||||||
@implementation TableViewController
|
@implementation TableViewController
|
||||||
|
|
||||||
- (void)viewDidLoad {
|
#pragma mark - View management and navigation
|
||||||
|
|
||||||
|
- (void)viewDidLoad
|
||||||
|
{
|
||||||
[super viewDidLoad];
|
[super viewDidLoad];
|
||||||
|
|
||||||
// Uncomment the following line to preserve selection between presentations.
|
// Uncomment the following line to preserve selection between presentations.
|
||||||
@ -31,24 +34,22 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)didReceiveMemoryWarning {
|
|
||||||
[super didReceiveMemoryWarning];
|
|
||||||
// Dispose of any resources that can be recreated.
|
|
||||||
}
|
|
||||||
|
|
||||||
#pragma mark - Table view data source
|
#pragma mark - Table view data source
|
||||||
|
|
||||||
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
|
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
|
||||||
|
{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSInteger)tableView:(UITableView *)tableView
|
- (NSInteger)tableView:(UITableView *)tableView
|
||||||
numberOfRowsInSection:(NSInteger)section {
|
numberOfRowsInSection:(NSInteger)section
|
||||||
|
{
|
||||||
return _dataSource.count;
|
return _dataSource.count;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (UITableViewCell *)tableView:(UITableView *)tableView
|
- (UITableViewCell *)tableView:(UITableView *)tableView
|
||||||
cellForRowAtIndexPath:(NSIndexPath *)indexPath {
|
cellForRowAtIndexPath:(NSIndexPath *)indexPath
|
||||||
|
{
|
||||||
UITableViewCell *cell =
|
UITableViewCell *cell =
|
||||||
[tableView dequeueReusableCellWithIdentifier:@"Cell"
|
[tableView dequeueReusableCellWithIdentifier:@"Cell"
|
||||||
forIndexPath:indexPath];
|
forIndexPath:indexPath];
|
||||||
@ -63,10 +64,13 @@
|
|||||||
return cell;
|
return cell;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#pragma mark - Table view editing action
|
||||||
|
|
||||||
// Override to support editing the table view.
|
// Override to support editing the table view.
|
||||||
- (void)tableView:(UITableView *)tableView
|
- (void)tableView:(UITableView *)tableView
|
||||||
commitEditingStyle:(UITableViewCellEditingStyle)editingStyle
|
commitEditingStyle:(UITableViewCellEditingStyle)editingStyle
|
||||||
forRowAtIndexPath:(NSIndexPath *)indexPath {
|
forRowAtIndexPath:(NSIndexPath *)indexPath
|
||||||
|
{
|
||||||
if (editingStyle == UITableViewCellEditingStyleDelete) {
|
if (editingStyle == UITableViewCellEditingStyleDelete) {
|
||||||
// Delete the row from the data source
|
// Delete the row from the data source
|
||||||
[[NSFileManager defaultManager]
|
[[NSFileManager defaultManager]
|
||||||
@ -76,14 +80,18 @@
|
|||||||
[_dataSource removeObjectAtIndex:indexPath.row];
|
[_dataSource removeObjectAtIndex:indexPath.row];
|
||||||
[tableView deleteRowsAtIndexPaths:@[ indexPath ]
|
[tableView deleteRowsAtIndexPaths:@[ indexPath ]
|
||||||
withRowAnimation:UITableViewRowAnimationFade];
|
withRowAnimation:UITableViewRowAnimationFade];
|
||||||
} else if (editingStyle == UITableViewCellEditingStyleInsert) {
|
}
|
||||||
|
else if (editingStyle == UITableViewCellEditingStyleInsert) {
|
||||||
// Create a new instance of the appropriate class, insert it into the
|
// Create a new instance of the appropriate class, insert it into the
|
||||||
// array, and add a new row to the table view
|
// array, and add a new row to the table view
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#pragma mark - Table view cell selection action
|
||||||
|
|
||||||
- (void)tableView:(UITableView *)tableView
|
- (void)tableView:(UITableView *)tableView
|
||||||
didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
|
didSelectRowAtIndexPath:(NSIndexPath *)indexPath
|
||||||
|
{
|
||||||
if ([self.title isEqualToString:@"Manage"]) {
|
if ([self.title isEqualToString:@"Manage"]) {
|
||||||
[self dismissViewControllerAnimated:YES
|
[self dismissViewControllerAnimated:YES
|
||||||
completion:^(void) {
|
completion:^(void) {
|
||||||
|
|||||||
@ -14,15 +14,23 @@
|
|||||||
|
|
||||||
@interface ViewController : UIViewController <UIAlertViewDelegate>
|
@interface ViewController : UIViewController <UIAlertViewDelegate>
|
||||||
|
|
||||||
@property(strong, nonatomic) ViewControllerScreen *screen;
|
#pragma mark - Refrence to other views in app
|
||||||
@property(strong, nonatomic) ViewControllerKeyboard *keys;
|
|
||||||
@property(strong, nonatomic) NSMutableDictionary *save;
|
|
||||||
@property(nonatomic) BOOL firstLoad;
|
|
||||||
@property(strong, nonatomic) NSString *backupCoRte;
|
|
||||||
|
|
||||||
@property(strong, nonatomic) IBOutlet UIView *backdropKeys;
|
@property (strong, nonatomic) ViewControllerScreen *screen;
|
||||||
|
@property (strong, nonatomic) ViewControllerKeyboard *keys;
|
||||||
|
|
||||||
@property(strong, nonatomic) IBOutlet UIView *backdropScreen;
|
#pragma mark - Save and loading
|
||||||
|
|
||||||
|
@property (strong, nonatomic) NSMutableDictionary *save;
|
||||||
|
@property (nonatomic) BOOL firstLoad;
|
||||||
|
@property (strong, nonatomic) NSString *backupCoRte;
|
||||||
|
|
||||||
|
#pragma mark - Refrences to views for corner rounding
|
||||||
|
|
||||||
|
@property (strong, nonatomic) IBOutlet UIView *backdropKeys;
|
||||||
|
@property (strong, nonatomic) IBOutlet UIView *backdropScreen;
|
||||||
|
|
||||||
|
#pragma mark - Save and loading methods
|
||||||
|
|
||||||
- (void)loadSave:(NSString *)file;
|
- (void)loadSave:(NSString *)file;
|
||||||
- (void)saveToFile:(NSDictionary *)save;
|
- (void)saveToFile:(NSDictionary *)save;
|
||||||
|
|||||||
@ -10,7 +10,10 @@
|
|||||||
|
|
||||||
@implementation ViewController
|
@implementation ViewController
|
||||||
|
|
||||||
- (void)viewDidLoad {
|
#pragma mark - View management and navigation
|
||||||
|
|
||||||
|
- (void)viewDidLoad
|
||||||
|
{
|
||||||
[super viewDidLoad];
|
[super viewDidLoad];
|
||||||
// Do any additional setup after loading the view, typically from a nib.
|
// Do any additional setup after loading the view, typically from a nib.
|
||||||
// Round corners
|
// Round corners
|
||||||
@ -24,7 +27,8 @@
|
|||||||
self.title = @"FMC";
|
self.title = @"FMC";
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
|
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
|
||||||
|
{
|
||||||
NSString *segueName = segue.identifier;
|
NSString *segueName = segue.identifier;
|
||||||
if ([segueName isEqualToString:@"keyboard"]) {
|
if ([segueName isEqualToString:@"keyboard"]) {
|
||||||
_keys = (ViewControllerKeyboard *)segue.destinationViewController;
|
_keys = (ViewControllerKeyboard *)segue.destinationViewController;
|
||||||
@ -36,25 +40,30 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)saveToFile:(NSDictionary *)save {
|
#pragma mark - Loading and saving actions
|
||||||
|
|
||||||
|
- (void)saveToFile:(NSDictionary *)save
|
||||||
|
{
|
||||||
NSString *file =
|
NSString *file =
|
||||||
[SharedDeclerations savePathForFile:[_save valueForKey:@"MENU@LSKR1"]];
|
[SharedDeclerations savePathForFile:[_save valueForKey:@"MENU@LSKR1"]];
|
||||||
if (_firstLoad) {
|
if (_firstLoad) {
|
||||||
if ([[NSFileManager defaultManager] fileExistsAtPath:file]) {
|
if ([[NSFileManager defaultManager] fileExistsAtPath:file]) {
|
||||||
[self alertViewiOS7:file];
|
[self alertViewiOS7:file];
|
||||||
} else if (!([[_save valueForKey:@"MENU@LSKR1"]
|
}
|
||||||
isEqualToString:@""]) &&
|
else if (!([[_save valueForKey:@"MENU@LSKR1"] isEqualToString:@""]) &&
|
||||||
[_save valueForKey:@"MENU@LSKR1"] != nil) {
|
[_save valueForKey:@"MENU@LSKR1"] != nil) {
|
||||||
[_save writeToFile:file atomically:YES];
|
[_save writeToFile:file atomically:YES];
|
||||||
}
|
}
|
||||||
} else if (!([_save valueForKey:@"MENU@LSKR1"] == nil ||
|
}
|
||||||
|
else if (!([_save valueForKey:@"MENU@LSKR1"] == nil ||
|
||||||
[[_save valueForKey:@"MENU@LSKR1"] isEqualToString:@""])) {
|
[[_save valueForKey:@"MENU@LSKR1"] isEqualToString:@""])) {
|
||||||
[_save writeToFile:file atomically:YES];
|
[_save writeToFile:file atomically:YES];
|
||||||
}
|
}
|
||||||
_firstLoad = false;
|
_firstLoad = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)loadSave:(NSString *)file {
|
- (void)loadSave:(NSString *)file
|
||||||
|
{
|
||||||
if ([[NSFileManager defaultManager]
|
if ([[NSFileManager defaultManager]
|
||||||
fileExistsAtPath:[SharedDeclerations savePathForFile:file]]) {
|
fileExistsAtPath:[SharedDeclerations savePathForFile:file]]) {
|
||||||
_save = [[NSMutableDictionary alloc]
|
_save = [[NSMutableDictionary alloc]
|
||||||
@ -67,20 +76,24 @@
|
|||||||
#pragma mark - Delegate for UIAlertView and UIAlertController outsource
|
#pragma mark - Delegate for UIAlertView and UIAlertController outsource
|
||||||
|
|
||||||
- (void)alertView:(UIAlertView *)alertView
|
- (void)alertView:(UIAlertView *)alertView
|
||||||
clickedButtonAtIndex:(NSInteger)buttonIndex {
|
clickedButtonAtIndex:(NSInteger)buttonIndex
|
||||||
|
{
|
||||||
if (buttonIndex == 1) {
|
if (buttonIndex == 1) {
|
||||||
[self loadSave:[_save valueForKey:@"MENU@LSKR1"]];
|
[self loadSave:[_save valueForKey:@"MENU@LSKR1"]];
|
||||||
} else if (buttonIndex == 2) {
|
}
|
||||||
|
else if (buttonIndex == 2) {
|
||||||
[_save
|
[_save
|
||||||
writeToFile:[SharedDeclerations
|
writeToFile:[SharedDeclerations
|
||||||
savePathForFile:[_save valueForKey:@"MENU@LSKR1"]]
|
savePathForFile:[_save valueForKey:@"MENU@LSKR1"]]
|
||||||
atomically:YES];
|
atomically:YES];
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
_screen.LSK_R1.text = _backupCoRte;
|
_screen.LSK_R1.text = _backupCoRte;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)alertViewiOS7:(NSString *)file {
|
- (void)alertViewiOS7:(NSString *)file
|
||||||
|
{
|
||||||
if ([UIAlertController class]) {
|
if ([UIAlertController class]) {
|
||||||
UIAlertController *alert = [UIAlertController
|
UIAlertController *alert = [UIAlertController
|
||||||
alertControllerWithTitle:@"Load or replace?"
|
alertControllerWithTitle:@"Load or replace?"
|
||||||
@ -107,7 +120,8 @@
|
|||||||
[alert addAction:loadAction];
|
[alert addAction:loadAction];
|
||||||
[alert addAction:replaceAction];
|
[alert addAction:replaceAction];
|
||||||
[self presentViewController:alert animated:YES completion:nil];
|
[self presentViewController:alert animated:YES completion:nil];
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
UIAlertView *alert = [[UIAlertView alloc]
|
UIAlertView *alert = [[UIAlertView alloc]
|
||||||
initWithTitle:@"Load or replace?"
|
initWithTitle:@"Load or replace?"
|
||||||
message:@"The entered CO ROUTE alreay exists. Do "
|
message:@"The entered CO ROUTE alreay exists. Do "
|
||||||
|
|||||||
@ -12,12 +12,21 @@
|
|||||||
@class ViewController;
|
@class ViewController;
|
||||||
@interface ViewControllerKeyboard : UIViewController
|
@interface ViewControllerKeyboard : UIViewController
|
||||||
|
|
||||||
@property(nonatomic) BOOL alphaOn;
|
#pragma mark - Keyboard management
|
||||||
@property(strong, nonatomic) NSArray *alphabet;
|
|
||||||
@property(strong, nonatomic) NSArray *numeric;
|
|
||||||
@property(strong, nonatomic) ViewController *main;
|
|
||||||
|
|
||||||
@property(strong, nonatomic) IBOutletCollection(UIButton) NSArray *Keys;
|
@property (nonatomic) BOOL alphaOn;
|
||||||
|
@property (strong, nonatomic) NSArray *alphabet;
|
||||||
|
@property (strong, nonatomic) NSArray *numeric;
|
||||||
|
|
||||||
|
#pragma mark - Refrence to other views in app
|
||||||
|
|
||||||
|
@property (strong, nonatomic) ViewController *main;
|
||||||
|
|
||||||
|
#pragma mark - Keys as Array
|
||||||
|
|
||||||
|
@property (strong, nonatomic) IBOutletCollection(UIButton) NSArray *Keys;
|
||||||
|
|
||||||
|
#pragma mark - Key methods
|
||||||
|
|
||||||
- (IBAction)KeyTaps:(UIButton *)sender;
|
- (IBAction)KeyTaps:(UIButton *)sender;
|
||||||
|
|
||||||
|
|||||||
@ -11,7 +11,10 @@
|
|||||||
|
|
||||||
@implementation ViewControllerKeyboard
|
@implementation ViewControllerKeyboard
|
||||||
|
|
||||||
- (void)viewDidLoad {
|
#pragma mark - View management and navigation
|
||||||
|
|
||||||
|
- (void)viewDidLoad
|
||||||
|
{
|
||||||
[super viewDidLoad];
|
[super viewDidLoad];
|
||||||
// Do any additional setup after loading the view.
|
// Do any additional setup after loading the view.
|
||||||
_alphaOn = true;
|
_alphaOn = true;
|
||||||
@ -94,41 +97,54 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (IBAction)KeyTaps:(UIButton *)sender {
|
#pragma mark - Keyborad actions
|
||||||
|
|
||||||
|
- (IBAction)KeyTaps:(UIButton *)sender
|
||||||
|
{
|
||||||
if ([sender.restorationIdentifier isEqualToString:@"Switch"]) {
|
if ([sender.restorationIdentifier isEqualToString:@"Switch"]) {
|
||||||
_alphaOn = !_alphaOn;
|
_alphaOn = !_alphaOn;
|
||||||
[self switchKeyboard];
|
[self switchKeyboard];
|
||||||
} else if ([sender.restorationIdentifier isEqualToString:@"Space"]) {
|
}
|
||||||
|
else if ([sender.restorationIdentifier isEqualToString:@"Space"]) {
|
||||||
_main.screen.Scratchpad.text =
|
_main.screen.Scratchpad.text =
|
||||||
[_main.screen.Scratchpad.text stringByAppendingString:@" "];
|
[_main.screen.Scratchpad.text stringByAppendingString:@" "];
|
||||||
} else if ([sender.restorationIdentifier isEqualToString:@"Clear"]) {
|
}
|
||||||
|
else if ([sender.restorationIdentifier isEqualToString:@"Clear"]) {
|
||||||
if ([_main.screen.Scratchpad.text isEqualToString:@"DELETE"]) {
|
if ([_main.screen.Scratchpad.text isEqualToString:@"DELETE"]) {
|
||||||
_main.screen.Scratchpad.text = @"";
|
_main.screen.Scratchpad.text = @"";
|
||||||
} else if (_main.screen.Scratchpad.text.length > 0) {
|
}
|
||||||
|
else if (_main.screen.Scratchpad.text.length > 0) {
|
||||||
_main.screen.Scratchpad.text = [_main.screen.Scratchpad.text
|
_main.screen.Scratchpad.text = [_main.screen.Scratchpad.text
|
||||||
substringToIndex:(_main.screen.Scratchpad.text).length - 1];
|
substringToIndex:(_main.screen.Scratchpad.text).length - 1];
|
||||||
}
|
}
|
||||||
} else if ([sender.restorationIdentifier isEqualToString:@"Delete"]) {
|
}
|
||||||
|
else if ([sender.restorationIdentifier isEqualToString:@"Delete"]) {
|
||||||
_main.screen.Scratchpad.text = @"DELETE";
|
_main.screen.Scratchpad.text = @"DELETE";
|
||||||
} else if ([sender.restorationIdentifier isEqualToString:@"Top"]) {
|
}
|
||||||
|
else if ([sender.restorationIdentifier isEqualToString:@"Top"]) {
|
||||||
[_main.screen loadScreen:@"MENU" withOptions:nil];
|
[_main.screen loadScreen:@"MENU" withOptions:nil];
|
||||||
} else if ([sender.restorationIdentifier isEqualToString:@"Mid"]) {
|
}
|
||||||
|
else if ([sender.restorationIdentifier isEqualToString:@"Mid"]) {
|
||||||
[_main.screen loadScreen:@"PERF INIT" withOptions:nil];
|
[_main.screen loadScreen:@"PERF INIT" withOptions:nil];
|
||||||
} else if ([sender.restorationIdentifier isEqualToString:@"Bot"]) {
|
}
|
||||||
|
else if ([sender.restorationIdentifier isEqualToString:@"Bot"]) {
|
||||||
if (_main.screen.maxNumRoutePages > _main.screen.numRoutePage &&
|
if (_main.screen.maxNumRoutePages > _main.screen.numRoutePage &&
|
||||||
([[_main.screen.Header.text substringToIndex:3]
|
([[_main.screen.Header.text substringToIndex:3]
|
||||||
isEqualToString:@"ROU"])) {
|
isEqualToString:@"ROU"])) {
|
||||||
[_main.screen loadScreen:@"ROUTE" withOptions:@[ FMCNEXTRTEPAGE ]];
|
[_main.screen loadScreen:@"ROUTE" withOptions:@[ FMCNEXTRTEPAGE ]];
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
[_main.screen loadScreen:@"ROUTE" withOptions:@[ FMCFIRSTRTEPAGE ]];
|
[_main.screen loadScreen:@"ROUTE" withOptions:@[ FMCFIRSTRTEPAGE ]];
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
_main.screen.Scratchpad.text = [_main.screen.Scratchpad.text
|
_main.screen.Scratchpad.text = [_main.screen.Scratchpad.text
|
||||||
stringByAppendingString:sender.titleLabel.text];
|
stringByAppendingString:sender.titleLabel.text];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)switchKeyboard {
|
- (void)switchKeyboard
|
||||||
|
{
|
||||||
if (_alphaOn) {
|
if (_alphaOn) {
|
||||||
for (int i = 0; i < _Keys.count; i++) {
|
for (int i = 0; i < _Keys.count; i++) {
|
||||||
((UIButton *)_Keys[i]).titleLabel.numberOfLines = 0;
|
((UIButton *)_Keys[i]).titleLabel.numberOfLines = 0;
|
||||||
@ -138,7 +154,8 @@
|
|||||||
forState:UIControlStateNormal];
|
forState:UIControlStateNormal];
|
||||||
[((UIButton *)_Keys[i]).titleLabel sizeToFit];
|
[((UIButton *)_Keys[i]).titleLabel sizeToFit];
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
for (int i = 0; i < _Keys.count; i++) {
|
for (int i = 0; i < _Keys.count; i++) {
|
||||||
((UIButton *)_Keys[i]).titleLabel.numberOfLines = 0;
|
((UIButton *)_Keys[i]).titleLabel.numberOfLines = 0;
|
||||||
((UIButton *)_Keys[i]).titleLabel.lineBreakMode =
|
((UIButton *)_Keys[i]).titleLabel.lineBreakMode =
|
||||||
|
|||||||
@ -14,20 +14,28 @@
|
|||||||
@class ViewController;
|
@class ViewController;
|
||||||
@interface ViewControllerScreen : UIViewController
|
@interface ViewControllerScreen : UIViewController
|
||||||
|
|
||||||
@property(strong, nonatomic) ViewController *main;
|
#pragma mark - Refrence to other views in app
|
||||||
@property(nonatomic) NSUInteger maxNumRoutePages;
|
|
||||||
@property(nonatomic) NSUInteger numRoutePage;
|
|
||||||
|
|
||||||
@property(strong, nonatomic) IBOutletCollection(UILabel) NSArray *LSK;
|
@property (strong, nonatomic) ViewController *main;
|
||||||
@property(strong, nonatomic) IBOutletCollection(UILabel) NSArray *Desc;
|
|
||||||
|
|
||||||
@property(strong, nonatomic) IBOutlet UILabel *Scratchpad;
|
#pragma mark - Route page management
|
||||||
|
|
||||||
@property(strong, nonatomic) IBOutlet UILabel *Header;
|
@property (nonatomic) NSUInteger maxNumRoutePages;
|
||||||
|
@property (nonatomic) NSUInteger numRoutePage;
|
||||||
|
|
||||||
@property(strong, nonatomic) IBOutlet NSLayoutConstraint *FrameHeight;
|
#pragma mark - Text fileds on view
|
||||||
|
|
||||||
@property(strong, nonatomic) IBOutlet UILabel *LSK_R1;
|
@property (strong, nonatomic) IBOutletCollection(UILabel) NSArray *LSK;
|
||||||
|
@property (strong, nonatomic) IBOutletCollection(UILabel) NSArray *Desc;
|
||||||
|
@property (strong, nonatomic) IBOutlet UILabel *Scratchpad;
|
||||||
|
@property (strong, nonatomic) IBOutlet UILabel *Header;
|
||||||
|
@property (strong, nonatomic) IBOutlet UILabel *LSK_R1;
|
||||||
|
|
||||||
|
#pragma mark - Constraint to adjust dynamic label height
|
||||||
|
|
||||||
|
@property (strong, nonatomic) IBOutlet NSLayoutConstraint *FrameHeight;
|
||||||
|
|
||||||
|
#pragma mark - Screen methods
|
||||||
|
|
||||||
- (void)loadScreen:(NSString *)screenName withOptions:(NSArray *)options;
|
- (void)loadScreen:(NSString *)screenName withOptions:(NSArray *)options;
|
||||||
- (void)loadDataToScreen;
|
- (void)loadDataToScreen;
|
||||||
|
|||||||
@ -11,7 +11,10 @@
|
|||||||
|
|
||||||
@implementation ViewControllerScreen
|
@implementation ViewControllerScreen
|
||||||
|
|
||||||
- (void)viewDidLoad {
|
#pragma mark - View management and navigation
|
||||||
|
|
||||||
|
- (void)viewDidLoad
|
||||||
|
{
|
||||||
[super viewDidLoad];
|
[super viewDidLoad];
|
||||||
|
|
||||||
// Do any additional setup after loading the view.
|
// Do any additional setup after loading the view.
|
||||||
@ -36,12 +39,14 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)viewDidAppear:(BOOL)animated {
|
- (void)viewDidAppear:(BOOL)animated
|
||||||
|
{
|
||||||
[super viewDidAppear:YES];
|
[super viewDidAppear:YES];
|
||||||
[self loadScreen:@"MENU" withOptions:nil];
|
[self loadScreen:@"MENU" withOptions:nil];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)viewDidLayoutSubviews {
|
- (void)viewDidLayoutSubviews
|
||||||
|
{
|
||||||
_FrameHeight.constant = self.view.frame.size.height / 14.5;
|
_FrameHeight.constant = self.view.frame.size.height / 14.5;
|
||||||
// Size and LineBreak
|
// Size and LineBreak
|
||||||
_Header.font =
|
_Header.font =
|
||||||
@ -62,27 +67,27 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)clearScreen {
|
#pragma mark - LSK action
|
||||||
for (UILabel *label in _LSK) {
|
|
||||||
label.text = @"";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)enterLSK:(UITapGestureRecognizer *)tapReg {
|
- (void)enterLSK:(UITapGestureRecognizer *)tapReg
|
||||||
|
{
|
||||||
if ([_Scratchpad.text isEqualToString:@"DELETE"]) {
|
if ([_Scratchpad.text isEqualToString:@"DELETE"]) {
|
||||||
((UILabel *)tapReg.view).text = @"";
|
((UILabel *)tapReg.view).text = @"";
|
||||||
} else if ([_Header.text isEqualToString:@"MENU"]) {
|
}
|
||||||
|
else if ([_Header.text isEqualToString:@"MENU"]) {
|
||||||
if ([((UILabel *)tapReg.view)
|
if ([((UILabel *)tapReg.view)
|
||||||
.restorationIdentifier isEqualToString:@"LSKR1"]) {
|
.restorationIdentifier isEqualToString:@"LSKR1"]) {
|
||||||
if ([((UILabel *)tapReg.view).text isEqualToString:@""]) {
|
if ([((UILabel *)tapReg.view).text isEqualToString:@""]) {
|
||||||
_main.firstLoad = true;
|
_main.firstLoad = true;
|
||||||
} else if (!([((UILabel *)tapReg.view)
|
}
|
||||||
|
else if (!([((UILabel *)tapReg.view)
|
||||||
.text isEqualToString:_Scratchpad.text])) {
|
.text isEqualToString:_Scratchpad.text])) {
|
||||||
_main.firstLoad = true;
|
_main.firstLoad = true;
|
||||||
}
|
}
|
||||||
_main.backupCoRte = ((UILabel *)tapReg.view).text;
|
_main.backupCoRte = ((UILabel *)tapReg.view).text;
|
||||||
((UILabel *)tapReg.view).text = _Scratchpad.text;
|
((UILabel *)tapReg.view).text = _Scratchpad.text;
|
||||||
} else if ([((UILabel *)tapReg.view)
|
}
|
||||||
|
else if ([((UILabel *)tapReg.view)
|
||||||
.restorationIdentifier isEqualToString:@"LSKR4"]) {
|
.restorationIdentifier isEqualToString:@"LSKR4"]) {
|
||||||
[_main saveToFile:_main.save];
|
[_main saveToFile:_main.save];
|
||||||
_main.save = [[NSMutableDictionary alloc] init];
|
_main.save = [[NSMutableDictionary alloc] init];
|
||||||
@ -102,20 +107,24 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if ([((UILabel *)tapReg.view)
|
}
|
||||||
|
else if ([((UILabel *)tapReg.view)
|
||||||
.restorationIdentifier isEqualToString:@"LSKR5"]) {
|
.restorationIdentifier isEqualToString:@"LSKR5"]) {
|
||||||
#warning EXPORT TO PMDG GOES HERE
|
#warning EXPORT TO PMDG GOES HERE
|
||||||
} else if ([((UILabel *)tapReg.view)
|
}
|
||||||
|
else if ([((UILabel *)tapReg.view)
|
||||||
.restorationIdentifier isEqualToString:@"LSKR6"]) {
|
.restorationIdentifier isEqualToString:@"LSKR6"]) {
|
||||||
UINavigationController *sm = [self.storyboard
|
UINavigationController *sm = [self.storyboard
|
||||||
instantiateViewControllerWithIdentifier:@"ServiceMenu"];
|
instantiateViewControllerWithIdentifier:@"ServiceMenu"];
|
||||||
((ViewControllerServiceMenu *)(sm.childViewControllers).firstObject)
|
((ViewControllerServiceMenu *)(sm.childViewControllers).firstObject)
|
||||||
.main = _main;
|
.main = _main;
|
||||||
[self presentViewController:sm animated:YES completion:nil];
|
[self presentViewController:sm animated:YES completion:nil];
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
((UILabel *)tapReg.view).text = _Scratchpad.text;
|
((UILabel *)tapReg.view).text = _Scratchpad.text;
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
((UILabel *)tapReg.view).text = _Scratchpad.text;
|
((UILabel *)tapReg.view).text = _Scratchpad.text;
|
||||||
}
|
}
|
||||||
if ([((UILabel *)tapReg.view)
|
if ([((UILabel *)tapReg.view)
|
||||||
@ -135,14 +144,25 @@
|
|||||||
(unsigned long)
|
(unsigned long)
|
||||||
_maxNumRoutePages]];
|
_maxNumRoutePages]];
|
||||||
}
|
}
|
||||||
(_main.save)[[NSString stringWithFormat:@"%@@%@", _Header.text,
|
(_main.save)[[NSString
|
||||||
((UILabel *)tapReg.view)
|
stringWithFormat:@"%@@%@", _Header.text,
|
||||||
.restorationIdentifier]] = ((UILabel *)tapReg.view).text;
|
((UILabel *)tapReg.view).restorationIdentifier]] =
|
||||||
|
((UILabel *)tapReg.view).text;
|
||||||
_Scratchpad.text = @"";
|
_Scratchpad.text = @"";
|
||||||
[_main saveToFile:_main.save];
|
[_main saveToFile:_main.save];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)loadScreen:(NSString *)screenName withOptions:(NSArray *)options {
|
#pragma mark - Screen actions
|
||||||
|
|
||||||
|
- (void)clearScreen
|
||||||
|
{
|
||||||
|
for (UILabel *label in _LSK) {
|
||||||
|
label.text = @"";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)loadScreen:(NSString *)screenName withOptions:(NSArray *)options
|
||||||
|
{
|
||||||
[self clearScreen];
|
[self clearScreen];
|
||||||
_Header.text = screenName;
|
_Header.text = screenName;
|
||||||
NSArray *screen =
|
NSArray *screen =
|
||||||
@ -167,7 +187,8 @@
|
|||||||
for (NSString *opt in options) {
|
for (NSString *opt in options) {
|
||||||
if ([opt isEqualToString:FMCNEXTRTEPAGE]) {
|
if ([opt isEqualToString:FMCNEXTRTEPAGE]) {
|
||||||
_numRoutePage += 1;
|
_numRoutePage += 1;
|
||||||
} else if ([opt isEqualToString:FMCFIRSTRTEPAGE]) {
|
}
|
||||||
|
else if ([opt isEqualToString:FMCFIRSTRTEPAGE]) {
|
||||||
_numRoutePage = 1;
|
_numRoutePage = 1;
|
||||||
}
|
}
|
||||||
_Header.text = [_Header.text
|
_Header.text = [_Header.text
|
||||||
@ -193,7 +214,8 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)loadDataToScreen {
|
- (void)loadDataToScreen
|
||||||
|
{
|
||||||
for (NSString *ident in _main.save) {
|
for (NSString *ident in _main.save) {
|
||||||
NSRange range = [ident rangeOfString:@"@"];
|
NSRange range = [ident rangeOfString:@"@"];
|
||||||
if ([[ident substringToIndex:range.location]
|
if ([[ident substringToIndex:range.location]
|
||||||
|
|||||||
@ -15,8 +15,15 @@
|
|||||||
|
|
||||||
@interface ViewControllerServiceMenu : UIViewController
|
@interface ViewControllerServiceMenu : UIViewController
|
||||||
|
|
||||||
@property(strong, nonatomic) ViewController *main;
|
#pragma mark - Refrence to other views in app
|
||||||
@property(strong, nonatomic) IBOutlet UIButton *dbConnectButton;
|
|
||||||
|
@property (strong, nonatomic) ViewController *main;
|
||||||
|
|
||||||
|
#pragma mark - Outlet fo Dropbox button
|
||||||
|
|
||||||
|
@property (strong, nonatomic) IBOutlet UIButton *dbConnectButton;
|
||||||
|
|
||||||
|
#pragma mark - Dropbox authentictaion methods
|
||||||
|
|
||||||
- (IBAction)dbConnect:(UIButton *)sender;
|
- (IBAction)dbConnect:(UIButton *)sender;
|
||||||
- (IBAction)dbDisconnect:(UIButton *)sender;
|
- (IBAction)dbDisconnect:(UIButton *)sender;
|
||||||
|
|||||||
@ -9,7 +9,10 @@
|
|||||||
|
|
||||||
@implementation ViewControllerServiceMenu
|
@implementation ViewControllerServiceMenu
|
||||||
|
|
||||||
- (void)viewDidLoad {
|
#pragma mark - View management and navigation
|
||||||
|
|
||||||
|
- (void)viewDidLoad
|
||||||
|
{
|
||||||
[super viewDidLoad];
|
[super viewDidLoad];
|
||||||
self.title = @"Service Menu";
|
self.title = @"Service Menu";
|
||||||
self.navigationItem.leftBarButtonItem =
|
self.navigationItem.leftBarButtonItem =
|
||||||
@ -19,7 +22,9 @@
|
|||||||
action:@selector(back)];
|
action:@selector(back)];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)viewWillAppear:(BOOL)animated {
|
- (void)viewWillAppear:(BOOL)animated
|
||||||
|
{
|
||||||
|
[super viewWillAppear:animated];
|
||||||
DropboxV2ObjC *dbClient =
|
DropboxV2ObjC *dbClient =
|
||||||
((AppDelegate *)[UIApplication sharedApplication].delegate).dbClient;
|
((AppDelegate *)[UIApplication sharedApplication].delegate).dbClient;
|
||||||
if (dbClient.token != nil) {
|
if (dbClient.token != nil) {
|
||||||
@ -34,11 +39,13 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)back {
|
- (void)back
|
||||||
|
{
|
||||||
[self dismissViewControllerAnimated:YES completion:nil];
|
[self dismissViewControllerAnimated:YES completion:nil];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
|
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
|
||||||
|
{
|
||||||
((TableViewController *)segue.destinationViewController).title =
|
((TableViewController *)segue.destinationViewController).title =
|
||||||
segue.identifier;
|
segue.identifier;
|
||||||
((TableViewController *)segue.destinationViewController).main = _main;
|
((TableViewController *)segue.destinationViewController).main = _main;
|
||||||
@ -47,7 +54,8 @@
|
|||||||
#pragma mark - Dropbox Button
|
#pragma mark - Dropbox Button
|
||||||
|
|
||||||
// Standard action (hence set), dnamically set and unset
|
// Standard action (hence set), dnamically set and unset
|
||||||
- (IBAction)dbConnect:(UIButton *)sender {
|
- (IBAction)dbConnect:(UIButton *)sender
|
||||||
|
{
|
||||||
UIViewController *webController = [[UIViewController alloc] init];
|
UIViewController *webController = [[UIViewController alloc] init];
|
||||||
webController.title = @"Dropbox";
|
webController.title = @"Dropbox";
|
||||||
UIWebView *web = [[UIWebView alloc] initWithFrame:webController.view.frame];
|
UIWebView *web = [[UIWebView alloc] initWithFrame:webController.view.frame];
|
||||||
@ -65,7 +73,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Dynamically set and unset
|
// Dynamically set and unset
|
||||||
- (IBAction)dbDisconnect:(UIButton *)sender {
|
- (IBAction)dbDisconnect:(UIButton *)sender
|
||||||
|
{
|
||||||
DropboxV2ObjC *dbClient =
|
DropboxV2ObjC *dbClient =
|
||||||
((AppDelegate *)[UIApplication sharedApplication].delegate).dbClient;
|
((AppDelegate *)[UIApplication sharedApplication].delegate).dbClient;
|
||||||
[dbClient deauthorizeUser];
|
[dbClient deauthorizeUser];
|
||||||
@ -80,7 +89,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
#warning TESTING GROUNDS
|
#warning TESTING GROUNDS
|
||||||
- (IBAction)testing:(id)sender {
|
- (IBAction)testing:(id)sender
|
||||||
|
{
|
||||||
DropboxV2ObjC *dbClient =
|
DropboxV2ObjC *dbClient =
|
||||||
((AppDelegate *)[UIApplication sharedApplication].delegate).dbClient;
|
((AppDelegate *)[UIApplication sharedApplication].delegate).dbClient;
|
||||||
NSLog(@"%@", [dbClient contentsOfPath:nil]);
|
NSLog(@"%@", [dbClient contentsOfPath:nil]);
|
||||||
|
|||||||
@ -9,7 +9,8 @@
|
|||||||
#import "AppDelegate.h"
|
#import "AppDelegate.h"
|
||||||
#import <UIKit/UIKit.h>
|
#import <UIKit/UIKit.h>
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
return UIApplicationMain(argc, argv, nil,
|
return UIApplicationMain(argc, argv, nil,
|
||||||
NSStringFromClass([AppDelegate class]));
|
NSStringFromClass([AppDelegate class]));
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user