Skip to content

Commit

Permalink
Merge pull request #443 from adobe/staging
Browse files Browse the repository at this point in the history
  • Loading branch information
praveek authored Apr 24, 2023
2 parents c8743a6 + e640e4c commit 5a05488
Show file tree
Hide file tree
Showing 18 changed files with 430 additions and 517 deletions.
2 changes: 2 additions & 0 deletions code/core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ dokkaJavadoc.configure {
dependencies {
//noinspection GradleDependency,GradleCompatible
implementation 'androidx.appcompat:appcompat:1.0.0'
// androidx card view for customizable rounded corners
implementation "androidx.cardview:cardview:1.0.0"
//noinspection GradleDependency
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
// unit tests
Expand Down
18 changes: 14 additions & 4 deletions code/core/release.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,20 @@ publishing {
withXml {
def dependenciesNode = asNode().appendNode('dependencies')

def coreDependencyNode = dependenciesNode.appendNode('dependency')
coreDependencyNode.appendNode('groupId', 'org.jetbrains.kotlin')
coreDependencyNode.appendNode('artifactId', 'kotlin-stdlib-jdk8')
coreDependencyNode.appendNode('version', rootProject.kotlin_version)
def kotlinDependencyNode = dependenciesNode.appendNode('dependency')
kotlinDependencyNode.appendNode('groupId', 'org.jetbrains.kotlin')
kotlinDependencyNode.appendNode('artifactId', 'kotlin-stdlib-jdk8')
kotlinDependencyNode.appendNode('version', rootProject.kotlin_version)

def cardviewDependencyNode = dependenciesNode.appendNode('dependency')
cardviewDependencyNode.appendNode('groupId', 'androidx.cardview')
cardviewDependencyNode.appendNode('artifactId', 'cardview')
cardviewDependencyNode.appendNode('version', '1.0.0')

def appcompatDependencyNode = dependenciesNode.appendNode('dependency')
appcompatDependencyNode.appendNode('groupId', 'androidx.appcompat')
appcompatDependencyNode.appendNode('artifactId', 'appcompat')
appcompatDependencyNode.appendNode('version', '1.0.0')
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ package com.adobe.marketing.mobile.internal

internal object CoreConstants {
const val LOG_TAG = "MobileCore"
const val VERSION = "2.1.2"
const val VERSION = "2.1.3"

object EventDataKeys {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,11 +165,11 @@ internal class EventHub(val eventHistory: EventHistory?) {
// Record event history
processedEvent.mask?.let {
eventHistory?.recordEvent(processedEvent) { result ->
if (Log.getLogLevel() == LoggingMode.VERBOSE) {
Log.trace(
if (!result) {
Log.debug(
CoreConstants.LOG_TAG,
LOG_TAG,
if (result) "Successfully inserted an Event into EventHistory database" else "Failed to insert an Event into EventHistory database"
"Failed to insert Event(${processedEvent.uniqueIdentifier}) into EventHistory database"
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,15 @@ public void recordEvent(final Event event, final EventHistoryResultHandler<Boole
final long fnv1aHash =
MapUtilsKt.convertMapToFnv1aHash(event.getEventData(), event.getMask());

Log.debug(
CoreConstants.LOG_TAG,
LOG_TAG,
"%s hash(%s) for Event(%s)",
fnv1aHash == 0 ? "Not Recording" : "Recording",
fnv1aHash,
event.getUniqueIdentifier());

if (fnv1aHash == 0) {
Log.trace(
CoreConstants.LOG_TAG,
LOG_TAG,
String.format(
"The event with name \"%s\" has a fnv1a hash equal to 0. The event"
+ " will not be recorded.",
event.getName()));
return;
}

Expand Down Expand Up @@ -96,7 +97,8 @@ public void run() {
long previousEventOldestOccurrence = 0L;
int foundEventCount = 0;

for (final EventHistoryRequest request : eventHistoryRequests) {
for (int i = 0; i < eventHistoryRequests.length; ++i) {
EventHistoryRequest request = eventHistoryRequests[i];
final long from =
(enforceOrder && previousEventOldestOccurrence != 0)
? previousEventOldestOccurrence
Expand All @@ -109,6 +111,7 @@ public void run() {
final Cursor result =
androidEventHistoryDatabase.select(eventHash, from, to);

int currentResult = 0;
try {
// columns are index 0: count, index 1: oldest, index 2:
// newest
Expand All @@ -119,11 +122,25 @@ public void run() {
result.getLong(OLDEST_INDEX);

if (enforceOrder) {
foundEventCount++;
currentResult = 1;
} else {
foundEventCount += result.getInt(COUNT_INDEX);
currentResult = result.getInt(COUNT_INDEX);
}

foundEventCount += currentResult;
}

Log.debug(
CoreConstants.LOG_TAG,
LOG_TAG,
"EventHistoryRequest[%s] - (%d of %d) for hash(%s)"
+ " with enforceOrder(%s) returned %d events",
eventHistoryRequests.hashCode(),
i + 1,
eventHistoryRequests.length,
eventHash,
enforceOrder ? "true" : "false",
currentResult);
} catch (final Exception exception) {
Log.debug(
CoreConstants.LOG_TAG,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ internal fun historicalEventsQuerying(
requests.toTypedArray(),
searchType == SEARCH_TYPE_ORDERED
) {
latch.countDown()
eventCounts = it
latch.countDown()
}
latch.await(ASYNC_TIMEOUT, TimeUnit.MILLISECONDS)
eventCounts
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@

/**
* The Android implementation for {@link FullscreenMessage}. It creates and starts a {@link
* MessageFragment} then adds a {@link MessageWebView} containing an in-app message.
* MessageFragment} then adds a {@link WebView} containing an in-app message.
*/
class AEPMessage implements FullscreenMessage {

Expand Down Expand Up @@ -200,7 +200,7 @@ public void show(final boolean withMessagingDelegateControl) {
// fragment frame layout to
// prevent any
// collisions
frameLayoutResourceId = new Random().nextInt();
frameLayoutResourceId = Math.abs(new Random().nextInt());

if (fragmentFrameLayout == null) {
fragmentFrameLayout = new FrameLayout(appContext);
Expand Down Expand Up @@ -357,7 +357,7 @@ boolean isMessageVisible() {

/**
* Creates the {@link MessageWebViewRunner} and posts it to the main {@link Handler} to create
* the {@link MessageWebView}.
* the {@link WebView}.
*/
void showInRootViewGroup() {
final int currentOrientation =
Expand Down Expand Up @@ -402,6 +402,10 @@ void cleanup() {
fragmentFrameLayout.setOnTouchListener(null);
rootViewGroup.setOnTouchListener(null);
// remove message webview, frame layout, and backdrop from the root view group
if (messageWebViewRunner.backdrop != null) {
rootViewGroup.removeView(messageWebViewRunner.backdrop);
}
rootViewGroup.removeView(messageWebViewRunner.webViewFrame);
rootViewGroup.removeView(webView);
rootViewGroup.removeView(fragmentFrameLayout);
rootViewGroup.removeView(messageWebViewRunner.backdrop);
Expand Down Expand Up @@ -482,7 +486,7 @@ public void onAnimationEnd(final Animation animation) {
public void onAnimationRepeat(final Animation animation) {}
};
dismissAnimation.setAnimationListener(animationListener);
webView.startAnimation(dismissAnimation);
messageWebViewRunner.webViewFrame.startAnimation(dismissAnimation);
} else { // otherwise, just clean the views
cleanup();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import com.adobe.marketing.mobile.services.ServiceConstants;
import com.adobe.marketing.mobile.services.ServiceProvider;
import com.adobe.marketing.mobile.services.ui.MessageSettings.MessageGesture;
import java.util.HashMap;
import java.util.Map;

/**
Expand Down Expand Up @@ -91,11 +92,16 @@ public boolean onTouch(final View view, final MotionEvent motionEvent) {

// determine if the tapped view is the webview
if (view.getId() == message.webView.getId()) {
// pass the event to the gesture detector to determine if a motion event occurred on the
// webview.
// if we have no gestures just pass the touch event to the webview
if (message.getMessageSettings().getGestures() == null
|| message.getMessageSettings().getGestures().isEmpty()) {
return view.onTouchEvent(motionEvent);
}
// otherwise, pass the event to the gesture detector to determine if a motion event
// occurred on the webview
gestureDetector.onTouchEvent(motionEvent);
// perform the tap to allow interaction with buttons within the webview
return view.onTouchEvent(motionEvent);
// we want to ignore scroll events (ACTION_MOVE) with gestures present
return motionEvent.getAction() == MotionEvent.ACTION_MOVE;
}

return false;
Expand All @@ -115,11 +121,10 @@ public void onCreate(final Bundle savedInstanceState) {
}

// store message gestures if available
final Map<MessageGesture, String> retrievedGestures = message.getSettings().getGestures();

if (retrievedGestures != null && !retrievedGestures.isEmpty()) {
gestures = retrievedGestures;
}
gestures =
message.getSettings().getGestures() != null
? message.getSettings().getGestures()
: new HashMap<>();

// initialize the gesture detector and listener
webViewGestureListener = new WebViewGestureListener(this);
Expand Down

This file was deleted.

Loading

0 comments on commit 5a05488

Please sign in to comment.