-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #67 from SUPLA/develop
v2.3.2
- Loading branch information
Showing
8 changed files
with
215 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,6 +26,8 @@ | |
013D73B022DD105400E3515A /* SAChartFilterField.m in Sources */ = {isa = PBXBuildFile; fileRef = 013D73AF22DD105400E3515A /* SAChartFilterField.m */; }; | ||
01567446232FCFD700397393 /* SAIncrementalMeterExtendedValue.m in Sources */ = {isa = PBXBuildFile; fileRef = 01567445232FCFD700397393 /* SAIncrementalMeterExtendedValue.m */; }; | ||
01567449232FD0A100397393 /* SAImpulseCounterExtendedValue.m in Sources */ = {isa = PBXBuildFile; fileRef = 01567448232FD0A100397393 /* SAImpulseCounterExtendedValue.m */; }; | ||
016ABE16236D8363001BF5FB /* SAKeychain.m in Sources */ = {isa = PBXBuildFile; fileRef = 016ABE15236D8363001BF5FB /* SAKeychain.m */; }; | ||
016ABE18236DA795001BF5FB /* KeychainTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 016ABE17236DA795001BF5FB /* KeychainTests.m */; }; | ||
016EE77423074DDC00FD301C /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = 016EE77223074DDC00FD301C /* [email protected] */; }; | ||
016EE77523074DDC00FD301C /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = 016EE77323074DDC00FD301C /* [email protected] */; }; | ||
0172677D234FAF78000F1CFB /* SADownloadImpulseCounterMeasurements.m in Sources */ = {isa = PBXBuildFile; fileRef = 0172677C234FAF78000F1CFB /* SADownloadImpulseCounterMeasurements.m */; }; | ||
|
@@ -396,6 +398,9 @@ | |
01567445232FCFD700397393 /* SAIncrementalMeterExtendedValue.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SAIncrementalMeterExtendedValue.m; sourceTree = "<group>"; }; | ||
01567447232FD0A100397393 /* SAImpulseCounterExtendedValue.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SAImpulseCounterExtendedValue.h; sourceTree = "<group>"; }; | ||
01567448232FD0A100397393 /* SAImpulseCounterExtendedValue.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SAImpulseCounterExtendedValue.m; sourceTree = "<group>"; }; | ||
016ABE14236D8363001BF5FB /* SAKeychain.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SAKeychain.h; sourceTree = "<group>"; }; | ||
016ABE15236D8363001BF5FB /* SAKeychain.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SAKeychain.m; sourceTree = "<group>"; }; | ||
016ABE17236DA795001BF5FB /* KeychainTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KeychainTests.m; sourceTree = "<group>"; }; | ||
016EE77223074DDC00FD301C /* [email protected] */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "[email protected]"; path = "Resources/Assets/Img/[email protected]"; sourceTree = "<group>"; }; | ||
016EE77323074DDC00FD301C /* [email protected] */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "[email protected]"; path = "Resources/Assets/Img/[email protected]"; sourceTree = "<group>"; }; | ||
0172677B234FAF78000F1CFB /* SADownloadImpulseCounterMeasurements.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SADownloadImpulseCounterMeasurements.h; sourceTree = "<group>"; }; | ||
|
@@ -1159,6 +1164,8 @@ | |
404E48F61FC75D0B001F6266 /* SAClassHelper.h */, | ||
013D350223350C48006E3B75 /* SAThermostatScheduleCfg.h */, | ||
013D350323350C48006E3B75 /* SAThermostatScheduleCfg.m */, | ||
016ABE14236D8363001BF5FB /* SAKeychain.h */, | ||
016ABE15236D8363001BF5FB /* SAKeychain.m */, | ||
); | ||
path = SUPLA; | ||
sourceTree = "<group>"; | ||
|
@@ -1176,6 +1183,7 @@ | |
isa = PBXGroup; | ||
children = ( | ||
01EFD94B236CA9AE00893489 /* NSDataEncryptionTest.m */, | ||
016ABE17236DA795001BF5FB /* KeychainTests.m */, | ||
012F722822DF3CF000E5F72E /* ChartFilterFieldTests.m */, | ||
401CA1DB1BA067DB00117AF4 /* SUPLATests.m */, | ||
401CA1D91BA067DB00117AF4 /* Supporting Files */, | ||
|
@@ -2090,6 +2098,7 @@ | |
403EB1141FBDF47F00AD6460 /* AddWizardVC.m in Sources */, | ||
013D350423350C48006E3B75 /* SAThermostatScheduleCfg.m in Sources */, | ||
408034C41BC83D1A007666E7 /* MGSwipeButton.m in Sources */, | ||
016ABE16236D8363001BF5FB /* SAKeychain.m in Sources */, | ||
01EE9BB022BA4B050029A142 /* SAChannelExtendedValue+CoreDataProperties.m in Sources */, | ||
01BDAC7522C518DE00915646 /* SARestApiClientTask.m in Sources */, | ||
401CA1BF1BA067DB00117AF4 /* main.m in Sources */, | ||
|
@@ -2142,6 +2151,7 @@ | |
buildActionMask = 2147483647; | ||
files = ( | ||
401CA1DC1BA067DB00117AF4 /* SUPLATests.m in Sources */, | ||
016ABE18236DA795001BF5FB /* KeychainTests.m in Sources */, | ||
01EFD94C236CA9AE00893489 /* NSDataEncryptionTest.m in Sources */, | ||
012F722C22DF3E2300E5F72E /* ChartFilterFieldTests.m in Sources */, | ||
0130894523395F4C00F46FCD /* ThermostatScheduleCfgTests.m in Sources */, | ||
|
@@ -2517,7 +2527,7 @@ | |
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; | ||
CLANG_ENABLE_MODULES = YES; | ||
CODE_SIGN_IDENTITY = "iPhone Developer"; | ||
CURRENT_PROJECT_VERSION = 36; | ||
CURRENT_PROJECT_VERSION = 37; | ||
DEFINES_MODULE = YES; | ||
HEADER_SEARCH_PATHS = "$(SDKROOT)/usr/include/libxml2"; | ||
INFOPLIST_FILE = SUPLA/Info.plist; | ||
|
@@ -2527,7 +2537,7 @@ | |
"$(inherited)", | ||
"$(PROJECT_DIR)/SUPLA/lib", | ||
); | ||
MARKETING_VERSION = 2.3.1; | ||
MARKETING_VERSION = 2.3.2; | ||
PRODUCT_BUNDLE_IDENTIFIER = com.acsoftware.ios.supla; | ||
PRODUCT_NAME = "$(TARGET_NAME)"; | ||
SWIFT_OBJC_BRIDGING_HEADER = "SUPLA/SUPLA-Bridging-Header.h"; | ||
|
@@ -2544,7 +2554,7 @@ | |
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; | ||
CLANG_ENABLE_MODULES = YES; | ||
CODE_SIGN_IDENTITY = "iPhone Developer"; | ||
CURRENT_PROJECT_VERSION = 36; | ||
CURRENT_PROJECT_VERSION = 37; | ||
DEFINES_MODULE = YES; | ||
HEADER_SEARCH_PATHS = "$(SDKROOT)/usr/include/libxml2"; | ||
INFOPLIST_FILE = SUPLA/Info.plist; | ||
|
@@ -2554,7 +2564,7 @@ | |
"$(inherited)", | ||
"$(PROJECT_DIR)/SUPLA/lib", | ||
); | ||
MARKETING_VERSION = 2.3.1; | ||
MARKETING_VERSION = 2.3.2; | ||
PRODUCT_BUNDLE_IDENTIFIER = com.acsoftware.ios.supla; | ||
PRODUCT_NAME = "$(TARGET_NAME)"; | ||
SWIFT_OBJC_BRIDGING_HEADER = "SUPLA/SUPLA-Bridging-Header.h"; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
Copyright (C) AC SOFTWARE SP. Z O.O. | ||
This program is free software; you can redistribute it and/or | ||
modify it under the terms of the GNU General Public License | ||
as published by the Free Software Foundation; either version 2 | ||
of the License, or (at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with this program; if not, write to the Free Software | ||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
*/ | ||
|
||
#import <Foundation/Foundation.h> | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
@interface SAKeychain : NSObject | ||
+ (BOOL)deleteObjectWithKey:(NSString *)key; | ||
+ (BOOL)addObject:(id)object withKey:(NSString *)key; | ||
+ (id)getObjectWithKey:(NSString *)key; | ||
@end | ||
|
||
NS_ASSUME_NONNULL_END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
/* | ||
Copyright (C) AC SOFTWARE SP. Z O.O. | ||
This program is free software; you can redistribute it and/or | ||
modify it under the terms of the GNU General Public License | ||
as published by the Free Software Foundation; either version 2 | ||
of the License, or (at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with this program; if not, write to the Free Software | ||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
*/ | ||
|
||
#import "SAKeychain.h" | ||
|
||
@implementation SAKeychain | ||
|
||
+ (NSMutableDictionary *)attributesWithKey:(NSString *)key { | ||
return [@{(__bridge id)kSecClass : (__bridge id)kSecClassGenericPassword, | ||
(__bridge id)kSecAttrService : @"SAKeychain", | ||
(__bridge id)kSecAttrAccount : key, | ||
(__bridge id)kSecAttrAccessible : (__bridge id)kSecAttrAccessibleAfterFirstUnlock | ||
} mutableCopy]; | ||
} | ||
|
||
+ (BOOL)deleteObjectWithKey:(NSString *)key { | ||
NSMutableDictionary *attrs = [self attributesWithKey:key]; | ||
return noErr == SecItemDelete((__bridge CFDictionaryRef)attrs); | ||
} | ||
|
||
+ (BOOL)addObject:(id)object withKey:(NSString *)key { | ||
NSMutableDictionary *attrs = [self attributesWithKey:key]; | ||
|
||
[attrs setObject:[NSKeyedArchiver archivedDataWithRootObject:object] forKey:(__bridge id)kSecValueData]; | ||
return noErr == SecItemAdd((__bridge CFDictionaryRef)attrs, NULL); | ||
} | ||
|
||
+ (id)getObjectWithKey:(NSString *)key { | ||
id result = nil; | ||
|
||
NSMutableDictionary *attrs = [self attributesWithKey:key]; | ||
|
||
[attrs setObject:(__bridge id)kCFBooleanTrue forKey:(__bridge id)kSecReturnData]; | ||
[attrs setObject:(__bridge id)kSecMatchLimitOne forKey:(__bridge id)kSecMatchLimit]; | ||
|
||
CFDataRef data = NULL; | ||
|
||
if (noErr == SecItemCopyMatching((__bridge CFDictionaryRef)attrs, (CFTypeRef *)&data)) { | ||
@try { | ||
result = [NSKeyedUnarchiver unarchiveObjectWithData:(__bridge NSData *)data]; | ||
} | ||
@catch (NSException *exception) { | ||
NSLog(@"%@", exception); | ||
result = nil; | ||
} | ||
@finally {} | ||
} | ||
|
||
if (data) { | ||
CFRelease(data); | ||
} | ||
|
||
return result; | ||
} | ||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
Copyright (C) AC SOFTWARE SP. Z O.O. | ||
This program is free software; you can redistribute it and/or | ||
modify it under the terms of the GNU General Public License | ||
as published by the Free Software Foundation; either version 2 | ||
of the License, or (at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with this program; if not, write to the Free Software | ||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
*/ | ||
|
||
#import <XCTest/XCTest.h> | ||
#import "SAKeychain.h" | ||
|
||
@interface KeychainTests : XCTestCase | ||
@end | ||
|
||
@implementation KeychainTests | ||
|
||
- (void)testKeychainStorage { | ||
NSString *source = @"ABCDEFGH"; | ||
[SAKeychain deleteObjectWithKey:@"1"]; | ||
XCTAssertFalse([SAKeychain deleteObjectWithKey:@"1"]); | ||
XCTAssertNil([SAKeychain getObjectWithKey:@"1"]); | ||
XCTAssertTrue([SAKeychain addObject:source withKey:@"1"]); | ||
XCTAssertFalse([SAKeychain addObject:@"XYZ" withKey:@"1"]); | ||
XCTAssertNil([SAKeychain getObjectWithKey:@"2"]); | ||
NSString *dest = [SAKeychain getObjectWithKey:@"1"]; | ||
XCTAssertNotNil(dest); | ||
XCTAssertTrue([source isEqualToString:dest]); | ||
XCTAssertTrue([SAKeychain deleteObjectWithKey:@"1"]); | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.