|
|
@@ -5,6 +5,7 @@ import UniformTypeIdentifiers
|
|
|
struct PostGeneratorView: View {
|
|
|
@Environment(\.requirePremiumAccess) private var requirePremiumAccess
|
|
|
@Bindable var viewModel: PostGeneratorViewModel
|
|
|
+ var onPostToReddit: (URL) -> Void = { _ in }
|
|
|
|
|
|
private enum Layout {
|
|
|
static let horizontalPadding: CGFloat = 24
|
|
|
@@ -141,6 +142,15 @@ struct PostGeneratorView: View {
|
|
|
.buttonStyle(AppSecondaryButtonStyle())
|
|
|
.disabled(!viewModel.canExport)
|
|
|
|
|
|
+ Button {
|
|
|
+ viewModel.postToReddit(openURL: onPostToReddit)
|
|
|
+ } label: {
|
|
|
+ Label("Post to Reddit", systemImage: "arrow.up.right.square")
|
|
|
+ .font(.system(size: 11, weight: .medium))
|
|
|
+ }
|
|
|
+ .buttonStyle(AppSecondaryButtonStyle())
|
|
|
+ .disabled(!viewModel.canExport)
|
|
|
+
|
|
|
Button {
|
|
|
guard requirePremiumAccess() else { return }
|
|
|
Task { await viewModel.generatePost() }
|
|
|
@@ -658,6 +668,20 @@ struct PostGeneratorView: View {
|
|
|
)
|
|
|
|
|
|
previewMetadata
|
|
|
+
|
|
|
+ Button {
|
|
|
+ viewModel.postToReddit(openURL: onPostToReddit)
|
|
|
+ } label: {
|
|
|
+ Label("Post to Reddit", systemImage: "arrow.up.right.square")
|
|
|
+ .font(.system(size: 12, weight: .semibold))
|
|
|
+ .foregroundStyle(.white)
|
|
|
+ .frame(maxWidth: .infinity)
|
|
|
+ .padding(.vertical, 10)
|
|
|
+ .background(viewModel.canExport ? AppTheme.accentPurple : AppTheme.accentPurple.opacity(0.4))
|
|
|
+ .clipShape(RoundedRectangle(cornerRadius: 8))
|
|
|
+ }
|
|
|
+ .buttonStyle(AppPrimaryButtonStyle())
|
|
|
+ .disabled(!viewModel.canExport)
|
|
|
}
|
|
|
.frame(maxWidth: 560)
|
|
|
|