Skip to content

Commit

Permalink
feat/add_clearAllTargetingData (#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
applovinAsh and thomasmso authored May 7, 2023
1 parent 0f9ea6c commit 624ca56
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
## Versions

## x.x.x
* Add support for clearing all targeting data.
## 1.0.10
* Add support for targeting data.
## 1.0.9
Expand Down
17 changes: 17 additions & 0 deletions plugin/src/android/AppLovinMAX.java
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,19 @@ public void setInterests(final List<String> interests, final CallbackContext cal
callbackContext.success();
}

public void clearAllTargetingData(final CallbackContext callbackContext)
{
if ( sdk == null )
{
Log.e( "[" + TAG + "]", "Failed to clear targeting data - please ensure the AppLovin MAX Cordova Plugin has been initialized by calling 'AppLovinMAX.initialize(...);'!" );
return;
}

sdk.getTargetingData().clearAll();

callbackContext.success();
}

// EVENT TRACKING

public void trackEvent(final String event, final JSONObject parameters, final CallbackContext callbackContext) throws JSONException
Expand Down Expand Up @@ -1537,6 +1550,10 @@ else if ( "setInterests".equalsIgnoreCase( action ) )

setInterests( interestsList, callbackContext );
}
else if ( "clearAllTargetingData".equalsIgnoreCase( action ) )
{
clearAllTargetingData( callbackContext );
}
else if ( "trackEvent".equalsIgnoreCase( action ) )
{
String event = args.getString( 0 );
Expand Down
17 changes: 16 additions & 1 deletion plugin/src/ios/AppLovinMAX.m
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ - (void)showMediationDebugger:(CDVInvokedUrlCommand *)command
{
if ( !_sdk )
{
[self log: @"Failed to show mediation debugger - please ensure the AppLovin MAX Unity Plugin has been initialized by calling 'AppLovinMAX.initialize(...);'!"];
[self log: @"Failed to show mediation debugger - please ensure the AppLovin MAX Cordova Plugin has been initialized by calling 'AppLovinMAX.initialize(...);'!"];
[self sendErrorPluginResultForCommand: command];

return;
Expand Down Expand Up @@ -445,6 +445,21 @@ - (void)setInterests:(CDVInvokedUrlCommand *)command
[self sendOKPluginResultForCommand: command];
}

- (void)clearAllTargetingData:(CDVInvokedUrlCommand *)command
{
if ( !_sdk )
{
[self log: @"Failed to clear targeting data - please ensure the AppLovin MAX Cordova Plugin has been initialized by calling 'AppLovinMAX.initialize(...);'!"];
[self sendErrorPluginResultForCommand: command];

return;
}

[self.sdk.targetingData clearAll];

[self sendOKPluginResultForCommand: command];
}

#pragma mark - Event Tracking

- (void)trackEvent:(CDVInvokedUrlCommand *)command
Expand Down
4 changes: 4 additions & 0 deletions plugin/www/applovinmax.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,10 @@ var AppLovinMAX = {
callNative('setInterests', [interests]);
},

clearAllTargetingData: function () {
callNative('clearAllTargetingData');
},

/*----------------*/
/* EVENT TRACKING */
/*----------------*/
Expand Down

0 comments on commit 624ca56

Please sign in to comment.