tapjoy-react-native-sdk 13.2.1 → 13.4.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.
Files changed (91) hide show
  1. package/CODEOWNERS +1 -0
  2. package/android/build.gradle +5 -6
  3. package/android/gradle.properties +5 -5
  4. package/android/src/main/java/com/tapjoyreactnativesdk/TJOfferwallDiscoverNativeView.kt +90 -0
  5. package/android/src/main/java/com/tapjoyreactnativesdk/TJOfferwallDiscoverNativeViewManager.kt +50 -0
  6. package/android/src/main/java/com/tapjoyreactnativesdk/TapjoyReactNativeSdkModule.kt +73 -2
  7. package/android/src/main/java/com/tapjoyreactnativesdk/TapjoyReactNativeSdkPackage.kt +1 -3
  8. package/example/Gemfile +7 -0
  9. package/example/android/app/build.gradle +10 -61
  10. package/example/android/app/src/debug/AndroidManifest.xml +1 -5
  11. package/example/android/app/src/main/AndroidManifest.xml +2 -2
  12. package/example/android/app/src/main/java/com/tapjoyreactnativesdkexample/MainActivity.kt +22 -0
  13. package/example/android/app/src/main/java/com/tapjoyreactnativesdkexample/MainApplication.kt +45 -0
  14. package/example/android/app/src/main/res/xml/network_security_config.xml +2 -0
  15. package/example/android/build.gradle +9 -9
  16. package/example/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  17. package/example/android/gradle/wrapper/gradle-wrapper.properties +4 -2
  18. package/example/android/gradle.properties +0 -3
  19. package/example/android/gradlew +24 -9
  20. package/example/babel.config.js +1 -1
  21. package/example/ios/Podfile +0 -9
  22. package/example/ios/TapjoyReactNativeSdkExample/AppDelegate.mm +6 -11
  23. package/example/ios/TapjoyReactNativeSdkExample/Info.plist +9 -13
  24. package/example/ios/TapjoyReactNativeSdkExample.xcodeproj/project.pbxproj +18 -8
  25. package/example/package.json +21 -18
  26. package/example/src/App.tsx +2 -0
  27. package/example/src/MainScreen.tsx +26 -7
  28. package/example/src/OfferwallDiscoverScreen.tsx +193 -0
  29. package/example/src/OfferwallScreen.tsx +1 -1
  30. package/example/src/Styles.ts +23 -1
  31. package/example/src/UserProperties.tsx +43 -0
  32. package/ios/TJOfferwallDiscoverNativeViewManager.m +10 -0
  33. package/ios/TJOfferwallDiscoverNativeViewManager.swift +81 -0
  34. package/ios/TapjoyOfferwallDiscoverNativeView.swift +23 -0
  35. package/ios/TapjoyReactNativeSdk-Bridging-Header.h +1 -0
  36. package/ios/TapjoyReactNativeSdk.m +5 -0
  37. package/ios/TapjoyReactNativeSdk.swift +65 -1
  38. package/ios/TapjoyReactNativeSdk.xcodeproj/project.pbxproj +10 -4
  39. package/package.json +24 -24
  40. package/src/TJConnect.ts +5 -0
  41. package/src/TJOfferwallDiscoverView.tsx +57 -0
  42. package/src/TJUtil.ts +14 -0
  43. package/src/TJVersion.ts +1 -1
  44. package/src/index.ts +12 -1
  45. package/tapjoy-react-native-sdk.podspec +1 -1
  46. package/example/android/app/src/debug/java/com/tapjoyreactnativesdkexample/ReactNativeFlipper.java +0 -75
  47. package/example/android/app/src/main/java/com/tapjoyreactnativesdkexample/MainActivity.java +0 -35
  48. package/example/android/app/src/main/java/com/tapjoyreactnativesdkexample/MainApplication.java +0 -62
  49. package/example/android/app/src/release/java/com/tapjoyreactnativesdkexample/ReactNativeFlipper.java +0 -20
  50. package/lib/commonjs/TJEntryPoint.js +0 -22
  51. package/lib/commonjs/TJEntryPoint.js.map +0 -1
  52. package/lib/commonjs/TJPlacement.js +0 -149
  53. package/lib/commonjs/TJPlacement.js.map +0 -1
  54. package/lib/commonjs/TJPrivacyPolicy.js +0 -77
  55. package/lib/commonjs/TJPrivacyPolicy.js.map +0 -1
  56. package/lib/commonjs/TJSegment.js +0 -16
  57. package/lib/commonjs/TJSegment.js.map +0 -1
  58. package/lib/commonjs/TJStatus.js +0 -15
  59. package/lib/commonjs/TJStatus.js.map +0 -1
  60. package/lib/commonjs/TJVersion.js +0 -22
  61. package/lib/commonjs/TJVersion.js.map +0 -1
  62. package/lib/commonjs/index.js +0 -56
  63. package/lib/commonjs/index.js.map +0 -1
  64. package/lib/module/TJEntryPoint.js +0 -15
  65. package/lib/module/TJEntryPoint.js.map +0 -1
  66. package/lib/module/TJPlacement.js +0 -141
  67. package/lib/module/TJPlacement.js.map +0 -1
  68. package/lib/module/TJPrivacyPolicy.js +0 -70
  69. package/lib/module/TJPrivacyPolicy.js.map +0 -1
  70. package/lib/module/TJSegment.js +0 -9
  71. package/lib/module/TJSegment.js.map +0 -1
  72. package/lib/module/TJStatus.js +0 -8
  73. package/lib/module/TJStatus.js.map +0 -1
  74. package/lib/module/TJVersion.js +0 -14
  75. package/lib/module/TJVersion.js.map +0 -1
  76. package/lib/module/index.js +0 -18
  77. package/lib/module/index.js.map +0 -1
  78. package/lib/typescript/TJEntryPoint.d.ts +0 -14
  79. package/lib/typescript/TJEntryPoint.d.ts.map +0 -1
  80. package/lib/typescript/TJPlacement.d.ts +0 -76
  81. package/lib/typescript/TJPlacement.d.ts.map +0 -1
  82. package/lib/typescript/TJPrivacyPolicy.d.ts +0 -17
  83. package/lib/typescript/TJPrivacyPolicy.d.ts.map +0 -1
  84. package/lib/typescript/TJSegment.d.ts +0 -8
  85. package/lib/typescript/TJSegment.d.ts.map +0 -1
  86. package/lib/typescript/TJStatus.d.ts +0 -7
  87. package/lib/typescript/TJStatus.d.ts.map +0 -1
  88. package/lib/typescript/TJVersion.d.ts +0 -5
  89. package/lib/typescript/TJVersion.d.ts.map +0 -1
  90. package/lib/typescript/index.d.ts +0 -9
  91. package/lib/typescript/index.d.ts.map +0 -1
@@ -15,6 +15,13 @@ const styles = StyleSheet.create({
15
15
  alignItems: 'center',
16
16
  marginBottom: 20,
17
17
  },
18
+ switchContainer: {
19
+ display: 'flex',
20
+ flexDirection: 'row',
21
+ alignItems: 'center',
22
+ marginBottom: 20,
23
+ justifyContent: 'flex-end',
24
+ },
18
25
  clearButton: {
19
26
  flex: 0,
20
27
  width: 50,
@@ -22,6 +29,7 @@ const styles = StyleSheet.create({
22
29
  borderRadius: 5,
23
30
  padding: 10,
24
31
  height: 40,
32
+ marginLeft: 10,
25
33
  },
26
34
  buttonContainer: {
27
35
  flexDirection: 'row',
@@ -36,6 +44,14 @@ const styles = StyleSheet.create({
36
44
  flex: 1,
37
45
  alignSelf: 'flex-start',
38
46
  },
47
+ buttonTag: {
48
+ backgroundColor: '#FDAA1C',
49
+ borderRadius: 5,
50
+ padding: 10,
51
+ flex: 1,
52
+ alignSelf: 'flex-start',
53
+ marginRight: 10,
54
+ },
39
55
  enabledButton: {},
40
56
  disabledButton: {
41
57
  opacity: 0.5,
@@ -57,9 +73,14 @@ const styles = StyleSheet.create({
57
73
  borderRadius: 10,
58
74
  paddingLeft: 10,
59
75
  paddingRight: 10,
60
- marginRight: 10,
61
76
  color: 'black',
62
77
  },
78
+ textInputLabel: {
79
+ width: 50,
80
+ },
81
+ leftSpacing: {
82
+ marginLeft: 10,
83
+ },
63
84
  statusText: {
64
85
  color: 'black',
65
86
  textAlign: 'center',
@@ -165,6 +186,7 @@ const styles = StyleSheet.create({
165
186
  owLogContainer: {
166
187
  height: '30%',
167
188
  padding: 10,
189
+ backgroundColor: '#DDDDDD',
168
190
  },
169
191
  });
170
192
 
@@ -34,6 +34,7 @@ const UserProperties: React.FC = () => {
34
34
  );
35
35
  const [userConsent, setUserConsent] = useState<TJStatus>(TJStatus.Unknown);
36
36
  const [userSegment, setUserSegment] = useState<TJSegment>(TJSegment.Unknown);
37
+ const [userTag, setUserTag] = useState<string>('');
37
38
  const [optOut, setOptOut] = useState<boolean>(false);
38
39
  const isFocused = useIsFocused();
39
40
 
@@ -197,6 +198,21 @@ const UserProperties: React.FC = () => {
197
198
  await setMaxLevel('');
198
199
  };
199
200
 
201
+ const handleAddUserTag = async () => {
202
+ Tapjoy.addUserTag(userTag);
203
+ setUserTag('');
204
+ };
205
+
206
+ const handleRemoveUserTag = async () => {
207
+ Tapjoy.removeUserTag(userTag);
208
+ setUserTag('');
209
+ };
210
+
211
+ const handleClearUserTag = async () => {
212
+ Tapjoy.clearUserTags();
213
+ setUserTag('');
214
+ };
215
+
200
216
  const handleSubjectToGDPR = (item: { value: TJStatus; label: string }) => {
201
217
  setSubjectToGDPR(item.value);
202
218
  };
@@ -254,6 +270,33 @@ const UserProperties: React.FC = () => {
254
270
  title={'\u2573'}
255
271
  />
256
272
  </View>
273
+ <View style={styles.inputContainer}>
274
+ <Text style={styles.userPropertiesLabel}>User Tags:</Text>
275
+ <TextInput
276
+ style={styles.textInput}
277
+ value={userTag}
278
+ onChangeText={setUserTag}
279
+ placeholder="Enter user tag"
280
+ placeholderTextColor="#888"
281
+ />
282
+ </View>
283
+ <View style={styles.horizontalContainer}>
284
+ <Button
285
+ style={styles.buttonTag}
286
+ onPress={handleAddUserTag}
287
+ title={'Add'}
288
+ />
289
+ <Button
290
+ style={styles.buttonTag}
291
+ onPress={handleRemoveUserTag}
292
+ title={'Remove'}
293
+ />
294
+ <Button
295
+ style={styles.buttonTag}
296
+ onPress={handleClearUserTag}
297
+ title={'Clear'}
298
+ />
299
+ </View>
257
300
  <View style={styles.selectionContainer}>
258
301
  <View style={styles.horizontalContainer}>
259
302
  <Text style={styles.userPropertiesLabel}>User Segment:</Text>
@@ -0,0 +1,10 @@
1
+ #import <React/RCTViewManager.h>
2
+
3
+ @interface RCT_EXTERN_MODULE(TJOfferwallDiscoverNativeViewManager, RCTViewManager)
4
+ RCT_EXTERN_METHOD(requestContent: (nonnull NSNumber *)tag : NSString)
5
+ RCT_EXTERN_METHOD(clearContent: (nonnull NSNumber *)tag)
6
+ RCT_EXPORT_VIEW_PROPERTY(onRequestSuccess, RCTBubblingEventBlock)
7
+ RCT_EXPORT_VIEW_PROPERTY(onRequestFailure, RCTBubblingEventBlock)
8
+ RCT_EXPORT_VIEW_PROPERTY(onContentReady, RCTBubblingEventBlock)
9
+ RCT_EXPORT_VIEW_PROPERTY(onContentError, RCTBubblingEventBlock)
10
+ @end
@@ -0,0 +1,81 @@
1
+ @objc (TJOfferwallDiscoverNativeViewManager)
2
+ class TJOfferwallDiscoverNativeViewManager: RCTViewManager, TJOfferwallDiscoverDelegate {
3
+
4
+ var owdView:TapjoyOfferwallDiscoverNativeView!
5
+ @objc var onRequestSuccess: RCTBubblingEventBlock?
6
+ @objc var onRequestFailure: RCTBubblingEventBlock?
7
+ @objc var onContentReady: RCTBubblingEventBlock?
8
+ @objc var onContentError: RCTBubblingEventBlock?
9
+
10
+ override static func requiresMainQueueSetup() -> Bool {
11
+ return true
12
+ }
13
+
14
+ override func view() -> UIView! {
15
+ owdView = TapjoyOfferwallDiscoverNativeView()
16
+ owdView.delegate = self
17
+ return owdView
18
+ }
19
+
20
+ /**
21
+ Show the OfferwallDiscover content.
22
+ */
23
+ @objc func requestContent(_ tag: NSNumber, _ placement: String) {
24
+ DispatchQueue.main.async {
25
+ self.owdView.requestContent(placement)
26
+ }
27
+ }
28
+
29
+ /**
30
+ Show current content.
31
+ */
32
+ @objc func clearContent(_ tag: NSNumber) {
33
+ DispatchQueue.main.async {
34
+ self.owdView.clearContent()
35
+ }
36
+ }
37
+
38
+ // MARK: - TJOfferwallDiscoverDelegate : The delegates method will call javascript event handlers.
39
+ func requestDidSucceed(for view: TJOfferwallDiscoverView) {
40
+ NSLog("requestDidSucceed")
41
+
42
+ guard let onRequestSuccess = self.owdView.onRequestSuccess else { return }
43
+ DispatchQueue.main.async {
44
+ let params: [String : Any] = ["result":"requestSuccess"]
45
+ onRequestSuccess(params)
46
+ }
47
+ }
48
+
49
+ func requestDidFail(for view: TJOfferwallDiscoverView, error: Error?) {
50
+ guard let error = error else { return }
51
+ NSLog("requestDidFail - \(error.localizedDescription) ")
52
+
53
+ guard let onRequestFailure = self.owdView.onRequestFailure else { return }
54
+ DispatchQueue.main.async {
55
+ let errorCode = (error as NSError).code
56
+ let params: [String : Any] = ["errorCode": errorCode, "errorMessage": error.localizedDescription]
57
+ onRequestFailure(params)
58
+ }
59
+ }
60
+
61
+ func contentIsReady(for view: TJOfferwallDiscoverView) {
62
+ NSLog("contentIsReady")
63
+ guard let onContentReady = self.owdView.onContentReady else { return }
64
+ DispatchQueue.main.async {
65
+ let params: [String : Any] = ["result":"contentReady"]
66
+ onContentReady(params)
67
+ }
68
+ }
69
+
70
+ func contentError(for view: TJOfferwallDiscoverView, error: Error?) {
71
+ guard let error = error else { return }
72
+ NSLog("contentError \(error.localizedDescription)")
73
+
74
+ guard let onContentError = self.owdView.onContentError else { return }
75
+ DispatchQueue.main.async {
76
+ let errorCode = (error as NSError).code
77
+ let params: [String : Any] = ["errorCode": errorCode, "errorMessage": error.localizedDescription]
78
+ onContentError(params)
79
+ }
80
+ }
81
+ }
@@ -0,0 +1,23 @@
1
+ class TapjoyOfferwallDiscoverNativeView: TJOfferwallDiscoverView {
2
+
3
+ // Event handlers
4
+ @objc var onRequestSuccess: RCTBubblingEventBlock?
5
+ @objc var onRequestFailure: RCTBubblingEventBlock?
6
+ @objc var onContentReady: RCTBubblingEventBlock?
7
+ @objc var onContentError: RCTBubblingEventBlock?
8
+
9
+ /**
10
+ Request content of placement.
11
+ - Parameter placement: Placement name.
12
+ */
13
+ func requestContent(_ placement: String) {
14
+ request(placement)
15
+ }
16
+
17
+ /**
18
+ Clear displayed content.
19
+ */
20
+ func clearContent() {
21
+ clear()
22
+ }
23
+ }
@@ -3,4 +3,5 @@
3
3
  //
4
4
  #import <React/RCTBridgeModule.h>
5
5
  #import <React/RCTEventEmitter.h>
6
+ #import <React/RCTViewManager.h>
6
7
  #import <Tapjoy/Tapjoy.h>
@@ -11,6 +11,11 @@ RCT_EXTERN_METHOD(setUserId:(NSString *)userId resolve:(RCTPromiseResolveBlock *
11
11
  RCT_EXTERN_METHOD(setUserSegment:(nonnull NSNumber *)userSegment)
12
12
  RCT_EXTERN_METHOD(getUserSegment: (RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject)
13
13
  RCT_EXTERN_METHOD(setMaxLevel:(int)maxLevel)
14
+ RCT_EXTERN_METHOD(getUserTags: (RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject)
15
+ RCT_EXTERN_METHOD(setUserTags:(NSArray *)tags)
16
+ RCT_EXTERN_METHOD(clearUserTags)
17
+ RCT_EXTERN_METHOD(addUserTag:(NSString *)tag)
18
+ RCT_EXTERN_METHOD(removeUserTag:(NSString *)tag)
14
19
 
15
20
  #pragma mark - Placements
16
21
  RCT_EXTERN_METHOD(createPlacement:(NSString *)name)
@@ -16,7 +16,7 @@ class TapjoyReactNativeSdk: RCTEventEmitter {
16
16
 
17
17
  // MARK: - Events
18
18
  @objc override func supportedEvents() -> [String] {
19
- return ["TapjoyPlacement"];
19
+ return ["TapjoyPlacement", "Tapjoy"];
20
20
  }
21
21
 
22
22
  @objc override func startObserving() {
@@ -43,6 +43,7 @@ class TapjoyReactNativeSdk: RCTEventEmitter {
43
43
  @objc func connect(_ sdkKey: String, connectFlags: NSDictionary, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
44
44
  if storedResolve == nil {
45
45
  NotificationCenter.default.addObserver(self, selector: #selector(tjcConnectSuccess(_:)), name: NSNotification.Name(TJC_CONNECT_SUCCESS), object: nil)
46
+ NotificationCenter.default.addObserver(self, selector: #selector(tcjConnectWarning(_:)), name: NSNotification.Name(TJC_CONNECT_WARNING), object: nil)
46
47
  NotificationCenter.default.addObserver(self, selector: #selector(tjcConnectFail(_:)), name: NSNotification.Name(TJC_CONNECT_FAILED), object: nil)
47
48
  }
48
49
 
@@ -64,6 +65,16 @@ class TapjoyReactNativeSdk: RCTEventEmitter {
64
65
  NotificationCenter.default.removeObserver(self, name: NSNotification.Name(TJC_CONNECT_FAILED), object: nil)
65
66
  }
66
67
 
68
+ @objc func tcjConnectWarning(_ notifyObj: Notification) {
69
+ if let error = notifyObj.userInfo?[TJC_CONNECT_USER_INFO_ERROR] as? NSError {
70
+ var message = error.localizedDescription
71
+ self.sendEvent(withName: "Tapjoy", body: ["name": "onConnectWarning",
72
+ "code" : "\(error.code)",
73
+ "message" : message])
74
+ }
75
+ NotificationCenter.default.removeObserver(self, name: NSNotification.Name(TJC_CONNECT_WARNING), object: nil)
76
+ }
77
+
67
78
  @objc func tjcConnectFail(_ notifyObj: Notification) {
68
79
  if let storedReject = storedReject {
69
80
  if let error = notifyObj.userInfo?[TJC_CONNECT_USER_INFO_ERROR] as? NSError {
@@ -140,6 +151,59 @@ class TapjoyReactNativeSdk: RCTEventEmitter {
140
151
  @objc func setMaxLevel(_ maxLevel: Int32) {
141
152
  Tapjoy.setMaxLevel(maxLevel)
142
153
  }
154
+
155
+ /**
156
+ * Returns a string set which contains tags on the user.
157
+ *
158
+ * @return set of string
159
+ */
160
+ @objc func getUserTags(_ resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
161
+ do {
162
+ if let tags = Tapjoy.getUserTags() {
163
+ let array = Array(tags)
164
+ resolve(array)
165
+ }
166
+ } catch let error {
167
+ reject("getUserTags failed", "Failed to get user tags", error)
168
+ }
169
+ }
170
+
171
+ /**
172
+ * Sets tags for the user.
173
+ *
174
+ * @param tags the tags to be set
175
+ * can have up to 200 tags where each tag can have 200 characters
176
+ */
177
+ @objc func setUserTags(_ tags: [AnyHashable]) {
178
+ let tagsSet = Set(tags.compactMap { $0 })
179
+ Tapjoy.setUserTags(tagsSet)
180
+ }
181
+
182
+ /**
183
+ * Removes all tags from the user.
184
+ */
185
+ @objc func clearUserTags() {
186
+ Tapjoy.clearUserTags()
187
+ }
188
+
189
+ /**
190
+ * Adds the given tag to the user if it is not already present.
191
+ *
192
+ * @param tag the tag to be added
193
+ */
194
+ @objc func addUserTag(_ tag: String) {
195
+ Tapjoy.addUserTag(tag)
196
+ }
197
+
198
+ /**
199
+ * Removes the given tag from the user if it is present.
200
+ *
201
+ * @param tag the tag to be removed
202
+ */
203
+ @objc func removeUserTag(_ tag: String) {
204
+ Tapjoy.removeUserTag(tag)
205
+ }
206
+
143
207
 
144
208
  // MARK: - Placements
145
209
 
@@ -20,8 +20,11 @@
20
20
 
21
21
  /* Begin PBXFileReference section */
22
22
  134814201AA4EA6300B7C361 /* libTapjoyReactNativeSdk.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libTapjoyReactNativeSdk.a; sourceTree = BUILT_PRODUCTS_DIR; };
23
- 2BDE3C8F29D5AE0E009EB4F1 /* TapjoyPlacement.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TapjoyPlacement.m; sourceTree = "<group>"; };
24
- 2BDE3C9029D5AE54009EB4F1 /* TapjoyPlacement.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TapjoyPlacement.swift; sourceTree = "<group>"; };
23
+ A1ABFAC92B023B9F00CA9B85 /* TapjoyPluginAPIModule.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TapjoyPluginAPIModule.m; sourceTree = "<group>"; };
24
+ A1ABFACA2B023C3400CA9B85 /* TapjoyPluginAPIModule.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TapjoyPluginAPIModule.swift; sourceTree = "<group>"; };
25
+ A1ABFAD12B032C0400CA9B85 /* TJOfferwallDiscoverNativeViewManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TJOfferwallDiscoverNativeViewManager.swift; sourceTree = "<group>"; };
26
+ A1ABFAD22B032C0400CA9B85 /* TapjoyOfferwallDiscoverNativeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TapjoyOfferwallDiscoverNativeView.swift; sourceTree = "<group>"; };
27
+ A1ABFAD32B032C0400CA9B85 /* TJOfferwallDiscoverNativeViewManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TJOfferwallDiscoverNativeViewManager.m; sourceTree = "<group>"; };
25
28
  B3E7B5891CC2AC0600A0062D /* TapjoyReactNativeSdk.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TapjoyReactNativeSdk.m; sourceTree = "<group>"; };
26
29
  F4FF95D5245B92E700C19C63 /* TapjoyReactNativeSdk-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "TapjoyReactNativeSdk-Bridging-Header.h"; sourceTree = "<group>"; };
27
30
  F4FF95D6245B92E800C19C63 /* TapjoyReactNativeSdk.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TapjoyReactNativeSdk.swift; sourceTree = "<group>"; };
@@ -49,10 +52,13 @@
49
52
  58B511D21A9E6C8500147676 = {
50
53
  isa = PBXGroup;
51
54
  children = (
52
- 2BDE3C9029D5AE54009EB4F1 /* TapjoyPlacement.swift */,
53
- 2BDE3C8F29D5AE0E009EB4F1 /* TapjoyPlacement.m */,
55
+ A1ABFAD22B032C0400CA9B85 /* TapjoyOfferwallDiscoverNativeView.swift */,
56
+ A1ABFAD32B032C0400CA9B85 /* TJOfferwallDiscoverNativeViewManager.m */,
57
+ A1ABFAD12B032C0400CA9B85 /* TJOfferwallDiscoverNativeViewManager.swift */,
58
+ A1ABFACA2B023C3400CA9B85 /* TapjoyPluginAPIModule.swift */,
54
59
  F4FF95D6245B92E800C19C63 /* TapjoyReactNativeSdk.swift */,
55
60
  B3E7B5891CC2AC0600A0062D /* TapjoyReactNativeSdk.m */,
61
+ A1ABFAC92B023B9F00CA9B85 /* TapjoyPluginAPIModule.m */,
56
62
  F4FF95D5245B92E700C19C63 /* TapjoyReactNativeSdk-Bridging-Header.h */,
57
63
  134814211AA4EA7D00B7C361 /* Products */,
58
64
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tapjoy-react-native-sdk",
3
- "version": "13.2.1",
3
+ "version": "13.4.0",
4
4
  "description": "ReactNative Plugin for Tapjoy SDK",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -37,7 +37,8 @@
37
37
  "!**/__tests__",
38
38
  "!**/__fixtures__",
39
39
  "!**/__mocks__",
40
- "!**/.*"
40
+ "!**/.*",
41
+ "CODEOWNERS"
41
42
  ],
42
43
  "scripts": {
43
44
  "test": "jest",
@@ -47,7 +48,7 @@
47
48
  "bootstrap": "yarn example && yarn install && yarn example pods",
48
49
  "clean": "del-cli android/build example/android/build example/android/app/build example/ios/build temp package",
49
50
  "prepare-repo": "rm -rf temp package && mkdir temp && cd temp && git clone git@github.com:Tapjoy/react-native-sdk . && rm -rf *",
50
- "copy-pack": "bob build && npm pack && tar xvzf tapjoy-react-native*.tgz && cp -af ./package/* ./temp && rm tapjoy-react-native*.tgz",
51
+ "copy-pack": "npm pack && tar xvzf tapjoy-react-native*.tgz && cp -af ./package/* ./temp && rm tapjoy-react-native*.tgz",
51
52
  "push": "cd temp && git add . && export VERSION=`node -p \"require('./package.json').version\"` && git commit -m \"Release $VERSION\" && git push",
52
53
  "publish-npm": "yarn prepare-repo && yarn copy-pack && yarn push && cd temp && npm config set //registry.npmjs.org/:_authToken $NPM_TOKEN && release-it --no-increment --ci"
53
54
  },
@@ -69,36 +70,35 @@
69
70
  "registry": "https://registry.npmjs.org/"
70
71
  },
71
72
  "devDependencies": {
72
- "@commitlint/config-conventional": "^17.0.2",
73
- "@react-native-community/eslint-config": "^3.0.2",
74
- "@react-native/metro-config": "^0.72.11",
75
- "@release-it/conventional-changelog": "^5.0.0",
76
- "@types/jest": "^28.1.2",
77
- "@types/react": "~17.0.21",
78
- "@types/react-native": "0.70.0",
79
- "commitlint": "^17.0.2",
80
- "del-cli": "^5.0.0",
81
- "eslint": "^8.4.1",
82
- "eslint-config-prettier": "^8.5.0",
83
- "eslint-plugin-prettier": "^4.0.0",
84
- "jest": "^28.1.1",
85
- "pod-install": "^0.1.0",
86
- "prettier": "^2.0.5",
73
+ "@commitlint/config-conventional": "^18.4.4",
74
+ "@react-native-community/eslint-config": "^3.2.0",
75
+ "@react-native/metro-config": "^0.73.3",
76
+ "@release-it/conventional-changelog": "^8.0.1",
77
+ "@types/jest": "^29.5.11",
78
+ "@types/react": "^18.2.48",
79
+ "commitlint": "^18.4.4",
80
+ "del-cli": "^5.1.0",
81
+ "eslint": "^8.56.0",
82
+ "eslint-config-prettier": "^9.1.0",
83
+ "eslint-plugin-prettier": "^5.1.3",
84
+ "jest": "^29.7.0",
85
+ "pod-install": "^0.2.0",
86
+ "prettier": "^3.2.4",
87
87
  "react": "18.2.0",
88
- "react-native": "0.72.5",
89
- "react-native-builder-bob": "^0.20.0",
90
- "release-it": "^15.0.0",
91
- "typescript": "^4.5.2"
88
+ "react-native": "^0.73.2",
89
+ "react-native-builder-bob": "^0.23.2",
90
+ "release-it": "^17.0.1",
91
+ "typescript": "^5.3.3"
92
92
  },
93
93
  "resolutions": {
94
- "@types/react": "17.0.21"
94
+ "@types/react": "^18.2.48"
95
95
  },
96
96
  "peerDependencies": {
97
97
  "react": "*",
98
98
  "react-native": "*"
99
99
  },
100
100
  "engines": {
101
- "node": ">= 16.0.0"
101
+ "node": ">= 18"
102
102
  },
103
103
  "packageManager": "^yarn@1.22.15",
104
104
  "jest": {
@@ -0,0 +1,5 @@
1
+ enum TJConnect {
2
+ TJC_CONNECT_WARNING = 'onConnectWarning',
3
+ }
4
+
5
+ export default TJConnect;
@@ -0,0 +1,57 @@
1
+ import {
2
+ findNodeHandle,
3
+ requireNativeComponent,
4
+ UIManager,
5
+ ViewStyle,
6
+ } from 'react-native';
7
+ import React from 'react';
8
+
9
+ enum Command {
10
+ REQUEST_CONTENT = 'requestContent',
11
+ CLEAR_CONTENT = 'clearContent',
12
+ }
13
+
14
+ const TJOfferwallDiscoverNativeView = requireNativeComponent(
15
+ 'TJOfferwallDiscoverNativeView'
16
+ );
17
+
18
+ interface TJOfferwallDiscoverViewProps {
19
+ style?: ViewStyle;
20
+ onRequestSuccess?: Function;
21
+ onRequestFailure?: Function;
22
+ onContentReady?: Function;
23
+ onContentError?: Function;
24
+ }
25
+
26
+ export default class TJOfferwallDiscoverView extends React.Component<TJOfferwallDiscoverViewProps> {
27
+ nativeCompHandle: number | null = null;
28
+ constructor(props: TJOfferwallDiscoverViewProps) {
29
+ super(props);
30
+ }
31
+
32
+ render() {
33
+ return (
34
+ <TJOfferwallDiscoverNativeView
35
+ {...this.props}
36
+ ref={(ref) => {
37
+ this.nativeCompHandle = findNodeHandle(ref);
38
+ }}
39
+ />
40
+ );
41
+ }
42
+
43
+ requestContent(placement: string) {
44
+ UIManager.dispatchViewManagerCommand(
45
+ this.nativeCompHandle!!,
46
+ Command.REQUEST_CONTENT,
47
+ [placement]
48
+ );
49
+ }
50
+
51
+ clearContent() {
52
+ UIManager.dispatchViewManagerCommand(
53
+ this.nativeCompHandle!!,
54
+ Command.CLEAR_CONTENT
55
+ );
56
+ }
57
+ }
package/src/TJUtil.ts ADDED
@@ -0,0 +1,14 @@
1
+ export default class TJUtil {
2
+ static isValidDimensionValue(value: any): boolean {
3
+ if (typeof value !== 'number' && /[0-9]+%|auto/.test(value)) {
4
+ return true;
5
+ } else if (typeof value === 'number' && !isNaN(value)) {
6
+ return true;
7
+ }
8
+ return false;
9
+ }
10
+
11
+ static isValidNumber(value: any): boolean {
12
+ return typeof value === 'number' && !isNaN(value);
13
+ }
14
+ }
package/src/TJVersion.ts CHANGED
@@ -1,4 +1,4 @@
1
- const REACT_LIBRARY_VERSION = '13.2.1';
1
+ const REACT_LIBRARY_VERSION = '13.4.0';
2
2
  const REACT_LIBRARY_VERSION_SUFFIX = '';
3
3
 
4
4
  export class TJVersion {
package/src/index.ts CHANGED
@@ -4,6 +4,8 @@ import TJPrivacyPolicy from './TJPrivacyPolicy';
4
4
  import TJVersion from './TJVersion';
5
5
  import TJStatus from './TJStatus';
6
6
  import TJSegment from './TJSegment';
7
+ import TJOfferwallDiscoverView from './TJOfferwallDiscoverView';
8
+ import TJConnect from './TJConnect';
7
9
 
8
10
  const LINKING_ERROR =
9
11
  `The package 'tapjoy-react-native-sdk' doesn't seem to be linked. Make sure: \n\n` +
@@ -22,5 +24,14 @@ const Tapjoy = NativeModules.TapjoyReactNativeSdk
22
24
  }
23
25
  );
24
26
 
25
- export { Tapjoy, TJPlacement, TJPrivacyPolicy, TJVersion, TJStatus, TJSegment };
27
+ export {
28
+ Tapjoy,
29
+ TJPlacement,
30
+ TJPrivacyPolicy,
31
+ TJVersion,
32
+ TJStatus,
33
+ TJSegment,
34
+ TJOfferwallDiscoverView,
35
+ TJConnect,
36
+ };
26
37
  export default Tapjoy;
@@ -17,7 +17,7 @@ Pod::Spec.new do |s|
17
17
  s.source_files = "ios/**/*.{h,m,mm,swift}"
18
18
 
19
19
  s.dependency "React-Core"
20
- s.dependency "TapjoySDK", "13.2.1"
20
+ s.dependency "TapjoySDK", "13.4.0"
21
21
 
22
22
  # Don't install the dependencies when we run `pod install` in the old architecture.
23
23
  if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
@@ -1,75 +0,0 @@
1
- /**
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * <p>This source code is licensed under the MIT license found in the LICENSE file in the root
5
- * directory of this source tree.
6
- */
7
- package com.tapjoyreactnativesdkexample;
8
-
9
- import android.content.Context;
10
- import com.facebook.flipper.android.AndroidFlipperClient;
11
- import com.facebook.flipper.android.utils.FlipperUtils;
12
- import com.facebook.flipper.core.FlipperClient;
13
- import com.facebook.flipper.plugins.crashreporter.CrashReporterPlugin;
14
- import com.facebook.flipper.plugins.databases.DatabasesFlipperPlugin;
15
- import com.facebook.flipper.plugins.fresco.FrescoFlipperPlugin;
16
- import com.facebook.flipper.plugins.inspector.DescriptorMapping;
17
- import com.facebook.flipper.plugins.inspector.InspectorFlipperPlugin;
18
- import com.facebook.flipper.plugins.network.FlipperOkhttpInterceptor;
19
- import com.facebook.flipper.plugins.network.NetworkFlipperPlugin;
20
- import com.facebook.flipper.plugins.sharedpreferences.SharedPreferencesFlipperPlugin;
21
- import com.facebook.react.ReactInstanceEventListener;
22
- import com.facebook.react.ReactInstanceManager;
23
- import com.facebook.react.bridge.ReactContext;
24
- import com.facebook.react.modules.network.NetworkingModule;
25
- import okhttp3.OkHttpClient;
26
-
27
- /**
28
- * Class responsible of loading Flipper inside your React Native application. This is the debug
29
- * flavor of it. Here you can add your own plugins and customize the Flipper setup.
30
- */
31
- public class ReactNativeFlipper {
32
- public static void initializeFlipper(Context context, ReactInstanceManager reactInstanceManager) {
33
- if (FlipperUtils.shouldEnableFlipper(context)) {
34
- final FlipperClient client = AndroidFlipperClient.getInstance(context);
35
-
36
- client.addPlugin(new InspectorFlipperPlugin(context, DescriptorMapping.withDefaults()));
37
- client.addPlugin(new DatabasesFlipperPlugin(context));
38
- client.addPlugin(new SharedPreferencesFlipperPlugin(context));
39
- client.addPlugin(CrashReporterPlugin.getInstance());
40
-
41
- NetworkFlipperPlugin networkFlipperPlugin = new NetworkFlipperPlugin();
42
- NetworkingModule.setCustomClientBuilder(
43
- new NetworkingModule.CustomClientBuilder() {
44
- @Override
45
- public void apply(OkHttpClient.Builder builder) {
46
- builder.addNetworkInterceptor(new FlipperOkhttpInterceptor(networkFlipperPlugin));
47
- }
48
- });
49
- client.addPlugin(networkFlipperPlugin);
50
- client.start();
51
-
52
- // Fresco Plugin needs to ensure that ImagePipelineFactory is initialized
53
- // Hence we run if after all native modules have been initialized
54
- ReactContext reactContext = reactInstanceManager.getCurrentReactContext();
55
- if (reactContext == null) {
56
- reactInstanceManager.addReactInstanceEventListener(
57
- new ReactInstanceEventListener() {
58
- @Override
59
- public void onReactContextInitialized(ReactContext reactContext) {
60
- reactInstanceManager.removeReactInstanceEventListener(this);
61
- reactContext.runOnNativeModulesQueueThread(
62
- new Runnable() {
63
- @Override
64
- public void run() {
65
- client.addPlugin(new FrescoFlipperPlugin());
66
- }
67
- });
68
- }
69
- });
70
- } else {
71
- client.addPlugin(new FrescoFlipperPlugin());
72
- }
73
- }
74
- }
75
- }