diff --git a/SimpleBrowserApp.xcodeproj/project.pbxproj b/SimpleBrowserApp.xcodeproj/project.pbxproj index 9b88acb..9300469 100644 --- a/SimpleBrowserApp.xcodeproj/project.pbxproj +++ b/SimpleBrowserApp.xcodeproj/project.pbxproj @@ -293,6 +293,7 @@ 6E3D0A3A2243E0240096198B /* Resources */, 6EFD6BF42244286D00E023D8 /* Embed Frameworks */, 6E3D0A7D22440BE30096198B /* Create MDX File */, + 24D4139327B55D5D006653D0 /* Embed IPA Into MDX */, ); buildRules = ( ); @@ -429,6 +430,24 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ + 24D4139327B55D5D006653D0 /* Embed IPA Into MDX */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + ); + name = "Embed IPA Into MDX"; + outputFileListPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "# Type a script or drag a script file from your workspace to insert its path.\nexport TOOLKIT_DIR=\"$PROJECT_DIR/Tools\"\nexport IPA_FILE_PATH=\"\"\n\nif [ -z \"${IPA_FILE_PATH}\" ]\nthen\n echo \"IPA_FILE_PATH variable was not found or was empty. If you wish to embed an IPA into the MDX, please generate an IPA and paste the full path, including the .ipa, into the IPA_FILE_PATH variable in the \\\"Embed IPA Into MDX\\\" post build script in \\\"Build Phases\\\".\"\n exit 0\nfi\n\n\"$TOOLKIT_DIR/CGAppCLPrepTool\" SetInfo -in \"$CONFIGURATION_BUILD_DIR/$EXECUTABLE_NAME.mdx\" -out \"$CONFIGURATION_BUILD_DIR/$EXECUTABLE_NAME-exported.mdx\" -embedBundle \"${IPA_FILE_PATH}\"\n"; + }; 6E3D0A7D22440BE30096198B /* Create MDX File */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; diff --git a/SimpleBrowserApp/AppDelegate.m b/SimpleBrowserApp/AppDelegate.m index 2a200bb..03c1cae 100644 --- a/SimpleBrowserApp/AppDelegate.m +++ b/SimpleBrowserApp/AppDelegate.m @@ -18,28 +18,17 @@ @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // Override point for customization after application launch. + + [[CTXMAMNotificationCenter mainNotificationCenter] registerForNotificationsFromSource:CTXMAMNotificationSource_Core + usingNotificationBlock:^(CTXMAMNotification * _Nonnull notification) { + NSLog(@"%@", [notification Message]); + }]; - CTXMAMNotificationEventBlock notificationHandler = ^(CTXMAMNotification * _Nonnull notification) - { - //Do something with the notification - if([[notification Source] isEqualToString:CTXMAMNotificationSource_Core]) - { - //Do something; - } - else if([[notification Source] isEqualToString:CTXMAMNotificationSource_Network]) - { - [self handleNetworkNotification:notification]; - } - else if([[notification Source] isEqualToString:CTXMAMNotificationSource_Containment]) - { - [self handleContainmentNotification:notification]; - } - else - { - // Handle any other unhandled notifications - } - }; - [[CTXMAMNotificationCenter mainNotificationCenter] registerForNotificationsFromSource:CTXMAMNotificationSource_All usingNotificationBlock:notificationHandler]; + [[CTXMAMNotificationCenter mainNotificationCenter] registerForNotificationsFromSource:CTXMAMNotificationSource_Network + usingNotificationBlock:^(CTXMAMNotification * _Nonnull notification) { + [self handleNetworkNotification:notification]; + }]; + [CTXMAMCore setDelegate:self]; [CTXMAMCore initializeSDKsWithCompletionBlock:^(NSError * _Nullable nilOrError) { @@ -84,42 +73,6 @@ - (void)applicationWillTerminate:(UIApplication *)application { [CTXMAMCore logoffApp]; } -#pragma mark - Containment SDK -- (void) handleContainmentNotification:(CTXMAMNotification *)notification -{ - switch(notification.Error.code) { - case CTXAlertAppContainment_GEOFENCE_LocationServicesRequired : - case CTXAlertAppContainment_GEOFENCE_OutsideOfAcceptedArea : - // For these events, usage of the app may be restricted. They will be handled by delegate callback. - break; - case CTXAlertAppContainment_None : - case CTXAlertAppContainment_DISABLECOPY : - case CTXAlertAppContainment_DISABLEPASTE : - case CTXAlertAppContainment_DISABLEOPENIN : - case CTXAlertAppContainment_DISABLEICLOUD_FM : - case CTXAlertAppContainment_DISABLEICLOUD_KC : - case CTXAlertAppContainment_DISABLEPRINTING : - case CTXAlertAppContainment_DISABLECAMERA : - case CTXAlertAppContainment_DISABLEPHOTOLIBRARY : - case CTXAlertAppContainment_DISABLESMS : - case CTXAlertAppContainment_DISABLELOCATION : - case CTXAlertAppContainment_DISABLEMIC : - case CTXAlertAppContainment_DISABLE_SOCIAL_MEDIA : - case CTXAlertAppContainment_INBOUNDDOCEX : - case CTXAlertAppContainment_SECUREMAIL_NotInstalled : - case CTXAlertAppContainment_SECUREMAIL_Upgrade : - case CTXAlertAppContainment_MAILBLOCKED : - case CTXAlertAppContainment_Unknown : - { - // For these events, just display a notification - NSString *alertMsg = [notification Message]; - NSLog(@"CTXMAM Containment Notification: [%@]", alertMsg); - [self showAlertMsg:alertMsg isFatal:NO]; - } - break; - } -} - #pragma mark - Network SDK - (void) handleNetworkNotification:(CTXMAMNotification *)notification {