Skip to content

Commit

Permalink
修改登录信息显示格式为密码
Browse files Browse the repository at this point in the history
Change-Id: I6f872f92016b5759918495ba0f9abd8a2939c838
  • Loading branch information
ccharlesren committed Jul 30, 2021
1 parent f6c32db commit 19eecf1
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 33 deletions.
16 changes: 12 additions & 4 deletions Source/LinkSDKDemo/Video/Login/Controller/TIoTDemoPlayConfigVC.m
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,11 @@ - (void)saveDeviceInfo {

- (void)saveLoginViewInfo {
[TIoTCoreUserManage shared].demoAccessID = self.loginView.accessID.text?:@"";
[TIoTCoreUserManage shared].demoAccessToken = self.loginView.accessToken.text?:@"";
[TIoTCoreUserManage shared].demoProductID = self.loginView.productID.text?:@"";

NSUserDefaults *defaluts = [NSUserDefaults standardUserDefaults];
if (![NSString isNullOrNilWithObject:self.loginView.accessID.text?:@""]) {
[defaluts setValue:@{@"AccessTokenString":self.loginView.accessToken.text?:@"",@"productIDString":self.loginView.productID.text?:@""} forKey:self.loginView.accessID.text?:@""];
}
}

- (void)saveAccessID {
Expand All @@ -128,8 +131,13 @@ - (void)saveAccessID {

- (void)readLoginInfoFromManage {
self.loginView.accessID.text = [TIoTCoreUserManage shared].demoAccessID?:@"";
self.loginView.accessToken.text = [TIoTCoreUserManage shared].demoAccessID?:@"";
self.loginView.productID.text = [TIoTCoreUserManage shared].demoProductID?:@"";

NSUserDefaults *defaluts = [NSUserDefaults standardUserDefaults];
NSDictionary *tokenAndProductIDDic = [NSDictionary dictionaryWithDictionary:[defaluts objectForKey:self.loginView.accessID.text?:@""]];
if (tokenAndProductIDDic != nil) {
self.loginView.accessToken.text = [tokenAndProductIDDic objectForKey:@"AccessTokenString"];
self.loginView.productID.text = [tokenAndProductIDDic objectForKey:@"productIDString"];
}
}

- (void)readAccessID {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#import "TIoTLoginCustomView.h"
#import "TIoTCoreXP2PBridge.h"
#import "TIoTAccessIDPickerView.h"
#import "TIoTCoreUserManage.h"

@interface TIoTLoginCustomView ()<UITextFieldDelegate>
//选择应用端
Expand Down Expand Up @@ -150,6 +151,7 @@ - (void)initLoginView {
self.accessToken.textColor = [UIColor colorWithHexString:@"#7F7F7F"];
self.accessToken.placeholder = @"请输入Access Token";
self.accessToken.delegate = self;
self.accessToken.secureTextEntry = YES;
self.accessToken.textAlignment = NSTextAlignmentLeft;
self.accessToken.returnKeyType = UIReturnKeyDone;
[self addSubview:self.accessToken];
Expand Down Expand Up @@ -183,6 +185,7 @@ - (void)initLoginView {
self.productID.textColor = [UIColor colorWithHexString:@"#7F7F7F"];
self.productID.placeholder = @"请输入Product ID";
self.productID.delegate = self;
self.productID.secureTextEntry = YES;
self.productID.textAlignment = NSTextAlignmentLeft;
self.productID.returnKeyType = UIReturnKeyDone;
[self addSubview:self.productID];
Expand Down Expand Up @@ -263,6 +266,13 @@ - (void)chooseAccessID {
self.choiceAccessIDView.defaultAccessID = self.accessID.text?:@"";
self.choiceAccessIDView.accessIDStringBlock = ^(NSString * _Nonnull accessIDString) {
weakSelf.accessID.text = accessIDString?:@"";

NSUserDefaults *defaluts = [NSUserDefaults standardUserDefaults];
NSDictionary *tokenAndProductIDDic = [NSDictionary dictionaryWithDictionary:[defaluts objectForKey:weakSelf.accessID.text?:@""]];
if (tokenAndProductIDDic != nil) {
weakSelf.accessToken.text = [tokenAndProductIDDic objectForKey:@"AccessTokenString"];
weakSelf.productID.text = [tokenAndProductIDDic objectForKey:@"productIDString"];
}
};
[[UIApplication sharedApplication].delegate.window addSubview:self.choiceAccessIDView];
[self.choiceAccessIDView mas_makeConstraints:^(MASConstraintMaker *make) {
Expand Down
2 changes: 0 additions & 2 deletions Source/SDK/LinkCore/QCFoundation/Other/TIoTCoreUserManage.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,6 @@ NS_ASSUME_NONNULL_BEGIN
SDKDemo
*/
@property (nonatomic, copy, nullable) NSString *demoAccessID;
@property (nonatomic, copy, nullable) NSString *demoAccessToken;
@property (nonatomic, copy, nullable) NSString *demoProductID;

//保存accessToken 和 有效期
- (void)saveAccessToken:(NSString *)accessToken expireAt:(NSString *)expireAt;
Expand Down
27 changes: 0 additions & 27 deletions Source/SDK/LinkCore/QCFoundation/Other/TIoTCoreUserManage.m
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ @implementation TIoTCoreUserManage
@synthesize searchHistoryArray = _searchHistoryArray;

@synthesize demoAccessID = _demoAccessID;
@synthesize demoAccessToken = _demoAccessToken;
@synthesize demoProductID = _demoProductID;

+(instancetype)shared{
static TIoTCoreUserManage *_instance = nil;
Expand Down Expand Up @@ -498,31 +496,6 @@ - (void)setDemoAccessID:(NSString *)demoAccessID {
[[NSUserDefaults standardUserDefaults] setValue:demoAccessID forKey:@"demoAccessID"];
}


- (NSString *)demoAccessToken {
if (!_demoAccessToken) {
_demoAccessToken = [[NSUserDefaults standardUserDefaults] valueForKey:@"demoAccessToken"];
}
return _demoAccessToken;
}

- (void)setDemoAccessToken:(NSString *)demoAccessToken {
_demoAccessToken = demoAccessToken;
[[NSUserDefaults standardUserDefaults] setValue:demoAccessToken forKey:@"demoAccessToken"];
}

- (NSString *)demoProductID {
if (!_demoProductID) {
_demoProductID = [[NSUserDefaults standardUserDefaults] valueForKey:@"demoProductID"];
}
return _demoProductID;
}

- (void)setDemoProductID:(NSString *)demoProductID {
_demoProductID = demoProductID;
[[NSUserDefaults standardUserDefaults] setValue:demoProductID forKey:@"demoProductID"];
}

//保存用户信息
- (void)saveUserInfo:(NSDictionary *)userInfo{

Expand Down

0 comments on commit 19eecf1

Please sign in to comment.