Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop #20

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions SimpleBrowserApp.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@
6E3D0A3A2243E0240096198B /* Resources */,
6EFD6BF42244286D00E023D8 /* Embed Frameworks */,
6E3D0A7D22440BE30096198B /* Create MDX File */,
24D4139327B55D5D006653D0 /* Embed IPA Into MDX */,
);
buildRules = (
);
Expand Down Expand Up @@ -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;
Expand Down
67 changes: 10 additions & 57 deletions SimpleBrowserApp/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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
{
Expand Down