tapjoy-react-native-sdk 13.1.2 → 13.2.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 (65) hide show
  1. package/android/build.gradle +4 -1
  2. package/android/settings.gradle +1 -1
  3. package/android/src/main/java/com/tapjoyreactnativesdk/TapjoyReactNativeSdkModule.kt +281 -24
  4. package/example/android/app/build.gradle +3 -1
  5. package/example/android/app/proguard-rules.pro +19 -0
  6. package/example/android/app/src/main/AndroidManifest.xml +2 -1
  7. package/example/android/app/src/main/res/xml/network_security_config.xml +12 -0
  8. package/example/android/settings.gradle +1 -1
  9. package/example/ios/TapjoyReactNativeSdkExample.xcodeproj/project.pbxproj +16 -2
  10. package/example/metro.config.js +10 -2
  11. package/example/package.json +7 -3
  12. package/example/src/MainScreen.tsx +52 -46
  13. package/example/src/OfferwallScreen.tsx +263 -63
  14. package/example/src/SelectionMenu.tsx +70 -0
  15. package/example/src/Styles.ts +91 -5
  16. package/example/src/UserProperties.tsx +246 -8
  17. package/ios/TapjoyReactNativeSdk.m +17 -1
  18. package/ios/TapjoyReactNativeSdk.swift +276 -6
  19. package/lib/commonjs/TJEntryPoint.js +22 -0
  20. package/lib/commonjs/TJEntryPoint.js.map +1 -0
  21. package/lib/commonjs/TJPlacement.js +86 -2
  22. package/lib/commonjs/TJPlacement.js.map +1 -1
  23. package/lib/commonjs/TJPrivacyPolicy.js +52 -0
  24. package/lib/commonjs/TJPrivacyPolicy.js.map +1 -1
  25. package/lib/commonjs/TJSegment.js +16 -0
  26. package/lib/commonjs/TJSegment.js.map +1 -0
  27. package/lib/commonjs/TJStatus.js +15 -0
  28. package/lib/commonjs/TJStatus.js.map +1 -0
  29. package/lib/commonjs/TJVersion.js +2 -2
  30. package/lib/commonjs/index.js +14 -0
  31. package/lib/commonjs/index.js.map +1 -1
  32. package/lib/module/TJEntryPoint.js +15 -0
  33. package/lib/module/TJEntryPoint.js.map +1 -0
  34. package/lib/module/TJPlacement.js +86 -3
  35. package/lib/module/TJPlacement.js.map +1 -1
  36. package/lib/module/TJPrivacyPolicy.js +53 -1
  37. package/lib/module/TJPrivacyPolicy.js.map +1 -1
  38. package/lib/module/TJSegment.js +9 -0
  39. package/lib/module/TJSegment.js.map +1 -0
  40. package/lib/module/TJStatus.js +8 -0
  41. package/lib/module/TJStatus.js.map +1 -0
  42. package/lib/module/TJVersion.js +2 -2
  43. package/lib/module/index.js +3 -1
  44. package/lib/module/index.js.map +1 -1
  45. package/lib/typescript/TJEntryPoint.d.ts +14 -0
  46. package/lib/typescript/TJEntryPoint.d.ts.map +1 -0
  47. package/lib/typescript/TJPlacement.d.ts +59 -0
  48. package/lib/typescript/TJPlacement.d.ts.map +1 -1
  49. package/lib/typescript/TJPrivacyPolicy.d.ts +9 -0
  50. package/lib/typescript/TJPrivacyPolicy.d.ts.map +1 -1
  51. package/lib/typescript/TJSegment.d.ts +8 -0
  52. package/lib/typescript/TJSegment.d.ts.map +1 -0
  53. package/lib/typescript/TJStatus.d.ts +7 -0
  54. package/lib/typescript/TJStatus.d.ts.map +1 -0
  55. package/lib/typescript/index.d.ts +3 -1
  56. package/lib/typescript/index.d.ts.map +1 -1
  57. package/package.json +3 -2
  58. package/src/TJEntryPoint.ts +14 -0
  59. package/src/TJPlacement.ts +86 -3
  60. package/src/TJPrivacyPolicy.ts +62 -1
  61. package/src/TJSegment.ts +8 -0
  62. package/src/TJStatus.ts +7 -0
  63. package/src/TJVersion.ts +2 -2
  64. package/src/index.ts +3 -1
  65. package/tapjoy-react-native-sdk.podspec +1 -1
@@ -1,5 +1,6 @@
1
- import { NativeModules, NativeEventEmitter } from 'react-native';
1
+ import { NativeEventEmitter, NativeModules } from 'react-native';
2
2
  import { EventEmitter } from 'eventemitter3';
3
+ import TJEntryPoint from './TJEntryPoint';
3
4
 
4
5
  const Tapjoy = NativeModules.TapjoyReactNativeSdk;
5
6
  const TapjoyEmitter = new NativeEventEmitter(Tapjoy);
@@ -26,10 +27,14 @@ class TJPlacement extends EventEmitter {
26
27
  super();
27
28
  this.name = name;
28
29
  this.error = undefined;
30
+ Tapjoy.createPlacement(this.name);
29
31
  }
30
32
 
33
+ /**
34
+ * Request placement content.
35
+ */
31
36
  requestContent(): void {
32
- var subscription = TapjoyEmitter.addListener(
37
+ const subscription = TapjoyEmitter.addListener(
33
38
  TapjoyEventType,
34
39
  (event: TapjoyPlacementEvent) => {
35
40
  if (event.name === TJPlacement.REQUEST_DID_SUCCEED) {
@@ -53,8 +58,11 @@ class TJPlacement extends EventEmitter {
53
58
  Tapjoy.requestPlacement(this.name);
54
59
  }
55
60
 
61
+ /**
62
+ * Displays the content associated with the placement.
63
+ */
56
64
  showContent(): void {
57
- var subscription = TapjoyEmitter.addListener(
65
+ const subscription = TapjoyEmitter.addListener(
58
66
  TapjoyEventType,
59
67
  (event: TapjoyPlacementEvent) => {
60
68
  if (event.name === TJPlacement.CONTENT_DID_APPEAR) {
@@ -69,13 +77,88 @@ class TJPlacement extends EventEmitter {
69
77
  Tapjoy.showPlacement(this.name);
70
78
  }
71
79
 
80
+ /**
81
+ * Checks whether the content is ready for use.
82
+ *
83
+ * @returns {boolean} True if the content is ready; otherwise, false.
84
+ */
72
85
  isContentReady(): boolean {
73
86
  return Tapjoy.isContentReady(this.name);
74
87
  }
75
88
 
89
+ /**
90
+ * Checks whether the content is available for use.
91
+ *
92
+ * @returns {boolean} True if the content is available; otherwise, false.
93
+ */
76
94
  isContentAvailable(): boolean {
77
95
  return Tapjoy.isContentAvailable(this.name);
78
96
  }
97
+
98
+ /**
99
+ * Sets the currency balance for given currency id.
100
+ *
101
+ * @param {String} currencyId - The identifier of the currency.
102
+ * @param {Number} currencyBalance - The amount of the currency to set.
103
+ */
104
+ async setCurrencyBalance(
105
+ currencyId: String,
106
+ currencyBalance: Number
107
+ ): Promise<void> {
108
+ await Tapjoy.setCurrencyBalance(currencyBalance, currencyId, this.name);
109
+ }
110
+
111
+ /**
112
+ * Gets the currency balance for given currency id.
113
+ *
114
+ * @param {String} currencyId - The identifier of the currency.
115
+ * @return {Number} currencyBalance - The amount of the currency.
116
+ */
117
+ async getCurrencyBalance(currencyId: String): Promise<Number> {
118
+ return await Tapjoy.getPlacementCurrencyBalance(currencyId, this.name);
119
+ }
120
+
121
+ /**
122
+ * Sets the currency amount required
123
+ *
124
+ * @param {Number} amount The amount of currency the user needs. Must be greater than 0.
125
+ * @param {String} currencyId The identifier of the currency.
126
+ */
127
+ async setRequiredAmount(amount: Number, currencyId: String): Promise<void> {
128
+ await Tapjoy.setRequiredAmount(amount, currencyId, this.name);
129
+ }
130
+
131
+ /**
132
+ * Gets the currency amount required.
133
+ *
134
+ * @param {String} currencyId The identifier of the currency.
135
+ * @return {Number} The amount of currency the user needs. -1 if not available.
136
+ */
137
+ async getRequiredAmount(currencyId: String): Promise<Number> {
138
+ return await Tapjoy.getRequiredAmount(currencyId, this.name);
139
+ }
140
+
141
+ /**
142
+ * Sets entry point.
143
+ *
144
+ * @param {TJEntryPoint} entryPoint - Entry point.
145
+ * @see TJEntryPoint
146
+ */
147
+ setEntryPoint(entryPoint: TJEntryPoint): void {
148
+ Tapjoy.setEntryPoint(this.name, Object.values(TJEntryPoint).indexOf(entryPoint));
149
+ }
150
+
151
+ /**
152
+ * Gets entry point.
153
+ *
154
+ * @returns Entry point.
155
+ * @see TJEntryPoint
156
+ */
157
+ async getEntryPoint(): Promise<TJEntryPoint | undefined> {
158
+ const entryPointValue: TJEntryPoint | undefined =
159
+ Object.values(TJEntryPoint)[await Tapjoy.getEntryPoint(this.name)];
160
+ return entryPointValue;
161
+ }
79
162
  }
80
163
 
81
164
  export default TJPlacement;
@@ -1,8 +1,19 @@
1
- import { NativeModules } from 'react-native';
1
+ import { NativeModules, Platform } from 'react-native';
2
+ import type TJStatus from './TJStatus';
2
3
 
3
4
  const Tapjoy = NativeModules.TapjoyReactNativeSdk;
4
5
 
5
6
  class TJPrivacyPolicy {
7
+ async getBelowConsentAge(): Promise<TJStatus> {
8
+ try {
9
+ let isBelowConsentAge: TJStatus = await Tapjoy.getBelowConsentAge();
10
+ return isBelowConsentAge;
11
+ } catch (err) {
12
+ console.error(err);
13
+ throw err;
14
+ }
15
+ }
16
+
6
17
  setBelowConsentAge(isBelowConsentAge: boolean): void {
7
18
  Tapjoy.setBelowConsentAge(isBelowConsentAge);
8
19
  }
@@ -11,13 +22,63 @@ class TJPrivacyPolicy {
11
22
  Tapjoy.setSubjectToGDPR(isSubjectToGDPR);
12
23
  }
13
24
 
25
+ async getSubjectToGDPR(): Promise<TJStatus> {
26
+ try {
27
+ let isSubjectToGDPR: TJStatus = await Tapjoy.getSubjectToGDPR();
28
+ return isSubjectToGDPR;
29
+ } catch (err) {
30
+ console.error(err);
31
+ throw err;
32
+ }
33
+ }
34
+
14
35
  setUSPrivacy(usPrivacy: string): void {
15
36
  Tapjoy.setUSPrivacy(usPrivacy);
16
37
  }
17
38
 
39
+ async getUSPrivacy(): Promise<string> {
40
+ try {
41
+ let usPrivacy: string = await Tapjoy.getUSPrivacy();
42
+ return usPrivacy;
43
+ } catch (err) {
44
+ console.error(err);
45
+ throw err;
46
+ }
47
+ }
48
+
18
49
  setUserConsent(userConsent: string): void {
19
50
  Tapjoy.setUserConsent(userConsent);
20
51
  }
52
+
53
+ async getUserConsent(): Promise<TJStatus> {
54
+ try {
55
+ let userConsent: TJStatus = await Tapjoy.getUserConsent();
56
+ return userConsent;
57
+ } catch (err) {
58
+ console.error(err);
59
+ throw err;
60
+ }
61
+ }
62
+
63
+ setBelowConsentAgeStatus(isBelowConsentAgeStatus: TJStatus): void {
64
+ Tapjoy.setBelowConsentAgeStatus(isBelowConsentAgeStatus);
65
+ }
66
+
67
+ setSubjectToGDPRStatus(isSubjectToGDPRStatus: TJStatus): void {
68
+ Tapjoy.setSubjectToGDPRStatus(isSubjectToGDPRStatus);
69
+ }
70
+
71
+ setUserConsentStatus(userConsentStatus: TJStatus): void {
72
+ Tapjoy.setUserConsentStatus(userConsentStatus);
73
+ }
74
+
75
+ optOutAdvertisingID(optOut: boolean): void {
76
+ if (Platform.OS === 'android') {
77
+ Tapjoy.optOutAdvertisingID(optOut);
78
+ } else {
79
+ console.warn('optOutAdvertisingID is only supported on Android.');
80
+ }
81
+ }
21
82
  }
22
83
 
23
84
  export default TJPrivacyPolicy;
@@ -0,0 +1,8 @@
1
+ enum TJSegment {
2
+ NonPayer = 0,
3
+ Payer = 1,
4
+ VIP = 2,
5
+ Unknown = -1,
6
+ }
7
+
8
+ export default TJSegment;
@@ -0,0 +1,7 @@
1
+ enum TJStatus {
2
+ False,
3
+ True,
4
+ Unknown
5
+ }
6
+
7
+ export default TJStatus;
package/src/TJVersion.ts CHANGED
@@ -1,5 +1,5 @@
1
- const REACT_LIBRARY_VERSION = "13.1.2"
2
- const REACT_LIBRARY_VERSION_SUFFIX = ""
1
+ const REACT_LIBRARY_VERSION = '13.2.1';
2
+ const REACT_LIBRARY_VERSION_SUFFIX = '';
3
3
 
4
4
  export class TJVersion {
5
5
  // Returns the version of the plugin - eg: 1.0.0-alpha-rc1
package/src/index.ts CHANGED
@@ -2,6 +2,8 @@ import { NativeModules, Platform } from 'react-native';
2
2
  import TJPlacement from './TJPlacement';
3
3
  import TJPrivacyPolicy from './TJPrivacyPolicy';
4
4
  import TJVersion from './TJVersion';
5
+ import TJStatus from './TJStatus';
6
+ import TJSegment from './TJSegment';
5
7
 
6
8
  const LINKING_ERROR =
7
9
  `The package 'tapjoy-react-native-sdk' doesn't seem to be linked. Make sure: \n\n` +
@@ -20,5 +22,5 @@ const Tapjoy = NativeModules.TapjoyReactNativeSdk
20
22
  }
21
23
  );
22
24
 
23
- export { Tapjoy, TJPlacement, TJPrivacyPolicy, TJVersion };
25
+ export { Tapjoy, TJPlacement, TJPrivacyPolicy, TJVersion, TJStatus, TJSegment };
24
26
  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.1.2"
20
+ s.dependency "TapjoySDK", "13.2.1"
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