@truewatchtech/react-native-mobile 0.4.0-alpha.4 → 0.4.1

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.
Files changed (154) hide show
  1. package/FTMobileReactNativeSDK.podspec +32 -3
  2. package/android/build.gradle +7 -19
  3. package/android/src/main/java/com/ft/sdk/reactnative/FTMobileImpl.java +434 -5
  4. package/android/src/main/java/com/ft/sdk/reactnative/FTRUMImpl.java +12 -0
  5. package/android/src/newarch/java/com/ft/sdk/reactnative/FTLogModule.java +7 -14
  6. package/android/src/newarch/java/com/ft/sdk/reactnative/FTMobileModule.java +46 -12
  7. package/android/src/newarch/java/com/ft/sdk/reactnative/FTRUMModule.java +12 -13
  8. package/android/src/newarch/java/com/ft/sdk/reactnative/FTTraceModule.java +6 -8
  9. package/android/src/oldarch/java/com/ft/sdk/reactnative/FTMobileModule.java +34 -2
  10. package/android/src/rnpost74/java/com/ft/sdk/reactnative/FTMobilePackage.java +14 -3
  11. package/android/src/rnpre74/java/com/ft/sdk/reactnative/FTMobilePackage.java +0 -3
  12. package/ios/FTMobileReactNative.h +9 -5
  13. package/ios/FTMobileReactNative.mm +619 -0
  14. package/ios/FTReactNativeLog.h +8 -3
  15. package/ios/FTReactNativeLog.mm +79 -0
  16. package/ios/FTReactNativeRUM.h +8 -3
  17. package/ios/{FTReactNativeRUM.m → FTReactNativeRUM.mm} +143 -84
  18. package/ios/FTReactNativeTrace.h +8 -2
  19. package/ios/FTReactNativeTrace.mm +74 -0
  20. package/ios/FtMobileAgent.xcodeproj/project.pbxproj +17 -1
  21. package/lib/commonjs/ft_logger.js +14 -13
  22. package/lib/commonjs/ft_logger.js.map +1 -1
  23. package/lib/commonjs/ft_mobile_agent.js +153 -6
  24. package/lib/commonjs/ft_mobile_agent.js.map +1 -1
  25. package/lib/commonjs/ft_rum.js +55 -21
  26. package/lib/commonjs/ft_rum.js.map +1 -1
  27. package/lib/commonjs/ft_tracing.js +29 -10
  28. package/lib/commonjs/ft_tracing.js.map +1 -1
  29. package/lib/commonjs/index.js +24 -13
  30. package/lib/commonjs/index.js.map +1 -1
  31. package/lib/commonjs/rum/FTRumActionTracking.js +10 -4
  32. package/lib/commonjs/rum/FTRumActionTracking.js.map +1 -1
  33. package/lib/commonjs/rum/FTRumErrorTracking.js +4 -4
  34. package/lib/commonjs/rum/FTRumErrorTracking.js.map +1 -1
  35. package/lib/commonjs/specs/NativeFTMobileReactNative.js +10 -0
  36. package/lib/commonjs/specs/NativeFTMobileReactNative.js.map +1 -0
  37. package/lib/commonjs/specs/NativeFTReactNativeLog.js +10 -0
  38. package/lib/commonjs/specs/NativeFTReactNativeLog.js.map +1 -0
  39. package/lib/commonjs/specs/NativeFTReactNativeRUM.js +10 -0
  40. package/lib/commonjs/specs/NativeFTReactNativeRUM.js.map +1 -0
  41. package/lib/commonjs/specs/NativeFTReactNativeTrace.js +10 -0
  42. package/lib/commonjs/specs/NativeFTReactNativeTrace.js.map +1 -0
  43. package/lib/commonjs/version.js +1 -1
  44. package/lib/commonjs/version.js.map +1 -1
  45. package/lib/module/ft_logger.js +14 -12
  46. package/lib/module/ft_logger.js.map +1 -1
  47. package/lib/module/ft_mobile_agent.js +159 -5
  48. package/lib/module/ft_mobile_agent.js.map +1 -1
  49. package/lib/module/ft_rum.js +54 -16
  50. package/lib/module/ft_rum.js.map +1 -1
  51. package/lib/module/ft_tracing.js +29 -9
  52. package/lib/module/ft_tracing.js.map +1 -1
  53. package/lib/module/index.js +3 -4
  54. package/lib/module/index.js.map +1 -1
  55. package/lib/module/rum/FTRumActionTracking.js +10 -4
  56. package/lib/module/rum/FTRumActionTracking.js.map +1 -1
  57. package/lib/module/rum/FTRumErrorTracking.js +4 -4
  58. package/lib/module/rum/FTRumErrorTracking.js.map +1 -1
  59. package/lib/module/specs/NativeFTMobileReactNative.js +5 -0
  60. package/lib/module/specs/NativeFTMobileReactNative.js.map +1 -0
  61. package/lib/module/specs/NativeFTReactNativeLog.js +5 -0
  62. package/lib/module/specs/NativeFTReactNativeLog.js.map +1 -0
  63. package/lib/module/specs/NativeFTReactNativeRUM.js +5 -0
  64. package/lib/module/specs/NativeFTReactNativeRUM.js.map +1 -0
  65. package/lib/module/specs/NativeFTReactNativeTrace.js +5 -0
  66. package/lib/module/specs/NativeFTReactNativeTrace.js.map +1 -0
  67. package/lib/module/version.js +1 -1
  68. package/lib/module/version.js.map +1 -1
  69. package/lib/typescript/ft_logger.d.ts +6 -6
  70. package/lib/typescript/ft_mobile_agent.d.ts +165 -14
  71. package/lib/typescript/ft_rum.d.ts +32 -8
  72. package/lib/typescript/ft_tracing.d.ts +6 -6
  73. package/lib/typescript/index.d.ts +3 -4
  74. package/lib/typescript/specs/NativeFTMobileReactNative.d.ts +75 -0
  75. package/lib/typescript/specs/NativeFTReactNativeLog.d.ts +23 -0
  76. package/lib/typescript/specs/NativeFTReactNativeRUM.d.ts +89 -0
  77. package/lib/typescript/specs/NativeFTReactNativeTrace.d.ts +24 -0
  78. package/lib/typescript/version.d.ts +1 -1
  79. package/package.json +29 -96
  80. package/scripts/replace-react-require.js +37 -38
  81. package/src/ft_logger.tsx +72 -40
  82. package/src/ft_mobile_agent.tsx +374 -91
  83. package/src/ft_rum.tsx +227 -121
  84. package/src/ft_tracing.tsx +58 -37
  85. package/src/index.tsx +58 -18
  86. package/src/rum/FTRumActionTracking.tsx +212 -204
  87. package/src/rum/FTRumErrorTracking.tsx +70 -71
  88. package/src/specs/NativeFTMobileReactNative.ts +83 -0
  89. package/src/specs/NativeFTReactNativeLog.ts +29 -0
  90. package/src/specs/NativeFTReactNativeRUM.ts +104 -0
  91. package/src/specs/NativeFTReactNativeTrace.ts +26 -0
  92. package/src/version.ts +1 -1
  93. package/LICENSE +0 -201
  94. package/android/.project +0 -17
  95. package/android/.settings/org.eclipse.buildship.core.prefs +0 -13
  96. package/android/gradlew +0 -185
  97. package/android/local.properties +0 -8
  98. package/android/src/main/java/com/ft/sdk/InnerClassProxy.java +0 -8
  99. package/android/src/main/java/com/ft/sdk/reactnative/FTSessionReplayImpl.java +0 -60
  100. package/android/src/main/java/com/ft/sdk/reactnative/extensions/ReactDrawablesExt.java +0 -155
  101. package/android/src/main/java/com/ft/sdk/reactnative/sessionreplay/NoopTextPropertiesResolver.java +0 -23
  102. package/android/src/main/java/com/ft/sdk/reactnative/sessionreplay/ReactNativeSessionReplayExtensionSupport.java +0 -57
  103. package/android/src/main/java/com/ft/sdk/reactnative/sessionreplay/ShadowNodeWrapper.java +0 -84
  104. package/android/src/main/java/com/ft/sdk/reactnative/sessionreplay/TextPropertiesResolver.java +0 -20
  105. package/android/src/main/java/com/ft/sdk/reactnative/sessionreplay/mappers/DefaultMapper.java +0 -78
  106. package/android/src/main/java/com/ft/sdk/reactnative/sessionreplay/mappers/Pair.java +0 -11
  107. package/android/src/main/java/com/ft/sdk/reactnative/sessionreplay/mappers/ReactEditTextMapper.java +0 -136
  108. package/android/src/main/java/com/ft/sdk/reactnative/sessionreplay/mappers/ReactNativeImageViewMapper.java +0 -117
  109. package/android/src/main/java/com/ft/sdk/reactnative/sessionreplay/mappers/ReactTextMapper.java +0 -57
  110. package/android/src/main/java/com/ft/sdk/reactnative/sessionreplay/mappers/ReactViewGroupMapper.java +0 -22
  111. package/android/src/main/java/com/ft/sdk/reactnative/sessionreplay/mappers/ReactViewModalMapper.java +0 -21
  112. package/android/src/main/java/com/ft/sdk/reactnative/sessionreplay/resources/ReactDrawableCopier.java +0 -35
  113. package/android/src/main/java/com/ft/sdk/reactnative/sessionreplay/utils/DrawableUtils.java +0 -34
  114. package/android/src/main/java/com/ft/sdk/reactnative/sessionreplay/utils/ReflectionUtils.java +0 -43
  115. package/android/src/main/java/com/ft/sdk/reactnative/sessionreplay/utils/text/FabricTextViewUtils.java +0 -69
  116. package/android/src/main/java/com/ft/sdk/reactnative/sessionreplay/utils/text/LegacyTextViewUtils.java +0 -97
  117. package/android/src/main/java/com/ft/sdk/reactnative/sessionreplay/utils/text/TextViewUtils.java +0 -184
  118. package/android/src/main/java/com/ft/sdk/reactnative/utils/ColorUtils.java +0 -24
  119. package/android/src/newarch/java/com/ft/sdk/reactnative/FTSessionReplayModule.java +0 -30
  120. package/android/src/oldarch/java/com/ft/sdk/reactnative/FTSessionReplayModule.java +0 -25
  121. package/android/src/rn69/java/com/ft/sdk/reactnative/sessionreplay/utils/ReactViewBackgroundDrawableUtils.java +0 -100
  122. package/android/src/rn75/java/com/ft/sdk/reactnative/sessionreplay/extensions/LengthPercentageExt.java +0 -27
  123. package/android/src/rn75/java/com/ft/sdk/reactnative/sessionreplay/utils/ReactViewBackgroundDrawableUtils.java +0 -116
  124. package/android/src/rn76/java/com/ft/sdk/reactnative/sessionreplay/extensions/LengthPercentageExt.java +0 -38
  125. package/android/src/rn76/java/com/ft/sdk/reactnative/sessionreplay/utils/ReactViewBackgroundDrawableUtils.java +0 -117
  126. package/android/src/rn79/java/com/ft/sdk/reactnative/sessionreplay/extensions/LengthPercentageExt.java +0 -38
  127. package/android/src/rn79/java/com/ft/sdk/reactnative/sessionreplay/utils/ReactViewBackgroundDrawableUtils.java +0 -132
  128. package/android/src/rn80/java/com/ft/sdk/reactnative/sessionreplay/extensions/ComputedBorderRadiusExt.java +0 -58
  129. package/android/src/rn80/java/com/ft/sdk/reactnative/sessionreplay/utils/ReactViewBackgroundDrawableUtils.java +0 -190
  130. package/android/src/rnlegacy/java/com/ft/sdk/reactnative/sessionreplay/utils/ReactViewBackgroundDrawableUtils.java +0 -120
  131. package/ios/.idea/.name +0 -1
  132. package/ios/.idea/ios.iml +0 -2
  133. package/ios/.idea/modules.xml +0 -8
  134. package/ios/.idea/vcs.xml +0 -6
  135. package/ios/.idea/xcode.xml +0 -4
  136. package/ios/FTMobileReactNative.m +0 -184
  137. package/ios/FTRCTTextViewRecorder.h +0 -33
  138. package/ios/FTRCTTextViewRecorder.m +0 -120
  139. package/ios/FTReactNativeLog.m +0 -60
  140. package/ios/FTReactNativeSessionReplay.h +0 -6
  141. package/ios/FTReactNativeSessionReplay.mm +0 -44
  142. package/ios/FTReactNativeTrace.m +0 -56
  143. package/ios/FtMobileAgent.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -4
  144. package/ios/FtMobileAgent.xcodeproj/project.xcworkspace/xcuserdata/Brandon.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  145. package/ios/FtMobileAgent.xcodeproj/project.xcworkspace/xcuserdata/Brandon.xcuserdatad/xcschemes/xcschememanagement.plist +0 -5
  146. package/ios/FtMobileAgent.xcodeproj/xcuserdata/Brandon.xcuserdatad/xcschemes/FtMobileAgent.xcscheme +0 -56
  147. package/ios/FtMobileAgent.xcodeproj/xcuserdata/Brandon.xcuserdatad/xcschemes/xcschememanagement.plist +0 -14
  148. package/ios/RCTVersion.h +0 -8
  149. package/lib/commonjs/ft_session_replay.js +0 -34
  150. package/lib/commonjs/ft_session_replay.js.map +0 -1
  151. package/lib/module/ft_session_replay.js +0 -29
  152. package/lib/module/ft_session_replay.js.map +0 -1
  153. package/lib/typescript/ft_session_replay.d.ts +0 -27
  154. package/src/ft_session_replay.tsx +0 -34
@@ -1,58 +0,0 @@
1
- /*
2
- * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
3
- * This product includes software developed at Datadog (https://www.datadoghq.com/).
4
- * Copyright 2016-Present Datadog, Inc.
5
- */
6
- package com.ft.sdk.reactnative.sessionreplay.extensions;
7
-
8
- import com.facebook.react.uimanager.style.ComputedBorderRadius;
9
- import com.facebook.react.uimanager.style.ComputedBorderRadiusProp;
10
- import com.facebook.react.uimanager.style.CornerRadii;
11
-
12
- public final class ComputedBorderRadiusExt {
13
-
14
- private ComputedBorderRadiusExt() {
15
- // Utility class, prevent instantiation
16
- }
17
-
18
- /**
19
- * Gets the average border radius from all four corners of a ComputedBorderRadius.
20
- *
21
- * @param computedBorderRadius the ComputedBorderRadius to calculate average from, can be null
22
- * @return the average border radius value, or 0f if computedBorderRadius is null
23
- */
24
- public static float getAverage(ComputedBorderRadius computedBorderRadius) {
25
- if (computedBorderRadius == null) {
26
- return 0f;
27
- }
28
-
29
- float topRightRadius = getAverageForProp(computedBorderRadius, ComputedBorderRadiusProp.COMPUTED_BORDER_TOP_RIGHT_RADIUS);
30
- float topLeftRadius = getAverageForProp(computedBorderRadius, ComputedBorderRadiusProp.COMPUTED_BORDER_TOP_LEFT_RADIUS);
31
- float bottomRightRadius = getAverageForProp(computedBorderRadius, ComputedBorderRadiusProp.COMPUTED_BORDER_BOTTOM_RIGHT_RADIUS);
32
- float bottomLeftRadius = getAverageForProp(computedBorderRadius, ComputedBorderRadiusProp.COMPUTED_BORDER_BOTTOM_LEFT_RADIUS);
33
-
34
- return (topRightRadius + topLeftRadius + bottomRightRadius + bottomLeftRadius) / 4f;
35
- }
36
-
37
- /**
38
- * Gets the average border radius for a specific property of ComputedBorderRadius.
39
- *
40
- * @param computedBorderRadius the ComputedBorderRadius to get value from, can be null
41
- * @param prop the ComputedBorderRadiusProp to get the average for
42
- * @return the average border radius value for the specified property, or 0f if computedBorderRadius is null
43
- */
44
- public static float getAverageForProp(ComputedBorderRadius computedBorderRadius, ComputedBorderRadiusProp prop) {
45
- if (computedBorderRadius == null) {
46
- return 0f;
47
- }
48
-
49
- CornerRadii borderRadius = computedBorderRadius.get(prop);
50
- if (borderRadius == null) {
51
- return 0f;
52
- }
53
-
54
- float vertical = borderRadius.getVertical();
55
- float horizontal = borderRadius.getHorizontal();
56
- return (vertical + horizontal) / 2f;
57
- }
58
- }
@@ -1,190 +0,0 @@
1
- /*
2
- * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
3
- * This product includes software developed at Datadog (https://www.datadoghq.com/).
4
- * Copyright 2016-Present Datadog, Inc.
5
- */
6
- package com.ft.sdk.reactnative.sessionreplay.utils;
7
-
8
- import android.graphics.Canvas;
9
- import android.graphics.Color;
10
- import android.graphics.ColorFilter;
11
- import android.graphics.PixelFormat;
12
- import android.graphics.drawable.Drawable;
13
- import android.graphics.drawable.InsetDrawable;
14
- import android.graphics.drawable.LayerDrawable;
15
-
16
- import com.ft.sdk.reactnative.sessionreplay.extensions.ComputedBorderRadiusExt;
17
- import com.ft.sdk.reactnative.sessionreplay.mappers.Pair;
18
- import com.ft.sdk.reactnative.utils.ColorUtils;
19
- import com.facebook.react.common.annotations.UnstableReactNativeAPI;
20
- import com.facebook.react.uimanager.Spacing;
21
- import com.facebook.react.uimanager.drawable.CSSBackgroundDrawable;
22
- import com.facebook.react.uimanager.style.ComputedBorderRadius;
23
- import com.ft.sdk.sessionreplay.model.ShapeBorder;
24
- import com.ft.sdk.sessionreplay.model.ShapeStyle;
25
-
26
- public class ReactViewBackgroundDrawableUtils extends DrawableUtils {
27
- private static final String CSS_BACKGROUND_COLOR_FIELD_NAME = "mColor";
28
- private static final String CSS_COMPUTED_BORDER_RADIUS_FIELD_NAME = "mComputedBorderRadius";
29
- private static final String COMPUTED_BORDER_RADIUS_FIELD_NAME = "computedBorderRadius";
30
- private static final String BACKGROUND_COLOR_FIELD_NAME = "backgroundColor";
31
- private final ReflectionUtils reflectionUtils;
32
-
33
-
34
- public ReactViewBackgroundDrawableUtils() {
35
- this(new ReflectionUtils());
36
- }
37
-
38
- public ReactViewBackgroundDrawableUtils(ReflectionUtils reflectionUtils) {
39
- this.reflectionUtils = reflectionUtils;
40
- }
41
-
42
- public static class BackgroundDrawableWrapper extends Drawable {
43
- public final String backgroundColor;
44
- public final float cornerRadius;
45
-
46
- public BackgroundDrawableWrapper(String backgroundColor, float cornerRadius) {
47
- this.backgroundColor = backgroundColor;
48
- this.cornerRadius = cornerRadius;
49
- }
50
-
51
- @Override
52
- public void draw(Canvas canvas) {
53
- }
54
-
55
- @Override
56
- public void setAlpha(int alpha) {
57
- }
58
-
59
- @Override
60
- public void setColorFilter(ColorFilter colorFilter) {
61
- }
62
-
63
- @Override
64
- public int getOpacity() {
65
- return PixelFormat.OPAQUE;
66
- }
67
- }
68
-
69
- @UnstableReactNativeAPI
70
- @Override
71
- public Pair<ShapeStyle, ShapeBorder> resolveShapeAndBorder(
72
- Drawable drawable,
73
- float opacity,
74
- float pixelDensity
75
- ) {
76
- if (drawable instanceof BackgroundDrawableWrapper) {
77
- BackgroundDrawableWrapper wrapper = (BackgroundDrawableWrapper) drawable;
78
- return new Pair<>(
79
- new ShapeStyle(
80
- wrapper.backgroundColor,
81
- opacity,
82
- wrapper.cornerRadius
83
- ),
84
- null
85
- );
86
- } else if (drawable instanceof CSSBackgroundDrawable) {
87
- CSSBackgroundDrawable cssDrawable = (CSSBackgroundDrawable) drawable;
88
- ShapeBorder borderProps = resolveBorder(cssDrawable, pixelDensity);
89
- Integer backgroundColor = getCSSBackgroundColor(cssDrawable);
90
- String colorHexString;
91
- if (backgroundColor != null) {
92
- colorHexString = ColorUtils.formatAsRgba(backgroundColor);
93
- } else {
94
- return new Pair<>(null, borderProps);
95
- }
96
- return new Pair<>(
97
- new ShapeStyle(
98
- colorHexString,
99
- opacity,
100
- getCSSComputedBorderRadius(cssDrawable) != null ? ComputedBorderRadiusExt.getAverage(getCSSComputedBorderRadius(cssDrawable)) : 0f
101
- ),
102
- borderProps
103
- );
104
- }
105
- return new Pair<>(null, null);
106
- }
107
-
108
- @UnstableReactNativeAPI
109
- @Override
110
- public Drawable getReactBackgroundFromDrawable(Drawable drawable) {
111
- if (drawable instanceof CSSBackgroundDrawable) {
112
- return drawable;
113
- } else if (drawable instanceof InsetDrawable) {
114
- return getReactBackgroundFromDrawable(((InsetDrawable) drawable).getDrawable());
115
- } else if (drawable instanceof LayerDrawable) {
116
- return getDrawableFromLayerDrawable((LayerDrawable) drawable);
117
- } else {
118
- return null;
119
- }
120
- }
121
-
122
- @UnstableReactNativeAPI
123
- private Drawable getDrawableFromLayerDrawable(LayerDrawable layerDrawable) {
124
- for (int layerNumber = 0; layerNumber < layerDrawable.getNumberOfLayers(); layerNumber++) {
125
- Drawable layer = layerDrawable.getDrawable(layerNumber);
126
- if (layer instanceof CSSBackgroundDrawable) {
127
- return layer;
128
- } else if (layer != null) {
129
- if (layer.getClass().getName().equals("com.facebook.react.uimanager.drawable.BackgroundDrawable")) {
130
- Integer backgroundColor = getBackgroundColor(layer);
131
- if (backgroundColor == null) backgroundColor = Color.TRANSPARENT;
132
- ComputedBorderRadius borderRadius = getComputedBorderRadius(layer);
133
- float cornerRadius = borderRadius != null ? ComputedBorderRadiusExt.getAverage(borderRadius) : 0f;
134
- return new BackgroundDrawableWrapper(
135
- ColorUtils.formatAsRgba(backgroundColor),
136
- cornerRadius
137
- );
138
- }
139
- }
140
- }
141
- return null;
142
- }
143
-
144
- @UnstableReactNativeAPI
145
- private ComputedBorderRadius getCSSComputedBorderRadius(CSSBackgroundDrawable drawable) {
146
- Object value = reflectionUtils.getDeclaredField(
147
- drawable,
148
- CSS_COMPUTED_BORDER_RADIUS_FIELD_NAME
149
- );
150
- return value instanceof ComputedBorderRadius ? (ComputedBorderRadius) value : null;
151
- }
152
-
153
- private ComputedBorderRadius getComputedBorderRadius(Object drawable) {
154
- Object value = reflectionUtils.getDeclaredField(
155
- drawable,
156
- COMPUTED_BORDER_RADIUS_FIELD_NAME
157
- );
158
- return value instanceof ComputedBorderRadius ? (ComputedBorderRadius) value : null;
159
- }
160
-
161
- @UnstableReactNativeAPI
162
- private Integer getCSSBackgroundColor(CSSBackgroundDrawable backgroundDrawable) {
163
- Object value = reflectionUtils.getDeclaredField(
164
- backgroundDrawable,
165
- CSS_BACKGROUND_COLOR_FIELD_NAME
166
- );
167
- return value instanceof Integer ? (Integer) value : null;
168
- }
169
-
170
- private Integer getBackgroundColor(Object backgroundDrawable) {
171
- Object value = reflectionUtils.getDeclaredField(
172
- backgroundDrawable,
173
- BACKGROUND_COLOR_FIELD_NAME
174
- );
175
- return value instanceof Integer ? (Integer) value : null;
176
- }
177
-
178
- @UnstableReactNativeAPI
179
- private ShapeBorder resolveBorder(
180
- CSSBackgroundDrawable backgroundDrawable,
181
- float pixelDensity
182
- ) {
183
- long borderWidth = (long) (backgroundDrawable.getFullBorderWidth() / pixelDensity);
184
- String borderColor = ColorUtils.formatAsRgba(backgroundDrawable.getBorderColor(Spacing.ALL));
185
- return new ShapeBorder(
186
- borderColor,
187
- borderWidth
188
- );
189
- }
190
- }
@@ -1,120 +0,0 @@
1
- package com.ft.sdk.reactnative.sessionreplay.utils;
2
-
3
- import android.graphics.Color;
4
- import android.graphics.drawable.Drawable;
5
- import android.graphics.drawable.InsetDrawable;
6
- import android.graphics.drawable.LayerDrawable;
7
-
8
- import com.ft.sdk.reactnative.sessionreplay.mappers.Pair;
9
- import com.ft.sdk.reactnative.utils.ColorUtils;
10
- import com.facebook.react.uimanager.Spacing;
11
- import com.facebook.react.views.view.ReactViewBackgroundDrawable;
12
- import com.ft.sdk.sessionreplay.model.ShapeBorder;
13
- import com.ft.sdk.sessionreplay.model.ShapeStyle;
14
-
15
- public class ReactViewBackgroundDrawableUtils extends DrawableUtils {
16
- private static final String COLOR_FIELD_NAME = "mColor";
17
- private static final String BORDER_RGB_FIELD_NAME = "mBorderRGB";
18
- private static final String BORDER_ALPHA_FIELD_NAME = "mBorderAlpha";
19
- private static final int DEFAULT_BORDER_RGB = 0x00FFFFFF & Color.BLACK;
20
- private static final int DEFAULT_BORDER_ALPHA = -0x1000000 & Color.BLACK;
21
- private final ReflectionUtils reflectionUtils;
22
-
23
- public ReactViewBackgroundDrawableUtils() {
24
- this(new ReflectionUtils());
25
- }
26
-
27
- public ReactViewBackgroundDrawableUtils(ReflectionUtils reflectionUtils) {
28
- this.reflectionUtils = reflectionUtils;
29
- }
30
-
31
- @Override
32
- public Pair<ShapeStyle, ShapeBorder> resolveShapeAndBorder(
33
- Drawable drawable,
34
- float opacity,
35
- float pixelDensity
36
- ) {
37
- if (!(drawable instanceof ReactViewBackgroundDrawable)) {
38
- return new Pair<>(null, null);
39
- }
40
- ReactViewBackgroundDrawable bgDrawable = (ReactViewBackgroundDrawable) drawable;
41
- ShapeBorder borderProps = resolveBorder(bgDrawable, pixelDensity);
42
- long cornerRadius = (long) (bgDrawable.getFullBorderRadius() / pixelDensity);
43
- Integer backgroundColor = getBackgroundColor(bgDrawable);
44
- String colorHexString;
45
- if (backgroundColor != null) {
46
- colorHexString = ColorUtils.formatAsRgba(backgroundColor);
47
- } else {
48
- return new Pair<>(null, borderProps);
49
- }
50
- return new Pair<>(
51
- new ShapeStyle(
52
- colorHexString,
53
- opacity,
54
- cornerRadius
55
- ),
56
- borderProps
57
- );
58
- }
59
-
60
- @Override
61
- public Drawable getReactBackgroundFromDrawable(Drawable drawable) {
62
- if (drawable instanceof ReactViewBackgroundDrawable) {
63
- return drawable;
64
- } else if (drawable instanceof InsetDrawable) {
65
- return getReactBackgroundFromDrawable(((InsetDrawable) drawable).getDrawable());
66
- } else if (drawable instanceof LayerDrawable) {
67
- return getDrawableFromLayerDrawable((LayerDrawable) drawable);
68
- } else {
69
- return null;
70
- }
71
- }
72
-
73
- private Drawable getDrawableFromLayerDrawable(LayerDrawable layerDrawable) {
74
- for (int layerNumber = 0; layerNumber < layerDrawable.getNumberOfLayers(); layerNumber++) {
75
- Drawable layer = layerDrawable.getDrawable(layerNumber);
76
- if (layer instanceof ReactViewBackgroundDrawable) {
77
- return layer;
78
- }
79
- }
80
- return null;
81
- }
82
-
83
- private ShapeBorder resolveBorder(
84
- ReactViewBackgroundDrawable backgroundDrawable,
85
- float pixelDensity
86
- ) {
87
- long borderWidth = (long) (backgroundDrawable.getFullBorderWidth() / pixelDensity);
88
- int borderColorInt = getBorderColor(backgroundDrawable);
89
- String borderColor = ColorUtils.formatAsRgba(borderColorInt);
90
- return new ShapeBorder(
91
- borderColor,
92
- borderWidth
93
- );
94
- }
95
-
96
- private int getBorderColor(ReactViewBackgroundDrawable backgroundDrawable) {
97
- Spacing borderRgb = (Spacing) reflectionUtils.getDeclaredField(
98
- backgroundDrawable,
99
- BORDER_RGB_FIELD_NAME
100
- );
101
- Spacing borderAlpha = (Spacing) reflectionUtils.getDeclaredField(
102
- backgroundDrawable,
103
- BORDER_ALPHA_FIELD_NAME
104
- );
105
- float rgb = borderRgb != null ? borderRgb.get(Spacing.ALL) : DEFAULT_BORDER_RGB;
106
- float alpha = borderAlpha != null ? borderAlpha.get(Spacing.ALL) : DEFAULT_BORDER_ALPHA;
107
- int rgbComponent = 0x00FFFFFF & (int) rgb;
108
- int alphaComponent = -0x1000000 & ((int) alpha << 24);
109
- return rgbComponent | alphaComponent;
110
- }
111
-
112
- private Integer getBackgroundColor(ReactViewBackgroundDrawable backgroundDrawable) {
113
- Object value = reflectionUtils.getDeclaredField(
114
- backgroundDrawable,
115
- COLOR_FIELD_NAME
116
- );
117
- return value instanceof Integer ? (Integer) value : null;
118
- }
119
-
120
- }
package/ios/.idea/.name DELETED
@@ -1 +0,0 @@
1
- FtMobileAgent
package/ios/.idea/ios.iml DELETED
@@ -1,2 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <module classpath="AppCode" type="CIDR_MODULE" version="4" />
@@ -1,8 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="ProjectModuleManager">
4
- <modules>
5
- <module fileurl="file://$PROJECT_DIR$/.idea/ios.iml" filepath="$PROJECT_DIR$/.idea/ios.iml" />
6
- </modules>
7
- </component>
8
- </project>
package/ios/.idea/vcs.xml DELETED
@@ -1,6 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="VcsDirectoryMappings">
4
- <mapping directory="$PROJECT_DIR$/.." vcs="Git" />
5
- </component>
6
- </project>
@@ -1,4 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="XcodeMetaData" PROJECT_DIR="$PROJECT_DIR$" PROJECT_FILE="$PROJECT_DIR$/FtMobileAgent.xcodeproj" />
4
- </project>
@@ -1,184 +0,0 @@
1
- //
2
- // FTMobileReactNative.m
3
- // FtMobileAgent
4
- //
5
- // Created by Hu Leilei on 2021/12/14.
6
- // Copyright © 2021 Facebook. All rights reserved.
7
- //
8
-
9
- #import "FTMobileReactNative.h"
10
- #import <FTMobileSDK/FTMobileAgent.h>
11
- #import <FTMobileSDK/FTMobileConfig+Private.h>
12
- #import <React/RCTConvert.h>
13
- #import <FTMobileSDK/FTThreadDispatchManager.h>
14
- #import <FTMobileSDK/FTConstants.h>
15
- @implementation FTMobileReactNative
16
- RCT_EXPORT_MODULE()
17
- RCT_REMAP_METHOD(sdkConfig,
18
- context:(NSDictionary *)context
19
- findEventsWithResolver:(RCTPromiseResolveBlock)resolve
20
- rejecter:(RCTPromiseRejectBlock)reject)
21
- {
22
- [FTThreadDispatchManager performBlockDispatchMainSyncSafe:^{
23
- FTMobileConfig *config;
24
- NSString *datakitUrl = [RCTConvert NSString:context[@"datakitUrl"]];
25
- NSString *dataWayUrl = [RCTConvert NSString:context[@"datawayUrl"]];
26
- NSString *clientToken = [RCTConvert NSString:context[@"clientToken"]];
27
- if(dataWayUrl && dataWayUrl.length>0 && clientToken && clientToken.length>0){
28
- config = [[FTMobileConfig alloc]initWithDatawayUrl:dataWayUrl clientToken:clientToken];
29
- }else if(datakitUrl && datakitUrl.length>0){
30
- config = [[FTMobileConfig alloc]initWithDatakitUrl:datakitUrl];
31
- }else{
32
- resolve(nil);
33
- return;
34
- }
35
- if ([context.allKeys containsObject:@"debug"]) {
36
- config.enableSDKDebugLog = [RCTConvert BOOL:context[@"debug"]];
37
- }
38
- if ([context.allKeys containsObject:@"service"]) {
39
- config.service = [RCTConvert NSString:context[@"service"]];
40
- }
41
- if([context.allKeys containsObject:@"env"]){
42
- id env = context[@"env"];
43
- if([env isKindOfClass:NSString.class]){
44
- config.env = env;
45
- }
46
- }
47
- if([context.allKeys containsObject:@"envType"]){
48
- id env = context[@"envType"];
49
- if([env isKindOfClass:NSNumber.class]){
50
- int envType = [env intValue];
51
- if(envType>=0 && envType<5){
52
- [config setEnvWithType:envType];
53
- }
54
- }
55
- }
56
- if ([context.allKeys containsObject:@"autoSync"]) {
57
- config.autoSync = [RCTConvert BOOL:context[@"autoSync"]];
58
- }
59
- if ([context.allKeys containsObject:@"syncPageSize"]) {
60
- config.syncPageSize = [RCTConvert int:context[@"syncPageSize"]];
61
- }
62
- if ([context.allKeys containsObject:@"syncSleepTime"]) {
63
- config.syncSleepTime = [RCTConvert int:context[@"syncSleepTime"]];
64
- }
65
- if ([context.allKeys containsObject:@"enableDataIntegerCompatible"]) {
66
- config.enableDataIntegerCompatible = [RCTConvert BOOL:context[@"enableDataIntegerCompatible"]];
67
- }
68
- if ([context.allKeys containsObject:@"compressIntakeRequests"]) {
69
- config.compressIntakeRequests = [RCTConvert BOOL:context[@"compressIntakeRequests"]];
70
- }
71
- if ([context.allKeys containsObject:@"globalContext"]) {
72
- config.globalContext = [RCTConvert NSDictionary:context[@"globalContext"]];
73
- }
74
- if ([context.allKeys containsObject:@"groupIdentifiers"]){
75
- config.groupIdentifiers = [RCTConvert NSArray:context[@"groupIdentifiers"]];
76
- }
77
- if ([context.allKeys containsObject:@"dbDiscardStrategy"]){
78
- config.dbDiscardType = [RCTConvert int:context[@"dbDiscardStrategy"]];
79
- }
80
- if ([context.allKeys containsObject:@"enableLimitWithDbSize"]){
81
- config.enableLimitWithDbSize = [RCTConvert BOOL:context[@"enableLimitWithDbSize"]];
82
- }
83
- if ([context.allKeys containsObject:@"dbCacheLimit"]){
84
- config.dbCacheLimit = [RCTConvert double:context[@"dbCacheLimit"]];
85
- }
86
- if ([context.allKeys containsObject:@"dataModifier"]){
87
- NSDictionary *dataModifierDict = [[RCTConvert NSDictionary:context[@"dataModifier"]] copy];
88
- config.dataModifier = ^id _Nullable(NSString * _Nonnull key, id _Nonnull value) {
89
- if ([dataModifierDict.allKeys containsObject:key]) {
90
- return dataModifierDict[key];
91
- }
92
- return value;
93
- };
94
- }
95
- if ([context.allKeys containsObject:@"lineDataModifier"]){
96
- NSDictionary *dataModifierDict = [[RCTConvert NSDictionary:context[@"lineDataModifier"]] copy];
97
- config.lineDataModifier = ^NSDictionary<NSString *,id> * _Nullable(NSString * _Nonnull measurement, NSDictionary<NSString *,id> * _Nonnull data) {
98
- if ([measurement isEqualToString:FT_LOGGER_SOURCE] || [measurement isEqualToString:FT_LOGGER_TVOS_SOURCE]) {
99
- return [dataModifierDict valueForKey:@"log"];
100
- }else{
101
- return [dataModifierDict valueForKey:measurement];
102
- }
103
- };
104
- }
105
- NSString *pkgInfo = [RCTConvert NSString:context[@"pkgInfo"]];
106
- [config addPkgInfo:@"reactnative" value:pkgInfo];
107
- [FTMobileAgent startWithConfigOptions:config];
108
- resolve(nil);
109
- }];
110
- }
111
-
112
- RCT_REMAP_METHOD(bindRUMUserData,
113
- userId:(NSString*)userId userName:(NSString*)userName userEmail:(NSString*)userEmail extra:(NSDictionary *)extra
114
- findEventsWithResolver:(RCTPromiseResolveBlock)resolve
115
- rejecter:(RCTPromiseRejectBlock)reject){
116
- [[FTMobileAgent sharedInstance] bindUserWithUserID:userId userName:userName userEmail:userEmail extra:extra];
117
- resolve(nil);
118
- }
119
-
120
- RCT_REMAP_METHOD(unbindRUMUserData,
121
- unbindRUMUserData_Resolver:(RCTPromiseResolveBlock)resolve
122
- rejecter:(RCTPromiseRejectBlock)reject
123
- ){
124
- [[FTMobileAgent sharedInstance] unbindUser];
125
- resolve(nil);
126
- }
127
- RCT_REMAP_METHOD(appendGlobalContext,
128
- appendGlobalContext:(NSDictionary *)context
129
- findEventsWithResolver:(RCTPromiseResolveBlock)resolve
130
- rejecter:(RCTPromiseRejectBlock)reject){
131
- [FTMobileAgent appendGlobalContext:context];
132
- resolve(nil);
133
- }
134
- RCT_REMAP_METHOD(appendRUMGlobalContext,
135
- appendRUMGlobalContext:(NSDictionary *)context
136
- findEventsWithResolver:(RCTPromiseResolveBlock)resolve
137
- rejecter:(RCTPromiseRejectBlock)reject){
138
- [FTMobileAgent appendRUMGlobalContext:context];
139
- resolve(nil);
140
- }
141
- RCT_REMAP_METHOD(appendLogGlobalContext,
142
- appendLogGlobalContext:(NSDictionary *)context
143
- findEventsWithResolver:(RCTPromiseResolveBlock)resolve
144
- rejecter:(RCTPromiseRejectBlock)reject){
145
- [FTMobileAgent appendLogGlobalContext:context];
146
- resolve(nil);
147
- }
148
-
149
- RCT_REMAP_METHOD(flushSyncData,
150
- flushSyncData_Resolver:(RCTPromiseResolveBlock)resolve
151
- rejecter:(RCTPromiseRejectBlock)reject
152
- ){
153
- [[FTMobileAgent sharedInstance] flushSyncData];
154
- resolve(nil);
155
- }
156
- RCT_REMAP_METHOD(trackEventFromExtension,
157
- identifier:(NSString*)identifier
158
- findEventsWithResolver:(RCTPromiseResolveBlock)resolve
159
- rejecter:(RCTPromiseRejectBlock)reject){
160
- [[FTMobileAgent sharedInstance] trackEventFromExtensionWithGroupIdentifier:identifier completion:^(NSString * _Nonnull groupIdentifier, NSArray * _Nonnull events) {
161
- if(events.count>0){
162
- resolve(@{@"groupIdentifier":identifier,
163
- @"datas":events
164
- });
165
- }else{
166
- resolve(nil);
167
- }
168
-
169
- }];
170
- }
171
- RCT_REMAP_METHOD(shutDown,
172
- shutDown_findEventsWithResolver:(RCTPromiseResolveBlock)resolve
173
- rejecter:(RCTPromiseRejectBlock)reject){
174
- [FTMobileAgent shutDown];
175
- resolve(nil);
176
- }
177
- RCT_REMAP_METHOD(clearAllData,
178
- clearAllData_findEventsWithResolver:(RCTPromiseResolveBlock)resolve
179
- rejecter:(RCTPromiseRejectBlock)reject){
180
- [FTMobileAgent clearAllData];
181
- resolve(nil);
182
- }
183
- @end
184
-
@@ -1,33 +0,0 @@
1
- //
2
- // FTRCTTextViewRecorder.h
3
- // FTMobileReactNativeSDK
4
- //
5
- // Created by hulilei on 2024/9/25.
6
- //
7
-
8
- #import <Foundation/Foundation.h>
9
- #import <FTMobileSDK/FTSRWireframesBuilder.h>
10
- #import <React/RCTUIManager.h>
11
- @class FTViewAttributes,FTViewTreeRecorder;
12
- NS_ASSUME_NONNULL_BEGIN
13
-
14
- @interface FTRCTTextViewBuilder : NSObject<FTSRWireframesBuilder>
15
- @property (nonatomic, strong) FTViewAttributes *attributes;
16
- @property (nonatomic, assign) CGRect wireframeRect;
17
- @property (nonatomic, assign) int wireframeID;
18
- @property (nonatomic, strong) UIColor * backgroundColor;
19
- @property (nonatomic, assign) NSTextAlignment textAlignment;
20
- @property (nonatomic, strong) UIColor *textColor;
21
- @property (nonatomic,assign) CGFloat fontSize;
22
- @property (nonatomic,assign) CGRect contentRect;
23
- @property (nonatomic, strong) id<FTSRTextObfuscatingProtocol> textObfuscator;
24
-
25
- @property (nonatomic, copy) NSString *text;
26
- @end
27
-
28
- @interface FTRCTTextViewRecorder : NSObject<FTSRWireframesRecorder>
29
- @property (nonatomic, copy) NSString *identifier;
30
- @property (nonatomic,copy) FTTextObfuscator textObfuscator;
31
- -(instancetype)initWithUIManager:(RCTUIManager *)uiManager;
32
- @end
33
- NS_ASSUME_NONNULL_END