Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Revert in app messaging overlay fix #482

Merged
merged 2 commits into from
Jan 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions messaginginapp/api/messaginginapp.api
Original file line number Diff line number Diff line change
Expand Up @@ -94,19 +94,17 @@ public final class io/customer/messaginginapp/gist/data/listeners/Queue : io/cus
}

public final class io/customer/messaginginapp/gist/data/model/GistProperties {
public fun <init> (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lio/customer/messaginginapp/gist/data/model/MessagePosition;ZLjava/lang/String;)V
public fun <init> (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lio/customer/messaginginapp/gist/data/model/MessagePosition;Z)V
public final fun component1 ()Ljava/lang/String;
public final fun component2 ()Ljava/lang/String;
public final fun component3 ()Ljava/lang/String;
public final fun component4 ()Lio/customer/messaginginapp/gist/data/model/MessagePosition;
public final fun component5 ()Z
public final fun component6 ()Ljava/lang/String;
public final fun copy (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lio/customer/messaginginapp/gist/data/model/MessagePosition;ZLjava/lang/String;)Lio/customer/messaginginapp/gist/data/model/GistProperties;
public static synthetic fun copy$default (Lio/customer/messaginginapp/gist/data/model/GistProperties;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lio/customer/messaginginapp/gist/data/model/MessagePosition;ZLjava/lang/String;ILjava/lang/Object;)Lio/customer/messaginginapp/gist/data/model/GistProperties;
public final fun copy (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lio/customer/messaginginapp/gist/data/model/MessagePosition;Z)Lio/customer/messaginginapp/gist/data/model/GistProperties;
public static synthetic fun copy$default (Lio/customer/messaginginapp/gist/data/model/GistProperties;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lio/customer/messaginginapp/gist/data/model/MessagePosition;ZILjava/lang/Object;)Lio/customer/messaginginapp/gist/data/model/GistProperties;
public fun equals (Ljava/lang/Object;)Z
public final fun getCampaignId ()Ljava/lang/String;
public final fun getElementId ()Ljava/lang/String;
public final fun getOverlayColor ()Ljava/lang/String;
public final fun getPersistent ()Z
public final fun getPosition ()Lio/customer/messaginginapp/gist/data/model/MessagePosition;
public final fun getRouteRule ()Ljava/lang/String;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
val elementId: String?,
val campaignId: String?,
val position: MessagePosition,
val persistent: Boolean,
val overlayColor: String?
val persistent: Boolean
)

data class Message(
Expand All @@ -33,11 +32,10 @@
var campaignId: String? = null
var position: MessagePosition = MessagePosition.CENTER
var persistent = false
var overlayColor: String? = null

(properties?.get("gist") as? Map<String, Any?>)?.let { gistProperties ->

Check warning on line 36 in messaginginapp/src/main/java/io/customer/messaginginapp/gist/data/model/Message.kt

View workflow job for this annotation

GitHub Actions / API check

Unchecked cast: Any? to Map<String, Any?>

Check warning on line 36 in messaginginapp/src/main/java/io/customer/messaginginapp/gist/data/model/Message.kt

View workflow job for this annotation

GitHub Actions / Android Lint (messaginginapp)

Unchecked cast: Any? to Map<String, Any?>

Check warning on line 36 in messaginginapp/src/main/java/io/customer/messaginginapp/gist/data/model/Message.kt

View workflow job for this annotation

GitHub Actions / API check

Unchecked cast: Any? to Map<String, Any?>

Check warning on line 36 in messaginginapp/src/main/java/io/customer/messaginginapp/gist/data/model/Message.kt

View workflow job for this annotation

GitHub Actions / Android Lint (messaginginapp)

Unchecked cast: Any? to Map<String, Any?>

Check warning on line 36 in messaginginapp/src/main/java/io/customer/messaginginapp/gist/data/model/Message.kt

View workflow job for this annotation

GitHub Actions / Unit tests (messaginginapp)

Unchecked cast: Any? to Map<String, Any?>

Check warning on line 36 in messaginginapp/src/main/java/io/customer/messaginginapp/gist/data/model/Message.kt

View workflow job for this annotation

GitHub Actions / Snapshot build and publish

Unchecked cast: Any? to Map<String, Any?>

Check warning on line 36 in messaginginapp/src/main/java/io/customer/messaginginapp/gist/data/model/Message.kt

View workflow job for this annotation

GitHub Actions / Generate Comparison Report

Unchecked cast: Any? to Map<String, Any?>
gistProperties["routeRuleAndroid"]?.let { rule ->
(rule as String).let { stringRule ->

Check warning on line 38 in messaginginapp/src/main/java/io/customer/messaginginapp/gist/data/model/Message.kt

View workflow job for this annotation

GitHub Actions / Generate Comparison Report

Unchecked cast: Any? to Map<String, Any?>
routeRule = stringRule
}
}
Expand All @@ -61,20 +59,8 @@
persistent = persistentValue
}
}
gistProperties["overlayColor"]?.let { id ->
(id as? String)?.let { color ->
overlayColor = color
}
}
}
return GistProperties(
routeRule = routeRule,
elementId = elementId,
campaignId = campaignId,
position = position,
persistent = persistent,
overlayColor = overlayColor
)
return GistProperties(routeRule = routeRule, elementId = elementId, campaignId = campaignId, position = position, persistent = persistent)
}

override fun toString(): String {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.customer.messaginginapp.gist.presentation

import android.animation.AnimatorInflater
import android.content.Context
import android.content.Intent
import android.os.Bundle
Expand All @@ -10,12 +11,12 @@
import androidx.appcompat.app.AppCompatActivity
import androidx.core.animation.doOnEnd
import com.google.gson.Gson
import io.customer.messaginginapp.R
import io.customer.messaginginapp.databinding.ActivityGistBinding
import io.customer.messaginginapp.di.inAppMessagingManager
import io.customer.messaginginapp.gist.data.model.Message
import io.customer.messaginginapp.gist.data.model.MessagePosition
import io.customer.messaginginapp.gist.utilities.ElapsedTimer
import io.customer.messaginginapp.gist.utilities.ModalAnimationUtil
import io.customer.messaginginapp.state.InAppMessagingAction
import io.customer.messaginginapp.state.InAppMessagingState
import io.customer.messaginginapp.state.MessageState
Expand Down Expand Up @@ -127,13 +128,14 @@
override fun finish() {
logger.debug("GistModelActivity finish")
runOnUiThread {
val animationSet = if (messagePosition == MessagePosition.TOP) {
ModalAnimationUtil.createAnimationSetOutToTop(binding.modalGistViewLayout)
val animation = if (messagePosition == MessagePosition.TOP) {
AnimatorInflater.loadAnimator(this, R.animator.animate_out_to_top)

Check warning on line 132 in messaginginapp/src/main/java/io/customer/messaginginapp/gist/presentation/GistModalActivity.kt

View check run for this annotation

Codecov / codecov/patch

messaginginapp/src/main/java/io/customer/messaginginapp/gist/presentation/GistModalActivity.kt#L132

Added line #L132 was not covered by tests
} else {
ModalAnimationUtil.createAnimationSetOutToBottom(binding.modalGistViewLayout)
AnimatorInflater.loadAnimator(this, R.animator.animate_out_to_bottom)

Check warning on line 134 in messaginginapp/src/main/java/io/customer/messaginginapp/gist/presentation/GistModalActivity.kt

View check run for this annotation

Codecov / codecov/patch

messaginginapp/src/main/java/io/customer/messaginginapp/gist/presentation/GistModalActivity.kt#L134

Added line #L134 was not covered by tests
}
animationSet.start()
animationSet.doOnEnd {
animation.setTarget(binding.modalGistViewLayout)
animation.start()
animation.doOnEnd {

Check warning on line 138 in messaginginapp/src/main/java/io/customer/messaginginapp/gist/presentation/GistModalActivity.kt

View check run for this annotation

Codecov / codecov/patch

messaginginapp/src/main/java/io/customer/messaginginapp/gist/presentation/GistModalActivity.kt#L137-L138

Added lines #L137 - L138 were not covered by tests
logger.debug("GistModelActivity finish animation completed")
super.finish()
}
Expand Down Expand Up @@ -167,14 +169,14 @@
runOnUiThread {
window.clearFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE)
binding.modalGistViewLayout.visibility = View.VISIBLE
val overlayColor = message.gistProperties.overlayColor ?: ModalAnimationUtil.FALLBACK_COLOR_STRING
val animatorSet = if (messagePosition == MessagePosition.TOP) {
ModalAnimationUtil.createAnimationSetInFromTop(binding.modalGistViewLayout, overlayColor)
val animation = if (messagePosition == MessagePosition.TOP) {
AnimatorInflater.loadAnimator(this, R.animator.animate_in_from_top)

Check warning on line 173 in messaginginapp/src/main/java/io/customer/messaginginapp/gist/presentation/GistModalActivity.kt

View check run for this annotation

Codecov / codecov/patch

messaginginapp/src/main/java/io/customer/messaginginapp/gist/presentation/GistModalActivity.kt#L173

Added line #L173 was not covered by tests
} else {
ModalAnimationUtil.createAnimationSetInFromBottom(binding.modalGistViewLayout, overlayColor)
AnimatorInflater.loadAnimator(this, R.animator.animate_in_from_bottom)

Check warning on line 175 in messaginginapp/src/main/java/io/customer/messaginginapp/gist/presentation/GistModalActivity.kt

View check run for this annotation

Codecov / codecov/patch

messaginginapp/src/main/java/io/customer/messaginginapp/gist/presentation/GistModalActivity.kt#L175

Added line #L175 was not covered by tests
}
animatorSet.start()
animatorSet.doOnEnd {
animation.setTarget(binding.modalGistViewLayout)
animation.start()
animation.doOnEnd {

Check warning on line 179 in messaginginapp/src/main/java/io/customer/messaginginapp/gist/presentation/GistModalActivity.kt

View check run for this annotation

Codecov / codecov/patch

messaginginapp/src/main/java/io/customer/messaginginapp/gist/presentation/GistModalActivity.kt#L178-L179

Added lines #L178 - L179 were not covered by tests
logger.debug("GistModelActivity Message Animation Completed: $message")
elapsedTimer.end()
}
Expand All @@ -187,7 +189,7 @@
binding.gistView.stopLoading()
}
// and finish the activity without performing any further actions
finish()
super.finish()

Check warning on line 192 in messaginginapp/src/main/java/io/customer/messaginginapp/gist/presentation/GistModalActivity.kt

View check run for this annotation

Codecov / codecov/patch

messaginginapp/src/main/java/io/customer/messaginginapp/gist/presentation/GistModalActivity.kt#L192

Added line #L192 was not covered by tests
}

override fun onGistViewSizeChanged(width: Int, height: Int) {
Expand Down

This file was deleted.

26 changes: 26 additions & 0 deletions messaginginapp/src/main/res/animator/animate_in_from_bottom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<set xmlns:android="http://schemas.android.com/apk/res/android" android:ordering="sequentially">
<set android:ordering="together">
<objectAnimator
android:propertyName="translationY"
android:duration="150"
android:valueFrom="100"
android:valueTo="0"
android:valueType="floatType" />

<objectAnimator
android:propertyName="alpha"
android:duration="150"
android:valueFrom="0"
android:valueTo="1"
android:valueType="floatType" />
</set>

<set>
<objectAnimator
android:propertyName="backgroundColor"
android:duration="100"
android:valueFrom="#00000000"
android:valueTo="#33000000"
android:startOffset="0" />
</set>
</set>
26 changes: 26 additions & 0 deletions messaginginapp/src/main/res/animator/animate_in_from_top.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<set xmlns:android="http://schemas.android.com/apk/res/android" android:ordering="sequentially">
<set android:ordering="together">
<objectAnimator
android:propertyName="translationY"
android:duration="150"
android:valueFrom="-100"
android:valueTo="0"
android:valueType="floatType" />

<objectAnimator
android:propertyName="alpha"
android:duration="150"
android:valueFrom="0"
android:valueTo="1"
android:valueType="floatType" />
</set>

<set>
<objectAnimator
android:propertyName="backgroundColor"
android:duration="100"
android:valueFrom="#00000000"
android:valueTo="#33000000"
android:startOffset="0" />
</set>
</set>
26 changes: 26 additions & 0 deletions messaginginapp/src/main/res/animator/animate_out_to_bottom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<set xmlns:android="http://schemas.android.com/apk/res/android" android:ordering="sequentially">
<set>
<objectAnimator
android:propertyName="backgroundColor"
android:duration="100"
android:valueFrom="#33000000"
android:valueTo="#00000000"
android:startOffset="0" />
</set>

<set android:ordering="together">
<objectAnimator
android:propertyName="translationY"
android:duration="150"
android:valueFrom="0"
android:valueTo="100"
android:valueType="floatType" />

<objectAnimator
android:propertyName="alpha"
android:duration="150"
android:valueFrom="1"
android:valueTo="0"
android:valueType="floatType" />
</set>
</set>
26 changes: 26 additions & 0 deletions messaginginapp/src/main/res/animator/animate_out_to_top.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<set xmlns:android="http://schemas.android.com/apk/res/android" android:ordering="sequentially">
<set>
<objectAnimator
android:propertyName="backgroundColor"
android:duration="100"
android:valueFrom="#33000000"
android:valueTo="#00000000"
android:startOffset="0" />
</set>

<set android:ordering="together">
<objectAnimator
android:propertyName="translationY"
android:duration="150"
android:valueFrom="0"
android:valueTo="-100"
android:valueType="floatType" />

<objectAnimator
android:propertyName="alpha"
android:duration="150"
android:valueFrom="1"
android:valueTo="0"
android:valueType="floatType" />
</set>
</set>
Loading