|  | @@ -1,41 +1,28 @@
 | 
	
		
			
				|  |  |  package eu.kanade.presentation.more
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -import androidx.compose.foundation.background
 | 
	
		
			
				|  |  | -import androidx.compose.foundation.layout.Box
 | 
	
		
			
				|  |  | -import androidx.compose.foundation.layout.Column
 | 
	
		
			
				|  |  |  import androidx.compose.foundation.layout.Spacer
 | 
	
		
			
				|  |  |  import androidx.compose.foundation.layout.fillMaxWidth
 | 
	
		
			
				|  |  | -import androidx.compose.foundation.layout.height
 | 
	
		
			
				|  |  |  import androidx.compose.foundation.layout.padding
 | 
	
		
			
				|  |  | -import androidx.compose.foundation.layout.size
 | 
	
		
			
				|  |  |  import androidx.compose.foundation.layout.width
 | 
	
		
			
				|  |  | -import androidx.compose.foundation.layout.windowInsetsPadding
 | 
	
		
			
				|  |  | -import androidx.compose.foundation.rememberScrollState
 | 
	
		
			
				|  |  | -import androidx.compose.foundation.verticalScroll
 | 
	
		
			
				|  |  |  import androidx.compose.material.icons.Icons
 | 
	
		
			
				|  |  |  import androidx.compose.material.icons.filled.OpenInNew
 | 
	
		
			
				|  |  |  import androidx.compose.material.icons.outlined.NewReleases
 | 
	
		
			
				|  |  |  import androidx.compose.material3.Icon
 | 
	
		
			
				|  |  |  import androidx.compose.material3.MaterialTheme
 | 
	
		
			
				|  |  | -import androidx.compose.material3.NavigationBarDefaults
 | 
	
		
			
				|  |  |  import androidx.compose.material3.Text
 | 
	
		
			
				|  |  |  import androidx.compose.material3.TextButton
 | 
	
		
			
				|  |  |  import androidx.compose.runtime.Composable
 | 
	
		
			
				|  |  |  import androidx.compose.ui.Modifier
 | 
	
		
			
				|  |  | -import androidx.compose.ui.draw.drawBehind
 | 
	
		
			
				|  |  | -import androidx.compose.ui.geometry.Offset
 | 
	
		
			
				|  |  |  import androidx.compose.ui.res.stringResource
 | 
	
		
			
				|  |  |  import androidx.compose.ui.text.SpanStyle
 | 
	
		
			
				|  |  | -import androidx.compose.ui.unit.Dp
 | 
	
		
			
				|  |  | -import androidx.compose.ui.unit.dp
 | 
	
		
			
				|  |  | -import androidx.compose.ui.zIndex
 | 
	
		
			
				|  |  |  import com.halilibo.richtext.markdown.Markdown
 | 
	
		
			
				|  |  |  import com.halilibo.richtext.ui.RichTextStyle
 | 
	
		
			
				|  |  |  import com.halilibo.richtext.ui.material3.Material3RichText
 | 
	
		
			
				|  |  |  import com.halilibo.richtext.ui.string.RichTextStringStyle
 | 
	
		
			
				|  |  | -import eu.kanade.presentation.components.Scaffold
 | 
	
		
			
				|  |  | +import eu.kanade.presentation.components.InfoScaffold
 | 
	
		
			
				|  |  | +import eu.kanade.presentation.theme.TachiyomiTheme
 | 
	
		
			
				|  |  | +import eu.kanade.presentation.util.ThemePreviews
 | 
	
		
			
				|  |  |  import eu.kanade.presentation.util.padding
 | 
	
		
			
				|  |  | -import eu.kanade.presentation.util.secondaryItemAlpha
 | 
	
		
			
				|  |  |  import eu.kanade.tachiyomi.R
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  @Composable
 | 
	
	
		
			
				|  | @@ -46,98 +33,56 @@ fun NewUpdateScreen(
 | 
	
		
			
				|  |  |      onRejectUpdate: () -> Unit,
 | 
	
		
			
				|  |  |      onAcceptUpdate: () -> Unit,
 | 
	
		
			
				|  |  |  ) {
 | 
	
		
			
				|  |  | -    Scaffold(
 | 
	
		
			
				|  |  | -        bottomBar = {
 | 
	
		
			
				|  |  | -            val strokeWidth = Dp.Hairline
 | 
	
		
			
				|  |  | -            val borderColor = MaterialTheme.colorScheme.outline
 | 
	
		
			
				|  |  | -            Column(
 | 
	
		
			
				|  |  | -                modifier = Modifier
 | 
	
		
			
				|  |  | -                    .background(MaterialTheme.colorScheme.background)
 | 
	
		
			
				|  |  | -                    .drawBehind {
 | 
	
		
			
				|  |  | -                        drawLine(
 | 
	
		
			
				|  |  | -                            borderColor,
 | 
	
		
			
				|  |  | -                            Offset(0f, 0f),
 | 
	
		
			
				|  |  | -                            Offset(size.width, 0f),
 | 
	
		
			
				|  |  | -                            strokeWidth.value,
 | 
	
		
			
				|  |  | -                        )
 | 
	
		
			
				|  |  | -                    }
 | 
	
		
			
				|  |  | -                    .windowInsetsPadding(NavigationBarDefaults.windowInsets)
 | 
	
		
			
				|  |  | -                    .padding(
 | 
	
		
			
				|  |  | -                        horizontal = MaterialTheme.padding.medium,
 | 
	
		
			
				|  |  | -                        vertical = MaterialTheme.padding.small,
 | 
	
		
			
				|  |  | -                    ),
 | 
	
		
			
				|  |  | -            ) {
 | 
	
		
			
				|  |  | -                TextButton(
 | 
	
		
			
				|  |  | -                    modifier = Modifier.fillMaxWidth(),
 | 
	
		
			
				|  |  | -                    onClick = onAcceptUpdate,
 | 
	
		
			
				|  |  | -                ) {
 | 
	
		
			
				|  |  | -                    Text(text = stringResource(id = R.string.update_check_confirm))
 | 
	
		
			
				|  |  | -                }
 | 
	
		
			
				|  |  | -                TextButton(
 | 
	
		
			
				|  |  | -                    modifier = Modifier.fillMaxWidth(),
 | 
	
		
			
				|  |  | -                    onClick = onRejectUpdate,
 | 
	
		
			
				|  |  | -                ) {
 | 
	
		
			
				|  |  | -                    Text(text = stringResource(R.string.action_not_now))
 | 
	
		
			
				|  |  | -                }
 | 
	
		
			
				|  |  | -            }
 | 
	
		
			
				|  |  | -        },
 | 
	
		
			
				|  |  | -    ) { paddingValues ->
 | 
	
		
			
				|  |  | -        // Status bar scrim
 | 
	
		
			
				|  |  | -        Box(
 | 
	
		
			
				|  |  | +    InfoScaffold(
 | 
	
		
			
				|  |  | +        icon = Icons.Outlined.NewReleases,
 | 
	
		
			
				|  |  | +        headingText = stringResource(R.string.update_check_notification_update_available),
 | 
	
		
			
				|  |  | +        subtitleText = versionName,
 | 
	
		
			
				|  |  | +        acceptText = stringResource(id = R.string.update_check_confirm),
 | 
	
		
			
				|  |  | +        onAcceptClick = onAcceptUpdate,
 | 
	
		
			
				|  |  | +        rejectText = stringResource(R.string.action_not_now),
 | 
	
		
			
				|  |  | +        onRejectClick = onRejectUpdate,
 | 
	
		
			
				|  |  | +    ) {
 | 
	
		
			
				|  |  | +        Material3RichText(
 | 
	
		
			
				|  |  |              modifier = Modifier
 | 
	
		
			
				|  |  | -                .zIndex(2f)
 | 
	
		
			
				|  |  | -                .secondaryItemAlpha()
 | 
	
		
			
				|  |  | -                .background(MaterialTheme.colorScheme.background)
 | 
	
		
			
				|  |  |                  .fillMaxWidth()
 | 
	
		
			
				|  |  | -                .height(paddingValues.calculateTopPadding()),
 | 
	
		
			
				|  |  | -        )
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -        Column(
 | 
	
		
			
				|  |  | -            modifier = Modifier
 | 
	
		
			
				|  |  | -                .verticalScroll(rememberScrollState())
 | 
	
		
			
				|  |  | -                .padding(paddingValues)
 | 
	
		
			
				|  |  | -                .padding(top = 48.dp)
 | 
	
		
			
				|  |  | -                .padding(horizontal = MaterialTheme.padding.medium),
 | 
	
		
			
				|  |  | +                .padding(vertical = MaterialTheme.padding.large),
 | 
	
		
			
				|  |  | +            style = RichTextStyle(
 | 
	
		
			
				|  |  | +                stringStyle = RichTextStringStyle(
 | 
	
		
			
				|  |  | +                    linkStyle = SpanStyle(color = MaterialTheme.colorScheme.primary),
 | 
	
		
			
				|  |  | +                ),
 | 
	
		
			
				|  |  | +            ),
 | 
	
		
			
				|  |  |          ) {
 | 
	
		
			
				|  |  | -            Icon(
 | 
	
		
			
				|  |  | -                imageVector = Icons.Outlined.NewReleases,
 | 
	
		
			
				|  |  | -                contentDescription = null,
 | 
	
		
			
				|  |  | -                modifier = Modifier
 | 
	
		
			
				|  |  | -                    .padding(bottom = MaterialTheme.padding.small)
 | 
	
		
			
				|  |  | -                    .size(48.dp),
 | 
	
		
			
				|  |  | -                tint = MaterialTheme.colorScheme.primary,
 | 
	
		
			
				|  |  | -            )
 | 
	
		
			
				|  |  | -            Text(
 | 
	
		
			
				|  |  | -                text = stringResource(R.string.update_check_notification_update_available),
 | 
	
		
			
				|  |  | -                style = MaterialTheme.typography.headlineLarge,
 | 
	
		
			
				|  |  | -            )
 | 
	
		
			
				|  |  | -            Text(
 | 
	
		
			
				|  |  | -                text = versionName,
 | 
	
		
			
				|  |  | -                modifier = Modifier.secondaryItemAlpha(),
 | 
	
		
			
				|  |  | -                style = MaterialTheme.typography.titleSmall,
 | 
	
		
			
				|  |  | -            )
 | 
	
		
			
				|  |  | +            Markdown(content = changelogInfo)
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -            Material3RichText(
 | 
	
		
			
				|  |  | -                modifier = Modifier
 | 
	
		
			
				|  |  | -                    .fillMaxWidth()
 | 
	
		
			
				|  |  | -                    .padding(vertical = MaterialTheme.padding.large),
 | 
	
		
			
				|  |  | -                style = RichTextStyle(
 | 
	
		
			
				|  |  | -                    stringStyle = RichTextStringStyle(
 | 
	
		
			
				|  |  | -                        linkStyle = SpanStyle(color = MaterialTheme.colorScheme.primary),
 | 
	
		
			
				|  |  | -                    ),
 | 
	
		
			
				|  |  | -                ),
 | 
	
		
			
				|  |  | +            TextButton(
 | 
	
		
			
				|  |  | +                onClick = onOpenInBrowser,
 | 
	
		
			
				|  |  | +                modifier = Modifier.padding(top = MaterialTheme.padding.small),
 | 
	
		
			
				|  |  |              ) {
 | 
	
		
			
				|  |  | -                Markdown(content = changelogInfo)
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -                TextButton(
 | 
	
		
			
				|  |  | -                    onClick = onOpenInBrowser,
 | 
	
		
			
				|  |  | -                    modifier = Modifier.padding(top = MaterialTheme.padding.small),
 | 
	
		
			
				|  |  | -                ) {
 | 
	
		
			
				|  |  | -                    Text(text = stringResource(R.string.update_check_open))
 | 
	
		
			
				|  |  | -                    Spacer(modifier = Modifier.width(MaterialTheme.padding.tiny))
 | 
	
		
			
				|  |  | -                    Icon(imageVector = Icons.Default.OpenInNew, contentDescription = null)
 | 
	
		
			
				|  |  | -                }
 | 
	
		
			
				|  |  | +                Text(text = stringResource(R.string.update_check_open))
 | 
	
		
			
				|  |  | +                Spacer(modifier = Modifier.width(MaterialTheme.padding.tiny))
 | 
	
		
			
				|  |  | +                Icon(imageVector = Icons.Default.OpenInNew, contentDescription = null)
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +@ThemePreviews
 | 
	
		
			
				|  |  | +@Composable
 | 
	
		
			
				|  |  | +private fun NewUpdateScreenPreview() {
 | 
	
		
			
				|  |  | +    TachiyomiTheme {
 | 
	
		
			
				|  |  | +        NewUpdateScreen(
 | 
	
		
			
				|  |  | +            versionName = "v0.99.9",
 | 
	
		
			
				|  |  | +            changelogInfo = """
 | 
	
		
			
				|  |  | +                ## Yay
 | 
	
		
			
				|  |  | +                Foobar
 | 
	
		
			
				|  |  | +                
 | 
	
		
			
				|  |  | +                ### More info
 | 
	
		
			
				|  |  | +                - Hello
 | 
	
		
			
				|  |  | +                - World
 | 
	
		
			
				|  |  | +            """.trimIndent(),
 | 
	
		
			
				|  |  | +            onOpenInBrowser = {},
 | 
	
		
			
				|  |  | +            onRejectUpdate = {},
 | 
	
		
			
				|  |  | +            onAcceptUpdate = {},
 | 
	
		
			
				|  |  | +        )
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +}
 |