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

[SDK-2328] Added API URL check for Branch.json #1371

Merged
merged 1 commit into from
Mar 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 4 additions & 0 deletions Sources/BranchSDK/Branch.m
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,10 @@
BranchJsonConfig *config = BranchJsonConfig.instance;
self.deferInitForPluginRuntime = config.deferInitForPluginRuntime;

if (config.apiUrl) {
[Branch setAPIUrl:config.apiUrl];

Check warning on line 239 in Sources/BranchSDK/Branch.m

View check run for this annotation

Codecov / codecov/patch

Sources/BranchSDK/Branch.m#L239

Added line #L239 was not covered by tests
}

if (config.enableLogging) {
[self enableLogging];
}
Expand Down
7 changes: 7 additions & 0 deletions Sources/BranchSDK/BranchJsonConfig.m
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
NSString * _Nonnull const BranchJsonConfigDeferInitForPluginRuntimeOption = @"deferInitForPluginRuntime";
NSString * _Nonnull const BranchJsonConfigEnableLogging = @"enableLogging";
NSString * _Nonnull const BranchJsonConfigCheckPasteboardOnInstall = @"checkPasteboardOnInstall";
NSString * _Nonnull const BranchJsonConfigAPIUrl = @"apiUrl";


@interface BranchJsonConfig()
@property (nonatomic, strong) NSDictionary *configuration;
Expand Down Expand Up @@ -161,6 +163,11 @@ - (NSString *)testKey
return self[BranchJsonConfigTestKeyOption];
}

- (NSString *)apiUrl
{
return self[BranchJsonConfigAPIUrl];
}

- (id)objectForKey:(NSString *)key
{
return self.configuration[key];
Expand Down
2 changes: 2 additions & 0 deletions Sources/BranchSDK/Private/BranchJsonConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ extern NSString * _Nonnull const BranchJsonConfigUseTestInstanceOption;
extern NSString * _Nonnull const BranchJsonConfigDeferInitForPluginRuntimeOption;
extern NSString * _Nonnull const BranchJsonConfigEnableLogging;
extern NSString * _Nonnull const BranchJsonConfigCheckPasteboardOnInstall;
extern NSString * _Nonnull const BranchJsonConfigAPIUrl;

@interface BranchJsonConfig : NSObject

Expand All @@ -29,6 +30,7 @@ extern NSString * _Nonnull const BranchJsonConfigCheckPasteboardOnInstall;
@property (nonatomic, readonly, assign) BOOL deferInitForPluginRuntime;
@property (nonatomic, readonly, assign) BOOL enableLogging;
@property (nonatomic, readonly, assign) BOOL checkPasteboardOnInstall;
@property (nonatomic, readonly, nullable, copy) NSString *apiUrl;

- (nullable id)objectForKey:(NSString * _Nonnull)key;
- (nullable id)objectForKeyedSubscript:(NSString * _Nonnull)key;
Expand Down
Loading