diff options
author | Teddy Wing | 2018-09-05 19:00:55 +0200 |
---|---|---|
committer | Teddy Wing | 2018-09-05 19:00:55 +0200 |
commit | da31291a965ea898a59a0859c7e455144eaea195 (patch) | |
tree | c9ac6621916dcaac25651e182ef730a806bc39a9 /CopyMailto/DefaultURLHandler.m | |
parent | eca0aacf16cb2340507407504d8d4a5e293b4178 (diff) | |
download | Copy-Mailto-da31291a965ea898a59a0859c7e455144eaea195.tar.bz2 |
Add `DefaultURLHandler`; Get current handler for `mailto` URLs
Add a class to get the current bundle handler for `mailto` URLs. It will
be extended to set CopyMailto as the default handler after saving the
original.
Diffstat (limited to 'CopyMailto/DefaultURLHandler.m')
-rw-r--r-- | CopyMailto/DefaultURLHandler.m | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/CopyMailto/DefaultURLHandler.m b/CopyMailto/DefaultURLHandler.m new file mode 100644 index 0000000..a8d124f --- /dev/null +++ b/CopyMailto/DefaultURLHandler.m @@ -0,0 +1,28 @@ +// +// DefaultURLHandler.m +// CopyMailto +// +// Created by tw on 9/5/18. +// Copyright © 2018 tw. All rights reserved. +// + +#import "DefaultURLHandler.h" + +@implementation DefaultURLHandler + +//LSSetDefaultHandlerForURLScheme(); ++ (void)saveDefaultURLHandler { + CFStringRef mailto = CFStringCreateWithCString( + kCFAllocatorDefault, + "mailto", + kCFStringEncodingUTF8 + ); + + CFStringRef bundle_identifier = LSCopyDefaultHandlerForURLScheme(mailto); + NSLog(@"%@", bundle_identifier); + + CFRelease(mailto); + CFRelease(bundle_identifier); +} + +@end |