Skip to content

Commit

Permalink
Merge pull request #1174 from hyperskill/release/1.71
Browse files Browse the repository at this point in the history
Release 1.71
  • Loading branch information
ivan-magda authored Sep 16, 2024
2 parents 920d4d2 + 907db00 commit 5543441
Show file tree
Hide file tree
Showing 114 changed files with 5,915 additions and 2,170 deletions.
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

Master coding on-the-go with [Hyperskill](https://hyperskill.org/)! Immerse yourself in curated lessons, keep your streak, and sharpen your knowledge with 3000+ hands-on topics. Hyperskill is the ultimate app to learn programming languages and technologies, offering over 50 courses and 300+ projects that cater to all levels of expertise.

![Choose your course](resources/screenshots/01.webp)
![Practice in a best way](resources/screenshots/02.webp)
![Learn practice repeat](resources/screenshots/03.webp)
<img src="resources/screenshots/01.webp?raw=true" width="33%" alt="Learn to code anywhere, anytime" title="Learn to code anywhere, anytime"><img src="resources/screenshots/02.webp?raw=true" width="33%" alt="Master real-world skills" title="Master real-world skills"><img src="resources/screenshots/03.webp?raw=true" width="33%" alt="Follow your study plan" title="Follow your study plan">

Features:
* **Curated Learning Experience:** Dive into lessons that are structured to guide you from beginner to expert.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ import androidx.compose.foundation.layout.windowInsetsPadding
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.key
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.colorResource
Expand All @@ -31,11 +35,13 @@ import org.hyperskill.app.R
import org.hyperskill.app.android.core.extensions.compose.plus
import org.hyperskill.app.android.core.view.ui.widget.compose.HyperskillButton
import org.hyperskill.app.android.core.view.ui.widget.compose.HyperskillTheme
import org.hyperskill.app.paywall.presentation.PaywallFeature

@Composable
fun PaywallContent(
buyButtonText: String,
priceText: String?,
products: List<PaywallFeature.ViewStateContent.SubscriptionProduct>,
onProductClick: (String) -> Unit,
onTermsOfServiceClick: () -> Unit,
onBuySubscriptionClick: () -> Unit,
modifier: Modifier = Modifier,
Expand All @@ -49,7 +55,9 @@ fun PaywallContent(
.windowInsetsPadding(WindowInsets.safeDrawing)
) {
Column(
modifier = Modifier.weight(1f)
modifier = Modifier
.weight(1f)
.fillMaxWidth()
) {
Image(
painter = painterResource(id = org.hyperskill.app.android.R.drawable.img_paywall),
Expand All @@ -64,10 +72,12 @@ fun PaywallContent(
)
Spacer(modifier = Modifier.height(24.dp))
SubscriptionDetails()
Spacer(modifier = Modifier.height(32.dp))
if (priceText != null) {
SubscriptionPrice(priceText)
}
Spacer(modifier = Modifier.height(24.dp))
SubscriptionProducts(
products = products,
onProdutsClick = onProductClick
)
Spacer(modifier = Modifier.height(24.dp))
}
Column {
HyperskillButton(
Expand All @@ -87,23 +97,27 @@ fun PaywallContent(
}

@Composable
private fun SubscriptionPrice(
priceText: String,
private fun SubscriptionProducts(
products: List<PaywallFeature.ViewStateContent.SubscriptionProduct>,
onProdutsClick: (String) -> Unit,
modifier: Modifier = Modifier
) {
Column(
modifier = modifier,
verticalArrangement = Arrangement.spacedBy(8.dp)
verticalArrangement = Arrangement.spacedBy(10.dp),
modifier = modifier
) {
Text(
text = stringResource(id = R.string.paywall_android_subscription_duration),
style = MaterialTheme.typography.subtitle1,
fontWeight = FontWeight.Medium
)
Text(
text = priceText,
style = MaterialTheme.typography.body2
)
products.forEach { option ->
key(option.productId) {
SubscriptionProduct(
product = option,
onClick = remember {
{
onProdutsClick(option.productId)
}
}
)
}
}
}
}

Expand All @@ -124,9 +138,15 @@ private fun TermsOfService(
@Composable
fun PaywallContentPreview() {
HyperskillTheme {
val options by remember {
mutableStateOf(
PaywallPreviewDefaults.subscriptionProducts
)
}
PaywallContent(
buyButtonText = PaywallPreviewDefaults.BUY_BUTTON_TEXT,
priceText = PaywallPreviewDefaults.PRICE_TEXT,
products = options,
onProductClick = { },
onTermsOfServiceClick = {},
onBuySubscriptionClick = {}
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,8 @@ import org.hyperskill.app.R

object PaywallDefaults {
val ContentPadding = PaddingValues(
start = 24.dp,
end = 20.dp,
top = 24.dp,
bottom = 32.dp
horizontal = 20.dp,
vertical = 24.dp
)

val BackgroundColor: Color
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,23 @@
package org.hyperskill.app.android.paywall.ui

import org.hyperskill.app.paywall.presentation.PaywallFeature

object PaywallPreviewDefaults {
const val BUY_BUTTON_TEXT = "Subscribe"
const val PRICE_TEXT = "$11.99 / month"
const val BUY_BUTTON_TEXT = "Start now"
val subscriptionProducts = listOf(
PaywallFeature.ViewStateContent.SubscriptionProduct(
productId = "1",
title = "Annual 100$",
subtitle = "$8.33 / month",
isBestValue = true,
isSelected = true
),
PaywallFeature.ViewStateContent.SubscriptionProduct(
productId = "2",
title = "Monthly",
subtitle = "$12 / month",
isBestValue = false,
isSelected = false
)
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ fun PaywallScreen(
PaywallScreen(
viewState = state,
onBackClick = onBackClick,
onProductClick = viewModel::onOptionClick,
onBuySubscriptionClick = remember(activity) {
{
viewModel.onBuySubscriptionClick(activity)
Expand All @@ -73,6 +74,7 @@ fun PaywallScreen(
fun PaywallScreen(
viewState: ViewState,
onBackClick: () -> Unit,
onProductClick: (String) -> Unit,
onBuySubscriptionClick: () -> Unit,
onCloseClick: () -> Unit,
onRetryLoadingClick: () -> Unit,
Expand Down Expand Up @@ -106,7 +108,8 @@ fun PaywallScreen(
is ViewStateContent.Content ->
PaywallContent(
buyButtonText = contentState.buyButtonText,
priceText = contentState.priceText,
products = contentState.subscriptionProducts,
onProductClick = onProductClick,
onBuySubscriptionClick = onBuySubscriptionClick,
onTermsOfServiceClick = onTermsOfServiceClick,
padding = padding
Expand Down Expand Up @@ -192,16 +195,14 @@ private class PaywallPreviewProvider : PreviewParameterProvider<ViewState> {
isToolbarVisible = true,
contentState = ViewStateContent.Content(
buyButtonText = PaywallPreviewDefaults.BUY_BUTTON_TEXT,
priceText = "$11.99 / month",
trialText = null
subscriptionProducts = PaywallPreviewDefaults.subscriptionProducts
)
),
ViewState(
isToolbarVisible = false,
contentState = ViewStateContent.Content(
buyButtonText = PaywallPreviewDefaults.BUY_BUTTON_TEXT,
priceText = PaywallPreviewDefaults.PRICE_TEXT,
trialText = null
subscriptionProducts = PaywallPreviewDefaults.subscriptionProducts
)
),
ViewState(
Expand Down Expand Up @@ -237,6 +238,7 @@ fun PaywallScreenPreview(
PaywallScreen(
viewState = viewState,
onBackClick = {},
onProductClick = {},
onBuySubscriptionClick = {},
onCloseClick = {},
onRetryLoadingClick = {},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ fun SubscriptionDetails(
modifier = modifier,
verticalArrangement = Arrangement.spacedBy(6.dp)
) {
SubscriptionOption(text = stringResource(id = SharedR.string.mobile_only_subscription_feature_1))
SubscriptionOption(text = stringResource(id = SharedR.string.mobile_only_subscription_feature_2))
SubscriptionOption(text = stringResource(id = SharedR.string.mobile_only_subscription_feature_3))
SubscriptionOption(text = stringResource(id = SharedR.string.mobile_only_subscription_feature_4))
SubscriptionDetail(text = stringResource(id = SharedR.string.mobile_only_subscription_feature_1))
SubscriptionDetail(text = stringResource(id = SharedR.string.mobile_only_subscription_feature_2))
SubscriptionDetail(text = stringResource(id = SharedR.string.mobile_only_subscription_feature_3))
SubscriptionDetail(text = stringResource(id = SharedR.string.mobile_only_subscription_feature_4))
}
}

@Composable
fun SubscriptionOption(
fun SubscriptionDetail(
text: String,
modifier: Modifier = Modifier
) {
Expand Down
Loading

0 comments on commit 5543441

Please sign in to comment.