155 lines
5.0 KiB
Objective-C
Executable File

//
// FirstViewController.m
// Talk
//
// Created by xuzs on 22/10/11.
// Copyright (c) 2022年 xuzs. All rights reserved.
//
#import "Setting.h"
#import "UI.h"
#import "HttpManager.h"
#import "Msg.h"
#import "Pub.h"
#import "sysInfo.h"
#import "EquList.h"
@interface Setting ()
@property (nonatomic, strong)UIView *rview;
@property (nonatomic, strong)NSArray *cells;
@end
@implementation Setting
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
// [self setNavTitle:@"系统设置"];
// [self setupViews];
// [self setUI];
// [self setData];
}
/*
- (void)setupViews
{
[self.view addSubview:self.rview];
for(int i=0;i<self.cells.count;i++){
[self.rview addSubview:self.cells[i]];
if(i==0){
[self.cells[i] addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(SetPushOnoff)]];
}
else if(i==1){
[self.cells[i] addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(SetHFOnoff)]];
}
}
}
- (void)setUI{
[UI SetRView:self.rview Top:@"0" Right:@"0" Bottom:@"0" Left:@"0"];
for(int i=0;i<self.cells.count;i++){
NSString *top = [[NSString alloc] initWithFormat:@"%f",[UI getStatuAndStatuHeight] + i*60.5] ;
[UI setFrameInView:self.cells[i] Width:@"100vw" Height:@"60" TranslateX:@"0" TranslateY:top InView:nil Position:UITopMid];
[UI setFrameInView:((UIView *)self.cells[i]).subviews[0] Width:@"70vw" Height:@"60" TranslateX:@"16" TranslateY:@"0" InView:nil Position:UIMidLeft];
[UI setFrameInView:((UIView *)self.cells[i]).subviews[1] Width:@"30vw" Height:@"60" TranslateX:@"16" TranslateY:@"0" InView:nil Position:UIMidRight];
}
}
- (void)setData{
if([Pub getApp].sysinfo.push==1){
UIView *cell = (UIView *)self.cells[0];
((UILabel *)cell.subviews[1]).text = @"已开启";
((UILabel *)cell.subviews[1]).textColor = [UI colorWithHex:0x378fe8];
}
if([Pub getApp].sysinfo.HF==1){
UIView *cell = (UIView *)self.cells[1];
((UILabel *)cell.subviews[1]).text = @"已开启";
((UILabel *)cell.subviews[1]).textColor = [UI colorWithHex:0x378fe8];
}
}
- (void)SetPushOnoff{
[Pub getApp].sysinfo.push = 1-[Pub getApp].sysinfo.push;
[[Pub getApp].sysinfo setSystemInfo:@"push" WithValue:[[NSString alloc] initWithFormat:@"%d",[Pub getApp].sysinfo.push]];
UIView *cell = (UIView *)self.cells[0];
if([Pub getApp].sysinfo.push==1){
((UILabel *)cell.subviews[1]).text = @"已开启";
((UILabel *)cell.subviews[1]).textColor = [UI colorWithHex:0x378fe8];
}
else{
((UILabel *)cell.subviews[1]).text = @"未开启";
((UILabel *)cell.subviews[1]).textColor = [UIColor grayColor];
}
[self.parent setNote];
[HttpManager postPushkitToken:[Pub getApp].sysinfo.username Token:[Pub getApp].sysinfo.token PushkitToken:[Pub getApp].sysinfo.pushkitToken
Push:[[NSString alloc] initWithFormat:@"%d",[Pub getApp].sysinfo.push]
IsSandbox:[[NSString alloc] initWithFormat:@"%d",[Pub getApp].sysinfo.sandbox] HttpResultHandler:^(NSDictionary *json) {
NSLog(@"上传token成功");
}];
}
- (void)SetHFOnoff{
[Pub getApp].sysinfo.HF = 1-[Pub getApp].sysinfo.HF;
[[Pub getApp].sysinfo setSystemInfo:@"HF" WithValue:[[NSString alloc] initWithFormat:@"%d",[Pub getApp].sysinfo.push]];
UIView *cell = (UIView *)self.cells[1];
if([Pub getApp].sysinfo.HF==1){
((UILabel *)cell.subviews[1]).text = @"已开启";
((UILabel *)cell.subviews[1]).textColor = [UI colorWithHex:0x378fe8];
}
else{
((UILabel *)cell.subviews[1]).text = @"未开启";
((UILabel *)cell.subviews[1]).textColor = [UIColor grayColor];
}
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
#pragma mark Property Accessors
- (UIView *)rview
{
if (!_rview) {
_rview = [[UIView alloc] init];
_rview.backgroundColor = [UIColor colorWithRed:241/255. green:241/255. blue:241/255. alpha:1];
}
return _rview;
}
- (NSArray *)cells{
if (!_cells) {
UIView *cell1 = [[UIView alloc] init];
cell1.backgroundColor = [UIColor whiteColor];
[cell1 addSubview:[UI NewLabel:@"推送功能" Color:[UIColor blackColor] Size:15. Align:(NSTextAlignmentLeft)]];
[cell1 addSubview:[UI NewLabel:@"未开启" Color:[UIColor grayColor] Size:15. Align:(NSTextAlignmentRight)]];
UIView *cell2 = [[UIView alloc] init];
cell2.backgroundColor = [UIColor whiteColor];
[cell2 addSubview:[UI NewLabel:@"默认免提" Color:[UIColor blackColor] Size:15. Align:(NSTextAlignmentLeft)]];
[cell2 addSubview:[UI NewLabel:@"未开启" Color:[UIColor grayColor] Size:15. Align:(NSTextAlignmentRight)]];
_cells = @[cell1,cell2 ];
}
return _cells;
}
*/
@end