File tree Expand file tree Collapse file tree 4 files changed +19
-4
lines changed
Branch-TestBed/Branch-TestBed Expand file tree Collapse file tree 4 files changed +19
-4
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 @@ -114,7 +114,7 @@ - (void)processResponse:(BNCServerResponse *)response error:(NSError *)error {
114114 NSDictionary *sessionDataDict = [BNCEncodingUtils decodeJsonStringToDictionary: sessionData];
115115 BOOL dataIsFromALinkClick = [sessionDataDict[BRANCH_RESPONSE_KEY_CLICKED_BRANCH_LINK] isEqual: @1 ];
116116
117- BOOL storedParamsAreEmpty = NO ;
117+ BOOL storedParamsAreEmpty = YES ;
118118 if ([preferenceHelper.installParams isKindOfClass: [NSString class ]]) {
119119 storedParamsAreEmpty = !preferenceHelper.installParams .length ;
120120 }
Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
3737
3838 [branch registerDeepLinkController: controller forKey: @" gravatar_email" ];
3939
40- [branch initSessionWithLaunchOptions: launchOptions automaticallyDisplayDeepLinkController :YES deepLinkHandler : ^(NSDictionary *params, NSError *error) {
40+ [branch initSessionWithLaunchOptions: launchOptions isReferrable :YES andRegisterDeepLinkHandler : ^(NSDictionary *params, NSError *error) {
4141 if (!error) {
4242 NSLog (@" finished init with params = %@ " , [params description ]);
4343 }
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