-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remote config list request implemented (#472)
* Remote config list request implemented * Linter fix * Tests fix * CR fixes
- Loading branch information
1 parent
fbc283d
commit 3c7774a
Showing
20 changed files
with
313 additions
and
31 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
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,24 @@ | ||
// | ||
// QONRemoteConfigList.h | ||
// Qonversion | ||
// | ||
// Created by Kamo Spertsyan on 27.03.2024. | ||
// Copyright © 2024 Qonversion Inc. All rights reserved. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
#import "QONRemoteConfig.h" | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
NS_SWIFT_NAME(Qonversion.RemoteConfig) | ||
@interface QONRemoteConfigList : NSObject | ||
|
||
@property (nonatomic, copy) NSArray<QONRemoteConfig *> *remoteConfigs; | ||
|
||
- (QONRemoteConfig *_Nullable)remoteConfigForContextKey:(NSString *)key; | ||
- (QONRemoteConfig *_Nullable)remoteConfigForEmptyContextKey; | ||
|
||
@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,40 @@ | ||
// | ||
// QONRemoteConfigList.m | ||
// Qonversion | ||
// | ||
// Created by Kamo Spertsyan on 27.03.2024. | ||
// Copyright © 2024 Qonversion Inc. All rights reserved. | ||
// | ||
|
||
#import "QONRemoteConfigList.h" | ||
|
||
@implementation QONRemoteConfigList | ||
|
||
- (instancetype)initWithRemoteConfigs:(NSArray *)remoteConfigs { | ||
self = [super init]; | ||
|
||
if (self) { | ||
_remoteConfigs = [remoteConfigs copy]; | ||
} | ||
|
||
return self; | ||
} | ||
|
||
- (QONRemoteConfig *_Nullable)remoteConfigForContextKey:(NSString *)key { | ||
return [self findRemoteConfigForContextKey:key]; | ||
} | ||
|
||
- (QONRemoteConfig *_Nullable)remoteConfigForEmptyContextKey { | ||
return [self findRemoteConfigForContextKey:nil]; | ||
} | ||
|
||
- (QONRemoteConfig *)findRemoteConfigForContextKey:(NSString *_Nullable)key { | ||
for (QONRemoteConfig *config in self.remoteConfigs) { | ||
if ((key == nil && config.source.contextKey == nil) || [config.source.contextKey isEqualToString:key]) { | ||
return config; | ||
} | ||
} | ||
return nil; | ||
} | ||
|
||
@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
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
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
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.