Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 5.11.0 #525

Merged
merged 30 commits into from
Jul 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
b3955e5
Added fallbacks logic
actions-user Jun 11, 2024
bcfa071
Updated logic
actions-user Jun 12, 2024
1fa7331
Updated key in json file
actions-user Jun 12, 2024
c499f91
Fixed logic for remote config for context key
actions-user Jun 12, 2024
28b1e2a
Updated logic
actions-user Jun 12, 2024
95597c0
Fixed warnings
actions-user Jun 12, 2024
fa95dd3
Fixed type
actions-user Jun 12, 2024
6cf91bd
Fixed SPM
actions-user Jun 12, 2024
2fa5000
Fixed tests
actions-user Jun 12, 2024
4f33077
Fixed remote configs for context keys logic
actions-user Jun 13, 2024
eb7f1c0
Fixed naming fallbacks -> fallback
actions-user Jun 14, 2024
e3541a8
Code review fixes
actions-user Jun 14, 2024
590fd23
Fixed unitialized value
actions-user Jun 14, 2024
89e7eb4
Fixed import
actions-user Jun 14, 2024
56e551c
Another part of review fixes
actions-user Jun 14, 2024
31e7921
Updated get actual fallback data function logic
actions-user Jun 17, 2024
a94b744
Updated fallback file
actions-user Jun 18, 2024
f7e3e5d
Merge pull request #520 from qonversion/release/5.10.1
suriksarkisyan Jun 26, 2024
5c0cfd7
Fixed nil file handling
actions-user Jun 27, 2024
40fe28a
Fixed fallback file
actions-user Jun 27, 2024
25c7452
Fixed platform check for mac catalyst
actions-user Jun 28, 2024
a711e67
Added function to check if fallback file is accessible + renamed file…
actions-user Jul 4, 2024
61a956b
Updated file name proj fix
actions-user Jul 4, 2024
e765913
Fixed typo
actions-user Jul 4, 2024
55442c4
Updated comment
actions-user Jul 4, 2024
e8f855d
Merge pull request #517 from qonversion/feature/fallbacks
suriksarkisyan Jul 4, 2024
40f2fa5
Merge branch 'develop' into catalystPlatformFix
actions-user Jul 4, 2024
d2b03d0
Merge pull request #523 from qonversion/catalystPlatformFix
suriksarkisyan Jul 4, 2024
c6cd89c
[create-pull-request] automated change
SpertsyanKM Jul 5, 2024
87ea026
Merge branch 'main' into release/5.11.0
SpertsyanKM Jul 5, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Framework/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>5.10.1</string>
<string>5.11.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand Down
4 changes: 4 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,17 @@ let sources: [String] = ["Qonversion/Automations/Constants",
"Qonversion/Qonversion/Mappers/QNUserInfoMapper",
"Qonversion/Qonversion/Mappers/QONRemoteConfigMapper",
"Qonversion/Qonversion/Mappers/QONUserPropertiesMapper",
"Qonversion/Qonversion/Mappers/QONFallbackMapper",
"Qonversion/Qonversion/Models",
"Qonversion/Qonversion/Models/Protected",
"Qonversion/Qonversion/Models/QONStoreKit2PurchaseModel",
"Qonversion/Qonversion/Models/QONFallbackObject",
"Qonversion/Qonversion/Models/QNMapperObject",
"Qonversion/Qonversion/Services",
"Qonversion/Qonversion/Services/QNAPIClient",
"Qonversion/Qonversion/Services/QNIdentityService",
"Qonversion/Qonversion/Services/QNStoreKitService",
"Qonversion/Qonversion/Services/QONFallbackService",
"Qonversion/Qonversion/Services/QNUserInfoService",
"Qonversion/Qonversion/Services/QONRemoteConfigService",
"Qonversion/Qonversion/Services/QONExceptionManager",
Expand All @@ -65,6 +68,7 @@ let sources: [String] = ["Qonversion/Automations/Constants",
"Qonversion/Qonversion/Utils/QNProperties",
"Qonversion/Qonversion/Utils/QNRateLimiter",
"Qonversion/Qonversion/Utils/QNUserInfo",
"Qonversion/Qonversion/Utils/NSError+Sugare",
"Qonversion/Qonversion/Utils/QNUtils"]

let package = Package(
Expand Down
2 changes: 1 addition & 1 deletion Qonversion.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Pod::Spec.new do |s|
idfa_exclude_files = ['Sources/Qonversion/IDFA']
s.name = 'Qonversion'
s.swift_version = '5.5'
s.version = '5.10.1'
s.version = '5.11.0'
s.summary = 'qonversion.io'
s.description = <<-DESC
Deep Analytics for iOS Subscriptions
Expand Down
76 changes: 68 additions & 8 deletions Qonversion.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion QonversionTests/ProductCenterManagerTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#import "QNUserInfoService.h"
#import "QNIdentityManager.h"
#import "QNLocalStorage.h"
#import "QONFallbackService.h"
#import "Helpers/XCTestCase+TestJSON.h"

@interface QNProductCenterManager (Private)
Expand Down Expand Up @@ -46,7 +47,8 @@ - (void)setUp {
id mockUserInfoService = OCMClassMock([QNUserInfoService class]);
id mockIdentityManager = OCMClassMock([QNIdentityManager class]);
id mockLocalStorage = OCMProtocolMock(@protocol(QNLocalStorage));
_manager = [[QNProductCenterManager alloc] initWithUserInfoService:mockUserInfoService identityManager:mockIdentityManager localStorage:mockLocalStorage];
id mockFallbackService = OCMClassMock([QONFallbackService class]);
_manager = [[QNProductCenterManager alloc] initWithUserInfoService:mockUserInfoService identityManager:mockIdentityManager localStorage:mockLocalStorage fallbackService:mockFallbackService];
[_manager setApiClient:_mockClient];
}

Expand Down
1 change: 1 addition & 0 deletions QonversionTests/QonversionMapperTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#import "QNMapperObject.h"
#import "QONEntitlement.h"
#import "QONLaunchResult.h"
#import "QONProduct.h"

@interface QNMapperTests : XCTestCase
@property (nonatomic, strong) NSDictionary *userInitSuccess;
Expand Down
2 changes: 1 addition & 1 deletion QonversionTests/StoreKitServiceTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ - (void)testGroupTransactions {
NSArray *resultArray = resultTransactions[key];
XCTAssertEqual(expectedArray.count, resultArray.count);

for (NSUInteger i; i < expectedArray.count; i++) {
for (NSUInteger i = 0; i < expectedArray.count; i++) {
NSArray *expectedTransaction = expectedArray[i];
NSArray *resultTransaction = resultArray[i];
XCTAssertEqual(expectedTransaction, resultTransaction);
Expand Down
159 changes: 159 additions & 0 deletions Sample/qonversion_ios_fallbacks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
{
"products": [
{
"id": "weekly",
"duration": 0,
"store_id": "io.qonversion.weekly",
"type": 1
},
{
"id": "consumable",
"duration": null,
"store_id": "io.qonversion.consumable",
"type": 2
},
{
"id": "subs_plus_trial",
"duration": 1,
"store_id": "io.qonversion.subs.monthly.plus.trial",
"type": 0
},
{
"id": "annual",
"duration": 4,
"store_id": "io.qonversion.subs.annual",
"type": 0
},
{
"id": "in_app",
"duration": null,
"store_id": "io.qonversion.nonconsumable",
"type": 2
}
],
"offerings": [
{
"id": "main",
"tag": 1,
"products": [
{
"id": "weekly",
"duration": 0,
"store_id": "io.qonversion.weekly",
"type": 1
},
{
"id": "annual",
"duration": 4,
"store_id": "io.qonversion.subs.annual",
"type": 0
},
{
"id": "consumable",
"duration": null,
"store_id": "io.qonversion.consumable",
"type": 2
}
]
},
{
"id": "discounted_offer",
"tag": 0,
"products": []
}
],
"products_permissions": {
"weekly": [
"plus"
],
"consumable": [],
"subs_plus_trial": [
"standart"
],
"annual": [
"standart",
"sample"
],
"in_app": [
"Premium Movies"
]
},
"remote_config_list": [
{
"experiment": null,
"payload": {
"CTA": "Start Trial",
"CTA_color": "#307BF6",
"main_image": "[IMAGE_URL]",
"product_id": "prod_7d_trial_5.99",
"show_close_button": true
},
"source": {
"assignment_type": "auto",
"context_key": "main_paywall",
"name": "default paywall",
"type": "remote_configuration",
"uid": "0dcb1bd9-9bc3-4668-84aa-4540d1042c5d"
}
},
{
"experiment": null,
"payload": {
"CTA": "Start you trial",
"CTA_color": "red",
"main_image": "111",
"product_id": "123123123123123",
"show_close_button": true
},
"source": {
"assignment_type": "auto",
"context_key": "",
"name": "Default settings",
"type": "remote_configuration",
"uid": "12feb1dd-8096-47bc-a5a1-443fd2828ecc"
}
},
{
"experiment": null,
"payload": {
"test_key": "test_value"
},
"source": {
"assignment_type": "auto",
"context_key": "test_context_key",
"name": "Test with context key1",
"type": "remote_configuration",
"uid": "c5077ec4-acf4-41ea-8b43-05114be5d7ce"
}
},
{
"experiment": null,
"payload": {
"test_key_2": "test_value_2"
},
"source": {
"assignment_type": "auto",
"context_key": "test_context_key_2",
"name": "Test with context key2 - copy",
"type": "remote_configuration",
"uid": "1c000f2a-2f4b-4736-b5dd-75b13bf73deb"
}
},
{
"experiment": null,
"payload": {
"bool": true,
"json": {
"key": "value"
}
},
"source": {
"assignment_type": "auto",
"context_key": "swift_key ",
"name": "Swift",
"type": "remote_configuration",
"uid": "9f85d738-56d8-4f6c-b54a-c08658be2cb4"
}
}
]
}
2 changes: 1 addition & 1 deletion Sources/Qonversion/Public/QONConfiguration.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#import "QONConfiguration.h"
#import "QNAPIConstants.h"

static NSString *const kSDKVersion = @"5.10.1";
static NSString *const kSDKVersion = @"5.11.0";

@interface QONConfiguration ()

Expand Down
6 changes: 6 additions & 0 deletions Sources/Qonversion/Public/Qonversion.h
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,12 @@ NS_SWIFT_NAME(remoteConfigList(contextKeys:includeEmptyContextKey:completion:));
*/
- (void)handlePurchases:(NSArray<QONStoreKit2PurchaseModel *> *)purchasesInfo completion:(nullable QONDefaultCompletionHandler)completion;

/**
Call this function to check if the fallback file is accessible.
@return flag that indicates whether Qonversion was able to read data from the fallback file or not.
*/
- (BOOL)isFallbackFileAccessible;

@end

NS_ASSUME_NONNULL_END
14 changes: 11 additions & 3 deletions Sources/Qonversion/Public/Qonversion.m
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#import "QONRemoteConfigManager.h"
#import "QONExceptionManager.h"
#import "QONUserProperty.h"
#import "QONFallbackService.h"

static id shared = nil;

Expand All @@ -26,7 +27,7 @@ @interface Qonversion()
@property (nonatomic, strong) QONExceptionManager *exceptionManager;
@property (nonatomic, strong) id<QNUserInfoServiceInterface> userInfoService;
@property (nonatomic, strong) id<QNLocalStorage> localStorage;

@property (nonatomic, strong) QONFallbackService *fallbackService;
@property (nonatomic, assign) BOOL debugMode;
@property (nonatomic, assign) QONLaunchMode launchMode;

Expand Down Expand Up @@ -239,6 +240,12 @@ - (void)handlePurchases:(NSArray<QONStoreKit2PurchaseModel *> *)purchasesInfo co
[[self productCenterManager] handlePurchases:purchasesInfo completion:completion];
}

- (BOOL)isFallbackFileAccessible {
QONFallbackObject *fallbackData = [self.fallbackService obtainFallbackData];

return fallbackData != nil;
}

// MARK: - Private

- (instancetype)initWithCustomUserDefaults:(NSUserDefaults *)userDefaults {
Expand All @@ -249,8 +256,9 @@ - (instancetype)initWithCustomUserDefaults:(NSUserDefaults *)userDefaults {
_userInfoService = [servicesAssembly userInfoService];
_localStorage = [servicesAssembly localStorage];
id<QNIdentityManagerInterface> identityManager = [servicesAssembly identityManager];

_productCenterManager = [[QNProductCenterManager alloc] initWithUserInfoService:_userInfoService identityManager:identityManager localStorage:_localStorage];
QONFallbackService *fallbackService = [QONFallbackService new];
_productCenterManager = [[QNProductCenterManager alloc] initWithUserInfoService:_userInfoService identityManager:identityManager localStorage:_localStorage fallbackService:fallbackService];
_fallbackService = fallbackService;
_propertiesManager = [QNUserPropertiesManager new];
_attributionManager = [QNAttributionManager new];
_remoteConfigManager = [QONRemoteConfigManager new];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#import "QONLaunchMode.h"
#import "QONRemoteConfigManager.h"

@class QONLaunchResult, QONStoreKit2PurchaseModel;
@class QONLaunchResult, QONStoreKit2PurchaseModel, QONFallbackService;
@protocol QONPromoPurchasesDelegate, QONEntitlementsUpdateListener, QNUserInfoServiceInterface, QNIdentityManagerInterface, QNLocalStorage;

NS_ASSUME_NONNULL_BEGIN
Expand All @@ -14,7 +14,7 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, assign) QONLaunchMode launchMode;
@property (nonatomic, strong) QONRemoteConfigManager *remoteConfigManager;

- (instancetype)initWithUserInfoService:(id<QNUserInfoServiceInterface>)userInfoService identityManager:(id<QNIdentityManagerInterface>)identityManager localStorage:(id<QNLocalStorage>)localStorage;
- (instancetype)initWithUserInfoService:(id<QNUserInfoServiceInterface>)userInfoService identityManager:(id<QNIdentityManagerInterface>)identityManager localStorage:(id<QNLocalStorage>)localStorage fallbackService:(QONFallbackService *)fallbackService;

- (BOOL)isUserStable;
- (void)identify:(NSString *)userID completion:(nullable QONUserInfoCompletionHandler)completion;
Expand Down
Loading
Loading