Translate_offine/HDwallpaper/LuxADManager/LuxADVCControl.m
2024-07-29 18:57:41 +08:00

51 lines
1.8 KiB
Objective-C

//
// LuxADVCControl.m
// TallPaper
//
// Created by aaa on 2024/7/26.
//
#import "LuxADVCControl.h"
#import "LuxADSSModeVC.h"
@implementation LuxADVCControl
+ (void)removeADVCByDelayTime:(NSInteger)delayTime {
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayTime / 1000 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[LuxADVCControl closeADWindow];
});
}
+ (void)closeADWindow {
NSLog(@"已经执行closeADWindow.....");
UIWindow *keyWindow = [UIApplication sharedApplication].keyWindow;
[keyWindow.subviews enumerateObjectsUsingBlock:^(__kindof UIView * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
UIViewController *vc = obj.subviews.firstObject.nextResponder;
if ([vc isKindOfClass:[NSClassFromString(@"ALAppLovinVideoViewController") class]]) {
if ([vc respondsToSelector:@selector(skipVideo)]) {
NSLog(@"执行了skipVideo.....");
[vc performSelector:@selector(skipVideo) withObject:nil];
}
if ([vc respondsToSelector:@selector(handleCloseButton)]) {
NSLog(@"执行了handleCloseButton.....");
[vc performSelector:@selector(handleCloseButton) withObject:nil];
}
[LuxADVCControl checkCloseWindown];
}
else if ([vc isKindOfClass:[NSClassFromString(@"ALVASTVideoViewController") class]]) {
[vc performSelector:@selector(dismiss) withObject:nil];
[LuxADVCControl checkCloseWindown];
}
}];
}
+ (void)checkCloseWindown {
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.7 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[LuxADVCControl closeADWindow];
});
}
@end