Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Installer Plugin that pops a message box to the user
//
// MyInstallerPane.m
// messagebox
//
// Created by Chris Ross on 1/23/18.
// Copyright © 2018 testplugin. All rights reserved.
//
/*
This should be in MyInstallerPane.h
#import <InstallerPlugins/InstallerPlugins.h>
@interface MyInstallerPane : InstallerPane
@end
*/
#import "MyInstallerPane.h"
#import <Foundation/Foundation.h>
@implementation MyInstallerPane
- (NSString *)title
{
return [[NSBundle bundleForClass:[self class]] localizedStringForKey:@"PaneTitle" value:nil table:nil];
}
- (void)didEnterPane:(InstallerSectionDirection)dir
{
//Malicious logic when entering pane
NSAlert *alert = [[NSAlert alloc] init];
[alert setMessageText:@"Are you sure you want to install my malware?"];
[alert setInformativeText:@"Remember, you WANTED this...."];
[alert addButtonWithTitle:@"OK"];
[alert addButtonWithTitle:@"Cancel"];
[alert setAlertStyle:NSInformationalAlertStyle];
NSInteger result = [alert runModal];
if (result == NSAlertFirstButtonReturn) {
NSLog(@"first button clicked");
} else if (result == NSAlertSecondButtonReturn) {
NSLog(@"Second button clicked");
}
}
- (void) willEnterPane:(InstallerSectionDirection)dir {
//Malicious logic when ????
}
- (BOOL)shouldExitPane:(InstallerSectionDirection)dir
{
return YES;
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment