Skip to content

Commit

Permalink
Update blocking update button title
Browse files Browse the repository at this point in the history
  • Loading branch information
Momo Ozawa committed May 17, 2024
1 parent 4842f1f commit 1d6f34b
Showing 2 changed files with 9 additions and 17 deletions.
Original file line number Diff line number Diff line change
@@ -9,8 +9,8 @@ struct AppStoreInfoViewModel {
let message = Strings.message
let whatsNewTitle = Strings.whatsNew
let updateButtonTitle = Strings.Actions.update
let latestVersionButtonTitle = Strings.Actions.latestVersion
let cancelButtonTitle = Strings.Actions.cancel
let moreInfoButtonTitle = Strings.Actions.moreInfo

init(_ appStoreInfo: AppStoreLookupResponse.AppStoreInfo) {
self.appName = appStoreInfo.trackName
@@ -27,7 +27,7 @@ private enum Strings {

enum Actions {
static let update = NSLocalizedString("appUpdate.action.update", value: "Update", comment: "Update button title")
static let latestVersion = NSLocalizedString("appUpdate.action.latestVersion", value: "Get the latest version", comment: "Get the latest version button title")
static let cancel = NSLocalizedString("appUpdate.action.cancel", value: "Cancel", comment: "Cancel button title")
static let moreInfo = NSLocalizedString("appUpdate.action.moreInfo", value: "More info", comment: "More info button title")
}
}
22 changes: 7 additions & 15 deletions WordPress/Classes/ViewRelated/AppUpdate/BlockingUpdateView.swift
Original file line number Diff line number Diff line change
@@ -4,8 +4,8 @@ import UIKit
import StoreKit

final class BlockingUpdateViewController: UIHostingController<BlockingUpdateView> {
init(viewModel: AppStoreInfoViewModel, onUpdateTapped: @escaping () -> Void) {
super.init(rootView: .init(viewModel: viewModel, onUpdateTapped: onUpdateTapped))
init(viewModel: AppStoreInfoViewModel, onButtonTapped: @escaping () -> Void) {
super.init(rootView: .init(viewModel: viewModel, onButtonTapped: onButtonTapped))
}

@MainActor required dynamic init?(coder aDecoder: NSCoder) {
@@ -15,7 +15,7 @@ final class BlockingUpdateViewController: UIHostingController<BlockingUpdateView

struct BlockingUpdateView: View {
let viewModel: AppStoreInfoViewModel
let onUpdateTapped: (() -> Void)
let onButtonTapped: (() -> Void)

var body: some View {
VStack(alignment: .leading, spacing: 8) {
@@ -36,7 +36,10 @@ struct BlockingUpdateView: View {

Spacer()

buttonsView
DSButton(title: viewModel.latestVersionButtonTitle, style: .init(emphasis: .primary, size: .large)) {
onButtonTapped()
}
.padding(.bottom, 20)
}
.padding([.leading, .trailing], 20)
.interactiveDismissDisabled()
@@ -80,15 +83,4 @@ struct BlockingUpdateView: View {
}
}
}

private var buttonsView: some View {
VStack {
DSButton(title: viewModel.updateButtonTitle, style: .init(emphasis: .primary, size: .large)) {
onUpdateTapped()
}
DSButton(title: viewModel.moreInfoButtonTitle, style: .init(emphasis: .tertiary, size: .large)) {
// Todo
}
}
}
}

0 comments on commit 1d6f34b

Please sign in to comment.