Here I have RCTHTTPRequestHandler+ignoreSSL.m that can ignoreSSL based on value from plist.info. It works nicely when I set the value of ignoreSSL from plist.info.
#import "React/RCTBridgeModule.h"
#import "React/RCTHTTPRequestHandler.h"
@implementation RCTHTTPRequestHandler (ignoreSSL)
- (void)URLSession:(NSURLSession *)session didReceiveChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential *credential))completionHandler
{
// Get the main bundle
NSBundle *mainBundle = [NSBundle mainBundle];
// Get the value of "IgnoreSSL" from the Info.plist
NSNumber *ignoreSSLValue = [mainBundle objectForInfoDictionaryKey:@"IgnoreSSL"];
NSLog(@"Ignore SSL: %@", ignoreSSLValue);
// Check if the value is a boolean and if it's set to true (1)
if ([ignoreSSLValue isKindOfClass:[NSNumber class]] && [ignoreSSLValue boolValue]) {
NSLog(@"SSL Ignored: %@", ignoreSSLValue);
// Handle SSL challenge here if IgnoreSSL is true
completionHandler(NSURLSessionAuthChallengeUseCredential, [NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust]);
} else {
// Do not IgnoreSSL is false
NSLog(@"SSL Not Ignored: %@", ignoreSSLValue);
completionHandler(NSURLSessionAuthChallengePerformDefaultHandling, nil);
}
}
@end
I expect to set IgnoreSSL when something happens in my code like shown below:
@implementation JitsiMeetView {
/**
* The unique identifier of this `JitsiMeetView` within the process for the
* purposes of `ExternalAPI`. The name scope was inspired by postis which we
* use on Web for the similar purposes of the iframe-based external API.
*/
NSString *externalAPIScope;
/**
* React Native view where the entire content will be rendered.
*/
RNRootView *rootView;
}
- (void)join:(JitsiMeetConferenceOptions *)options {
[self setProps:options == nil ? @{} : [options asProps]];
// Access the boolean value from options._starvConferenceInfo._ignoreSSL
NSString *ignoreSSL = options.starvConferenceInfo.ignoreSSL;
NSLog(@"Ivan SSL Ignored: %@",ignoreSSL);
// Or use it in a conditional statement:
if ([ignoreSSL isEqual: @"true"]) {
// Do something when ignoreSSL is true
NSLog(@" SSL Ignored");
} else {
// Do something when ignoreSSL is false
NSLog(@" SSL not ignored");
}
}
Could we do something like this? I am sorry, I am a beginner in Objective-C