Merge pull request #14497 from akien-mga/iphone-cleanup

iOS: Drop obsolete code from never-public modules
This commit is contained in:
Rémi Verschelde 2017-12-10 20:21:31 +01:00 committed by GitHub
commit 356bab4534
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 138 deletions

View File

@ -35,21 +35,6 @@
#include "main/main.h"
#include "os_iphone.h"
#ifdef MODULE_FACEBOOKSCORER_IOS_ENABLED
#include "modules/FacebookScorer_ios/FacebookScorer.h"
#endif
#ifdef MODULE_GAME_ANALYTICS_ENABLED
#import "modules/game_analytics/ios/MobileAppTracker.framework/Headers/MobileAppTracker.h"
//#import "modules/game_analytics/ios/MobileAppTracker.h"
#import <AdSupport/AdSupport.h>
#endif
#ifdef MODULE_PARSE_ENABLED
#import "FBSDKCoreKit/FBSDKCoreKit.h"
#import <Parse/Parse.h>
#endif
#import "GameController/GameController.h"
#define kFilteringFactor 0.1
@ -418,11 +403,7 @@ static int frame_count = 0;
OSIPhone::get_singleton()->set_unique_id(String::utf8([uuid UTF8String]));
}; break;
/*
case 1: {
++frame_count;
}; break;
*/
case 1: {
Main::setup2();
@ -453,11 +434,7 @@ static int frame_count = 0;
}
}; break;
/*
case 3: {
++frame_count;
}; break;
*/
case 2: {
Main::start();
@ -558,15 +535,11 @@ static int frame_count = 0;
};
- (void)applicationDidReceiveMemoryWarning:(UIApplication *)application {
printf("****************** did receive memory warning!\n");
OS::get_singleton()->get_main_loop()->notification(
MainLoop::NOTIFICATION_OS_MEMORY_WARNING);
};
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
printf("**************** app delegate init\n");
CGRect rect = [[UIScreen mainScreen] bounds];
[application setStatusBarHidden:YES withAnimation:UIStatusBarAnimationNone];
@ -603,7 +576,7 @@ static int frame_count = 0;
if (err != 0) {
// bail, things did not go very well for us, should probably output a message on screen with our error code...
exit(0);
return;
return FALSE;
};
view_controller = [[ViewController alloc] init];
@ -641,43 +614,10 @@ static int frame_count = 0;
// prevent to stop music in another background app
[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryAmbient error:nil];
#ifdef MODULE_GAME_ANALYTICS_ENABLED
printf("********************* didFinishLaunchingWithOptions\n");
if (!ProjectSettings::get_singleton()->has("mobileapptracker/advertiser_id")) {
return;
}
if (!ProjectSettings::get_singleton()->has("mobileapptracker/conversion_key")) {
return;
}
String adid = GLOBAL_DEF("mobileapptracker/advertiser_id", "");
String convkey = GLOBAL_DEF("mobileapptracker/conversion_key", "");
NSString *advertiser_id =
[NSString stringWithUTF8String:adid.utf8().get_data()];
NSString *conversion_key =
[NSString stringWithUTF8String:convkey.utf8().get_data()];
// Account Configuration info - must be set
[MobileAppTracker initializeWithMATAdvertiserId:advertiser_id
MATConversionKey:conversion_key];
// Used to pass us the IFA, enables highly accurate 1-to-1 attribution.
// Required for many advertising networks.
[MobileAppTracker
setAppleAdvertisingIdentifier:[[ASIdentifierManager sharedManager]
advertisingIdentifier]
advertisingTrackingEnabled:[[ASIdentifierManager sharedManager]
isAdvertisingTrackingEnabled]];
#endif
return TRUE;
};
- (void)applicationWillTerminate:(UIApplication *)application {
printf("********************* will terminate\n");
[self deinitGameControllers];
if (motionInitialised) {
@ -692,7 +632,6 @@ static int frame_count = 0;
};
- (void)applicationDidEnterBackground:(UIApplication *)application {
printf("********************* did enter background\n");
///@TODO maybe add pause motionManager? and where would we unpause it?
if (OS::get_singleton()->get_main_loop())
@ -706,24 +645,17 @@ static int frame_count = 0;
}
- (void)applicationWillEnterForeground:(UIApplication *)application {
printf("********************* did enter foreground\n");
// OS::get_singleton()->get_main_loop()->notification(MainLoop::NOTIFICATION_WM_FOCUS_IN);
[view_controller.view startAnimation];
}
- (void)applicationWillResignActive:(UIApplication *)application {
printf("********************* will resign active\n");
// OS::get_singleton()->get_main_loop()->notification(MainLoop::NOTIFICATION_WM_FOCUS_OUT);
[view_controller.view
stopAnimation]; // FIXME: pause seems to be recommended elsewhere
}
- (void)applicationDidBecomeActive:(UIApplication *)application {
printf("********************* did become active\n");
#ifdef MODULE_GAME_ANALYTICS_ENABLED
printf("********************* mobile app tracker found\n");
[MobileAppTracker measureSession];
#endif
if (OS::get_singleton()->get_main_loop())
OS::get_singleton()->get_main_loop()->notification(
MainLoop::NOTIFICATION_WM_FOCUS_IN);
@ -739,65 +671,6 @@ static int frame_count = 0;
AudioDriverCoreAudio::get_singleton()->start();
}
- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url {
#ifdef MODULE_FACEBOOKSCORER_IOS_ENABLED
return [[[FacebookScorer sharedInstance] facebook] handleOpenURL:url];
#else
return false;
#endif
}
// For 4.2+ support
- (BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
sourceApplication:(NSString *)sourceApplication
annotation:(id)annotation {
#ifdef MODULE_PARSE_ENABLED
NSLog(@"Handling application openURL");
return
[[FBSDKApplicationDelegate sharedInstance] application:application
openURL:url
sourceApplication:sourceApplication
annotation:annotation];
#endif
#ifdef MODULE_FACEBOOKSCORER_IOS_ENABLED
return [[[FacebookScorer sharedInstance] facebook] handleOpenURL:url];
#else
return false;
#endif
}
- (void)application:(UIApplication *)application
didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
#ifdef MODULE_PARSE_ENABLED
// Store the deviceToken in the current installation and save it to Parse.
PFInstallation *currentInstallation = [PFInstallation currentInstallation];
// NSString* token = [[NSString alloc] initWithData:deviceToken
// encoding:NSUTF8StringEncoding];
NSLog(@"Device Token : %@ ", deviceToken);
[currentInstallation setDeviceTokenFromData:deviceToken];
[currentInstallation saveInBackground];
#endif
}
- (void)application:(UIApplication *)application
didReceiveRemoteNotification:(NSDictionary *)userInfo {
#ifdef MODULE_PARSE_ENABLED
[PFPush handlePush:userInfo];
NSDictionary *aps =
[userInfo objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey];
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSLog(@"Push Notification Payload (app active) %@", aps);
[defaults setObject:aps forKey:@"notificationInfo"];
[defaults synchronize];
if (application.applicationState == UIApplicationStateInactive) {
[PFAnalytics trackAppOpenedWithRemoteNotificationPayload:userInfo];
}
#endif
}
- (void)dealloc {
[window release];
[super dealloc];

View File

@ -31,10 +31,6 @@
#include "in_app_store.h"
#ifdef MODULE_FUSEBOXX_ENABLED
#import "modules/fuseboxx/ios/FuseSDK.h"
#endif
extern "C" {
#import <Foundation/Foundation.h>
#import <StoreKit/StoreKit.h>
@ -224,10 +220,6 @@ Error InAppStore::request_product_info(Variant p_params) {
[pending_transactions setObject:transaction forKey:transaction.payment.productIdentifier];
}
#ifdef MODULE_FUSEBOXX_ENABLED
printf("Registering transaction on Fuseboxx!\n");
[FuseSDK registerInAppPurchase:transaction];
#endif
}; break;
case SKPaymentTransactionStateFailed: {
printf("status transaction failed!\n");