tapjoy-react-native-sdk 13.3.0 → 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.
- package/android/build.gradle +5 -5
- package/android/gradle.properties +5 -5
- package/android/src/main/java/com/tapjoyreactnativesdk/TapjoyReactNativeSdkModule.kt +72 -2
- package/example/Gemfile +7 -0
- package/example/android/app/build.gradle +10 -61
- package/example/android/app/src/debug/AndroidManifest.xml +1 -5
- package/example/android/app/src/main/java/com/tapjoyreactnativesdkexample/MainActivity.kt +22 -0
- package/example/android/app/src/main/java/com/tapjoyreactnativesdkexample/MainApplication.kt +45 -0
- package/example/android/build.gradle +9 -9
- package/example/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/example/android/gradle/wrapper/gradle-wrapper.properties +4 -2
- package/example/android/gradle.properties +0 -3
- package/example/android/gradlew +24 -9
- package/example/babel.config.js +1 -1
- package/example/ios/Podfile +0 -9
- package/example/ios/TapjoyReactNativeSdkExample/AppDelegate.mm +6 -11
- package/example/ios/TapjoyReactNativeSdkExample/Info.plist +9 -13
- package/example/ios/TapjoyReactNativeSdkExample.xcodeproj/project.pbxproj +18 -8
- package/example/package.json +21 -18
- package/example/src/MainScreen.tsx +25 -6
- package/example/src/Styles.ts +8 -0
- package/example/src/UserProperties.tsx +43 -0
- package/ios/TapjoyReactNativeSdk.m +5 -0
- package/ios/TapjoyReactNativeSdk.swift +65 -1
- package/package.json +22 -23
- package/src/TJConnect.ts +5 -0
- package/src/TJVersion.ts +1 -1
- package/src/index.ts +11 -1
- package/tapjoy-react-native-sdk.podspec +1 -1
- package/example/android/app/src/debug/java/com/tapjoyreactnativesdkexample/ReactNativeFlipper.java +0 -75
- package/example/android/app/src/main/java/com/tapjoyreactnativesdkexample/MainActivity.java +0 -35
- package/example/android/app/src/main/java/com/tapjoyreactnativesdkexample/MainApplication.java +0 -62
- package/example/android/app/src/release/java/com/tapjoyreactnativesdkexample/ReactNativeFlipper.java +0 -20
- package/lib/commonjs/TJEntryPoint.js +0 -22
- package/lib/commonjs/TJEntryPoint.js.map +0 -1
- package/lib/commonjs/TJOfferwallDiscoverView.js +0 -37
- package/lib/commonjs/TJOfferwallDiscoverView.js.map +0 -1
- package/lib/commonjs/TJPlacement.js +0 -149
- package/lib/commonjs/TJPlacement.js.map +0 -1
- package/lib/commonjs/TJPrivacyPolicy.js +0 -77
- package/lib/commonjs/TJPrivacyPolicy.js.map +0 -1
- package/lib/commonjs/TJSegment.js +0 -16
- package/lib/commonjs/TJSegment.js.map +0 -1
- package/lib/commonjs/TJStatus.js +0 -15
- package/lib/commonjs/TJStatus.js.map +0 -1
- package/lib/commonjs/TJUtil.js +0 -21
- package/lib/commonjs/TJUtil.js.map +0 -1
- package/lib/commonjs/TJVersion.js +0 -22
- package/lib/commonjs/TJVersion.js.map +0 -1
- package/lib/commonjs/index.js +0 -63
- package/lib/commonjs/index.js.map +0 -1
- package/lib/module/TJEntryPoint.js +0 -15
- package/lib/module/TJEntryPoint.js.map +0 -1
- package/lib/module/TJOfferwallDiscoverView.js +0 -29
- package/lib/module/TJOfferwallDiscoverView.js.map +0 -1
- package/lib/module/TJPlacement.js +0 -141
- package/lib/module/TJPlacement.js.map +0 -1
- package/lib/module/TJPrivacyPolicy.js +0 -70
- package/lib/module/TJPrivacyPolicy.js.map +0 -1
- package/lib/module/TJSegment.js +0 -9
- package/lib/module/TJSegment.js.map +0 -1
- package/lib/module/TJStatus.js +0 -8
- package/lib/module/TJStatus.js.map +0 -1
- package/lib/module/TJUtil.js +0 -14
- package/lib/module/TJUtil.js.map +0 -1
- package/lib/module/TJVersion.js +0 -14
- package/lib/module/TJVersion.js.map +0 -1
- package/lib/module/index.js +0 -19
- package/lib/module/index.js.map +0 -1
- package/lib/typescript/TJEntryPoint.d.ts +0 -14
- package/lib/typescript/TJEntryPoint.d.ts.map +0 -1
- package/lib/typescript/TJOfferwallDiscoverView.d.ts +0 -18
- package/lib/typescript/TJOfferwallDiscoverView.d.ts.map +0 -1
- package/lib/typescript/TJPlacement.d.ts +0 -76
- package/lib/typescript/TJPlacement.d.ts.map +0 -1
- package/lib/typescript/TJPrivacyPolicy.d.ts +0 -17
- package/lib/typescript/TJPrivacyPolicy.d.ts.map +0 -1
- package/lib/typescript/TJSegment.d.ts +0 -8
- package/lib/typescript/TJSegment.d.ts.map +0 -1
- package/lib/typescript/TJStatus.d.ts +0 -7
- package/lib/typescript/TJStatus.d.ts.map +0 -1
- package/lib/typescript/TJUtil.d.ts +0 -5
- package/lib/typescript/TJUtil.d.ts.map +0 -1
- package/lib/typescript/TJVersion.d.ts +0 -5
- package/lib/typescript/TJVersion.d.ts.map +0 -1
- package/lib/typescript/index.d.ts +0 -10
- package/lib/typescript/index.d.ts.map +0 -1
|
@@ -438,7 +438,7 @@
|
|
|
438
438
|
"$(inherited)",
|
|
439
439
|
);
|
|
440
440
|
INFOPLIST_FILE = TapjoyReactNativeSdkExampleTests/Info.plist;
|
|
441
|
-
IPHONEOS_DEPLOYMENT_TARGET =
|
|
441
|
+
IPHONEOS_DEPLOYMENT_TARGET = 13.4;
|
|
442
442
|
LD_RUNPATH_SEARCH_PATHS = (
|
|
443
443
|
"$(inherited)",
|
|
444
444
|
"@executable_path/Frameworks",
|
|
@@ -466,7 +466,7 @@
|
|
|
466
466
|
BUNDLE_LOADER = "$(TEST_HOST)";
|
|
467
467
|
COPY_PHASE_STRIP = NO;
|
|
468
468
|
INFOPLIST_FILE = TapjoyReactNativeSdkExampleTests/Info.plist;
|
|
469
|
-
IPHONEOS_DEPLOYMENT_TARGET =
|
|
469
|
+
IPHONEOS_DEPLOYMENT_TARGET = 13.4;
|
|
470
470
|
LD_RUNPATH_SEARCH_PATHS = (
|
|
471
471
|
"$(inherited)",
|
|
472
472
|
"@executable_path/Frameworks",
|
|
@@ -650,7 +650,7 @@
|
|
|
650
650
|
buildSettings = {
|
|
651
651
|
ALWAYS_SEARCH_USER_PATHS = YES;
|
|
652
652
|
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
|
|
653
|
-
CLANG_CXX_LANGUAGE_STANDARD = "c++
|
|
653
|
+
CLANG_CXX_LANGUAGE_STANDARD = "c++20";
|
|
654
654
|
CLANG_CXX_LIBRARY = "libc++";
|
|
655
655
|
CLANG_ENABLE_MODULES = YES;
|
|
656
656
|
CLANG_ENABLE_OBJC_ARC = YES;
|
|
@@ -695,7 +695,7 @@
|
|
|
695
695
|
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
|
696
696
|
GCC_WARN_UNUSED_FUNCTION = YES;
|
|
697
697
|
GCC_WARN_UNUSED_VARIABLE = YES;
|
|
698
|
-
IPHONEOS_DEPLOYMENT_TARGET =
|
|
698
|
+
IPHONEOS_DEPLOYMENT_TARGET = 13.4;
|
|
699
699
|
LD_RUNPATH_SEARCH_PATHS = (
|
|
700
700
|
/usr/lib/swift,
|
|
701
701
|
"$(inherited)",
|
|
@@ -714,10 +714,16 @@
|
|
|
714
714
|
"-DFOLLY_MOBILE=1",
|
|
715
715
|
"-DFOLLY_USE_LIBCPP=1",
|
|
716
716
|
);
|
|
717
|
-
OTHER_LDFLAGS =
|
|
717
|
+
OTHER_LDFLAGS = (
|
|
718
|
+
"$(inherited)-Wl",
|
|
719
|
+
"-ld_classic",
|
|
720
|
+
"-Wl",
|
|
721
|
+
"-ld_classic",
|
|
722
|
+
);
|
|
718
723
|
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
|
|
719
724
|
SDKROOT = iphoneos;
|
|
720
725
|
TARGETED_DEVICE_FAMILY = "1,2";
|
|
726
|
+
USE_HERMES = true;
|
|
721
727
|
};
|
|
722
728
|
name = Debug;
|
|
723
729
|
};
|
|
@@ -726,7 +732,7 @@
|
|
|
726
732
|
buildSettings = {
|
|
727
733
|
ALWAYS_SEARCH_USER_PATHS = YES;
|
|
728
734
|
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
|
|
729
|
-
CLANG_CXX_LANGUAGE_STANDARD = "c++
|
|
735
|
+
CLANG_CXX_LANGUAGE_STANDARD = "c++20";
|
|
730
736
|
CLANG_CXX_LIBRARY = "libc++";
|
|
731
737
|
CLANG_ENABLE_MODULES = YES;
|
|
732
738
|
CLANG_ENABLE_OBJC_ARC = YES;
|
|
@@ -767,7 +773,7 @@
|
|
|
767
773
|
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
|
768
774
|
GCC_WARN_UNUSED_FUNCTION = YES;
|
|
769
775
|
GCC_WARN_UNUSED_VARIABLE = YES;
|
|
770
|
-
IPHONEOS_DEPLOYMENT_TARGET =
|
|
776
|
+
IPHONEOS_DEPLOYMENT_TARGET = 13.4;
|
|
771
777
|
LD_RUNPATH_SEARCH_PATHS = (
|
|
772
778
|
/usr/lib/swift,
|
|
773
779
|
"$(inherited)",
|
|
@@ -787,11 +793,15 @@
|
|
|
787
793
|
);
|
|
788
794
|
OTHER_LDFLAGS = (
|
|
789
795
|
"$(inherited)",
|
|
790
|
-
"
|
|
796
|
+
"-Wl",
|
|
797
|
+
"-ld_classic",
|
|
798
|
+
"-Wl",
|
|
799
|
+
"-ld_classic",
|
|
791
800
|
);
|
|
792
801
|
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
|
|
793
802
|
SDKROOT = iphoneos;
|
|
794
803
|
TARGETED_DEVICE_FAMILY = "1,2";
|
|
804
|
+
USE_HERMES = true;
|
|
795
805
|
VALIDATE_PRODUCT = YES;
|
|
796
806
|
};
|
|
797
807
|
name = Release;
|
package/example/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "TapjoyReactNativeSdkExample",
|
|
3
|
-
"version": "13.
|
|
3
|
+
"version": "13.4.0",
|
|
4
4
|
"private": true,
|
|
5
5
|
"scripts": {
|
|
6
6
|
"android": "react-native run-android",
|
|
@@ -9,28 +9,31 @@
|
|
|
9
9
|
"pods": "pod-install --quiet"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@react-native-async-storage/async-storage": "^1.
|
|
12
|
+
"@react-native-async-storage/async-storage": "^1.21.0",
|
|
13
13
|
"@react-native-community/masked-view": "^0.1.11",
|
|
14
|
-
"@react-native-picker/picker": "^2.
|
|
15
|
-
"@react-navigation/bottom-tabs": "^6.5.
|
|
16
|
-
"@react-navigation/native": "^6.1.
|
|
14
|
+
"@react-native-picker/picker": "^2.6.1",
|
|
15
|
+
"@react-navigation/bottom-tabs": "^6.5.11",
|
|
16
|
+
"@react-navigation/native": "^6.1.9",
|
|
17
17
|
"dayjs": "^1.11.10",
|
|
18
18
|
"react": "18.2.0",
|
|
19
|
-
"react-native": "0.
|
|
20
|
-
"react-native-gesture-handler": "^2.
|
|
21
|
-
"react-native-picker-select": "^
|
|
22
|
-
"react-native-reanimated": "^3.
|
|
23
|
-
"react-native-safe-area-context": "^4.
|
|
24
|
-
"react-native-screens": "^3.
|
|
19
|
+
"react-native": "0.73.2",
|
|
20
|
+
"react-native-gesture-handler": "^2.14.1",
|
|
21
|
+
"react-native-picker-select": "^9.0.0",
|
|
22
|
+
"react-native-reanimated": "^3.6.1",
|
|
23
|
+
"react-native-safe-area-context": "^4.8.2",
|
|
24
|
+
"react-native-screens": "^3.29.0",
|
|
25
25
|
"react-native-tracking-transparency": "^0.1.2",
|
|
26
|
-
"react-native-toast-message": "^2.
|
|
26
|
+
"react-native-toast-message": "^2.2.0"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@babel/core": "^7.
|
|
30
|
-
"@babel/preset-env": "^7.
|
|
31
|
-
"@babel/runtime": "^7.
|
|
32
|
-
"babel-plugin-module-resolver": "^
|
|
33
|
-
"@react-native/metro-config": "^0.
|
|
34
|
-
"metro-react-native-babel-preset": "0.
|
|
29
|
+
"@babel/core": "^7.23.7",
|
|
30
|
+
"@babel/preset-env": "^7.23.8",
|
|
31
|
+
"@babel/runtime": "^7.23.8",
|
|
32
|
+
"babel-plugin-module-resolver": "^5.0.0",
|
|
33
|
+
"@react-native/metro-config": "^0.73.3",
|
|
34
|
+
"metro-react-native-babel-preset": "0.77.0"
|
|
35
|
+
},
|
|
36
|
+
"engines": {
|
|
37
|
+
"node": ">=18"
|
|
35
38
|
}
|
|
36
39
|
}
|
|
@@ -6,6 +6,8 @@ import {
|
|
|
6
6
|
Platform,
|
|
7
7
|
Text,
|
|
8
8
|
ScrollView,
|
|
9
|
+
NativeEventEmitter,
|
|
10
|
+
NativeModules,
|
|
9
11
|
} from 'react-native';
|
|
10
12
|
import AsyncStorage from '@react-native-async-storage/async-storage';
|
|
11
13
|
import {
|
|
@@ -14,13 +16,19 @@ import {
|
|
|
14
16
|
} from 'react-native-tracking-transparency';
|
|
15
17
|
import styles from './Styles';
|
|
16
18
|
import Button from './Button';
|
|
17
|
-
import Tapjoy, { TJVersion } from 'tapjoy-react-native-sdk';
|
|
19
|
+
import Tapjoy, { TJVersion, TJConnect } from 'tapjoy-react-native-sdk';
|
|
18
20
|
|
|
19
21
|
const MainScreen: React.FC = () => {
|
|
20
22
|
const [sdkKey, setSdkKey] = useState<string>('');
|
|
21
23
|
const [isConnecting, setIsConnecting] = useState<boolean>(false);
|
|
22
24
|
const [statusLabelText, setStatusLabelText] = useState('Status Message');
|
|
23
25
|
|
|
26
|
+
interface TapjoyEvent {
|
|
27
|
+
name: string;
|
|
28
|
+
code: string;
|
|
29
|
+
message: string;
|
|
30
|
+
}
|
|
31
|
+
|
|
24
32
|
useEffect(() => {
|
|
25
33
|
retrieveSdkKey().then();
|
|
26
34
|
}, []);
|
|
@@ -50,14 +58,25 @@ const MainScreen: React.FC = () => {
|
|
|
50
58
|
Tapjoy.setDebugEnabled(true);
|
|
51
59
|
let userId = await AsyncStorage.getItem('userId');
|
|
52
60
|
let flags: object = { TJC_OPTION_USER_ID: userId };
|
|
53
|
-
|
|
54
61
|
let trackingStatus = await getTrackingStatus();
|
|
55
|
-
if (trackingStatus
|
|
56
|
-
await Tapjoy.connect(sdkKey, flags);
|
|
57
|
-
} else {
|
|
62
|
+
if (trackingStatus !== 'authorized' && trackingStatus !== 'unavailable') {
|
|
58
63
|
await requestTrackingPermission();
|
|
59
|
-
await Tapjoy.connect(sdkKey, flags);
|
|
60
64
|
}
|
|
65
|
+
const TJ = NativeModules.TapjoyReactNativeSdk;
|
|
66
|
+
const TapjoyEmitter = new NativeEventEmitter(TJ);
|
|
67
|
+
const TapjoyEventType = 'Tapjoy';
|
|
68
|
+
const subscription = TapjoyEmitter.addListener(
|
|
69
|
+
TapjoyEventType,
|
|
70
|
+
(event: TapjoyEvent) => {
|
|
71
|
+
if (event.name === TJConnect.TJC_CONNECT_WARNING) {
|
|
72
|
+
subscription.remove();
|
|
73
|
+
setStatusLabelText(
|
|
74
|
+
`Tapjoy SDK connected with Warning: ErrorCode: ${event.code} ${event.message} `
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
);
|
|
79
|
+
await Tapjoy.connect(sdkKey, flags);
|
|
61
80
|
setIsConnecting(false);
|
|
62
81
|
setStatusLabelText(
|
|
63
82
|
'Tapjoy SDK Connected' +
|
package/example/src/Styles.ts
CHANGED
|
@@ -44,6 +44,14 @@ const styles = StyleSheet.create({
|
|
|
44
44
|
flex: 1,
|
|
45
45
|
alignSelf: 'flex-start',
|
|
46
46
|
},
|
|
47
|
+
buttonTag: {
|
|
48
|
+
backgroundColor: '#FDAA1C',
|
|
49
|
+
borderRadius: 5,
|
|
50
|
+
padding: 10,
|
|
51
|
+
flex: 1,
|
|
52
|
+
alignSelf: 'flex-start',
|
|
53
|
+
marginRight: 10,
|
|
54
|
+
},
|
|
47
55
|
enabledButton: {},
|
|
48
56
|
disabledButton: {
|
|
49
57
|
opacity: 0.5,
|
|
@@ -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>
|
|
@@ -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
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tapjoy-react-native-sdk",
|
|
3
|
-
"version": "13.
|
|
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",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"bootstrap": "yarn example && yarn install && yarn example pods",
|
|
49
49
|
"clean": "del-cli android/build example/android/build example/android/app/build example/ios/build temp package",
|
|
50
50
|
"prepare-repo": "rm -rf temp package && mkdir temp && cd temp && git clone git@github.com:Tapjoy/react-native-sdk . && rm -rf *",
|
|
51
|
-
"copy-pack": "
|
|
51
|
+
"copy-pack": "npm pack && tar xvzf tapjoy-react-native*.tgz && cp -af ./package/* ./temp && rm tapjoy-react-native*.tgz",
|
|
52
52
|
"push": "cd temp && git add . && export VERSION=`node -p \"require('./package.json').version\"` && git commit -m \"Release $VERSION\" && git push",
|
|
53
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"
|
|
54
54
|
},
|
|
@@ -70,36 +70,35 @@
|
|
|
70
70
|
"registry": "https://registry.npmjs.org/"
|
|
71
71
|
},
|
|
72
72
|
"devDependencies": {
|
|
73
|
-
"@commitlint/config-conventional": "^
|
|
74
|
-
"@react-native-community/eslint-config": "^3.0
|
|
75
|
-
"@react-native/metro-config": "^0.
|
|
76
|
-
"@release-it/conventional-changelog": "^
|
|
77
|
-
"@types/jest": "^
|
|
78
|
-
"@types/react": "
|
|
79
|
-
"
|
|
80
|
-
"
|
|
81
|
-
"
|
|
82
|
-
"eslint": "^
|
|
83
|
-
"eslint-
|
|
84
|
-
"
|
|
85
|
-
"
|
|
86
|
-
"
|
|
87
|
-
"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",
|
|
88
87
|
"react": "18.2.0",
|
|
89
|
-
"react-native": "0.
|
|
90
|
-
"react-native-builder-bob": "^0.
|
|
91
|
-
"release-it": "^
|
|
92
|
-
"typescript": "^
|
|
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"
|
|
93
92
|
},
|
|
94
93
|
"resolutions": {
|
|
95
|
-
"@types/react": "
|
|
94
|
+
"@types/react": "^18.2.48"
|
|
96
95
|
},
|
|
97
96
|
"peerDependencies": {
|
|
98
97
|
"react": "*",
|
|
99
98
|
"react-native": "*"
|
|
100
99
|
},
|
|
101
100
|
"engines": {
|
|
102
|
-
"node": ">=
|
|
101
|
+
"node": ">= 18"
|
|
103
102
|
},
|
|
104
103
|
"packageManager": "^yarn@1.22.15",
|
|
105
104
|
"jest": {
|
package/src/TJConnect.ts
ADDED
package/src/TJVersion.ts
CHANGED
package/src/index.ts
CHANGED
|
@@ -5,6 +5,7 @@ import TJVersion from './TJVersion';
|
|
|
5
5
|
import TJStatus from './TJStatus';
|
|
6
6
|
import TJSegment from './TJSegment';
|
|
7
7
|
import TJOfferwallDiscoverView from './TJOfferwallDiscoverView';
|
|
8
|
+
import TJConnect from './TJConnect';
|
|
8
9
|
|
|
9
10
|
const LINKING_ERROR =
|
|
10
11
|
`The package 'tapjoy-react-native-sdk' doesn't seem to be linked. Make sure: \n\n` +
|
|
@@ -23,5 +24,14 @@ const Tapjoy = NativeModules.TapjoyReactNativeSdk
|
|
|
23
24
|
}
|
|
24
25
|
);
|
|
25
26
|
|
|
26
|
-
export {
|
|
27
|
+
export {
|
|
28
|
+
Tapjoy,
|
|
29
|
+
TJPlacement,
|
|
30
|
+
TJPrivacyPolicy,
|
|
31
|
+
TJVersion,
|
|
32
|
+
TJStatus,
|
|
33
|
+
TJSegment,
|
|
34
|
+
TJOfferwallDiscoverView,
|
|
35
|
+
TJConnect,
|
|
36
|
+
};
|
|
27
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.
|
|
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
|
package/example/android/app/src/debug/java/com/tapjoyreactnativesdkexample/ReactNativeFlipper.java
DELETED
|
@@ -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
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
package com.tapjoyreactnativesdkexample;
|
|
2
|
-
|
|
3
|
-
import com.facebook.react.ReactActivity;
|
|
4
|
-
import com.facebook.react.ReactActivityDelegate;
|
|
5
|
-
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint;
|
|
6
|
-
import com.facebook.react.defaults.DefaultReactActivityDelegate;
|
|
7
|
-
|
|
8
|
-
public class MainActivity extends ReactActivity {
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Returns the name of the main component registered from JavaScript. This is used to schedule
|
|
12
|
-
* rendering of the component.
|
|
13
|
-
*/
|
|
14
|
-
@Override
|
|
15
|
-
protected String getMainComponentName() {
|
|
16
|
-
return "TapjoyReactNativeSdkExample";
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Returns the instance of the {@link ReactActivityDelegate}. Here we use a util class {@link
|
|
21
|
-
* DefaultReactActivityDelegate} which allows you to easily enable Fabric and Concurrent React
|
|
22
|
-
* (aka React 18) with two boolean flags.
|
|
23
|
-
*/
|
|
24
|
-
@Override
|
|
25
|
-
protected ReactActivityDelegate createReactActivityDelegate() {
|
|
26
|
-
return new DefaultReactActivityDelegate(
|
|
27
|
-
this,
|
|
28
|
-
getMainComponentName(),
|
|
29
|
-
// If you opted-in for the New Architecture, we enable the Fabric Renderer.
|
|
30
|
-
DefaultNewArchitectureEntryPoint.getFabricEnabled(), // fabricEnabled
|
|
31
|
-
// If you opted-in for the New Architecture, we enable Concurrent React (i.e. React 18).
|
|
32
|
-
DefaultNewArchitectureEntryPoint.getConcurrentReactEnabled() // concurrentRootEnabled
|
|
33
|
-
);
|
|
34
|
-
}
|
|
35
|
-
}
|