Skip to content

Commit

Permalink
feat(inline-in-app): add support for overrideable width and height pa…
Browse files Browse the repository at this point in the history
…rams

SUITEDEV-34797

Co-authored-by: davidSchuppa <[email protected]>
Co-authored-by: LasOri <[email protected]>
Co-authored-by: LordAndras <[email protected]>
Co-authored-by: matusekma <[email protected]>
  • Loading branch information
5 people committed Dec 7, 2023
1 parent 88c8527 commit 41a23b5
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 19 deletions.
17 changes: 14 additions & 3 deletions emarsys-sdk/src/main/java/com/emarsys/inapp/ui/InlineInAppView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,23 @@ class InlineInAppView : LinearLayout {
private val concurrentHandlerHolder = mobileEngage().concurrentHandlerHolder
private val requestManager = mobileEngage().requestManager
private val requestModelFactory = mobileEngage().mobileEngageRequestModelFactory
private var webViewHeightParam: Int = ViewGroup.LayoutParams.WRAP_CONTENT
private var webViewWidthParam: Int = ViewGroup.LayoutParams.MATCH_PARENT

constructor(context: Context, attrs: AttributeSet?) : super(context, attrs) {
commonConstructor(attrs)
}

constructor(context: Context) : super(context) {
@JvmOverloads
constructor(
context: Context,
overrideWebViewWidthParam: Int? = null,
overrideWebViewHeightParam: Int? = null
) : super(
context
) {
webViewWidthParam = overrideWebViewWidthParam ?: webViewWidthParam
webViewHeightParam = overrideWebViewHeightParam ?: webViewHeightParam
commonConstructor()
}

Expand Down Expand Up @@ -76,8 +87,8 @@ class InlineInAppView : LinearLayout {
private fun setupViewHierarchy(iamWebView: IamWebView) {
addView(iamWebView.webView)
with(iamWebView.webView.layoutParams) {
width = ViewGroup.LayoutParams.MATCH_PARENT
height = ViewGroup.LayoutParams.WRAP_CONTENT
width = webViewWidthParam
height = webViewHeightParam
}
}

Expand Down
28 changes: 14 additions & 14 deletions sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -99,39 +99,39 @@ dependencies {
// Getting a "Could not find firebase-core" error? Make sure you have
// the latest Google Repository in the Android SDK manager

implementation "org.jetbrains.kotlin:kotlin-reflect:1.9.10"
implementation "org.jetbrains.kotlin:kotlin-stdlib:1.9.10"
implementation 'com.google.android.material:material:1.9.0'
implementation "org.jetbrains.kotlin:kotlin-reflect:1.9.21"
implementation "org.jetbrains.kotlin:kotlin-stdlib:1.9.21"
implementation 'com.google.android.material:material:1.10.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.google.android.gms:play-services-auth:20.7.0'
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'io.coil-kt:coil:2.4.0'

implementation "androidx.core:core-ktx:1.12.0"
implementation "com.google.android.material:material:1.9.0"
implementation "androidx.compose.ui:ui:1.5.1"
implementation "androidx.compose.material:material:1.5.1"
implementation "androidx.compose.ui:ui-tooling-preview:1.5.1"
implementation "androidx.navigation:navigation-compose:2.7.2"
implementation "androidx.compose.material:material-icons-extended:1.5.1"
implementation "com.google.android.material:material:1.10.0"
implementation "androidx.compose.ui:ui:1.5.4"
implementation "androidx.compose.material:material:1.5.4"
implementation "androidx.compose.ui:ui-tooling-preview:1.5.4"
implementation "androidx.navigation:navigation-compose:2.7.5"
implementation "androidx.compose.material:material-icons-extended:1.5.4"
implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.6.2"
implementation "androidx.activity:activity-compose:1.7.2"
implementation "androidx.activity:activity-compose:1.8.1"
implementation "io.coil-kt:coil-compose:2.4.0"
implementation "androidx.datastore:datastore-preferences:1.0.0"
implementation "com.chibatching.kotpref:kotpref:2.13.2"
implementation "com.google.firebase:firebase-common-ktx:20.3.3"
implementation "com.google.firebase:firebase-messaging-ktx:23.2.1"
implementation "com.google.firebase:firebase-common-ktx:20.4.2"
implementation "com.google.firebase:firebase-messaging-ktx:23.3.1"
implementation "com.google.android.gms:play-services-auth:20.7.0"
implementation "com.google.accompanist:accompanist-swiperefresh:0.30.1"
implementation "com.google.code.gson:gson:2.10.1"

debugImplementation "androidx.compose.ui:ui-tooling:1.5.1"
debugImplementation "androidx.compose.ui:ui-tooling:1.5.4"

testImplementation 'junit:junit:4.13.2'

androidTestImplementation "androidx.test.ext:junit:1.1.5"
androidTestImplementation "androidx.test.espresso:espresso-core:3.5.1"
androidTestImplementation "androidx.compose.ui:ui-test-junit4:1.5.1"
androidTestImplementation "androidx.compose.ui:ui-test-junit4:1.5.4"
androidTestImplementation 'androidx.test:rules:1.5.0'
androidTestImplementation 'androidx.test:runner:1.5.2'
androidTestImplementation('com.adevinta.android:barista:4.3.0') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ import com.emarsys.sample.ui.component.toast.customTextToast
import com.emarsys.sample.ui.style.columnWithMaxWidth
import com.emarsys.sample.ui.style.rowWithMaxWidth
import com.emarsys.sample.ui.style.rowWithPointEightWidth
import java.util.*
import java.util.UUID

class InAppScreen(
override val context: Context,
Expand All @@ -58,7 +58,11 @@ class InAppScreen(
if (it != null) {
Log.e("ERROR", it.toString())
} else {
Toast.makeText(context, context.getString(R.string.event_track_success), Toast.LENGTH_SHORT)
Toast.makeText(
context,
context.getString(R.string.event_track_success),
Toast.LENGTH_SHORT
)
.show()
}
}
Expand Down

0 comments on commit 41a23b5

Please sign in to comment.