diff --git a/app/src/main/java/com/anytypeio/anytype/device/NotificationBuilder.kt b/app/src/main/java/com/anytypeio/anytype/device/NotificationBuilder.kt index d7d37e4c3e..669b231140 100644 --- a/app/src/main/java/com/anytypeio/anytype/device/NotificationBuilder.kt +++ b/app/src/main/java/com/anytypeio/anytype/device/NotificationBuilder.kt @@ -15,6 +15,7 @@ import com.anytypeio.anytype.core_models.Id import com.anytypeio.anytype.core_models.Relations import com.anytypeio.anytype.ui.main.MainActivity import kotlin.math.absoluteValue +import timber.log.Timber class NotificationBuilder( private val context: Context, @@ -63,6 +64,7 @@ class NotificationBuilder( .setVibrate(longArrayOf(0, 500, 200, 500)) .build() + // TODO maybe use message ID as notification ID? notificationManager.notify(System.currentTimeMillis().toInt(), notif) } @@ -82,7 +84,7 @@ class NotificationBuilder( enableVibration(true) setShowBadge(true) lockscreenVisibility = NotificationCompat.VISIBILITY_PUBLIC - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { group = CHANNEL_GROUP_ID } } @@ -120,9 +122,21 @@ class NotificationBuilder( } fun createChannelGroupIfNeeded() { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - val existingGroup = notificationManager.getNotificationChannelGroup(CHANNEL_GROUP_ID) - if (existingGroup == null) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { + try { + val existingGroup = notificationManager.getNotificationChannelGroup(CHANNEL_GROUP_ID) + if (existingGroup == null) { + val group = NotificationChannelGroup(CHANNEL_GROUP_ID, CHANNEL_GROUP_NAME) + notificationManager.createNotificationChannelGroup(group) + } + } catch (e: NoSuchMethodError) { + Timber.e(e, "Error while creating or getting notification group") + // Some devices might not support getNotificationChannelGroup even on Android O + // Just create the group without checking if it exists + val group = NotificationChannelGroup(CHANNEL_GROUP_ID, CHANNEL_GROUP_NAME) + notificationManager.createNotificationChannelGroup(group) + } catch (e : Exception) { + Timber.e(e, "Error while creating or getting notification group") val group = NotificationChannelGroup(CHANNEL_GROUP_ID, CHANNEL_GROUP_NAME) notificationManager.createNotificationChannelGroup(group) } diff --git a/core-ui/src/main/java/com/anytypeio/anytype/core_ui/views/OnBoardingTypographyCompose.kt b/core-ui/src/main/java/com/anytypeio/anytype/core_ui/views/OnBoardingTypographyCompose.kt index 8a52c9f561..e40f665935 100644 --- a/core-ui/src/main/java/com/anytypeio/anytype/core_ui/views/OnBoardingTypographyCompose.kt +++ b/core-ui/src/main/java/com/anytypeio/anytype/core_ui/views/OnBoardingTypographyCompose.kt @@ -3,24 +3,16 @@ package com.anytypeio.anytype.core_ui.views import androidx.compose.ui.text.TextStyle import androidx.compose.ui.text.font.Font import androidx.compose.ui.text.font.FontFamily +import androidx.compose.ui.text.font.FontLoadingStrategy import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.unit.em import androidx.compose.ui.unit.sp import com.anytypeio.anytype.core_ui.R val fontRiccioneRegular = FontFamily( - Font(R.font.riccione_regular, weight = FontWeight.Normal) + Font(R.font.riccione_regular, weight = FontWeight.Normal, loadingStrategy = FontLoadingStrategy.Async) ) -val HeadlineOnBoardingTitle = - TextStyle( - fontFamily = fontRiccioneRegular, - fontWeight = FontWeight.W500, - fontSize = 60.sp, - lineHeight = 60.sp, - letterSpacing = (-0.05).em - ) - val HeadlineOnBoardingDescription = TextStyle( fontFamily = fontInterRegular, diff --git a/core-ui/src/main/java/com/anytypeio/anytype/core_ui/views/TypographyCompose.kt b/core-ui/src/main/java/com/anytypeio/anytype/core_ui/views/TypographyCompose.kt index 4c3067a46c..1295db15df 100644 --- a/core-ui/src/main/java/com/anytypeio/anytype/core_ui/views/TypographyCompose.kt +++ b/core-ui/src/main/java/com/anytypeio/anytype/core_ui/views/TypographyCompose.kt @@ -5,28 +5,29 @@ import androidx.compose.ui.text.font.Font import androidx.compose.ui.unit.sp import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.font.FontFamily +import androidx.compose.ui.text.font.FontLoadingStrategy import androidx.compose.ui.text.font.FontStyle import androidx.compose.ui.unit.em import com.anytypeio.anytype.core_ui.R val fontInterRegular = FontFamily( - Font(R.font.inter_regular, weight = FontWeight.Normal) + Font(R.font.inter_regular, weight = FontWeight.Normal, loadingStrategy = FontLoadingStrategy.Async) ) val fontInterMedium = FontFamily( - Font(R.font.inter_medium, weight = FontWeight.Medium) + Font(R.font.inter_medium, weight = FontWeight.Medium, loadingStrategy = FontLoadingStrategy.Async) ) val fontInterBold = FontFamily( - Font(R.font.inter_bold, weight = FontWeight.Bold) + Font(R.font.inter_bold, weight = FontWeight.Bold, loadingStrategy = FontLoadingStrategy.Async) ) val fontInterSemibold = FontFamily( - Font(R.font.inter_semibold, weight = FontWeight.SemiBold) + Font(R.font.inter_semibold, weight = FontWeight.SemiBold, loadingStrategy = FontLoadingStrategy.Async) ) val fontIBM = FontFamily( - Font(R.font.ibm_plex_mono, weight = FontWeight.Normal) + Font(R.font.ibm_plex_mono, weight = FontWeight.Normal, loadingStrategy = FontLoadingStrategy.Async) ) //Content/Headlines/Title