File tree Expand file tree Collapse file tree 3 files changed +22
-3
lines changed
Branch-TestBed/Branch-TestBed Expand file tree Collapse file tree 3 files changed +22
-3
lines changed Original file line number Diff line number Diff line change 77//
88
99#import " BNCPreferenceHelper.h"
10+ #import " BNCEncodingUtils.h"
1011#import " BNCConfig.h"
1112#import " Branch.h"
1213
@@ -368,13 +369,25 @@ - (void)setSessionParams:(NSString *)sessionParams {
368369
369370- (NSString *)installParams {
370371 if (!_installParams) {
371- _installParams = [self readStringFromDefaults: BRANCH_PREFS_KEY_INSTALL_PARAMS];
372+ id installParamsFromCache = [self readStringFromDefaults: BRANCH_PREFS_KEY_INSTALL_PARAMS];
373+ if ([installParamsFromCache isKindOfClass: [NSString class ]]) {
374+ _installParams = [self readStringFromDefaults: BRANCH_PREFS_KEY_INSTALL_PARAMS];
375+ }
376+ else if ([installParamsFromCache isKindOfClass: [NSDictionary class ]]) {
377+ [self writeObjectToDefaults: BRANCH_PREFS_KEY_INSTALL_PARAMS value: nil ];
378+ }
372379 }
373380
374381 return _installParams;
375382}
376383
377384- (void )setInstallParams : (NSString *)installParams {
385+ if ([installParams isKindOfClass: [NSDictionary class ]]) {
386+ _installParams = [BNCEncodingUtils encodeDictionaryToJsonString: installParams];
387+ [self writeObjectToDefaults: BRANCH_PREFS_KEY_INSTALL_PARAMS value: _installParams];
388+ return ;
389+ }
390+
378391 if (![_installParams isEqualToString: installParams]) {
379392 _installParams = installParams;
380393 [self writeObjectToDefaults: BRANCH_PREFS_KEY_INSTALL_PARAMS value: installParams];
Original file line number Diff line number Diff line change @@ -113,7 +113,11 @@ - (void)processResponse:(BNCServerResponse *)response error:(NSError *)error {
113113 if (sessionData.length && preferenceHelper.isReferrable ) {
114114 NSDictionary *sessionDataDict = [BNCEncodingUtils decodeJsonStringToDictionary: sessionData];
115115 BOOL dataIsFromALinkClick = [sessionDataDict[BRANCH_RESPONSE_KEY_CLICKED_BRANCH_LINK] isEqual: @1 ];
116- BOOL storedParamsAreEmpty = !preferenceHelper.installParams .length ;
116+
117+ BOOL storedParamsAreEmpty = YES ;
118+ if ([preferenceHelper.installParams isKindOfClass: [NSString class ]]) {
119+ storedParamsAreEmpty = !preferenceHelper.installParams .length ;
120+ }
117121
118122 if (dataIsFromALinkClick && (self.isInstall || storedParamsAreEmpty)) {
119123 preferenceHelper.installParams = sessionData;
Original file line number Diff line number Diff line change @@ -117,7 +117,9 @@ - (IBAction)cmdExecuteBuy:(id)sender {
117117}
118118- (IBAction )cmdIdentifyUserClick : (id )sender {
119119 Branch *branch = [Branch getInstance ];
120- [branch setIdentity: @" test_user_10" ];
120+ [branch setIdentity: @" test_user_104" withCallback: ^(NSDictionary *params, NSError *error) {
121+ NSLog (@" callback in setIdentity %@ " , params);
122+ }];
121123}
122124- (IBAction )logoutWithCallback {
123125 Branch *branch = [Branch getInstance ];
You can’t perform that action at this time.
0 commit comments