| 1 |
/* |
| 2 |
Copyright 2017-2017 Michalis Kamburelis. |
| 3 |
|
| 4 |
This file is part of "Castle Game Engine". |
| 5 |
|
| 6 |
"Castle Game Engine" is free software; see the file COPYING.txt, |
| 7 |
included in the "Castle Game Engine" distribution, |
| 8 |
for details about the copyright. |
| 9 |
|
| 10 |
"Castle Game Engine" is distributed in the hope that it will be useful, |
| 11 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| 13 |
|
| 14 |
---------------------------------------------------------------------------- |
| 15 |
*/ |
| 16 |
|
| 17 |
#import "ServiceAbstract.h" |
| 18 |
#include "castleiosappglue.h" |
| 19 |
#import "CgeUtils.h" |
| 20 |
|
| 21 |
@implementation ServiceAbstract |
| 22 |
|
| 23 |
- (void)applicationDidEnterBackground |
| 24 |
{ |
| 25 |
} |
| 26 |
|
| 27 |
- (void)application:(UIApplication *) application didFinishLaunchingWithOptions:(NSDictionary *) launchOptions |
| 28 |
{ |
| 29 |
} |
| 30 |
|
| 31 |
- (void)applicationDidBecomeActive:(UIApplication *)application |
| 32 |
{ |
| 33 |
} |
| 34 |
|
| 35 |
- (BOOL)application:(UIApplication *)app |
| 36 |
openURL:(NSURL *)url |
| 37 |
options:(NSDictionary<UIApplicationOpenURLOptionsKey, id> *)options |
| 38 |
{ |
| 39 |
return NO; |
| 40 |
} |
| 41 |
|
| 42 |
- (bool)messageReceived:(NSArray* )message |
| 43 |
{ |
| 44 |
return FALSE; |
| 45 |
} |
| 46 |
|
| 47 |
- (bool)stringToBool:(NSString* )value |
| 48 |
{ |
| 49 |
if ([value isEqualToString:@"true"]) { |
| 50 |
return TRUE; |
| 51 |
} else |
| 52 |
if ([value isEqualToString:@"false"]) { |
| 53 |
return FALSE; |
| 54 |
} else |
| 55 |
{ |
| 56 |
NSLog(@"Invalid boolean value in message: %@", value); |
| 57 |
return FALSE; |
| 58 |
} |
| 59 |
} |
| 60 |
|
| 61 |
- (NSString*)boolToString:(bool)value |
| 62 |
{ |
| 63 |
return value ? @"true" : @"false"; |
| 64 |
} |
| 65 |
|
| 66 |
- (void)messageSend:(NSArray* )message |
| 67 |
{ |
| 68 |
NSString* messageStr = [message componentsJoinedByString:@"\1"]; |
| 69 |
const char* messageCPointer = [messageStr UTF8String]; |
| 70 |
CGEApp_SendMessageToPascal(messageCPointer); |
| 71 |
} |
| 72 |
|
| 73 |
- (void)onPurchase:(AvailableProduct*) product |
| 74 |
withTransaction:(SKPaymentTransaction*) transaction |
| 75 |
{ |
| 76 |
} |
| 77 |
|
| 78 |
@end |
| 79 |
|
| 80 |
NSString* stringNonNil(NSString* value) |
| 81 |
{ |
| 82 |
return value != nil ? value : @""; |
| 83 |
} |