-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Pull request #90: Provided in app click reporting
Merge in MML/infobip-mobile-messaging-huawei from ikresic-MM-6997-huawei-fix-inapp-click-reports to master Squashed commit of the following: commit 4e802542bd3442d84c39161443da2f57ed089026 Author: ikresic <[email protected]> Date: Wed Jan 8 14:10:49 2025 +0100 - provided in app click reporting
- Loading branch information
Showing
19 changed files
with
350 additions
and
54 deletions.
There are no files selected for viewing
57 changes: 57 additions & 0 deletions
57
...ng-huawei-sdk/src/androidTest/java/org/infobip/mobile/messaging/ClickUrlReporterTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package org.infobip.mobile.messaging; | ||
|
||
import static org.mockito.Mockito.mock; | ||
|
||
import org.infobip.mobile.messaging.interactive.inapp.InAppWebViewMessage; | ||
import org.infobip.mobile.messaging.mobileapi.BatchReporter; | ||
import org.infobip.mobile.messaging.mobileapi.common.MRetryPolicy; | ||
import org.infobip.mobile.messaging.mobileapi.common.RetryPolicyProvider; | ||
import org.infobip.mobile.messaging.mobileapi.inapp.InAppClickReporter; | ||
import org.infobip.mobile.messaging.stats.MobileMessagingStats; | ||
import org.infobip.mobile.messaging.tools.MobileMessagingTestCase; | ||
import org.infobip.mobile.messaging.util.StringUtils; | ||
import org.junit.Test; | ||
import org.mockito.Mockito; | ||
|
||
import java.util.concurrent.Executor; | ||
|
||
public class ClickUrlReporterTest extends MobileMessagingTestCase { | ||
|
||
private InAppClickReporter inAppClickReporter; | ||
private Executor executor; | ||
private BatchReporter batchReporter; | ||
private MRetryPolicy retryPolicy; | ||
|
||
@Override | ||
public void setUp() throws Exception { | ||
super.setUp(); | ||
|
||
batchReporter = new BatchReporter(300L); | ||
|
||
RetryPolicyProvider retryPolicyProvider = new RetryPolicyProvider(context); | ||
retryPolicy = retryPolicyProvider.DEFAULT(); | ||
|
||
MobileMessagingStats stats = mobileMessagingCore.getStats(); | ||
executor = mock(Executor.class); | ||
inAppClickReporter = new InAppClickReporter(mobileMessagingCore, context, stats, executor, broadcaster, batchReporter, retryPolicy); | ||
} | ||
|
||
@Test | ||
public void test_clickUrlReportBatch() throws Exception { | ||
|
||
InAppWebViewMessage message = new InAppWebViewMessage(); | ||
message.clickUrl = "https://www.infobip.com"; | ||
message.url = "https://www.infobip.com"; | ||
message.position = InAppWebViewMessage.InAppWebViewPosition.TOP; | ||
message.type = InAppWebViewMessage.InAppWebViewType.BANNER; | ||
|
||
String temp = StringUtils.concat(message.clickUrl, "banner", StringUtils.COMMA_WITH_SPACE); | ||
String clickReport = StringUtils.concat(temp, null, StringUtils.COMMA_WITH_SPACE); | ||
|
||
mobileMessagingCore.reportInAppClick(clickReport); | ||
inAppClickReporter.sync(); | ||
|
||
Mockito.verify(executor, Mockito.times(1)).execute(Mockito.any(Runnable.class)); | ||
Mockito.verify(executor, Mockito.after(500).atMost(2)).execute(Mockito.any(Runnable.class)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 18 additions & 14 deletions
32
...oidTest/java/org/infobip/mobile/messaging/interactive/inapp/view/InAppViewDialogTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.