-
Notifications
You must be signed in to change notification settings - Fork 0
/
UADSWebViewShowOperation.m
44 lines (34 loc) · 1.21 KB
/
UADSWebViewShowOperation.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#import "UADSWebViewShowOperation.h"
#import "USRVSDKMetrics.h"
static USRVConfiguration *configuration = nil;
@implementation UADSWebViewShowOperation
- (instancetype)initWithPlacementId: (NSString *)placementId parametersDictionary: (NSDictionary *)parametersDictionary {
NSArray *params = @[placementId, parametersDictionary];
if (configuration == nil) {
configuration = [[USRVConfiguration alloc] init];
USRVLogError(@"Configuration is null, apply default configuration");
}
self = [super initWithMethod: @"show"
webViewClass: @"webview"
parameters: params
waitTime: configuration.showTimeout / 1000];
return self;
}
- (void)main {
[super main];
if (!self.success) {
USRVLogError(@"Unity Ads webapp timeout, shutting down Unity Ads");
[[USRVSDKMetrics getInstance] sendEvent: @"native_show_callback_failed"];
} else {
USRVLogDebug(@"SHOW SUCCESS");
}
}
+ (void)callback: (NSArray *)params {
if ([[params objectAtIndex: 0] isEqualToString: @"OK"]) {
[super callback: params];
}
}
+ (void)setConfiguration: (USRVConfiguration *)config {
configuration = config;
}
@end