react-native-gleapsdk 6.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +27 -0
- package/android/build.gradle +61 -0
- package/android/src/main/AndroidManifest.xml +4 -0
- package/android/src/main/java/com/reactnativegleapsdk/GleapUtil.java +66 -0
- package/android/src/main/java/com/reactnativegleapsdk/GleapsdkModule.java +450 -0
- package/android/src/main/java/com/reactnativegleapsdk/GleapsdkPackage.java +28 -0
- package/ios/Gleapsdk.h +7 -0
- package/ios/Gleapsdk.m +229 -0
- package/ios/Gleapsdk.xcodeproj/project.pbxproj +282 -0
- package/lib/commonjs/index.js +96 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/networklogger.js +274 -0
- package/lib/commonjs/networklogger.js.map +1 -0
- package/lib/module/index.js +84 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/networklogger.js +266 -0
- package/lib/module/networklogger.js.map +1 -0
- package/lib/typescript/index.d.ts +28 -0
- package/lib/typescript/networklogger.d.ts +14 -0
- package/package.json +147 -0
- package/react-native-gleapsdk.podspec +20 -0
- package/src/index.tsx +115 -0
- package/src/networklogger.ts +292 -0
package/ios/Gleapsdk.m
ADDED
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
#import "Gleapsdk.h"
|
|
2
|
+
|
|
3
|
+
#import <React/RCTEventDispatcher.h>
|
|
4
|
+
#import <React/RCTLog.h>
|
|
5
|
+
#import <React/RCTUtils.h>
|
|
6
|
+
|
|
7
|
+
static NSString *const RCTShowDevMenuNotification = @"RCTShowDevMenuNotification";
|
|
8
|
+
|
|
9
|
+
#if !RCT_DEV
|
|
10
|
+
|
|
11
|
+
@implementation UIWindow (RNShakeEvent)
|
|
12
|
+
|
|
13
|
+
- (void)handleShakeEvent:(__unused UIEventSubtype)motion withEvent:(UIEvent *)event
|
|
14
|
+
{
|
|
15
|
+
if (event.subtype == UIEventSubtypeMotionShake) {
|
|
16
|
+
[[NSNotificationCenter defaultCenter] postNotificationName: RCTShowDevMenuNotification object:nil];
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
@end
|
|
21
|
+
|
|
22
|
+
#endif
|
|
23
|
+
|
|
24
|
+
@implementation Gleapsdk
|
|
25
|
+
{
|
|
26
|
+
BOOL _hasListeners;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
RCT_EXPORT_MODULE()
|
|
30
|
+
|
|
31
|
+
- (void)initSDK {
|
|
32
|
+
Gleap.sharedInstance.delegate = self;
|
|
33
|
+
[Gleap setApplicationType: REACTNATIVE];
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
RCT_EXPORT_METHOD(initialize:(NSString *)token)
|
|
37
|
+
{
|
|
38
|
+
[self initSDK];
|
|
39
|
+
[Gleap initializeWithToken: token];
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
- (void)configLoaded:(NSDictionary *)config {
|
|
43
|
+
if ([config objectForKey: @"activationMethodShake"] != nil && [[config objectForKey: @"activationMethodShake"] boolValue] == YES) {
|
|
44
|
+
[[NSNotificationCenter defaultCenter] addObserver: self
|
|
45
|
+
selector: @selector(motionEnded:)
|
|
46
|
+
name: RCTShowDevMenuNotification
|
|
47
|
+
object: nil];
|
|
48
|
+
|
|
49
|
+
#if !RCT_DEV
|
|
50
|
+
RCTSwapInstanceMethods([UIWindow class], @selector(motionEnded:withEvent:), @selector(handleShakeEvent:withEvent:));
|
|
51
|
+
#endif
|
|
52
|
+
}
|
|
53
|
+
if ([config objectForKey: @"activationMethodScreenshotGesture"] != nil && [[config objectForKey: @"activationMethodScreenshotGesture"] boolValue] == YES) {
|
|
54
|
+
NSOperationQueue *mainQueue = [NSOperationQueue mainQueue];
|
|
55
|
+
[[NSNotificationCenter defaultCenter] addObserverForName:UIApplicationUserDidTakeScreenshotNotification
|
|
56
|
+
object:nil
|
|
57
|
+
queue:mainQueue
|
|
58
|
+
usingBlock:^(NSNotification *note) {
|
|
59
|
+
[Gleap startFeedbackFlow];
|
|
60
|
+
}];
|
|
61
|
+
}
|
|
62
|
+
if ([config objectForKey: @"activationMethodThreeFingerDoubleTab"] != nil && [[config objectForKey: @"activationMethodThreeFingerDoubleTab"] boolValue] == YES) {
|
|
63
|
+
[self initializeGestureRecognizer];
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if (_hasListeners) {
|
|
67
|
+
[self sendEventWithName:@"configLoaded" body: config];
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
- (void)initializeGestureRecognizer {
|
|
72
|
+
UITapGestureRecognizer *tapGestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget: self action: @selector(handleTapGestureActivation:)];
|
|
73
|
+
tapGestureRecognizer.numberOfTapsRequired = 2;
|
|
74
|
+
tapGestureRecognizer.numberOfTouchesRequired = 3;
|
|
75
|
+
tapGestureRecognizer.cancelsTouchesInView = false;
|
|
76
|
+
|
|
77
|
+
[[[[UIApplication sharedApplication] delegate] window] addGestureRecognizer: tapGestureRecognizer];
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
- (void)handleTapGestureActivation: (UITapGestureRecognizer *)recognizer
|
|
81
|
+
{
|
|
82
|
+
[Gleap startFeedbackFlow];
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
- (void)motionEnded:(NSNotification *)notification
|
|
86
|
+
{
|
|
87
|
+
[Gleap startFeedbackFlow];
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
- (void)feedbackWillBeSent {
|
|
91
|
+
if (_hasListeners) {
|
|
92
|
+
[self sendEventWithName:@"feedbackWillBeSent" body:@{}];
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
- (void)feedbackSendingFailed {
|
|
97
|
+
if (_hasListeners) {
|
|
98
|
+
[self sendEventWithName:@"feedbackSendingFailed" body:@{}];
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
- (void)feedbackSent {
|
|
103
|
+
if (_hasListeners) {
|
|
104
|
+
[self sendEventWithName:@"feedbackSent" body:@{}];
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
- (void)customActionCalled:(NSString *)customAction {
|
|
109
|
+
if (_hasListeners) {
|
|
110
|
+
[self sendEventWithName:@"customActionTriggered" body:@{
|
|
111
|
+
@"name": customAction
|
|
112
|
+
}];
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
- (void)startObserving
|
|
117
|
+
{
|
|
118
|
+
_hasListeners = YES;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
- (void)stopObserving
|
|
122
|
+
{
|
|
123
|
+
_hasListeners = NO;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
- (NSArray<NSString *> *)supportedEvents {
|
|
127
|
+
return @[@"feedbackSent", @"feedbackWillBeSent", @"feedbackSendingFailed", @"configLoaded", @"customActionTriggered"];
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
RCT_EXPORT_METHOD(sendSilentBugReport:(NSString *)description andSeverity:(NSString *)priority)
|
|
131
|
+
{
|
|
132
|
+
GleapBugSeverity prio = MEDIUM;
|
|
133
|
+
if ([priority isEqualToString: @"LOW"]) {
|
|
134
|
+
prio = LOW;
|
|
135
|
+
}
|
|
136
|
+
if ([priority isEqualToString: @"HIGH"]) {
|
|
137
|
+
prio = HIGH;
|
|
138
|
+
}
|
|
139
|
+
[Gleap sendSilentBugReportWith: description andSeverity: prio];
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
RCT_EXPORT_METHOD(attachNetworkLog:(NSArray *)networkLogs)
|
|
143
|
+
{
|
|
144
|
+
[Gleap attachData: @{ @"networkLogs": networkLogs }];
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
RCT_EXPORT_METHOD(startFeedbackFlow)
|
|
148
|
+
{
|
|
149
|
+
[Gleap startFeedbackFlow];
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
RCT_EXPORT_METHOD(setLanguage:(NSString *)language)
|
|
153
|
+
{
|
|
154
|
+
[Gleap setLanguage: language];
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
RCT_EXPORT_METHOD(clearIdentity)
|
|
158
|
+
{
|
|
159
|
+
[Gleap clearIdentity];
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
RCT_EXPORT_METHOD(identify:(NSString *)userId withUserProperties: (NSDictionary *)userProperties)
|
|
163
|
+
{
|
|
164
|
+
GleapUserProperty *userProperty = [[GleapUserProperty alloc] init];
|
|
165
|
+
if (userProperties != nil && [userProperties objectForKey: @"name"] != nil) {
|
|
166
|
+
userProperty.name = [userProperties objectForKey: @"name"];
|
|
167
|
+
}
|
|
168
|
+
if (userProperties != nil && [userProperties objectForKey: @"email"] != nil) {
|
|
169
|
+
userProperty.email = [userProperties objectForKey: @"email"];
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
NSLog(@"identifying user... %@", userId);
|
|
173
|
+
NSLog(@"%@", userProperty);
|
|
174
|
+
|
|
175
|
+
[Gleap identifyUserWith: userId andData: userProperty];
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
RCT_EXPORT_METHOD(attachCustomData:(NSDictionary *)customData)
|
|
179
|
+
{
|
|
180
|
+
[Gleap attachCustomData: customData];
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
RCT_EXPORT_METHOD(setCustomData:(NSString *)key andData:(NSString *)value)
|
|
184
|
+
{
|
|
185
|
+
[Gleap setCustomData: value forKey: key];
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
RCT_EXPORT_METHOD(removeCustomDataForKey:(NSString *)key)
|
|
189
|
+
{
|
|
190
|
+
[Gleap removeCustomDataForKey: key];
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
RCT_EXPORT_METHOD(clearCustomData)
|
|
194
|
+
{
|
|
195
|
+
[Gleap clearCustomData];
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
RCT_EXPORT_METHOD(setApiUrl: (NSString *)apiUrl)
|
|
199
|
+
{
|
|
200
|
+
[Gleap setApiUrl: apiUrl];
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
RCT_EXPORT_METHOD(setWidgetUrl: (NSString *)apiUrl)
|
|
204
|
+
{
|
|
205
|
+
[Gleap setWidgetUrl: apiUrl];
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
RCT_EXPORT_METHOD(logEvent:(NSString *)name andData:(NSDictionary *)data)
|
|
209
|
+
{
|
|
210
|
+
[Gleap logEvent: name withData: data];
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
RCT_EXPORT_METHOD(removeAllAttachments)
|
|
214
|
+
{
|
|
215
|
+
[Gleap removeAllAttachments];
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
RCT_EXPORT_METHOD(addAttachment:(NSString *)base64file withFileName:(NSString *)fileName)
|
|
219
|
+
{
|
|
220
|
+
NSArray *dataParts = [base64file componentsSeparatedByString: @";base64,"];
|
|
221
|
+
NSData *fileData = [[NSData alloc] initWithBase64EncodedString: [dataParts lastObject] options:0];
|
|
222
|
+
if (fileData != nil) {
|
|
223
|
+
[Gleap addAttachmentWithData: fileData andName: fileName];
|
|
224
|
+
} else {
|
|
225
|
+
NSLog(@"[Gleap]: Invalid base64 string passed.");
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
@end
|
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
// !$*UTF8*$!
|
|
2
|
+
{
|
|
3
|
+
archiveVersion = 1;
|
|
4
|
+
classes = {
|
|
5
|
+
};
|
|
6
|
+
objectVersion = 46;
|
|
7
|
+
objects = {
|
|
8
|
+
|
|
9
|
+
/* Begin PBXBuildFile section */
|
|
10
|
+
|
|
11
|
+
5E555C0D2413F4C50049A1A2 /* Gleapsdk.m in Sources */ = {isa = PBXBuildFile; fileRef = B3E7B5891CC2AC0600A0062D /* Gleapsdk.m */; };
|
|
12
|
+
|
|
13
|
+
/* End PBXBuildFile section */
|
|
14
|
+
|
|
15
|
+
/* Begin PBXCopyFilesBuildPhase section */
|
|
16
|
+
58B511D91A9E6C8500147676 /* CopyFiles */ = {
|
|
17
|
+
isa = PBXCopyFilesBuildPhase;
|
|
18
|
+
buildActionMask = 2147483647;
|
|
19
|
+
dstPath = "include/$(PRODUCT_NAME)";
|
|
20
|
+
dstSubfolderSpec = 16;
|
|
21
|
+
files = (
|
|
22
|
+
);
|
|
23
|
+
runOnlyForDeploymentPostprocessing = 0;
|
|
24
|
+
};
|
|
25
|
+
/* End PBXCopyFilesBuildPhase section */
|
|
26
|
+
|
|
27
|
+
/* Begin PBXFileReference section */
|
|
28
|
+
134814201AA4EA6300B7C361 /* libGleapsdk.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libGleapsdk.a; sourceTree = BUILT_PRODUCTS_DIR; };
|
|
29
|
+
|
|
30
|
+
B3E7B5881CC2AC0600A0062D /* Gleapsdk.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Gleapsdk.h; sourceTree = "<group>"; };
|
|
31
|
+
B3E7B5891CC2AC0600A0062D /* Gleapsdk.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Gleapsdk.m; sourceTree = "<group>"; };
|
|
32
|
+
|
|
33
|
+
/* End PBXFileReference section */
|
|
34
|
+
|
|
35
|
+
/* Begin PBXFrameworksBuildPhase section */
|
|
36
|
+
58B511D81A9E6C8500147676 /* Frameworks */ = {
|
|
37
|
+
isa = PBXFrameworksBuildPhase;
|
|
38
|
+
buildActionMask = 2147483647;
|
|
39
|
+
files = (
|
|
40
|
+
);
|
|
41
|
+
runOnlyForDeploymentPostprocessing = 0;
|
|
42
|
+
};
|
|
43
|
+
/* End PBXFrameworksBuildPhase section */
|
|
44
|
+
|
|
45
|
+
/* Begin PBXGroup section */
|
|
46
|
+
134814211AA4EA7D00B7C361 /* Products */ = {
|
|
47
|
+
isa = PBXGroup;
|
|
48
|
+
children = (
|
|
49
|
+
134814201AA4EA6300B7C361 /* libGleapsdk.a */,
|
|
50
|
+
);
|
|
51
|
+
name = Products;
|
|
52
|
+
sourceTree = "<group>";
|
|
53
|
+
};
|
|
54
|
+
58B511D21A9E6C8500147676 = {
|
|
55
|
+
isa = PBXGroup;
|
|
56
|
+
children = (
|
|
57
|
+
|
|
58
|
+
B3E7B5881CC2AC0600A0062D /* Gleapsdk.h */,
|
|
59
|
+
B3E7B5891CC2AC0600A0062D /* Gleapsdk.m */,
|
|
60
|
+
|
|
61
|
+
134814211AA4EA7D00B7C361 /* Products */,
|
|
62
|
+
);
|
|
63
|
+
sourceTree = "<group>";
|
|
64
|
+
};
|
|
65
|
+
/* End PBXGroup section */
|
|
66
|
+
|
|
67
|
+
/* Begin PBXNativeTarget section */
|
|
68
|
+
58B511DA1A9E6C8500147676 /* Gleapsdk */ = {
|
|
69
|
+
isa = PBXNativeTarget;
|
|
70
|
+
buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "Gleapsdk" */;
|
|
71
|
+
buildPhases = (
|
|
72
|
+
58B511D71A9E6C8500147676 /* Sources */,
|
|
73
|
+
58B511D81A9E6C8500147676 /* Frameworks */,
|
|
74
|
+
58B511D91A9E6C8500147676 /* CopyFiles */,
|
|
75
|
+
);
|
|
76
|
+
buildRules = (
|
|
77
|
+
);
|
|
78
|
+
dependencies = (
|
|
79
|
+
);
|
|
80
|
+
name = Gleapsdk;
|
|
81
|
+
productName = RCTDataManager;
|
|
82
|
+
productReference = 134814201AA4EA6300B7C361 /* libGleapsdk.a */;
|
|
83
|
+
productType = "com.apple.product-type.library.static";
|
|
84
|
+
};
|
|
85
|
+
/* End PBXNativeTarget section */
|
|
86
|
+
|
|
87
|
+
/* Begin PBXProject section */
|
|
88
|
+
58B511D31A9E6C8500147676 /* Project object */ = {
|
|
89
|
+
isa = PBXProject;
|
|
90
|
+
attributes = {
|
|
91
|
+
LastUpgradeCheck = 0920;
|
|
92
|
+
ORGANIZATIONNAME = Facebook;
|
|
93
|
+
TargetAttributes = {
|
|
94
|
+
58B511DA1A9E6C8500147676 = {
|
|
95
|
+
CreatedOnToolsVersion = 6.1.1;
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
buildConfigurationList = 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "Gleapsdk" */;
|
|
100
|
+
compatibilityVersion = "Xcode 3.2";
|
|
101
|
+
developmentRegion = English;
|
|
102
|
+
hasScannedForEncodings = 0;
|
|
103
|
+
knownRegions = (
|
|
104
|
+
English,
|
|
105
|
+
en,
|
|
106
|
+
);
|
|
107
|
+
mainGroup = 58B511D21A9E6C8500147676;
|
|
108
|
+
productRefGroup = 58B511D21A9E6C8500147676;
|
|
109
|
+
projectDirPath = "";
|
|
110
|
+
projectRoot = "";
|
|
111
|
+
targets = (
|
|
112
|
+
58B511DA1A9E6C8500147676 /* Gleapsdk */,
|
|
113
|
+
);
|
|
114
|
+
};
|
|
115
|
+
/* End PBXProject section */
|
|
116
|
+
|
|
117
|
+
/* Begin PBXSourcesBuildPhase section */
|
|
118
|
+
58B511D71A9E6C8500147676 /* Sources */ = {
|
|
119
|
+
isa = PBXSourcesBuildPhase;
|
|
120
|
+
buildActionMask = 2147483647;
|
|
121
|
+
files = (
|
|
122
|
+
|
|
123
|
+
B3E7B58A1CC2AC0600A0062D /* Gleapsdk.m in Sources */,
|
|
124
|
+
|
|
125
|
+
);
|
|
126
|
+
runOnlyForDeploymentPostprocessing = 0;
|
|
127
|
+
};
|
|
128
|
+
/* End PBXSourcesBuildPhase section */
|
|
129
|
+
|
|
130
|
+
/* Begin XCBuildConfiguration section */
|
|
131
|
+
58B511ED1A9E6C8500147676 /* Debug */ = {
|
|
132
|
+
isa = XCBuildConfiguration;
|
|
133
|
+
buildSettings = {
|
|
134
|
+
ALWAYS_SEARCH_USER_PATHS = NO;
|
|
135
|
+
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
|
136
|
+
CLANG_CXX_LIBRARY = "libc++";
|
|
137
|
+
CLANG_ENABLE_MODULES = YES;
|
|
138
|
+
CLANG_ENABLE_OBJC_ARC = YES;
|
|
139
|
+
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
|
140
|
+
CLANG_WARN_BOOL_CONVERSION = YES;
|
|
141
|
+
CLANG_WARN_COMMA = YES;
|
|
142
|
+
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
|
143
|
+
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
|
144
|
+
CLANG_WARN_EMPTY_BODY = YES;
|
|
145
|
+
CLANG_WARN_ENUM_CONVERSION = YES;
|
|
146
|
+
CLANG_WARN_INFINITE_RECURSION = YES;
|
|
147
|
+
CLANG_WARN_INT_CONVERSION = YES;
|
|
148
|
+
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
|
149
|
+
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
|
150
|
+
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
|
151
|
+
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
|
152
|
+
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
|
153
|
+
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
|
154
|
+
CLANG_WARN_UNREACHABLE_CODE = YES;
|
|
155
|
+
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
|
156
|
+
COPY_PHASE_STRIP = NO;
|
|
157
|
+
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
|
158
|
+
ENABLE_TESTABILITY = YES;
|
|
159
|
+
GCC_C_LANGUAGE_STANDARD = gnu99;
|
|
160
|
+
GCC_DYNAMIC_NO_PIC = NO;
|
|
161
|
+
GCC_NO_COMMON_BLOCKS = YES;
|
|
162
|
+
GCC_OPTIMIZATION_LEVEL = 0;
|
|
163
|
+
GCC_PREPROCESSOR_DEFINITIONS = (
|
|
164
|
+
"DEBUG=1",
|
|
165
|
+
"$(inherited)",
|
|
166
|
+
);
|
|
167
|
+
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
|
|
168
|
+
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
|
169
|
+
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
|
170
|
+
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
|
171
|
+
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
|
172
|
+
GCC_WARN_UNUSED_FUNCTION = YES;
|
|
173
|
+
GCC_WARN_UNUSED_VARIABLE = YES;
|
|
174
|
+
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
|
175
|
+
MTL_ENABLE_DEBUG_INFO = YES;
|
|
176
|
+
ONLY_ACTIVE_ARCH = YES;
|
|
177
|
+
SDKROOT = iphoneos;
|
|
178
|
+
};
|
|
179
|
+
name = Debug;
|
|
180
|
+
};
|
|
181
|
+
58B511EE1A9E6C8500147676 /* Release */ = {
|
|
182
|
+
isa = XCBuildConfiguration;
|
|
183
|
+
buildSettings = {
|
|
184
|
+
ALWAYS_SEARCH_USER_PATHS = NO;
|
|
185
|
+
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
|
186
|
+
CLANG_CXX_LIBRARY = "libc++";
|
|
187
|
+
CLANG_ENABLE_MODULES = YES;
|
|
188
|
+
CLANG_ENABLE_OBJC_ARC = YES;
|
|
189
|
+
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
|
190
|
+
CLANG_WARN_BOOL_CONVERSION = YES;
|
|
191
|
+
CLANG_WARN_COMMA = YES;
|
|
192
|
+
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
|
193
|
+
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
|
194
|
+
CLANG_WARN_EMPTY_BODY = YES;
|
|
195
|
+
CLANG_WARN_ENUM_CONVERSION = YES;
|
|
196
|
+
CLANG_WARN_INFINITE_RECURSION = YES;
|
|
197
|
+
CLANG_WARN_INT_CONVERSION = YES;
|
|
198
|
+
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
|
199
|
+
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
|
200
|
+
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
|
201
|
+
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
|
202
|
+
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
|
203
|
+
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
|
204
|
+
CLANG_WARN_UNREACHABLE_CODE = YES;
|
|
205
|
+
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
|
206
|
+
COPY_PHASE_STRIP = YES;
|
|
207
|
+
ENABLE_NS_ASSERTIONS = NO;
|
|
208
|
+
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
|
209
|
+
GCC_C_LANGUAGE_STANDARD = gnu99;
|
|
210
|
+
GCC_NO_COMMON_BLOCKS = YES;
|
|
211
|
+
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
|
212
|
+
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
|
213
|
+
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
|
214
|
+
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
|
215
|
+
GCC_WARN_UNUSED_FUNCTION = YES;
|
|
216
|
+
GCC_WARN_UNUSED_VARIABLE = YES;
|
|
217
|
+
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
|
218
|
+
MTL_ENABLE_DEBUG_INFO = NO;
|
|
219
|
+
SDKROOT = iphoneos;
|
|
220
|
+
VALIDATE_PRODUCT = YES;
|
|
221
|
+
};
|
|
222
|
+
name = Release;
|
|
223
|
+
};
|
|
224
|
+
58B511F01A9E6C8500147676 /* Debug */ = {
|
|
225
|
+
isa = XCBuildConfiguration;
|
|
226
|
+
buildSettings = {
|
|
227
|
+
HEADER_SEARCH_PATHS = (
|
|
228
|
+
"$(inherited)",
|
|
229
|
+
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
|
|
230
|
+
"$(SRCROOT)/../../../React/**",
|
|
231
|
+
"$(SRCROOT)/../../react-native/React/**",
|
|
232
|
+
);
|
|
233
|
+
LIBRARY_SEARCH_PATHS = "$(inherited)";
|
|
234
|
+
OTHER_LDFLAGS = "-ObjC";
|
|
235
|
+
PRODUCT_NAME = Gleapsdk;
|
|
236
|
+
SKIP_INSTALL = YES;
|
|
237
|
+
|
|
238
|
+
};
|
|
239
|
+
name = Debug;
|
|
240
|
+
};
|
|
241
|
+
58B511F11A9E6C8500147676 /* Release */ = {
|
|
242
|
+
isa = XCBuildConfiguration;
|
|
243
|
+
buildSettings = {
|
|
244
|
+
HEADER_SEARCH_PATHS = (
|
|
245
|
+
"$(inherited)",
|
|
246
|
+
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
|
|
247
|
+
"$(SRCROOT)/../../../React/**",
|
|
248
|
+
"$(SRCROOT)/../../react-native/React/**",
|
|
249
|
+
);
|
|
250
|
+
LIBRARY_SEARCH_PATHS = "$(inherited)";
|
|
251
|
+
OTHER_LDFLAGS = "-ObjC";
|
|
252
|
+
PRODUCT_NAME = Gleapsdk;
|
|
253
|
+
SKIP_INSTALL = YES;
|
|
254
|
+
|
|
255
|
+
};
|
|
256
|
+
name = Release;
|
|
257
|
+
};
|
|
258
|
+
/* End XCBuildConfiguration section */
|
|
259
|
+
|
|
260
|
+
/* Begin XCConfigurationList section */
|
|
261
|
+
58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "Gleapsdk" */ = {
|
|
262
|
+
isa = XCConfigurationList;
|
|
263
|
+
buildConfigurations = (
|
|
264
|
+
58B511ED1A9E6C8500147676 /* Debug */,
|
|
265
|
+
58B511EE1A9E6C8500147676 /* Release */,
|
|
266
|
+
);
|
|
267
|
+
defaultConfigurationIsVisible = 0;
|
|
268
|
+
defaultConfigurationName = Release;
|
|
269
|
+
};
|
|
270
|
+
58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "Gleapsdk" */ = {
|
|
271
|
+
isa = XCConfigurationList;
|
|
272
|
+
buildConfigurations = (
|
|
273
|
+
58B511F01A9E6C8500147676 /* Debug */,
|
|
274
|
+
58B511F11A9E6C8500147676 /* Release */,
|
|
275
|
+
);
|
|
276
|
+
defaultConfigurationIsVisible = 0;
|
|
277
|
+
defaultConfigurationName = Release;
|
|
278
|
+
};
|
|
279
|
+
/* End XCConfigurationList section */
|
|
280
|
+
};
|
|
281
|
+
rootObject = 58B511D31A9E6C8500147676 /* Project object */;
|
|
282
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
|
|
10
|
+
var _networklogger = _interopRequireDefault(require("./networklogger"));
|
|
11
|
+
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
+
|
|
14
|
+
const LINKING_ERROR = `The package 'react-native-gleapsdk' doesn't seem to be linked. Make sure: \n\n` + _reactNative.Platform.select({
|
|
15
|
+
ios: "- You have run 'pod install'\n",
|
|
16
|
+
default: ''
|
|
17
|
+
}) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo managed workflow\n';
|
|
18
|
+
const GleapSdk = _reactNative.NativeModules.Gleapsdk ? _reactNative.NativeModules.Gleapsdk : new Proxy({}, {
|
|
19
|
+
get() {
|
|
20
|
+
throw new Error(LINKING_ERROR);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
});
|
|
24
|
+
const networkLogger = new _networklogger.default();
|
|
25
|
+
|
|
26
|
+
GleapSdk.startNetworkLogging = () => {
|
|
27
|
+
networkLogger.start();
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
GleapSdk.stopNetworkLogging = () => {
|
|
31
|
+
networkLogger.setStopped(true);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
if (GleapSdk) {
|
|
35
|
+
var callbacks = [];
|
|
36
|
+
|
|
37
|
+
GleapSdk.registerCustomAction = customActionCallback => {
|
|
38
|
+
callbacks.push(customActionCallback);
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const gleapEmitter = new _reactNative.NativeEventEmitter(GleapSdk);
|
|
42
|
+
gleapEmitter.addListener('configLoaded', config => {
|
|
43
|
+
try {
|
|
44
|
+
const configJSON = JSON.parse(config);
|
|
45
|
+
|
|
46
|
+
if (configJSON.enableNetworkLogs) {
|
|
47
|
+
GleapSdk.startNetworkLogging();
|
|
48
|
+
}
|
|
49
|
+
} catch (exp) {}
|
|
50
|
+
});
|
|
51
|
+
gleapEmitter.addListener('feedbackWillBeSent', () => {
|
|
52
|
+
// Push the network log to the native SDK.
|
|
53
|
+
const requests = networkLogger.getRequests();
|
|
54
|
+
|
|
55
|
+
if (_reactNative.Platform.OS === 'android') {
|
|
56
|
+
GleapSdk.attachNetworkLog(JSON.stringify(requests));
|
|
57
|
+
} else {
|
|
58
|
+
GleapSdk.attachNetworkLog(requests);
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
gleapEmitter.addListener('customActionTriggered', data => {
|
|
62
|
+
try {
|
|
63
|
+
if (isJsonString(data)) {
|
|
64
|
+
data = JSON.parse(data);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const {
|
|
68
|
+
name
|
|
69
|
+
} = data;
|
|
70
|
+
|
|
71
|
+
if (name && callbacks.length > 0) {
|
|
72
|
+
for (var i = 0; i < callbacks.length; i++) {
|
|
73
|
+
if (callbacks[i]) {
|
|
74
|
+
callbacks[i]({
|
|
75
|
+
name
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
} catch (exp) {}
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function isJsonString(str) {
|
|
85
|
+
try {
|
|
86
|
+
JSON.parse(str);
|
|
87
|
+
} catch (e) {
|
|
88
|
+
return false;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
return true;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
var _default = GleapSdk;
|
|
95
|
+
exports.default = _default;
|
|
96
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["index.tsx"],"names":["LINKING_ERROR","Platform","select","ios","default","GleapSdk","NativeModules","Gleapsdk","Proxy","get","Error","networkLogger","GleapNetworkIntercepter","startNetworkLogging","start","stopNetworkLogging","setStopped","callbacks","registerCustomAction","customActionCallback","push","gleapEmitter","NativeEventEmitter","addListener","config","configJSON","JSON","parse","enableNetworkLogs","exp","requests","getRequests","OS","attachNetworkLog","stringify","data","isJsonString","name","length","i","str","e"],"mappings":";;;;;;;AAAA;;AACA;;;;AAEA,MAAMA,aAAa,GAChB,gFAAD,GACAC,sBAASC,MAAT,CAAgB;AAAEC,EAAAA,GAAG,EAAE,gCAAP;AAAyCC,EAAAA,OAAO,EAAE;AAAlD,CAAhB,CADA,GAEA,sDAFA,GAGA,6CAJF;AAqCA,MAAMC,QAAQ,GAAGC,2BAAcC,QAAd,GACbD,2BAAcC,QADD,GAEb,IAAIC,KAAJ,CACE,EADF,EAEE;AACEC,EAAAA,GAAG,GAAG;AACJ,UAAM,IAAIC,KAAJ,CAAUV,aAAV,CAAN;AACD;;AAHH,CAFF,CAFJ;AAUA,MAAMW,aAAa,GAAG,IAAIC,sBAAJ,EAAtB;;AAEAP,QAAQ,CAACQ,mBAAT,GAA+B,MAAM;AACnCF,EAAAA,aAAa,CAACG,KAAd;AACD,CAFD;;AAIAT,QAAQ,CAACU,kBAAT,GAA8B,MAAM;AAClCJ,EAAAA,aAAa,CAACK,UAAd,CAAyB,IAAzB;AACD,CAFD;;AAIA,IAAIX,QAAJ,EAAc;AACZ,MAAIY,SAAgB,GAAG,EAAvB;;AAEAZ,EAAAA,QAAQ,CAACa,oBAAT,GAAiCC,oBAAD,IAA+B;AAC7DF,IAAAA,SAAS,CAACG,IAAV,CAAeD,oBAAf;AACD,GAFD;;AAIA,QAAME,YAAY,GAAG,IAAIC,+BAAJ,CAAuBjB,QAAvB,CAArB;AACAgB,EAAAA,YAAY,CAACE,WAAb,CAAyB,cAAzB,EAA0CC,MAAD,IAAiB;AACxD,QAAI;AACF,YAAMC,UAAU,GAAGC,IAAI,CAACC,KAAL,CAAWH,MAAX,CAAnB;;AACA,UAAIC,UAAU,CAACG,iBAAf,EAAkC;AAChCvB,QAAAA,QAAQ,CAACQ,mBAAT;AACD;AACF,KALD,CAKE,OAAOgB,GAAP,EAAY,CAAE;AACjB,GAPD;AAQAR,EAAAA,YAAY,CAACE,WAAb,CAAyB,oBAAzB,EAA+C,MAAM;AACnD;AACA,UAAMO,QAAQ,GAAGnB,aAAa,CAACoB,WAAd,EAAjB;;AACA,QAAI9B,sBAAS+B,EAAT,KAAgB,SAApB,EAA+B;AAC7B3B,MAAAA,QAAQ,CAAC4B,gBAAT,CAA0BP,IAAI,CAACQ,SAAL,CAAeJ,QAAf,CAA1B;AACD,KAFD,MAEO;AACLzB,MAAAA,QAAQ,CAAC4B,gBAAT,CAA0BH,QAA1B;AACD;AACF,GARD;AAUAT,EAAAA,YAAY,CAACE,WAAb,CAAyB,uBAAzB,EAAmDY,IAAD,IAAe;AAC/D,QAAI;AACF,UAAIC,YAAY,CAACD,IAAD,CAAhB,EAAwB;AACtBA,QAAAA,IAAI,GAAGT,IAAI,CAACC,KAAL,CAAWQ,IAAX,CAAP;AACD;;AACD,YAAM;AAAEE,QAAAA;AAAF,UAAWF,IAAjB;;AACA,UAAIE,IAAI,IAAIpB,SAAS,CAACqB,MAAV,GAAmB,CAA/B,EAAkC;AAChC,aAAK,IAAIC,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGtB,SAAS,CAACqB,MAA9B,EAAsCC,CAAC,EAAvC,EAA2C;AACzC,cAAItB,SAAS,CAACsB,CAAD,CAAb,EAAkB;AAChBtB,YAAAA,SAAS,CAACsB,CAAD,CAAT,CAAa;AACXF,cAAAA;AADW,aAAb;AAGD;AACF;AACF;AACF,KAdD,CAcE,OAAOR,GAAP,EAAY,CAAE;AACjB,GAhBD;AAiBD;;AAED,SAASO,YAAT,CAAsBI,GAAtB,EAAmC;AACjC,MAAI;AACFd,IAAAA,IAAI,CAACC,KAAL,CAAWa,GAAX;AACD,GAFD,CAEE,OAAOC,CAAP,EAAU;AACV,WAAO,KAAP;AACD;;AACD,SAAO,IAAP;AACD;;eAEcpC,Q","sourcesContent":["import { NativeModules, NativeEventEmitter, Platform } from 'react-native';\nimport GleapNetworkIntercepter from './networklogger';\n\nconst LINKING_ERROR =\n `The package 'react-native-gleapsdk' doesn't seem to be linked. Make sure: \\n\\n` +\n Platform.select({ ios: \"- You have run 'pod install'\\n\", default: '' }) +\n '- You rebuilt the app after installing the package\\n' +\n '- You are not using Expo managed workflow\\n';\n\nexport type GleapUserProperty = {\n email?: string;\n name?: string;\n};\n\ntype GleapSdkType = {\n initialize(token: string): void;\n startFeedbackFlow(): void;\n sendSilentBugReport(\n description: string,\n severity: 'LOW' | 'MEDIUM' | 'HIGH'\n ): void;\n identify(userId: string, userProperties: GleapUserProperty): void;\n clearIdentity(): void;\n setApiUrl(apiUrl: string): void;\n setWidgetUrl(widgetUrl: string): void;\n attachCustomData(customData: any): void;\n setCustomData(key: string, value: string): void;\n removeCustomDataForKey(key: string): void;\n clearCustomData(): void;\n registerCustomAction(\n customActionCallback: (data: { name: string }) => void\n ): void;\n setLanguage(language: string): void;\n logEvent(name: string, data: any): void;\n addAttachment(base64file: string, fileName: string): void;\n removeAllAttachments(): void;\n startNetworkLogging(): void;\n stopNetworkLogging(): void;\n};\n\nconst GleapSdk = NativeModules.Gleapsdk\n ? NativeModules.Gleapsdk\n : new Proxy(\n {},\n {\n get() {\n throw new Error(LINKING_ERROR);\n },\n }\n );\nconst networkLogger = new GleapNetworkIntercepter();\n\nGleapSdk.startNetworkLogging = () => {\n networkLogger.start();\n};\n\nGleapSdk.stopNetworkLogging = () => {\n networkLogger.setStopped(true);\n};\n\nif (GleapSdk) {\n var callbacks: any[] = [];\n\n GleapSdk.registerCustomAction = (customActionCallback: any) => {\n callbacks.push(customActionCallback);\n };\n\n const gleapEmitter = new NativeEventEmitter(GleapSdk);\n gleapEmitter.addListener('configLoaded', (config: any) => {\n try {\n const configJSON = JSON.parse(config);\n if (configJSON.enableNetworkLogs) {\n GleapSdk.startNetworkLogging();\n }\n } catch (exp) {}\n });\n gleapEmitter.addListener('feedbackWillBeSent', () => {\n // Push the network log to the native SDK.\n const requests = networkLogger.getRequests();\n if (Platform.OS === 'android') {\n GleapSdk.attachNetworkLog(JSON.stringify(requests));\n } else {\n GleapSdk.attachNetworkLog(requests);\n }\n });\n\n gleapEmitter.addListener('customActionTriggered', (data: any) => {\n try {\n if (isJsonString(data)) {\n data = JSON.parse(data);\n }\n const { name } = data;\n if (name && callbacks.length > 0) {\n for (var i = 0; i < callbacks.length; i++) {\n if (callbacks[i]) {\n callbacks[i]({\n name,\n });\n }\n }\n }\n } catch (exp) {}\n });\n}\n\nfunction isJsonString(str: string) {\n try {\n JSON.parse(str);\n } catch (e) {\n return false;\n }\n return true;\n}\n\nexport default GleapSdk as GleapSdkType;\n"]}
|