Skip to content

Commit

Permalink
Typed constants, less preprocessor
Browse files Browse the repository at this point in the history
  • Loading branch information
keeshux committed Sep 21, 2015
1 parent 9477170 commit aa0683d
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 31 deletions.
16 changes: 5 additions & 11 deletions Components/Macros/KSMacrosApp.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,15 @@
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//

#ifndef KSMacrosApp_h
#define KSMacrosApp_h

#import <Foundation/Foundation.h>

extern NSString *const KSAppLinkProtocol;
extern NSString *const KSAppLinkProtocolWeb;

#define KSAppLinkProtocol @"itms-apps"
#define KSAppLinkProtocolWeb @"http"

#define KSAppLinkFormat @"%@://itunes.apple.com/app/id%lu"
#define KSAppDeveloperLinkFormat @"%@://itunes.apple.com/developer/id%lu"
extern NSString *const KSAppLinkFormat;
extern NSString *const KSAppDeveloperLinkFormat;

#define KSAppGCLogin @"gamecenter:/me"
extern NSString *const KSAppGCLogin;

static inline NSString *KSAppVersion()
{
Expand Down Expand Up @@ -84,5 +80,3 @@ static inline NSString *KSAppWebDeveloperURL(const unsigned long developerID)
{
return [NSString stringWithFormat:KSAppDeveloperLinkFormat, KSAppLinkProtocolWeb, developerID];
}

#endif
37 changes: 37 additions & 0 deletions Components/Macros/KSMacrosApp.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
//
// Copyright (c) 2011, Davide De Rosa
// All rights reserved.
//
// This code is distributed under the terms and conditions of the BSD license.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation and/or
// other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//

#import "KSMacrosApp.h"

NSString *const KSAppLinkProtocol = @"itms-apps";
NSString *const KSAppLinkProtocolWeb = @"http";

NSString *const KSAppLinkFormat = @"%@://itunes.apple.com/app/id%lu";
NSString *const KSAppDeveloperLinkFormat = @"%@://itunes.apple.com/developer/id%lu";

NSString *const KSAppGCLogin = @"gamecenter:/me";
6 changes: 0 additions & 6 deletions Components/Macros/KSMacrosBlocks.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,6 @@
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//

#ifndef KSMacrosBlocks_h
#define KSMacrosBlocks_h

#import <Foundation/Foundation.h>


void KSBlocksDelaySeconds(const NSTimeInterval seconds, void (^block)());

#endif
1 change: 0 additions & 1 deletion Components/Macros/KSMacrosDates.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@

#import <Foundation/Foundation.h>


#pragma mark - Year

NSInteger KSDatesYear(NSDate *date);
Expand Down
1 change: 0 additions & 1 deletion Components/Macros/KSMacrosSharing.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@

#import <UIKit/UIKit.h>


void KSSharingFacebookOpenPage(NSString *pageId, NSString *fallbackURL);

void KSSharingFacebookPostStatus(UIViewController *controller, NSString *status, UIImage *image);
Expand Down
6 changes: 0 additions & 6 deletions Components/Macros/KSMacrosSystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,9 @@
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//

#ifndef KSMacrosSystem_h
#define KSMacrosSystem_h

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


static inline NSString *KSSystemVersion()
{
return [[UIDevice currentDevice] systemVersion];
Expand Down Expand Up @@ -72,5 +68,3 @@ static inline BOOL KSSystemIsiOS7()
return NO;
#endif
}

#endif
8 changes: 2 additions & 6 deletions Components/Macros/KSMacrosUI.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,9 @@
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//

#ifndef KSMacrosUI_h
#define KSMacrosUI_h

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


static inline BOOL KSUIIsPad()
{
return (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad);
Expand All @@ -57,7 +53,9 @@ static inline UIColor *KSUIColorFromRGB(const NSUInteger rgb)
return [UIColor colorWithRed:r green:g blue:b alpha:1.0];
}

#ifndef KSUISF
#define KSUISF(format, ...) [NSString stringWithFormat:format, __VA_ARGS__]
#endif

static inline NSString *KSUIString(NSString *key)
{
Expand All @@ -72,5 +70,3 @@ static inline NSString *KSUITableString(NSString *table, NSString *key)
BOOL KSUIPhoneCanCall(void);

BOOL KSUIPhoneCall(NSString *phone);

#endif

0 comments on commit aa0683d

Please sign in to comment.