友盟统计
This commit is contained in:
@@ -10,7 +10,9 @@
|
||||
#import <Masonry/Masonry.h>
|
||||
#import <YYText/YYText.h>
|
||||
#import <AppTrackingTransparency/AppTrackingTransparency.h>
|
||||
#import <UMCommon/UMCommon.h>
|
||||
///Tool
|
||||
#import "XPConstant.h"
|
||||
#import "ThemeColor.h"
|
||||
#import "XPMacro.h"
|
||||
#import "XPHtmlUrl.h"
|
||||
@@ -21,12 +23,16 @@
|
||||
|
||||
NSString * const kYinyouPrivateKey = @"kYinyouPrivateKey";
|
||||
@interface UserPrivacyView ()
|
||||
/** title */
|
||||
///title
|
||||
@property (nonatomic, strong) UILabel *titleLabel;
|
||||
/** contentLabel */
|
||||
///内容
|
||||
@property (nonatomic, strong) YYTextView *contentLabel;
|
||||
/** confirmButton */
|
||||
///容器
|
||||
@property (nonatomic,strong) UIStackView *stackView;
|
||||
///确认
|
||||
@property (nonatomic, strong) UIButton *confirmButton;
|
||||
///退出
|
||||
@property (nonatomic, strong) UIButton *exitButton;
|
||||
@end
|
||||
|
||||
@implementation UserPrivacyView
|
||||
@@ -48,10 +54,15 @@ NSString * const kYinyouPrivateKey = @"kYinyouPrivateKey";
|
||||
[defaults setObject:@"isShow" forKey:kYinyouPrivateKey];
|
||||
[defaults synchronize];
|
||||
[self getAdvertisingTrackingAuthority];//请求idfa权限
|
||||
///初始化友盟
|
||||
[UMConfigure initWithAppkey:KeyWithType(keyType_UMengAppKey) channel:KeyWithType(keyType_UMengAppChannel)];
|
||||
[TTPopup dismiss];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)exitButtonClick:(UIButton *)sender {
|
||||
[self exitApplication];
|
||||
}
|
||||
|
||||
#pragma mark - Private Method
|
||||
- (void)initSubViews {
|
||||
@@ -60,7 +71,9 @@ NSString * const kYinyouPrivateKey = @"kYinyouPrivateKey";
|
||||
self.layer.cornerRadius = 10;
|
||||
[self addSubview:self.titleLabel];
|
||||
[self addSubview:self.contentLabel];
|
||||
[self addSubview:self.confirmButton];
|
||||
[self addSubview:self.stackView];
|
||||
[self.stackView addArrangedSubview:self.exitButton];
|
||||
[self.stackView addArrangedSubview:self.confirmButton];
|
||||
}
|
||||
|
||||
- (void)initSubViewConstraints {
|
||||
@@ -81,12 +94,12 @@ NSString * const kYinyouPrivateKey = @"kYinyouPrivateKey";
|
||||
make.bottom.mas_equalTo(-68);
|
||||
}];
|
||||
|
||||
[self.confirmButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
[self.stackView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.bottom.mas_equalTo(-20);
|
||||
make.centerX.mas_equalTo(0);
|
||||
make.left.right.mas_equalTo(self).inset(15);
|
||||
make.height.mas_equalTo(36);
|
||||
make.width.mas_equalTo(160);
|
||||
}];
|
||||
|
||||
}
|
||||
|
||||
- (void)getAdvertisingTrackingAuthority {
|
||||
@@ -113,6 +126,22 @@ NSString * const kYinyouPrivateKey = @"kYinyouPrivateKey";
|
||||
}
|
||||
}
|
||||
|
||||
///退出app
|
||||
- (void)exitApplication {
|
||||
[TTPopup dismiss];
|
||||
[UIView beginAnimations:@"exitApplication" context:nil];
|
||||
[UIView setAnimationDuration:0.5];
|
||||
[UIView setAnimationDelegate:self];
|
||||
[UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:self cache:NO];
|
||||
[UIView setAnimationDidStopSelector:@selector(animationFinished:finished:context:)];
|
||||
[UIView commitAnimations];
|
||||
}
|
||||
- (void)animationFinished:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context {
|
||||
if ([animationID compare:@"exitApplication"] == 0) {
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - getters and setters
|
||||
|
||||
- (UILabel *)titleLabel {
|
||||
@@ -163,6 +192,7 @@ NSString * const kYinyouPrivateKey = @"kYinyouPrivateKey";
|
||||
}
|
||||
return _contentLabel;
|
||||
}
|
||||
|
||||
- (UIButton *)confirmButton {
|
||||
if (!_confirmButton) {
|
||||
_confirmButton = [[UIButton alloc]init];
|
||||
@@ -178,6 +208,32 @@ NSString * const kYinyouPrivateKey = @"kYinyouPrivateKey";
|
||||
return _confirmButton;
|
||||
}
|
||||
|
||||
- (UIButton *)exitButton {
|
||||
if (!_exitButton) {
|
||||
_exitButton = [[UIButton alloc]init];
|
||||
[_exitButton setTitle:@"不同意并退出" forState:UIControlStateNormal];
|
||||
_exitButton.titleLabel.font = [UIFont systemFontOfSize:15];
|
||||
[_exitButton setTitleColor:[ThemeColor cancelButtonTextColor] forState:UIControlStateNormal];
|
||||
UIImage *image = [UIImage gradientColorImageFromColors:@[[ThemeColor cancelButtonGradientStartColor],[ThemeColor cancelButtonGradientEndColor]] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(10, 10)];
|
||||
[_exitButton setBackgroundImage:image forState:UIControlStateNormal];
|
||||
_exitButton.layer.cornerRadius = 18;
|
||||
_exitButton.layer.masksToBounds = YES;
|
||||
[_exitButton addTarget:self action:@selector(exitButtonClick:) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _exitButton;
|
||||
}
|
||||
|
||||
- (UIStackView *)stackView {
|
||||
if (!_stackView) {
|
||||
_stackView = [[UIStackView alloc] init];
|
||||
_stackView.axis = UILayoutConstraintAxisHorizontal;
|
||||
_stackView.distribution = UIStackViewDistributionFillEqually;
|
||||
_stackView.alignment = UIStackViewAlignmentFill;
|
||||
_stackView.spacing = 20;
|
||||
}
|
||||
return _stackView;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@end
|
||||
|
Reference in New Issue
Block a user