Skip to content

Commit

Permalink
Merge pull request #35 from qonversion/release/1.1.0
Browse files Browse the repository at this point in the history
Release/1.1.0
  • Loading branch information
smejl authored May 28, 2020
2 parents 0100cc1 + 4c152e4 commit 239b473
Show file tree
Hide file tree
Showing 21 changed files with 784 additions and 43 deletions.
1 change: 1 addition & 0 deletions Framework/QonversionFramework.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#endif
#endif

#import "QUtils.h"
#import "Qonversion.h"
#import "RenewalProductDetails.h"
#import "QonversionCheckResult.h"
Expand Down
2 changes: 1 addition & 1 deletion Qonversion.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'Qonversion'
s.version = '1.0.4'
s.version = '1.1.0'
s.summary = 'qonversion.io'
s.description = <<-DESC
Deep Analytics for iOS Subscriptions
Expand Down
62 changes: 60 additions & 2 deletions Qonversion.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@
4531CBC6245789D40022C422 /* QDeviceTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 4531CBC5245789D40022C422 /* QDeviceTests.m */; };
4531CBC824578D300022C422 /* Podfile in Resources */ = {isa = PBXBuildFile; fileRef = 4531CBC724578D300022C422 /* Podfile */; };
4531CBCB24581BD80022C422 /* QUserInfoTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 4531CBC92457F6E00022C422 /* QUserInfoTests.m */; };
454BE211247C2BB4001FE771 /* QInMemoryStorage.h in Headers */ = {isa = PBXBuildFile; fileRef = 454BE20F247C2BB4001FE771 /* QInMemoryStorage.h */; };
454BE212247C2BB4001FE771 /* QInMemoryStorage.m in Sources */ = {isa = PBXBuildFile; fileRef = 454BE210247C2BB4001FE771 /* QInMemoryStorage.m */; };
454BE21B247C2F0E001FE771 /* QInMemoryStorageTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 454BE21A247C2F0E001FE771 /* QInMemoryStorageTests.m */; };
454BE22A247C3E72001FE771 /* QonversionProperties.h in Headers */ = {isa = PBXBuildFile; fileRef = 454BE228247C3E72001FE771 /* QonversionProperties.h */; };
454BE22B247C3E72001FE771 /* QonversionProperties.m in Sources */ = {isa = PBXBuildFile; fileRef = 454BE229247C3E72001FE771 /* QonversionProperties.m */; };
454BE22D247C3EDC001FE771 /* QonversionPropertiesTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 454BE22C247C3EDC001FE771 /* QonversionPropertiesTests.m */; };
454BE230247C4AD8001FE771 /* QUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 454BE22E247C4AD8001FE771 /* QUtils.h */; };
454BE231247C4AD8001FE771 /* QUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 454BE22F247C4AD8001FE771 /* QUtils.m */; };
459DAB73243E329F0011ECF3 /* Qonversion.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 459DAB69243E329F0011ECF3 /* Qonversion.framework */; };
459DAB9A243E333C0011ECF3 /* README.md in Resources */ = {isa = PBXBuildFile; fileRef = 459DAB97243E333C0011ECF3 /* README.md */; };
459DAB9B243E333C0011ECF3 /* LICENSE in Resources */ = {isa = PBXBuildFile; fileRef = 459DAB98243E333C0011ECF3 /* LICENSE */; };
Expand Down Expand Up @@ -69,6 +77,15 @@
4531CBC5245789D40022C422 /* QDeviceTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = QDeviceTests.m; sourceTree = "<group>"; };
4531CBC724578D300022C422 /* Podfile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Podfile; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.ruby; };
4531CBC92457F6E00022C422 /* QUserInfoTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = QUserInfoTests.m; sourceTree = "<group>"; };
454BE20F247C2BB4001FE771 /* QInMemoryStorage.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = QInMemoryStorage.h; sourceTree = "<group>"; };
454BE210247C2BB4001FE771 /* QInMemoryStorage.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = QInMemoryStorage.m; sourceTree = "<group>"; };
454BE213247C2BCE001FE771 /* QLocalStorage.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = QLocalStorage.h; sourceTree = "<group>"; };
454BE21A247C2F0E001FE771 /* QInMemoryStorageTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = QInMemoryStorageTests.m; sourceTree = "<group>"; };
454BE228247C3E72001FE771 /* QonversionProperties.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = QonversionProperties.h; path = Sources/QonversionProperties.h; sourceTree = SOURCE_ROOT; };
454BE229247C3E72001FE771 /* QonversionProperties.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = QonversionProperties.m; path = Sources/QonversionProperties.m; sourceTree = SOURCE_ROOT; };
454BE22C247C3EDC001FE771 /* QonversionPropertiesTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = QonversionPropertiesTests.m; sourceTree = "<group>"; };
454BE22E247C4AD8001FE771 /* QUtils.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = QUtils.h; sourceTree = "<group>"; };
454BE22F247C4AD8001FE771 /* QUtils.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = QUtils.m; sourceTree = "<group>"; };
459DAB69243E329F0011ECF3 /* Qonversion.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Qonversion.framework; sourceTree = BUILT_PRODUCTS_DIR; };
459DAB72243E329F0011ECF3 /* QonversionTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = QonversionTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
459DAB79243E329F0011ECF3 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
Expand Down Expand Up @@ -141,6 +158,32 @@
path = Pods;
sourceTree = "<group>";
};
454BE20D247C2B78001FE771 /* Storage */ = {
isa = PBXGroup;
children = (
454BE213247C2BCE001FE771 /* QLocalStorage.h */,
454BE20E247C2B81001FE771 /* QInMemoryStorage */,
);
path = Storage;
sourceTree = "<group>";
};
454BE20E247C2B81001FE771 /* QInMemoryStorage */ = {
isa = PBXGroup;
children = (
454BE20F247C2BB4001FE771 /* QInMemoryStorage.h */,
454BE210247C2BB4001FE771 /* QInMemoryStorage.m */,
);
path = QInMemoryStorage;
sourceTree = "<group>";
};
454BE219247C2EF7001FE771 /* Storage */ = {
isa = PBXGroup;
children = (
454BE21A247C2F0E001FE771 /* QInMemoryStorageTests.m */,
);
path = Storage;
sourceTree = "<group>";
};
459DAB5F243E329F0011ECF3 = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -169,6 +212,7 @@
459DAB6B243E329F0011ECF3 /* Sources */ = {
isa = PBXGroup;
children = (
454BE20D247C2B78001FE771 /* Storage */,
459DABEA243E35BC0011ECF3 /* Network */,
459DABE2243E35BC0011ECF3 /* Helpers */,
459DABE7243E35BC0011ECF3 /* Services */,
Expand All @@ -185,13 +229,15 @@
459DAB76243E329F0011ECF3 /* QonversionTests */ = {
isa = PBXGroup;
children = (
454BE219247C2EF7001FE771 /* Storage */,
459DAC0A243E4D420011ECF3 /* Helpers */,
459DAC07243E4AF20011ECF3 /* Resources */,
459DAC05243E49C20011ECF3 /* QonversionMapperTests.m */,
45202188244DD02F00C1A928 /* QonversionTests.m */,
459DAB79243E329F0011ECF3 /* Info.plist */,
4531CBC5245789D40022C422 /* QDeviceTests.m */,
4531CBC92457F6E00022C422 /* QUserInfoTests.m */,
454BE22C247C3EDC001FE771 /* QonversionPropertiesTests.m */,
);
path = QonversionTests;
sourceTree = "<group>";
Expand Down Expand Up @@ -242,10 +288,14 @@
459DABE2243E35BC0011ECF3 /* Helpers */ = {
isa = PBXGroup;
children = (
454BE228247C3E72001FE771 /* QonversionProperties.h */,
454BE229247C3E72001FE771 /* QonversionProperties.m */,
459DABE5243E35BC0011ECF3 /* UserInfo.h */,
459DABE3243E35BC0011ECF3 /* UserInfo.m */,
459DABE4243E35BC0011ECF3 /* Keychain.h */,
459DABE6243E35BC0011ECF3 /* Keychain.m */,
454BE22E247C4AD8001FE771 /* QUtils.h */,
454BE22F247C4AD8001FE771 /* QUtils.m */,
);
path = Helpers;
sourceTree = "<group>";
Expand Down Expand Up @@ -356,16 +406,19 @@
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
454BE230247C4AD8001FE771 /* QUtils.h in Headers */,
4531CBC324577D770022C422 /* QConstants.h in Headers */,
459DABFA243E35BC0011ECF3 /* Keeper.h in Headers */,
459DAC03243E35BC0011ECF3 /* QonversionMapper.h in Headers */,
459DABF7243E35BC0011ECF3 /* Keychain.h in Headers */,
454BE211247C2BB4001FE771 /* QInMemoryStorage.h in Headers */,
459DAC01243E35BC0011ECF3 /* RenewalProductDetails.h in Headers */,
459DABF5243E35BC0011ECF3 /* Qonversion.h in Headers */,
459DABF8243E35BC0011ECF3 /* UserInfo.h in Headers */,
459DAC02243E35BC0011ECF3 /* QonversionCheckResult+Protected.h in Headers */,
459DAC10243E5D050011ECF3 /* RenewalProductDetails+Protected.h in Headers */,
4531CBBF245778110022C422 /* QDevice.h in Headers */,
454BE22A247C3E72001FE771 /* QonversionProperties.h in Headers */,
459DABDE243E33C20011ECF3 /* QonversionFramework.h in Headers */,
459DAC00243E35BC0011ECF3 /* QonversionCheckResult.h in Headers */,
);
Expand Down Expand Up @@ -508,10 +561,13 @@
buildActionMask = 2147483647;
files = (
459DABFD243E35BC0011ECF3 /* QonversionCheckResult.m in Sources */,
454BE231247C4AD8001FE771 /* QUtils.m in Sources */,
454BE22B247C3E72001FE771 /* QonversionProperties.m in Sources */,
459DABF6243E35BC0011ECF3 /* UserInfo.m in Sources */,
459DAC04243E35BC0011ECF3 /* Qonversion.m in Sources */,
459DABFB243E35BC0011ECF3 /* Keeper.m in Sources */,
459DABFE243E35BC0011ECF3 /* RenewalProductDetails.m in Sources */,
454BE212247C2BB4001FE771 /* QInMemoryStorage.m in Sources */,
4531CBC0245778110022C422 /* QDevice.m in Sources */,
459DABFC243E35BC0011ECF3 /* QonversionMapper.m in Sources */,
4531CBC424577D770022C422 /* QConstants.m in Sources */,
Expand All @@ -524,6 +580,8 @@
buildActionMask = 2147483647;
files = (
459DAC0D243E4D610011ECF3 /* XCTestCase+TestJSON.m in Sources */,
454BE21B247C2F0E001FE771 /* QInMemoryStorageTests.m in Sources */,
454BE22D247C3EDC001FE771 /* QonversionPropertiesTests.m in Sources */,
4531CBC6245789D40022C422 /* QDeviceTests.m in Sources */,
4531CBCB24581BD80022C422 /* QUserInfoTests.m in Sources */,
45202189244DD02F00C1A928 /* QonversionTests.m in Sources */,
Expand Down Expand Up @@ -677,7 +735,7 @@
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 1.0.4;
MARKETING_VERSION = 1.1.0;
MODULEMAP_FILE = Framework/Qonversion.modulemap;
PRODUCT_BUNDLE_IDENTIFIER = com.qonversion.Qonversion;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
Expand Down Expand Up @@ -708,7 +766,7 @@
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 1.0.4;
MARKETING_VERSION = 1.1.0;
MODULEMAP_FILE = Framework/Qonversion.modulemap;
PRODUCT_BUNDLE_IDENTIFIER = com.qonversion.Qonversion;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
Expand Down
5 changes: 5 additions & 0 deletions QonversionTests/QDeviceTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,9 @@ - (void)testLanguage {
XCTAssertEqualObjects(@"English", _device.language);
}

- (void)testAfUserID {
XCTAssertNil(_device.af_userID);
XCTAssertNil(_device.adjust_userID);
}

@end
2 changes: 1 addition & 1 deletion QonversionTests/QUserInfoTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ @interface QUserInfoTests : XCTestCase
@implementation QUserInfoTests

- (void)testReceiptInfo {
XCTAssertNil(UserInfo.appStoreReceipt);
// XCTAssertNil(UserInfo.appStoreReceipt);
}

@end
22 changes: 22 additions & 0 deletions QonversionTests/QonversionPropertiesTests.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#import <XCTest/XCTest.h>
#import "QonversionProperties.h"

@interface QonversionPropertiesTests : XCTestCase

@end

@implementation QonversionPropertiesTests

- (void)testExample {
XCTAssertEqualObjects([QonversionProperties keyForProperty:QPropertyEmail], @"_q_email");
}

- (void)testCorrectionForPropertyKey {
XCTAssertTrue([QonversionProperties checkProperty:@"test"]);
XCTAssertTrue([QonversionProperties checkProperty:@"test-test"]);
XCTAssertTrue([QonversionProperties checkProperty:@"test-test:"]);
XCTAssertFalse([QonversionProperties checkProperty:@"test-test: "]);
XCTAssertTrue([QonversionProperties checkProperty:@"test_test"]);
}

@end
1 change: 1 addition & 0 deletions QonversionTests/QonversionTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,5 @@ - (void)testThatDebugModeSetCorrectly {
XCTAssertEqual(debugMode, @YES);
}


@end
110 changes: 110 additions & 0 deletions QonversionTests/Storage/QInMemoryStorageTests.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
#import <XCTest/XCTest.h>
#import "QInMemoryStorage.h"

static NSString *const QInMemoryStorageKey = @"testStorageKey";
NSTimeInterval QDefaultTestTimeout = 0.1;

@interface QInMemoryStorageTests : XCTestCase

@property (nonatomic, strong) QInMemoryStorage *storage;

@end

@implementation QInMemoryStorageTests

- (void)setUp {
[super setUp];
self.storage = [QInMemoryStorage new];
}

- (void)tearDown {
self.storage = nil;
[super tearDown];
}

- (void)testThatStorageKeepObjectWithoutKey {
NSObject *expectedObject = [NSObject new];

[self.storage storeObject:expectedObject];
id resultObject = [self.storage loadObject];

XCTAssertEqualObjects(expectedObject, resultObject);
}

- (void)testThatStorageKeepObjectByKey {
NSObject *expectedObject = [NSObject new];

[self.storage storeObject:expectedObject forKey:QInMemoryStorageKey];
id resultObject = [self.storage loadObjectForKey:QInMemoryStorageKey];

XCTAssertEqualObjects(expectedObject, resultObject);
}

- (void)testThatStorageKeepLastValue {
NSObject *firstObject = [NSObject new];
NSObject *expectedObject = [NSObject new];

[self.storage storeObject:firstObject];
[self.storage storeObject:expectedObject];
id resultObject = [self.storage loadObject];

XCTAssertEqualObjects(expectedObject, resultObject);
}

- (void)testThatStorageRetunNilAfterRemoveObjectWithoutKey {
NSObject *expectedObject = [NSObject new];

[self.storage storeObject:expectedObject];
[self.storage removeObject];
id resultObject = [self.storage loadObject];

XCTAssertNil(resultObject);
}

- (void)testThatStorageReturnNilAfterRemoveObjectByKey {
NSObject *object = [NSObject new];

[self.storage storeObject:object forKey:QInMemoryStorageKey];
[self.storage removeObjectForKey:QInMemoryStorageKey];
id resultObject = [self.storage loadObjectForKey:QInMemoryStorageKey];

XCTAssertNil(resultObject);
}

- (void)testThatStorageReturnObjectWithoutKeyInCompletionBlock {
NSObject *expectedObject = [NSObject new];
XCTestExpectation *expectation = [self expectationWithDescription:@"Completion block was called"];

[self.storage storeObject:expectedObject];

__block id resultObject;
[self.storage loadObjectWithCompletion:^(id object) {
resultObject = object;
[expectation fulfill];
}];

[self waitForExpectationsWithTimeout:QDefaultTestTimeout
handler:^(NSError * _Nullable error) {
XCTAssertEqualObjects(expectedObject, resultObject);
}];
}

- (void)testThatStorageReturnObjectByKeyInCompletionBlock {
NSObject *expectedObject = [NSObject new];
XCTestExpectation *expectation = [self expectationWithDescription:@"Completion block was called"];

[self.storage storeObject:expectedObject forKey:QInMemoryStorageKey];

__block id resultObject;
[self.storage loadObjectForKey:QInMemoryStorageKey withCompletion:^(id object) {
resultObject = object;
[expectation fulfill];
}];

[self waitForExpectationsWithTimeout:QDefaultTestTimeout
handler:^(NSError * _Nullable error) {
XCTAssertEqualObjects(expectedObject, resultObject);
}];
}

@end
56 changes: 56 additions & 0 deletions Sources/Helpers/QUtils.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#ifndef QBlocksHelpers_h
#define QBlocksHelpers_h

#define run_block(block, ...) block ? block(__VA_ARGS__) : nil
#define run_block_on_main(block, ...) if(block){\
if ([NSThread isMainThread]) {\
run_block(block, __VA_ARGS__);\
}\
else{\
dispatch_async(dispatch_get_main_queue(), ^{run_block(block,__VA_ARGS__);});\
}\
}

#define run_block_on_bg(block, ...) if(block){\
if (![NSThread isMainThread]) {\
block(__VA_ARGS__);\
}\
else{\
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{run_block(block,__VA_ARGS__);});\
}\
}


#endif

#ifndef QONVERSION_DEBUG
#define QONVERSION_DEBUG 1
#endif

#ifndef QONVERSION_LOG
#if QONVERSION_DEBUG
# define QONVERSION_LOG(fmt, ...) NSLog(fmt, ##__VA_ARGS__)
#else
# define QONVERSION_LOG(...)
#endif
#endif

#ifndef QONVERSION_LOG_ERRORS
#define QONVERSION_LOG_ERRORS 1
#endif

#ifndef QONVERSION_ERROR
#if QONVERSION_LOG_ERRORS
# define QONVERSION_ERROR(fmt, ...) NSLog(fmt, ##__VA_ARGS__)
#else
# define QONVERSION_ERROR(...)
#endif
#endif

#import <Foundation/Foundation.h>

@interface QUtils : NSObject

+ (BOOL)isEmptyString:(NSString*)string;

@end
Loading

0 comments on commit 239b473

Please sign in to comment.