BuddyBuildSDK.h 5.3 KB
Newer Older
buddybuild's avatar
buddybuild committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
//  Copyright (c) 2015 Doe Pics Hit, Inc. All rights reserved.

#import <Foundation/Foundation.h>
#import <UIKit/UIApplication.h>

typedef NSString*(^BBReturnNSStringCallback)(void);
typedef BOOL (^BBReturnBooleanCallback)(void);
typedef void (^BBCallback)(void);

@interface BuddyBuildSDK : NSObject

// Deprecated
+ (void)setup:(id<UIApplicationDelegate>)bbAppDelegate;

/**
 * Initialize the SDK
 *
 * This should be called at (or near) the start of the appdelegate
 */
+ (void)setup;

/*
 * Associate arbitrary key/value pairs with your crash reports and user feedback
 * which will be visible from the buddybuild dashboard
 */
+ (void)setMetadataObject:(id)object forKey:(NSString*)key;

/*
 * Programatically trigger the screenshot feedback UI without pressing the screenshot buttons
 * If you have screenshot feedback disabled through the buddybuild setting,
 * you can still trigger it by calling this method
 */

+ (void)takeScreenshotAndShowFeedbackScreen;

/*
 * If you distribute a build to someone with their email address, buddybuild can
 * figure out who they are and attach their info to feedback and crash reports.
 *
 * However, if you send out a build to a mailing list, or through TestFlight or
 * the App Store we are unable to infer who they are. If you see 'Unknown User'
 * this is likely the cause.
 
 * Often you'll know the identity of your user, for example, after they've
 * logged in. You can provide buddybuild a callback to identify the current user.
 */

+ (void)setUserDisplayNameCallback:(BBReturnNSStringCallback)bbCallback;

/*
 * You might have API keys and other secrets that your app needs to consume.
 * However, you may not want to check these secrets into the source code.
 *
 * You can provide your secrets to buddybuild. Buddybuild can then expose them
 * to you at build time through environment variables. These secrets can also be
 * configured to be included into built app. We obfuscate the device keys to
 * prevent unauthorized access.
 */
+ (NSString*)valueForDeviceKey:(NSString*)bbKey;

/*
 * To temporarily disable screenshot interception you can provide a callback
 * here.
 *
 * When screenshotting is turned on through a buddybuild setting, and no
 * callback is provided then screenshotting is by default on.
 *
 * If screenshotting is disabled through the buddybuild setting, then this
 * callback has no effect
 *
 */
+ (void)setScreenshotAllowedCallback:(BBReturnBooleanCallback)bbCallback;

/*
 * Once a piece of feedback is sent this callback will be called
 * so you can take additional actions if necessary
 */
+ (void)setScreenshotFeedbackSentCallback:(BBCallback)bbCallback;

/*
 * Once a crash report is sent this callback will be called
 * so you can take additional actions if necessary
 */
+ (void)setCrashReportSentCallback:(BBCallback)bbCallback;

/*
 * Buddybuild Build Number
 */
+ (NSString*)buildNumber;

/*
 * Scheme
 */
+ (NSString*)scheme;

/*
 * App ID
 */
+ (NSString*)appID;

/*
 * Build ID
 */
+ (NSString*)buildID;

/*
 * Build Configuration
 */

+ (NSString*)buildConfiguration;

/*
 * Branch name for this build
 */

+ (NSString*)branchName;

/* Manually invoke the screenshot tutorial
 * If you don't want it to appear on app launch, disable it in the
 * dashboard by going to settings -> buddybuildSDK -> Feature Settings and turning off the screenshot tutorial
 * You will be able to show it at any time from anywhere in your app
 */
+ (void)showScreenshotTutorial;


+ (void)crash;

/*
 * Logs to the console only while the debugger is attached (when running in Xcode)
 * They can be downloaded in crash instances and feedbacks in the dashboard
 */
+ (void)log:(NSString *)message;

/*
 * Starts recording video when running a UI test case.
 * Should be called after each "[[[XCUIApplication alloc] init] launch];" in your UI tests codebase.
 * Only run in buddybuild while the UI tests run. It will not run locally, on real iOS devices or on TestFlight and App Store installs.
 */
+ (void)startUITests;

/*
 * Stops recording video at the end of a UI test case.
 * Should be called before each "[super tearDown];" in your UI tests codebase.
 * Only run in buddybuild while the UI tests run. It will not run locally, on real iOS devices or on TestFlight and App Store installs.
 
 */
+ (void)stopUITests;

/*
 * Should be called in your app delegate in -[UIApplication application:didReceiveRemoteNotification:fetchCompletionHandler].
 * Only run in buddybuild while the UI tests run. It will not run locally, on real iOS devices or on TestFlight and App Store installs.
 */
+ (void)uiTestsDidReceiveRemoteNotification:(NSDictionary *)userInfo;

/*
 * DEPRECATED IN SDK 1.0.16+, use setMetadataObject:forKey:
 */
+ (void)setCrashMetadataObject:(id)object forKey:(NSString*)key __deprecated_msg("Use setMetadataObject:forKey: instead");

/*
 * DEPRECATED IN SDK 1.0.17+
 */
+ (NSString*)userEmail __deprecated_msg("No longer available");


@end

@interface UIView (BuddyBuildSDK)

// Certain features of buddybuild involve capturing the screen (either through a static screenshot, or as a video for instant replays in crash reporting or video feedback.
// Your app may contain certain sensitive customer information that you do not want to be included in the video.
// If you set this property to be true, this view will be redacted from the screen capture and blacked out

@property (nonatomic, assign) BOOL buddybuildViewIsPrivate;

@end