Skip to content

Commit

Permalink
Merge release/2024.08.21T00.44.56 into master
Browse files Browse the repository at this point in the history
  • Loading branch information
harukitosa committed Aug 21, 2024
2 parents ed2a17d + 36bee80 commit 72d272b
Show file tree
Hide file tree
Showing 8 changed files with 80 additions and 18 deletions.
25 changes: 18 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,24 @@
# Latest Version

| モジュール/プラグイン名 | Description | 最新のバージョン |
| :-- | :-- | :-- |
| core | イベントトラッキング機能を提供します。 | 2.25.0 |
| inappmessaging | アプリ内メッセージ機能を提供します。 | 2.19.1 |
| notifications | プッシュ通知の受信および効果測定機能を提供します。 | 2.11.0 |
| variables | 設定値配信機能を提供します。 | 2.7.0 |
| visualtracking | ビジュアルトラッキング機能を提供します。| 2.9.0 |
| Karte Gradle Plugin | ビジュアルトラッキング機能に必要なプラグインです。| 2.5.1 |
| :-- | :-- |:---------|
| core | イベントトラッキング機能を提供します。 | 2.25.0 |
| inappmessaging | アプリ内メッセージ機能を提供します。 | 2.20.0 |
| notifications | プッシュ通知の受信および効果測定機能を提供します。 | 2.11.0 |
| variables | 設定値配信機能を提供します。 | 2.7.0 |
| visualtracking | ビジュアルトラッキング機能を提供します。| 2.9.0 |
| Karte Gradle Plugin | ビジュアルトラッキング機能に必要なプラグインです。| 2.5.1 |

# Releases - 2024.08.21

### InAppMessaging 2.20.0
** 🔨CHANGED**
- AndroidのEdge to Edgeによる表示に対応しました
- Edge to Edgeに対応後にKARTEの接客の表示が正しくされているか検証をお願いします
- Navigation Barに被ってしまう、接客の表示が下すぎる場合はCSS等を利用して調整してください。テンプレートによってはbottomをいじれるものもあるためそちらで設定することもできます。
- IAMWebViewの初期化を、アプリがフォアグラウンドに戻った際に遅延して行うように変更しました
** 🔨FIXED**
- suppressed状態で設定値配信を取得した場合に_message_suppressedが発生しないように変更しました

# Releases - 2024.06.03

Expand Down
4 changes: 3 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ plugins {
id 'com.android.application' version '7.0.4' apply false
id 'com.android.library' version '7.0.4' apply false
id 'org.jetbrains.kotlin.android' version '1.7.20' apply false
id 'org.jetbrains.dokka' version '1.4.20'
id 'org.jetbrains.dokka' version '1.9.20'

// for upload maven repo
id "com.github.dcendents.android-maven" version "2.1" apply false
Expand All @@ -37,6 +37,8 @@ configure(subprojects.findAll { !it.name.startsWith("sample_") && !it.name.start
apply from: '../buildscripts/projectMavenAndroid.gradle'
}
ext {
ossrhUsername = System.getenv().getOrDefault("MAVEN_USER_NAME", "")
ossrhPassword = System.getenv().getOrDefault("MAVEN_PASSWORD", "")
afterConfigurate = { Project project ->
project.apply from: '../buildscripts/projectSonatype.gradle'
}
Expand Down
10 changes: 8 additions & 2 deletions buildscripts/projectSonatype.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ apply plugin: 'maven-publish'
apply plugin: 'signing'

def getPropOrDefault(name, defaultValue = "") {
if (project.ext.has(name))
return project.ext.get(name)
if (rootProject.ext.has(name))
return rootProject.ext.get(name)
return defaultValue
}

Expand Down Expand Up @@ -39,6 +39,12 @@ publishing {

def sonatypeUsername = getPropOrDefault("ossrhUsername")
def sonatypePassword = getPropOrDefault("ossrhPassword")
if (sonatypeUsername.toString() == "") {
println("not set sonatypeUserName")
}
if (sonatypePassword.toString() == "") {
println("not set sonatypePassword")
}
credentials {
username = "$sonatypeUsername"
password = "$sonatypePassword"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,11 @@ class InAppMessaging : Library, ActionModule, UserModule, TrackModule, ActivityL
val action = message.getJSONObject("action")
val campaignId = action.getString("campaign_id")
val shortenId = action.getString("shorten_id")
val campaign = message.getJSONObject("campaign")
val serviceActionType = campaign.getString("service_action_type")
if (serviceActionType == "remote_config") {
return
}
val values = mapOf("reason" to reason)
Tracker.track(MessageEvent(MessageEventType.Suppressed, campaignId, shortenId, values))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import android.app.Activity
import android.app.Application
import android.content.pm.PackageManager
import android.net.Uri
import android.os.Handler
import android.os.Looper
import android.webkit.ValueCallback
import io.karte.android.KarteApp
import io.karte.android.core.logger.Logger
Expand Down Expand Up @@ -157,11 +159,13 @@ internal class IAMProcessor(application: Application, private val panelWindowMan

//region ActivityLifecycle
override fun onActivityResumed(activity: Activity) {
Logger.d(LOG_TAG, "onActivityResumed: visible? ${webView?.visible}")
currentActivity = WeakReference(activity)
// アプリフォアグラウンド時にはwebViewが参照され、初期化される
if (webView?.visible == true) {
show(activity)
Handler(Looper.getMainLooper()).post {
Logger.d(LOG_TAG, "onActivityResumed: visible? ${webView?.visible}")
currentActivity = WeakReference(activity)
// アプリフォアグラウンド時にはwebViewが参照され、初期化される
if (webView?.visible == true) {
show(activity)
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,11 @@ import org.json.JSONArray
import java.lang.ref.WeakReference

private const val LOG_TAG = "Karte.IAMView"

@Suppress("DEPRECATION")
private const val WINDOW_FLAGS_FOCUSED = WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN or
WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR

@Suppress("DEPRECATION")
private const val WINDOW_FLAGS_UNFOCUSED = (
WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
Expand Down Expand Up @@ -148,6 +150,13 @@ internal open class WindowView(
PixelFormat.TRANSLUCENT
)

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
// NOTE: WindowManager.addViewしたViewはデフォルトでSystemBarsのInsetが考慮されるため明示的に無効化するために0を設定する
// https://developer.android.com/reference/android/view/WindowManager.LayoutParams#setFitInsetsTypes(int)
params.fitInsetsTypes = 0
params.layoutInDisplayCutoutMode = WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES
}

if (appSoftInputModeIsNothing) {
// keyboard表示中に接客が配信された場合、接客のz-ordferがkeyboardより上になる。この時appWindowのsoftInputModeがSOFT_INPUT_ADJUST_NOTHINGだとkeyboardの高さを知る方法がない
// そのためこのケースでは、hideSoftInputFromWindow後にaddViewすることでz-orderをkeyboardより下にし、再度showSoftInputする。(hideSoftInputFromWindowの結果によって元々keyboardが表示されていたかどうかの判定ができる)
Expand Down Expand Up @@ -407,6 +416,26 @@ internal open class WindowView(
}
}

private val drawingHeight: Int
get() {
// NOTE: Edge to edge有効化時にcontentView.heightとcontentViewVisibleRect.bottomの値が異なる(VisibleRectにNavigationBarの高さが含まれない)ため
// diffを取って描画すべき領域の高さを決定する
// diffがNavigationBarの高さを超える場合はキーボード等が表示されていると判定しvisibleRect.bottomを下限とする
// それ以外はcontentView.height=画面の高さを下限とする
val diff = contentView.height - contentViewVisibleRect.bottom
return if (diff > navbarHeight) contentViewVisibleRect.bottom else contentView.height
}

private val navbarHeight: Int
get() {
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
windowManager.currentWindowMetrics.windowInsets.getInsets(WindowInsets.Type.navigationBars()).bottom
} else {
// バージョンに依存せずにNavigationBarの高さを正確に取得する方法がないため画面下2.5%をNavigationBarの高さとして扱う
(contentView.height * 0.025).toInt()
}
}

override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
try {
val contentView = contentView
Expand All @@ -428,14 +457,14 @@ internal open class WindowView(
} else {
locationOnScreen[1]
}
childBottom = iamViewVisibleRect.bottom
childBottom = drawingHeight
} else {
childTop = if (isStatusBarOverlaid) {
contentView.top + contentView.paddingTop
} else {
contentViewVisibleRect.top
}
childBottom = contentViewVisibleRect.bottom
childBottom = drawingHeight
}

Logger.d(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import org.robolectric.Robolectric
import org.robolectric.RobolectricTestRunner
import org.robolectric.android.controller.ActivityController
import org.robolectric.annotation.Config
import org.robolectric.shadows.ShadowLooper

@Suppress("NonAsciiCharacters")
@RunWith(RobolectricTestRunner::class)
Expand Down Expand Up @@ -134,6 +135,7 @@ class IAMProcessorTest {
assertThat(processor.isPresenting).isFalse()

resumeActivity()
ShadowLooper.runUiThreadTasksIncludingDelayedTasks()
assertThat(processor.isPresenting).isTrue()

closeAction()
Expand All @@ -146,6 +148,7 @@ class IAMProcessorTest {
assertThat(processor.isPresenting).isFalse()

resumeActivity()
ShadowLooper.runUiThreadTasksIncludingDelayedTasks()
assertThat(processor.isPresenting).isTrue()

pauseActivity()
Expand All @@ -157,6 +160,7 @@ class IAMProcessorTest {
assertThat(processor.isPresenting).isFalse()

resumeActivity()
ShadowLooper.runUiThreadTasksIncludingDelayedTasks()
assertThat(processor.isPresenting).isFalse()

openAction()
Expand All @@ -171,6 +175,7 @@ class IAMProcessorTest {
assertThat(processor.isPresenting).isFalse()

resumeActivity()
ShadowLooper.runUiThreadTasksIncludingDelayedTasks()
assertThat(processor.isPresenting).isFalse()

openAction()
Expand Down
2 changes: 1 addition & 1 deletion inappmessaging/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.19.1
2.20.0

0 comments on commit 72d272b

Please sign in to comment.