Skip to content

Instantly share code, notes, and snippets.

@wh1te4ever
Created April 25, 2023 04:36
Show Gist options
  • Save wh1te4ever/2a7eddc741d29a5bb75368199391d51d to your computer and use it in GitHub Desktop.
Save wh1te4ever/2a7eddc741d29a5bb75368199391d51d to your computer and use it in GitHub Desktop.
//
// MultiKaTalkFix.m
// MultiKaTalkFix
//
// Created by Akhil on 12/13/22.
//
#import <Foundation/Foundation.h>
#import "MultiKaTalkFix.h"
#import "MethodSwizzling.h"
#import <objc/runtime.h>
#import <Intents/Intents.h>
IMP origIMP_containerURLForSecurityApplicationGroupIdentifier = NULL;
IMP origIMP_siriAuthorizationStatus = NULL;
@implementation MultiKaTalkFix
+(void)load {
origIMP_containerURLForSecurityApplicationGroupIdentifier = method_getImplementation(class_getInstanceMethod(NSClassFromString(@"NSFileManager"), @selector(containerURLForSecurityApplicationGroupIdentifier:)));
SwizzleInstanceMethod(NSClassFromString(@"NSFileManager"), [self class], @selector(containerURLForSecurityApplicationGroupIdentifier:), @selector(hook_containerURLForSecurityApplicationGroupIdentifier:));
origIMP_containerURLForSecurityApplicationGroupIdentifier = method_getImplementation(class_getClassMethod(NSClassFromString(@"INPreferences"), @selector(siriAuthorizationStatus)));
SwizzleClassMethod(NSClassFromString(@"INPreferences"), [self class], @selector(siriAuthorizationStatus), @selector(hook_siriAuthorizationStatus));
}
-(NSURL *)hook_containerURLForSecurityApplicationGroupIdentifier:(NSString *)groupIdentifier {
id ret = ((id(*)(id, SEL))origIMP_containerURLForSecurityApplicationGroupIdentifier)(self, @selector(containerURLForSecurityApplicationGroupIdentifier:));
if(!ret)
return [NSURL fileURLWithPath:NSHomeDirectory() isDirectory:YES];
return ret;
}
+(INSiriAuthorizationStatus)hook_siriAuthorizationStatus {
return INSiriAuthorizationStatusRestricted;
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment