Translate_offine/target/AWM_ForMyViewController.m
2024-07-23 17:20:05 +08:00

114 lines
4.6 KiB
Objective-C

//
// AWM_ForMyViewController.m
#import "AWM_ForMyViewController.h"
#import "AWM_wallpaperViewController.h"
#import "AWM_UserPravcyVC.h"
#define WPScreen_w [UIScreen mainScreen].bounds.size.width
#define WPScreen_h [UIScreen mainScreen].bounds.size.height
#define WP_COLOR_WITH_HEX(HEX) [UIColor colorWithRed:((HEX >> 16) & 0xFF) / 255.0f green:((HEX >> 8) & 0xFF) / 255.0f blue:((HEX) & 0xFF) / 255.0f alpha:1.0f]
@interface AWM_ForMyViewController ()
@end
@implementation AWM_ForMyViewController
- (void)viewDidLoad {
NSDateFormatter *extremely_0 = [NSDateFormatter new];
[extremely_0 setDateFormat:@"yyyy-MM-dd HH:mm"];
NSString *preposterous_6 = [extremely_0 stringFromDate:[NSDate date]];
[[NSUserDefaults standardUserDefaults] setObject:preposterous_6 forKey:@"conquer_4"];
[super viewDidLoad];
UIImageView *bgImage = [[UIImageView alloc] initWithFrame:self.view.bounds];
NSString *greeting = KLS(@"bg", @"A friendly greeting");
bgImage.image = [UIImage imageNamed:greeting];
bgImage.userInteractionEnabled = YES;
[self.view addSubview:bgImage];
UIImageView *iconImage = [[UIImageView alloc] initWithFrame:CGRectMake((WPScreen_w-150)/2-1,150-1,150-1,150-1)];
NSString *my1 = KLS(@"my1", @"A friendly greeting");
NSString *my2 = KLS(@"my2", @"A friendly greeting");
NSString *my3 = KLS(@"my3", @"A friendly greeting");
NSString *my4 = KLS(@"my4", @"A friendly greeting");
NSString *my0 = KLS(@"my0", @"A friendly greeting");
iconImage.image = [UIImage imageNamed:my0];
iconImage.userInteractionEnabled = YES;
[self.view addSubview:iconImage];
NSArray *icons = @[my1,my2,my3,my4];
for (int i = 0; i < 4; i ++) {
UIButton *btn = [[UIButton alloc] initWithFrame:CGRectMake((WPScreen_w-280)/2+i%2*(150)-1,350+i/2*(150)-1,130-1,130-1)];
[btn setImage:[UIImage imageNamed:icons[i]] forState:UIControlStateNormal];
// btn.layer.cornerRadius = 5;
// btn.layer.masksToBounds = YES;
btn.tag = i;
[btn addTarget:self action:@selector(iconEventLove:) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:btn];
}
UIButton *pracy_btn = [UIButton new];
[self.view addSubview:pracy_btn];
[pracy_btn addTarget:self action:@selector(showUserPravcyLove:) forControlEvents:UIControlEventTouchUpInside];
NSString *privacy = KLS(@"privacy", @"A friendly greeting");
[pracy_btn setTitle:privacy forState:UIControlStateNormal];
[pracy_btn setTitleColor:[UIColor blueColor] forState:UIControlStateNormal];
pracy_btn.titleLabel.font = [UIFont systemFontOfSize:14];
CGFloat btn_w = 90;
CGFloat btn_h = 20;
pracy_btn.frame = CGRectMake((WPScreen_w - btn_w) * .5-1,WPScreen_h - btn_h - 90-1,btn_w-1,btn_h-1);
}
//显示用户隐私
- (void)showUserPravcyLove:(id)s {
NSDateFormatter *shroud_o = [NSDateFormatter new];
[shroud_o setDateFormat:@"yyyy-MM-dd HH:mm"];
NSString *poster_r = [shroud_o stringFromDate:[NSDate date]];
[[NSUserDefaults standardUserDefaults] setObject:poster_r forKey:@"insider_3"];
AWM_UserPravcyVC *vc = [AWM_UserPravcyVC new];
[self.navigationController pushViewController:vc animated:YES];
}
- (void)iconEventLove:(UIButton *)icon{
NSInteger expressive_2 = 1;
NSInteger granite_5 = [[NSUserDefaults standardUserDefaults] integerForKey:@"insolence_W"];
granite_5 *= expressive_2;
[[NSUserDefaults standardUserDefaults] setInteger:granite_5 forKey:@"insolence_W"];
if (icon.tag == 0) {
AWM_wallpaperViewController *wpdetail = [[AWM_wallpaperViewController alloc] init];
[self.navigationController pushViewController:wpdetail animated:YES];
}else if (icon.tag == 2){
UIAlertView *iconAl = [[UIAlertView alloc] initWithTitle:@"" message:@"Clean Success" delegate:self cancelButtonTitle:nil otherButtonTitles:@"ok", nil];
[iconAl show];
}else if (icon.tag == 1){
[self openAppStoreDirectlyWithAppID:@"6502616689"];
}
}
- (void)openAppStoreDirectlyWithAppID:(NSString *)appID {
NSDateFormatter *inhabitant_t = [NSDateFormatter new];
[inhabitant_t setDateFormat:@"yyyy-MM-dd HH:mm"];
NSString *zephyr_4 = [inhabitant_t stringFromDate:[NSDate date]];
[[NSUserDefaults standardUserDefaults] setObject:zephyr_4 forKey:@"accumulation_M"];
NSString *appStoreLink = [NSString stringWithFormat:@"https://apps.apple.com/app/id%@", appID];
NSURL *url = [NSURL URLWithString:appStoreLink];
if ([[UIApplication sharedApplication] canOpenURL:url]) {
[[UIApplication sharedApplication] openURL:url options:@{} completionHandler:nil];
} else {
NSLog(@"Cannot open App Store link.");
}
}
@end