mirror of
https://github.com/anyproto/anytype-kotlin.git
synced 2025-06-07 21:37:02 +09:00
DROID-3704 Sentry | Release 11 (#2471)
Co-authored-by: Evgenii Kozlov <enklave.mare.balticum@protonmail.com>
This commit is contained in:
parent
eddd5b98f3
commit
879ff57f41
3 changed files with 26 additions and 19 deletions
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue