新增app更新弹窗
This commit is contained in:
@@ -26,6 +26,7 @@
|
||||
#import "KBLoginVC.h"
|
||||
#import "KBConfig.h"
|
||||
#import "KBSkinInstallBridge.h"
|
||||
#import "KBAppUpdateView.h"
|
||||
|
||||
static NSTimeInterval const kKBSubscriptionPrefillTTL = 10 * 60.0;
|
||||
|
||||
@@ -34,6 +35,10 @@ static NSTimeInterval const kKBSubscriptionPrefillTTL = 10 * 60.0;
|
||||
// 当前工程的 CustomKeyboard target 为 com.loveKey.nyx.CustomKeyboard
|
||||
//static NSString * const kKBKeyboardExtensionBundleId = @"com.loveKey.nyx.CustomKeyboard";
|
||||
|
||||
@interface AppDelegate () <KBAppUpdateViewDelegate>
|
||||
@property (nonatomic, strong) LSTPopView *appUpdatePopView;
|
||||
@end
|
||||
|
||||
@implementation AppDelegate
|
||||
|
||||
|
||||
@@ -68,6 +73,8 @@ static NSTimeInterval const kKBSubscriptionPrefillTTL = 10 * 60.0;
|
||||
// 安装默认皮肤(首次安装时)
|
||||
[self kb_installDefaultSkinIfNeeded];
|
||||
|
||||
[self kb_requestAppUpdateAndPresentIfNeeded];
|
||||
|
||||
#if !DEBUG
|
||||
/// Bugly
|
||||
BuglyConfig *buglyConfig = [BuglyConfig new];
|
||||
@@ -79,6 +86,34 @@ static NSTimeInterval const kKBSubscriptionPrefillTTL = 10 * 60.0;
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void)kb_requestAppUpdateAndPresentIfNeeded {
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||
if (self.appUpdatePopView) { return; }
|
||||
CGFloat width = KBFit(323.0);
|
||||
CGFloat height = KBFit(390.0);
|
||||
KBAppUpdateView *view = [[KBAppUpdateView alloc] initWithFrame:CGRectMake(0, 0, width, height)];
|
||||
view.backgroundImageName = @"app_update_bg";
|
||||
view.delegate = self;
|
||||
LSTPopView *pop = [LSTPopView initWithCustomView:view
|
||||
parentView:nil
|
||||
popStyle:LSTPopStyleScale
|
||||
dismissStyle:LSTDismissStyleScale];
|
||||
pop.hemStyle = LSTHemStyleCenter;
|
||||
pop.bgColor = [[UIColor blackColor] colorWithAlphaComponent:0.4];
|
||||
pop.isClickBgDismiss = NO;
|
||||
pop.cornerRadius = 0;
|
||||
self.appUpdatePopView = pop;
|
||||
[pop pop];
|
||||
});
|
||||
}
|
||||
|
||||
#pragma mark - KBAppUpdateViewDelegate
|
||||
|
||||
- (void)appUpdateViewDidTapUpgrade:(KBAppUpdateView *)view {
|
||||
[self.appUpdatePopView dismiss];
|
||||
self.appUpdatePopView = nil;
|
||||
}
|
||||
|
||||
- (void)applicationDidBecomeActive:(UIApplication *)application{
|
||||
// [self kb_checkNetworkAndShowAlertIfNeeded];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user