mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-12-18 07:11:58 +03:00
Fix crash when max shortcuts count is exceeded (#8644)
This commit is contained in:
parent
ec9a066900
commit
ff548d2f98
6 changed files with 21 additions and 18 deletions
2
.github/workflows/build.yml
vendored
2
.github/workflows/build.yml
vendored
|
@ -7,7 +7,7 @@ on:
|
||||||
|
|
||||||
# Enrich gradle.properties for CI/CD
|
# Enrich gradle.properties for CI/CD
|
||||||
env:
|
env:
|
||||||
GRADLE_OPTS: -Dorg.gradle.jvmargs="-Xmx3072m -Dfile.encoding=UTF-8 -XX:+HeapDumpOnOutOfMemoryError" -Dkotlin.daemon.jvm.options="-Xmx2560m" -Dkotlin.incremental=false
|
GRADLE_OPTS: -Dorg.gradle.jvmargs="-Xmx3072m -Dfile.encoding=UTF-8 -XX:+HeapDumpOnOutOfMemoryError -XX:MaxMetaspaceSize=1g" -Dkotlin.daemon.jvm.options="-Xmx2560m" -Dkotlin.incremental=false
|
||||||
CI_GRADLE_ARG_PROPERTIES: --stacktrace -PpreDexEnable=false --max-workers 2 --no-daemon
|
CI_GRADLE_ARG_PROPERTIES: --stacktrace -PpreDexEnable=false --max-workers 2 --no-daemon
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
|
2
.github/workflows/nightly.yml
vendored
2
.github/workflows/nightly.yml
vendored
|
@ -7,7 +7,7 @@ on:
|
||||||
- cron: "0 4 * * *"
|
- cron: "0 4 * * *"
|
||||||
|
|
||||||
env:
|
env:
|
||||||
GRADLE_OPTS: -Dorg.gradle.jvmargs="-Xmx3072m -Dfile.encoding=UTF-8 -XX:+HeapDumpOnOutOfMemoryError" -Dkotlin.daemon.jvm.options="-Xmx2560m" -Dkotlin.incremental=false
|
GRADLE_OPTS: -Dorg.gradle.jvmargs="-Xmx3072m -Dfile.encoding=UTF-8 -XX:+HeapDumpOnOutOfMemoryError -XX:MaxMetaspaceSize=1g" -Dkotlin.daemon.jvm.options="-Xmx2560m" -Dkotlin.incremental=false
|
||||||
CI_GRADLE_ARG_PROPERTIES: --stacktrace -PpreDexEnable=false --max-workers 2 --no-daemon
|
CI_GRADLE_ARG_PROPERTIES: --stacktrace -PpreDexEnable=false --max-workers 2 --no-daemon
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
|
2
.github/workflows/nightly_er.yml
vendored
2
.github/workflows/nightly_er.yml
vendored
|
@ -6,7 +6,7 @@ on:
|
||||||
- cron: "0 4 * * *"
|
- cron: "0 4 * * *"
|
||||||
|
|
||||||
env:
|
env:
|
||||||
GRADLE_OPTS: -Dorg.gradle.jvmargs="-Xmx3072m -Dfile.encoding=UTF-8 -XX:+HeapDumpOnOutOfMemoryError" -Dkotlin.daemon.jvm.options="-Xmx2560m" -Dkotlin.incremental=false
|
GRADLE_OPTS: -Dorg.gradle.jvmargs="-Xmx3072m -Dfile.encoding=UTF-8 -XX:+HeapDumpOnOutOfMemoryError -XX:MaxMetaspaceSize=1g" -Dkotlin.daemon.jvm.options="-Xmx2560m" -Dkotlin.incremental=false
|
||||||
CI_GRADLE_ARG_PROPERTIES: --stacktrace -PpreDexEnable=false --max-workers 2 --no-daemon
|
CI_GRADLE_ARG_PROPERTIES: --stacktrace -PpreDexEnable=false --max-workers 2 --no-daemon
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
|
1
changelog.d/8644.bugfix
Normal file
1
changelog.d/8644.bugfix
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Fix crash when max shortcuts count is exceeded
|
|
@ -139,10 +139,11 @@ class ShortcutsHandler @Inject constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun createShortcuts(rooms: List<RoomSummary>) {
|
private fun createShortcuts(rooms: List<RoomSummary>) {
|
||||||
if (hasPinCode.get()) {
|
|
||||||
// No shortcut in this case (privacy)
|
|
||||||
ShortcutManagerCompat.removeAllDynamicShortcuts(context)
|
ShortcutManagerCompat.removeAllDynamicShortcuts(context)
|
||||||
} else {
|
|
||||||
|
// No shortcut in this case (privacy)
|
||||||
|
if (hasPinCode.get()) return
|
||||||
|
|
||||||
val shortcuts = rooms
|
val shortcuts = rooms
|
||||||
.take(maxShortcutCountPerActivity)
|
.take(maxShortcutCountPerActivity)
|
||||||
.mapIndexed { index, room ->
|
.mapIndexed { index, room ->
|
||||||
|
@ -153,7 +154,6 @@ class ShortcutsHandler @Inject constructor(
|
||||||
ShortcutManagerCompat.pushDynamicShortcut(context, shortcut)
|
ShortcutManagerCompat.pushDynamicShortcut(context, shortcut)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
fun clearShortcuts() {
|
fun clearShortcuts() {
|
||||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N_MR1) {
|
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N_MR1) {
|
||||||
|
|
|
@ -20,6 +20,7 @@ import android.content.SharedPreferences
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
import androidx.core.content.edit
|
import androidx.core.content.edit
|
||||||
import im.vector.app.core.di.DefaultPreferences
|
import im.vector.app.core.di.DefaultPreferences
|
||||||
|
import im.vector.app.core.resources.AppNameProvider
|
||||||
import im.vector.app.core.resources.VersionCodeProvider
|
import im.vector.app.core.resources.VersionCodeProvider
|
||||||
import im.vector.app.features.version.VersionProvider
|
import im.vector.app.features.version.VersionProvider
|
||||||
import org.matrix.android.sdk.api.Matrix
|
import org.matrix.android.sdk.api.Matrix
|
||||||
|
@ -36,6 +37,7 @@ class VectorUncaughtExceptionHandler @Inject constructor(
|
||||||
private val bugReporter: BugReporter,
|
private val bugReporter: BugReporter,
|
||||||
private val versionProvider: VersionProvider,
|
private val versionProvider: VersionProvider,
|
||||||
private val versionCodeProvider: VersionCodeProvider,
|
private val versionCodeProvider: VersionCodeProvider,
|
||||||
|
private val appNameProvider: AppNameProvider,
|
||||||
) : Thread.UncaughtExceptionHandler {
|
) : Thread.UncaughtExceptionHandler {
|
||||||
|
|
||||||
// key to save the crash status
|
// key to save the crash status
|
||||||
|
@ -67,12 +69,12 @@ class VectorUncaughtExceptionHandler @Inject constructor(
|
||||||
putBoolean(PREFS_CRASH_KEY, true)
|
putBoolean(PREFS_CRASH_KEY, true)
|
||||||
}
|
}
|
||||||
val b = StringBuilder()
|
val b = StringBuilder()
|
||||||
val appName = "Element" // TODO Matrix.getApplicationName()
|
val appName = appNameProvider.getAppName()
|
||||||
|
|
||||||
b.append(appName + " Build : " + versionCodeProvider.getVersionCode() + "\n")
|
b.append("$appName Build : ${versionCodeProvider.getVersionCode()}\n")
|
||||||
b.append("$appName Version : ${versionProvider.getVersion(longFormat = true)}\n")
|
b.append("$appName Version : ${versionProvider.getVersion(longFormat = true)}\n")
|
||||||
b.append("SDK Version : ${Matrix.getSdkVersion()}\n")
|
b.append("SDK Version : ${Matrix.getSdkVersion()}\n")
|
||||||
b.append("Phone : " + Build.MODEL.trim() + " (" + Build.VERSION.INCREMENTAL + " " + Build.VERSION.RELEASE + " " + Build.VERSION.CODENAME + ")\n")
|
b.append("Phone : ${Build.MODEL.trim()} (${Build.VERSION.INCREMENTAL} ${Build.VERSION.RELEASE} ${Build.VERSION.CODENAME})\n")
|
||||||
|
|
||||||
b.append("Memory statuses \n")
|
b.append("Memory statuses \n")
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue