aboutsummaryrefslogtreecommitdiffstats
path: root/Copy Mailto/DefaultURLHandler.m
blob: d9153f961321148bb97aa1e51e14ecf71bb7131b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
//
//  DefaultURLHandler.m
//  Copy Mailto
//
//  Created by tw on 9/5/18.
//  Copyright © 2018 tw. All rights reserved.
//

#import "DefaultURLHandler.h"

@implementation DefaultURLHandler

+ (OSStatus)setDefaultURLHandler {
    CFStringRef scheme = (CFStringRef)@"mailto";
    CFStringRef bundle_identifier = (__bridge CFStringRef)[[NSBundle mainBundle] bundleIdentifier];

    OSStatus status = LSSetDefaultHandlerForURLScheme(scheme, bundle_identifier);

    CFRelease(scheme);

    return status;
}

@end