Skip to content

Commit

Permalink
MBL-1635: Mock data to real data, and cleanup (#2099)
Browse files Browse the repository at this point in the history
  • Loading branch information
leighdouglas authored Aug 14, 2024
1 parent 7d505bf commit ef64663
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 19 deletions.
1 change: 1 addition & 0 deletions app/src/main/graphql/fragments.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,7 @@ fragment shippingRule on ShippingRule {

fragment ppoCard on Backing {
id
backingDetailsPageUrl
clientSecret
amount {
...amount
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ fun PPOCardView(
}

when (viewType) {
PPOCardViewType.CONFIRM_ADDRESS -> ConfirmAddressButtonsView(onActionButtonClicked, onSecondaryActionButtonClicked)
PPOCardViewType.CONFIRM_ADDRESS -> ConfirmAddressButtonsView(!shippingAddress.isNullOrEmpty(), onActionButtonClicked, onSecondaryActionButtonClicked)
PPOCardViewType.ADDRESS_CONFIRMED -> AddressConfirmedButtonView()
PPOCardViewType.FIX_PAYMENT -> FixPaymentButtonView(onActionButtonClicked)
PPOCardViewType.PAYMENT_FIXED -> PaymentFixedButtonView()
Expand Down Expand Up @@ -456,7 +456,7 @@ fun ConfirmAddressAlertsView(hoursRemaining: Int = -1) {
}
}
@Composable
fun ConfirmAddressButtonsView(onEditAddressClicked: () -> Unit, onConfirmAddressClicked: () -> Unit) {
fun ConfirmAddressButtonsView(isConfirmButtonEnabled: Boolean, onEditAddressClicked: () -> Unit, onConfirmAddressClicked: () -> Unit) {
Row(
modifier = Modifier
.fillMaxWidth()
Expand All @@ -479,7 +479,7 @@ fun ConfirmAddressButtonsView(onEditAddressClicked: () -> Unit, onConfirmAddress
.weight(0.5f),
onClickAction = { onConfirmAddressClicked.invoke() },
text = "Confirm",
isEnabled = true,
isEnabled = isConfirmButtonEnabled,
textStyle = typography.buttonText
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ import com.kickstarter.libs.utils.TransitionUtils
import com.kickstarter.libs.utils.extensions.getEnvironment
import com.kickstarter.libs.utils.extensions.getProjectIntent
import com.kickstarter.libs.utils.extensions.isDarkModeEnabled
import com.kickstarter.libs.utils.extensions.isNotNull
import com.kickstarter.ui.IntentKey
import com.kickstarter.ui.SharedPreferenceKey
import com.kickstarter.ui.activities.AppThemes
import com.kickstarter.ui.activities.ProfileActivity
import com.kickstarter.ui.compose.designsystem.KickstarterApp
import com.kickstarter.ui.extensions.setUpConnectivityStatusCheck
import com.kickstarter.ui.extensions.showSnackbar
import com.kickstarter.ui.extensions.startCreatorMessageActivity
import com.kickstarter.ui.extensions.transition
import com.stripe.android.ApiResultCallback
Expand Down Expand Up @@ -102,7 +102,7 @@ class PledgedProjectsOverviewActivity : AppCompatActivity() {
onSendMessageClick = { projectName -> viewModel.onMessageCreatorClicked(projectName) },
onProjectPledgeSummaryClick = { url ->
openBackingDetailsWebView(
url = url,
url = env.webEndpoint() + url,
resultLauncher = null
)
},
Expand Down Expand Up @@ -131,14 +131,14 @@ class PledgedProjectsOverviewActivity : AppCompatActivity() {

PPOCardViewType.OPEN_SURVEY -> {
openBackingDetailsWebView(
url = PPOCard.backingDetailsUrl ?: "",
url = env.webEndpoint() + (PPOCard.backingDetailsUrl ?: ""),
resultLauncher = startForResult
)
}

PPOCardViewType.CONFIRM_ADDRESS -> {
openBackingDetailsWebView(
url = PPOCard.backingDetailsUrl ?: "",
url = env.webEndpoint() + (PPOCard.backingDetailsUrl ?: ""),
resultLauncher = startForResult
)
}
Expand Down Expand Up @@ -185,14 +185,18 @@ class PledgedProjectsOverviewActivity : AppCompatActivity() {
url: String,
resultLauncher: ActivityResultLauncher<Intent>?
) {
resultLauncher?.launch(
Intent(this, BackingDetailsActivity::class.java)
.putExtra(IntentKey.URL, url)
) ?: {
val intent = Intent(this, BackingDetailsActivity::class.java)
.putExtra(IntentKey.URL, url)
startActivity(intent)
if (resultLauncher.isNotNull()) {
resultLauncher?.launch(
Intent(this, BackingDetailsActivity::class.java)
.putExtra(IntentKey.URL, url)
)
} else {
startActivity(
Intent(this, BackingDetailsActivity::class.java)
.putExtra(IntentKey.URL, url)
)
}

this.let {
TransitionUtils.transition(it, TransitionUtils.slideInFromRight())
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import androidx.paging.compose.collectAsLazyPagingItems
import com.kickstarter.R
import com.kickstarter.features.pledgedprojectsoverview.data.PPOCard
import com.kickstarter.features.pledgedprojectsoverview.data.PPOCardFactory
import com.kickstarter.libs.utils.extensions.isNullOrZero
import com.kickstarter.ui.compose.designsystem.KSAlertDialog
import com.kickstarter.ui.compose.designsystem.KSCircularProgressIndicator
import com.kickstarter.ui.compose.designsystem.KSErrorSnackbar
Expand Down Expand Up @@ -225,11 +226,13 @@ fun PledgedProjectsOverviewScreen(
state = lazyColumnListState
) {
item {
Text(
text = stringResource(id = R.string.alerts_fpo, totalAlerts),
style = typography.title3Bold,
color = colors.textPrimary
)
if (!totalAlerts.isNullOrZero()) {
Text(
text = stringResource(id = R.string.alerts_fpo, totalAlerts),
style = typography.title3Bold,
color = colors.textPrimary
)
}
}

items(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -922,6 +922,7 @@ fun pledgedProjectsOverviewEnvelopeTransformer(ppoResponse: PledgedProjectsOverv
val ppoBackingData = it.node()?.backing()?.fragments()?.ppoCard()
PPOCard.builder()
.backingId(ppoBackingData?.id())
.backingDetailsUrl(ppoBackingData?.backingDetailsPageUrl())
.clientSecret(ppoBackingData?.clientSecret())
.amount(ppoBackingData?.amount()?.fragments()?.amount()?.amount())
.currencyCode(ppoBackingData?.amount()?.fragments()?.amount()?.currency())
Expand Down

0 comments on commit ef64663

Please sign in to comment.