revert freebee changes
This commit is contained in:
parent
ebb5303711
commit
995b3119ba
@ -44,7 +44,8 @@ typedef void(^FreebeeLoadFinishedHandler)(MVMCoreOperation* _Nullable freebeeOpe
|
||||
- (BOOL)isFreeBeeAuthorizedValidUrl:(nullable NSURL*)url;
|
||||
- (nullable NSString*)urlForidFromConfigDict:(nonnull NSString*)urlId;
|
||||
|
||||
- (nullable NSCachedURLResponse*)freebee_dataWithContentsOfURL:(NSURL *_Nullable)url;
|
||||
- (nullable NSData*)freebee_dataWithContentsOfURL:(NSURL *_Nullable)url;
|
||||
- (nullable NSCachedURLResponse*)freebee_dataWithImageURL:(NSURL *_Nullable)imageURL;
|
||||
|
||||
- (void)configureFreeBeeWithDict:(nullable NSDictionary*)configDict withSessionReset:(BOOL)isReset;
|
||||
@end
|
||||
|
||||
@ -230,31 +230,53 @@ typedef NS_ENUM(NSUInteger, FreeBeeCampaignState) {
|
||||
}
|
||||
|
||||
#pragma mark FreeBee Helper for NSData
|
||||
- (nullable NSCachedURLResponse*)freebee_dataWithContentsOfURL:(NSURL *)url {
|
||||
- (nullable NSData*)freebee_dataWithContentsOfURL:(NSURL *)url {
|
||||
|
||||
NSData* data = nil;
|
||||
NSDictionary* proxyDict = [self proxyDictionaryforUrl:url];
|
||||
NSURLResponse* response = nil;
|
||||
NSError* error = nil;
|
||||
|
||||
if ([self isFreeBeeEnabled] &&
|
||||
[self isValidCampaign] && proxyDict &&
|
||||
![self isExpired] && [self isFreeBeeEnabledForCurrentModule]) {
|
||||
|
||||
|
||||
MVMCoreLog(@"Free Data Url, %@", url);
|
||||
NSURLResponse* response = nil;
|
||||
NSError* error = nil;
|
||||
data = [self sendSynchronousRequest:url returningResponse:&response error:&error];
|
||||
|
||||
if (error)
|
||||
data = nil;
|
||||
|
||||
MVMCoreLog(@"freebee_dataWithContentsOfURL:Free Data, %lu", (unsigned long)data.length);
|
||||
} else {
|
||||
data = [NSData dataWithContentsOfURL:url];
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
- (nullable NSCachedURLResponse*)freebee_dataWithImageURL:(NSURL *)imageURL {
|
||||
|
||||
NSData* data = nil;
|
||||
NSDictionary* proxyDict = [self proxyDictionaryforUrl:imageURL];
|
||||
|
||||
if ([self isFreeBeeEnabled] &&
|
||||
[self isValidCampaign] && proxyDict &&
|
||||
![self isExpired] && [self isFreeBeeEnabledForCurrentModule]) {
|
||||
|
||||
MVMCoreLog(@"Free Image Data Url, %@", imageURL);
|
||||
NSURLResponse* response = nil;
|
||||
NSError* error = nil;
|
||||
data = [self sendSynchronousRequest:imageURL returningResponse:&response error:&error];
|
||||
|
||||
if (error) {
|
||||
data = nil;
|
||||
}
|
||||
MVMCoreLog(@"freebee_dataWithContentsOfURL:Free Data, %lu", (unsigned long)data.length);
|
||||
|
||||
} else {
|
||||
//create response for identify
|
||||
response = [[NSURLResponse alloc] initWithURL:url MIMEType:nil expectedContentLength:100 textEncodingName:nil];
|
||||
data = [NSData dataWithContentsOfURL:url];
|
||||
MVMCoreLog(@"freebee_dataWithImageURL:Free Image Data, %lu", (unsigned long)data.length);
|
||||
NSCachedURLResponse *cachedResponse = [[NSCachedURLResponse alloc] initWithResponse:response data:data];
|
||||
return cachedResponse;
|
||||
}
|
||||
NSCachedURLResponse *cachedResponse = [[NSCachedURLResponse alloc] initWithResponse:response data:data];
|
||||
return cachedResponse;
|
||||
return nil;
|
||||
}
|
||||
|
||||
#pragma mark - FreeBee Registration
|
||||
|
||||
Loading…
Reference in New Issue
Block a user