Skip to content

Commit

Permalink
Trim in different place
Browse files Browse the repository at this point in the history
  • Loading branch information
przemyslawzygmunt committed Jan 3, 2020
1 parent af68674 commit 22f230c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
8 changes: 2 additions & 6 deletions SUPLA/SuplaClient.m
Original file line number Diff line number Diff line change
Expand Up @@ -270,12 +270,9 @@ - (char*) getServerHostName {

NSString *host = [SAApp getServerHostName];
if ( [host isEqualToString:@""] == YES && [SAApp getAdvancedConfig] == NO && ![[SAApp getEmailAddress] isEqualToString:@""] ) {

NSString *email = [SAApp getEmailAddress];
email = [email stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];


NSMutableURLRequest *request =
[NSMutableURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"https://autodiscover.supla.org/users/%@", email]] cachePolicy:NSURLRequestReloadIgnoringLocalAndRemoteCacheData timeoutInterval:5];
[NSMutableURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"https://autodiscover.supla.org/users/%@", [SAApp getEmailAddress]]] cachePolicy:NSURLRequestReloadIgnoringLocalAndRemoteCacheData timeoutInterval:5];

[request setHTTPMethod: @"GET"];

Expand All @@ -298,7 +295,6 @@ - (char*) getServerHostName {
}
}

host = [host stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
return (char*)[host UTF8String];

}
Expand Down
6 changes: 3 additions & 3 deletions SuplaApp.m
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ +(NSString*) getAccessIDpwd {
}

+(void) setAccessIDpwd:(NSString *)pwd {

pwd = [pwd stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
@synchronized(self) {
[[NSUserDefaults standardUserDefaults] setValue:pwd forKey:@"access_id_pwd"];
}
Expand All @@ -277,7 +277,7 @@ +(NSString*) getServerHostName {
}

-(void) setServerHostName:(NSString *)hostname {

hostname = [hostname stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
@synchronized(self) {
[[NSUserDefaults standardUserDefaults] setValue:hostname forKey:@"server_host"];
_current_server = hostname;
Expand Down Expand Up @@ -309,7 +309,7 @@ +(NSString*) getEmailAddress {
}

-(void) setEmailAddress:(NSString *)email {

email = [email stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
@synchronized(self) {
[[NSUserDefaults standardUserDefaults] setValue:email forKey:@"email_address"];
_current_email = email;
Expand Down

0 comments on commit 22f230c

Please sign in to comment.