tapjoy-react-native-sdk 14.3.0 → 14.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 (40) hide show
  1. package/android/build.gradle +1 -1
  2. package/android/src/main/java/com/tapjoyreactnativesdk/TapjoyReactNativeSdkModule.kt +39 -0
  3. package/example/Gemfile +9 -1
  4. package/example/android/app/build.gradle +3 -3
  5. package/example/android/build.gradle +3 -3
  6. package/example/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  7. package/example/android/gradle/wrapper/gradle-wrapper.properties +1 -1
  8. package/example/android/gradlew +2 -3
  9. package/example/babel.config.js +0 -9
  10. package/example/ios/AppDelegate.swift +55 -0
  11. package/example/ios/Podfile +0 -1
  12. package/example/ios/TapjoyReactNativeSdkExample.xcodeproj/project.pbxproj +5 -17
  13. package/example/metro.config.js +1 -1
  14. package/example/package.json +15 -15
  15. package/example/src/MainScreen.tsx +39 -5
  16. package/ios/TapjoyReactNativeSdk.m +4 -1
  17. package/ios/TapjoyReactNativeSdk.swift +14 -6
  18. package/lib/commonjs/TJLoggingLevel.js +8 -0
  19. package/lib/commonjs/TJVersion.js +1 -1
  20. package/lib/commonjs/Tapjoy.js +41 -1
  21. package/lib/commonjs/TapjoyEvent.js +1 -1
  22. package/lib/commonjs/index.js +2 -1
  23. package/lib/typescript/TJLoggingLevel.d.ts +7 -0
  24. package/lib/typescript/Tapjoy.d.ts +31 -0
  25. package/lib/typescript/TapjoyEvent.d.ts +1 -1
  26. package/lib/typescript/index.d.ts +4 -1
  27. package/package.json +4 -4
  28. package/src/TJLoggingLevel.ts +8 -0
  29. package/src/TJStatus.ts +1 -1
  30. package/src/TJVersion.ts +1 -1
  31. package/src/Tapjoy.ts +46 -3
  32. package/src/TapjoyEvent.ts +2 -2
  33. package/src/index.ts +4 -0
  34. package/tapjoy-react-native-sdk.podspec +1 -1
  35. package/example/ios/TapjoyReactNativeSdkExample/AppDelegate.h +0 -6
  36. package/example/ios/TapjoyReactNativeSdkExample/AppDelegate.mm +0 -31
  37. package/example/ios/TapjoyReactNativeSdkExample/main.m +0 -10
  38. package/example/ios/TapjoyReactNativeSdkExampleTests/Info.plist +0 -24
  39. package/example/ios/TapjoyReactNativeSdkExampleTests/TapjoyReactNativeSdkExampleTests.m +0 -66
  40. package/example/package-lock.json +0 -8605
@@ -1,4 +1,6 @@
1
1
  import TJSegment from './TJSegment';
2
+ import TJLoggingLevel from './TJLoggingLevel';
3
+ import { TapjoyEvent } from './TapjoyEvent';
2
4
  declare class Tapjoy {
3
5
  /**
4
6
  * Connects to the Tapjoy Server.
@@ -49,6 +51,23 @@ declare class Tapjoy {
49
51
  */
50
52
  static trackPurchase(currencyCode: string, price: number): void;
51
53
  /**
54
+ * Sets the logging level for Tapjoy.
55
+ *
56
+ * @param loggingLevel
57
+ * the logging level to set
58
+ * @see TJLoggingLevel
59
+ */
60
+ static setLoggingLevel(loggingLevel: TJLoggingLevel): void;
61
+ /**
62
+ * Gets the current logging level for Tapjoy.
63
+ *
64
+ * @return the current logging level
65
+ * @see TJLoggingLevel
66
+ */
67
+ static getLoggingLevel(): Promise<any>;
68
+ /**
69
+ * @deprecated Deprecated in 14.4.0 in favor of setLoggingLevel
70
+ *
52
71
  * Enables or disables Tapjoy logging
53
72
  *
54
73
  * @param enable
@@ -144,5 +163,17 @@ declare class Tapjoy {
144
163
  * the tag to be removed
145
164
  */
146
165
  static removeUserTag(tag: string): void;
166
+ /**
167
+ * Assign a custom parameter associated with any following placement requests that contains an ad type. We will return this value on the currency callback.
168
+ * Only applicable for publishers who manage their own currency servers. This value does NOT get unset with each subsequent placement request.
169
+ * @param customParameter
170
+ * The custom parameter to assign to this device
171
+ */
172
+ static setCustomParameter(customParameter: string): void;
173
+ /**
174
+ * Returns the currently set custom parameter.
175
+ * @return the value of the currently set custom parameter.
176
+ */
177
+ static getCustomParameter(): Promise<any>;
147
178
  }
148
179
  export default Tapjoy;
@@ -1,4 +1,4 @@
1
- interface TapjoyEvent {
1
+ export interface TapjoyEvent {
2
2
  name: string;
3
3
  code: string;
4
4
  message: string;
@@ -5,6 +5,9 @@ import TJStatus from './TJStatus';
5
5
  import TJSegment from './TJSegment';
6
6
  import TJOfferwallDiscoverView from './TJOfferwallDiscoverView';
7
7
  import TJPurchase from './TJPurchase';
8
+ import TJLoggingLevel from './TJLoggingLevel';
8
9
  import Tapjoy from './Tapjoy';
9
- export { Tapjoy, TJPlacement, TJPrivacyPolicy, TJVersion, TJStatus, TJSegment, TJOfferwallDiscoverView, TJPurchase, };
10
+ import { TapjoyEvent } from './TapjoyEvent';
11
+ export { Tapjoy, TJPlacement, TJPrivacyPolicy, TJVersion, TJStatus, TJSegment, TJOfferwallDiscoverView, TJPurchase, TJLoggingLevel, };
12
+ export type { TapjoyEvent };
10
13
  export default Tapjoy;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tapjoy-react-native-sdk",
3
- "version": "14.3.0",
3
+ "version": "14.4.0",
4
4
  "description": "ReactNative Plugin for Tapjoy SDK",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -77,7 +77,7 @@
77
77
  "devDependencies": {
78
78
  "@commitlint/config-conventional": "^19.5.0",
79
79
  "@react-native-community/eslint-config": "^3.2.0",
80
- "@react-native/metro-config": "^0.76.6",
80
+ "@react-native/metro-config": "^0.79.2",
81
81
  "@types/jest": "^29.5.13",
82
82
  "@types/react": "^18.3.10",
83
83
  "commitlint": "^19.5.0",
@@ -88,8 +88,8 @@
88
88
  "jest": "^29.7.0",
89
89
  "pod-install": "^0.2.2",
90
90
  "prettier": "^3.3.3",
91
- "react": "^18.3.1",
92
- "react-native": "0.76.1",
91
+ "react": "^19.0.0",
92
+ "react-native": "0.79.2",
93
93
  "typedoc": "^0.26.7",
94
94
  "typescript": "^5.6.2"
95
95
  },
@@ -0,0 +1,8 @@
1
+ enum TJLoggingLevel {
2
+ Error = 0,
3
+ Warning = 1,
4
+ Info = 2,
5
+ Debug = 3,
6
+ }
7
+
8
+ export default TJLoggingLevel;
package/src/TJStatus.ts CHANGED
@@ -4,4 +4,4 @@ enum TJStatus {
4
4
  Unknown
5
5
  }
6
6
 
7
- export default TJStatus;
7
+ export default TJStatus;
package/src/TJVersion.ts CHANGED
@@ -1,4 +1,4 @@
1
- const REACT_LIBRARY_VERSION = '14.3.0';
1
+ const REACT_LIBRARY_VERSION = '14.4.0';
2
2
  const REACT_LIBRARY_VERSION_SUFFIX = '';
3
3
 
4
4
  export class TJVersion {
package/src/Tapjoy.ts CHANGED
@@ -1,6 +1,8 @@
1
1
  import { NativeModules, Platform, NativeEventEmitter } from 'react-native';
2
2
  import TJSegment from './TJSegment';
3
3
  import TJConnect from './TJConnect';
4
+ import TJLoggingLevel from './TJLoggingLevel';
5
+ import { TapjoyEvent } from './TapjoyEvent';
4
6
 
5
7
  const LINKING_ERROR =
6
8
  `The package 'tapjoy-react-native-sdk' doesn't seem to be linked. Make sure: \n\n` +
@@ -99,15 +101,38 @@ class Tapjoy {
99
101
  TapjoyAPI.trackPurchase(currencyCode, price);
100
102
  }
101
103
 
104
+ /**
105
+ * Sets the logging level for Tapjoy.
106
+ *
107
+ * @param loggingLevel
108
+ * the logging level to set
109
+ * @see TJLoggingLevel
110
+ */
111
+ public static setLoggingLevel(loggingLevel: TJLoggingLevel) {
112
+ TapjoyAPI.setLoggingLevel(loggingLevel);
113
+ };
114
+
115
+ /**
116
+ * Gets the current logging level for Tapjoy.
117
+ *
118
+ * @return the current logging level
119
+ * @see TJLoggingLevel
120
+ */
121
+ public static async getLoggingLevel() {
122
+ return await TapjoyAPI.getLoggingLevel();
123
+ };
124
+
102
125
  /**
126
+ * @deprecated Deprecated in 14.4.0 in favor of setLoggingLevel
127
+ *
103
128
  * Enables or disables Tapjoy logging
104
- *
129
+ *
105
130
  * @param enable
106
131
  * set to true if logging should be enabled, false to disable
107
132
  * logging
108
133
  */
109
134
  public static setDebugEnabled(enable: Boolean) {
110
- TapjoyAPI.setDebugEnabled(enable);
135
+ TapjoyAPI.setLoggingLevel(enable ? TJLoggingLevel.Debug : TJLoggingLevel.Error);
111
136
  };
112
137
 
113
138
  /**
@@ -236,5 +261,23 @@ class Tapjoy {
236
261
  public static removeUserTag(tag: string) {
237
262
  TapjoyAPI.removeUserTag(tag);
238
263
  }
264
+
265
+ /**
266
+ * Assign a custom parameter associated with any following placement requests that contains an ad type. We will return this value on the currency callback.
267
+ * Only applicable for publishers who manage their own currency servers. This value does NOT get unset with each subsequent placement request.
268
+ * @param customParameter
269
+ * The custom parameter to assign to this device
270
+ */
271
+ public static setCustomParameter(customParameter: string) {
272
+ TapjoyAPI.setCustomParameter(customParameter);
273
+ }
274
+
275
+ /**
276
+ * Returns the currently set custom parameter.
277
+ * @return the value of the currently set custom parameter.
278
+ */
279
+ public static async getCustomParameter() {
280
+ return TapjoyAPI.getCustomParameter();
281
+ }
239
282
  }
240
- export default Tapjoy;
283
+ export default Tapjoy;
@@ -1,5 +1,5 @@
1
- interface TapjoyEvent {
1
+ export interface TapjoyEvent {
2
2
  name: string;
3
3
  code: string;
4
4
  message: string;
5
- }
5
+ }
package/src/index.ts CHANGED
@@ -5,7 +5,9 @@ import TJStatus from './TJStatus';
5
5
  import TJSegment from './TJSegment';
6
6
  import TJOfferwallDiscoverView from './TJOfferwallDiscoverView';
7
7
  import TJPurchase from './TJPurchase';
8
+ import TJLoggingLevel from './TJLoggingLevel';
8
9
  import Tapjoy from './Tapjoy';
10
+ import { TapjoyEvent } from './TapjoyEvent';
9
11
 
10
12
 
11
13
  export {
@@ -17,5 +19,7 @@ export {
17
19
  TJSegment,
18
20
  TJOfferwallDiscoverView,
19
21
  TJPurchase,
22
+ TJLoggingLevel,
20
23
  };
24
+ export type { TapjoyEvent };
21
25
  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", "14.3.0"
20
+ s.dependency "TapjoySDK", "14.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,6 +0,0 @@
1
- #import <RCTAppDelegate.h>
2
- #import <UIKit/UIKit.h>
3
-
4
- @interface AppDelegate : RCTAppDelegate
5
-
6
- @end
@@ -1,31 +0,0 @@
1
- #import "AppDelegate.h"
2
-
3
- #import <React/RCTBundleURLProvider.h>
4
-
5
- @implementation AppDelegate
6
-
7
- - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
8
- {
9
- self.moduleName = @"TapjoyReactNativeSdkExample";
10
- // You can add your custom initial props in the dictionary below.
11
- // They will be passed down to the ViewController used by React Native.
12
- self.initialProps = @{};
13
-
14
- return [super application:application didFinishLaunchingWithOptions:launchOptions];
15
- }
16
-
17
- - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
18
- {
19
- return [self bundleURL];
20
- }
21
-
22
- - (NSURL *)bundleURL
23
- {
24
- #if DEBUG
25
- return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"];
26
- #else
27
- return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
28
- #endif
29
- }
30
-
31
- @end
@@ -1,10 +0,0 @@
1
- #import <UIKit/UIKit.h>
2
-
3
- #import "AppDelegate.h"
4
-
5
- int main(int argc, char *argv[])
6
- {
7
- @autoreleasepool {
8
- return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
9
- }
10
- }
@@ -1,24 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
- <plist version="1.0">
4
- <dict>
5
- <key>CFBundleDevelopmentRegion</key>
6
- <string>en</string>
7
- <key>CFBundleExecutable</key>
8
- <string>$(EXECUTABLE_NAME)</string>
9
- <key>CFBundleIdentifier</key>
10
- <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
11
- <key>CFBundleInfoDictionaryVersion</key>
12
- <string>6.0</string>
13
- <key>CFBundleName</key>
14
- <string>$(PRODUCT_NAME)</string>
15
- <key>CFBundlePackageType</key>
16
- <string>BNDL</string>
17
- <key>CFBundleShortVersionString</key>
18
- <string>1.0</string>
19
- <key>CFBundleSignature</key>
20
- <string>????</string>
21
- <key>CFBundleVersion</key>
22
- <string>1</string>
23
- </dict>
24
- </plist>
@@ -1,66 +0,0 @@
1
- #import <UIKit/UIKit.h>
2
- #import <XCTest/XCTest.h>
3
-
4
- #import <React/RCTLog.h>
5
- #import <React/RCTRootView.h>
6
-
7
- #define TIMEOUT_SECONDS 600
8
- #define TEXT_TO_LOOK_FOR @"Welcome to React"
9
-
10
- @interface TapjoyReactNativeSdkExampleTests : XCTestCase
11
-
12
- @end
13
-
14
- @implementation TapjoyReactNativeSdkExampleTests
15
-
16
- - (BOOL)findSubviewInView:(UIView *)view matching:(BOOL (^)(UIView *view))test
17
- {
18
- if (test(view)) {
19
- return YES;
20
- }
21
- for (UIView *subview in [view subviews]) {
22
- if ([self findSubviewInView:subview matching:test]) {
23
- return YES;
24
- }
25
- }
26
- return NO;
27
- }
28
-
29
- - (void)testRendersWelcomeScreen
30
- {
31
- UIViewController *vc = [[[RCTSharedApplication() delegate] window] rootViewController];
32
- NSDate *date = [NSDate dateWithTimeIntervalSinceNow:TIMEOUT_SECONDS];
33
- BOOL foundElement = NO;
34
-
35
- __block NSString *redboxError = nil;
36
- #ifdef DEBUG
37
- RCTSetLogFunction(
38
- ^(RCTLogLevel level, RCTLogSource source, NSString *fileName, NSNumber *lineNumber, NSString *message) {
39
- if (level >= RCTLogLevelError) {
40
- redboxError = message;
41
- }
42
- });
43
- #endif
44
-
45
- while ([date timeIntervalSinceNow] > 0 && !foundElement && !redboxError) {
46
- [[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
47
- [[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
48
-
49
- foundElement = [self findSubviewInView:vc.view
50
- matching:^BOOL(UIView *view) {
51
- if ([view.accessibilityLabel isEqualToString:TEXT_TO_LOOK_FOR]) {
52
- return YES;
53
- }
54
- return NO;
55
- }];
56
- }
57
-
58
- #ifdef DEBUG
59
- RCTSetLogFunction(RCTDefaultLogFunction);
60
- #endif
61
-
62
- XCTAssertNil(redboxError, @"RedBox error: %@", redboxError);
63
- XCTAssertTrue(foundElement, @"Couldn't find element with text '%@' in %d seconds", TEXT_TO_LOOK_FOR, TIMEOUT_SECONDS);
64
- }
65
-
66
- @end