-
Notifications
You must be signed in to change notification settings - Fork 145
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
updated 2.1.4 with Fabric Answers integration code for iOS
- Loading branch information
Showing
32 changed files
with
779 additions
and
120 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,21 @@ | ||
// | ||
// BNCCallbacks.h | ||
// Branch-TestBed | ||
// | ||
// Created by Ahmed Nawar on 6/18/16. | ||
// Copyright © 2016 Branch Metrics. All rights reserved. | ||
// | ||
|
||
#ifndef BNCCallbacks_h | ||
#define BNCCallbacks_h | ||
|
||
@class BranchUniversalObject, BranchLinkProperties; | ||
|
||
typedef void (^callbackWithParams) (NSDictionary *params, NSError *error); | ||
typedef void (^callbackWithUrl) (NSString *url, NSError *error); | ||
typedef void (^callbackWithStatus) (BOOL changed, NSError *error); | ||
typedef void (^callbackWithList) (NSArray *list, NSError *error); | ||
typedef void (^callbackWithUrlAndSpotlightIdentifier) (NSString *url, NSString *spotlightIdentifier, NSError *error); | ||
typedef void (^callbackWithBranchUniversalObject) (BranchUniversalObject *universalObject, BranchLinkProperties *linkProperties, NSError *error); | ||
|
||
#endif /* BNCCallbacks_h */ |
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,16 @@ | ||
// | ||
// BNCFabricAnswers.h | ||
// Branch-TestBed | ||
// | ||
// Created by Ahmed Nawar on 6/2/16. | ||
// Copyright © 2016 Branch Metrics. All rights reserved. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
|
||
@interface BNCFabricAnswers : NSObject | ||
|
||
+ (void)sendEventWithName:(NSString*)name andAttributes:(NSDictionary*)attributes; | ||
+ (NSDictionary *)prepareBranchDataForAnswers:(NSDictionary *)dictionary; | ||
|
||
@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,51 @@ | ||
// | ||
// BNCFabricAnswers.m | ||
// Branch-TestBed | ||
// | ||
// Created by Ahmed Nawar on 6/2/16. | ||
// Copyright © 2016 Branch Metrics. All rights reserved. | ||
// | ||
|
||
#import "BNCFabricAnswers.h" | ||
#import "BNCPreferenceHelper.h" | ||
#import "../Fabric/Answers.h" | ||
|
||
@implementation BNCFabricAnswers | ||
|
||
+ (void)sendEventWithName:(NSString *)name andAttributes:(NSDictionary *)attributes { | ||
ANSLogCustomEvent(name, [self prepareBranchDataForAnswers:attributes]); | ||
} | ||
|
||
+ (NSDictionary *)prepareBranchDataForAnswers:(NSDictionary *)dictionary { | ||
NSMutableDictionary *temp = [[NSMutableDictionary alloc] init]; | ||
|
||
for (NSString *key in dictionary.allKeys) { | ||
if ([key hasPrefix:@"+"] || ([key hasPrefix:@"$"] && ![key isEqualToString:@"$identity_id"])) { | ||
// ignore because this data is not found on the ShareSheet | ||
continue; | ||
} else if ([dictionary[key] isKindOfClass:[NSArray class]]) { | ||
// flatten arrays, special treatement for ~tags | ||
NSString *aKey; | ||
if ([key hasPrefix:@"~"]) | ||
aKey = [key substringFromIndex:1]; | ||
else | ||
aKey = key; | ||
NSArray *valuesArray = dictionary[key]; | ||
for (NSUInteger i = 0; i < valuesArray.count; ++i) { | ||
temp[[NSString stringWithFormat:@"%@.%lu", aKey, (unsigned long)i]] = valuesArray[i]; | ||
} | ||
} else if ([key hasPrefix:@"~"]) { | ||
// strip tildes ~ | ||
temp[[key substringFromIndex:1]] = dictionary[key]; | ||
} else if ([key isEqualToString:@"$identity_id"]) { | ||
temp[@"referring_branch_identity"] = dictionary[key]; | ||
} | ||
} | ||
|
||
BNCPreferenceHelper *preferenceHelper = [BNCPreferenceHelper preferenceHelper]; | ||
temp[@"branch_identity"] = preferenceHelper.identityID; | ||
|
||
return temp; | ||
} | ||
|
||
@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 was deleted.
Oops, something went wrong.
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.