Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ import AnytypeCore


struct MembershipModuleView: View {
@Environment(\.openURL) private var openURL
@State private var safariUrl: URL?
@Injected(\.mailUrlBuilder) private var mailUrlBuilder: any MailUrlBuilderProtocol

private let membership: MembershipStatus
private let tiers: [MembershipTier]
Expand Down Expand Up @@ -93,34 +91,10 @@ struct MembershipModuleView: View {
}

Spacer.fixedHeight(32)
if !FeatureFlags.hideWebPayments {
contactUs
Spacer.fixedHeight(24)
}
restorePurchases
}
}

@MainActor
private var contactUs: some View {
Button {
guard let mailUrl = mailUrlBuilder.membershipUpgrateUrl() else { return }
openURL(mailUrl)
} label: {
Group {
AnytypeText(
"\(Loc.Membership.Legal.wouldYouLike) ",
style: .caption1Regular
).foregroundColor(.Text.primary) +
AnytypeText(
Loc.Membership.Legal.letUsKnow,
style: .caption1Regular
).foregroundColor(.Text.primary).underline()
}
.multilineTextAlignment(.leading)
.padding(.horizontal, 20)
}
}

private var restorePurchases: some View {
AsyncButton {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import StoreKit

struct MembershipTierSelectionView: View {
@StateObject private var model: MembershipTierSelectionViewModel
@State private var safariUrl: URL?


init(
Expand All @@ -26,7 +25,6 @@ struct MembershipTierSelectionView: View {

var body: some View {
content
.safariSheet(url: $safariUrl)
.task {
await model.onAppear()
}
Expand Down Expand Up @@ -73,29 +71,13 @@ struct MembershipTierSelectionView: View {
case .appStore(let product):
MembershipNameSheetView(tier: model.tierToDisplay, anyName: model.userMembership.anyName, product: product, onSuccessfulPurchase: model.onSuccessfulPurchase)
case .external(let url):
if FeatureFlags.hideWebPayments {
notAvaliableOnAppStore
} else {
moreInfoButton(url: url)
}
notAvaliableOnAppStore
}
}
}
}

func moreInfoButton(url: URL) -> some View {
VStack {
StandardButton(Loc.moreInfo, style: .primaryLarge) {
AnytypeAnalytics.instance().logClickMembership(type: .moreInfo)
safariUrl = url
}
.padding(.horizontal, 20)
.padding(.vertical, 34)
}
.background(Color.Background.primary)
.cornerRadius(16, corners: .top)
}


var notAvaliableOnAppStore: some View {
VStack {
AnytypeText(Loc.Membership.unavailable, style: .uxTitle2Regular)
Expand All @@ -107,7 +89,7 @@ struct MembershipTierSelectionView: View {
.background(Color.Background.primary)
.cornerRadius(16, corners: .top)
}

// To mimic sheet overlay style
var sheetBackground: some View {
LinearGradient(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,6 @@ public extension FeatureFlags {
value(for: .dndOnCollectionsAndSets)
}

static var hideWebPayments: Bool {
value(for: .hideWebPayments)
}

static var enableStreamSpaceType: Bool {
value(for: .enableStreamSpaceType)
}
Expand Down Expand Up @@ -207,7 +203,6 @@ public extension FeatureFlags {
.setKanbanView,
.fullInlineSetImpl,
.dndOnCollectionsAndSets,
.hideWebPayments,
.enableStreamSpaceType,
.aiToolInSet,
.anyAppBetaTip,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,6 @@ public extension FeatureDescription {
defaultValue: false
)

static let hideWebPayments = FeatureDescription(
title: "Hide web based payments for memebership tier",
type: .feature(author: "vova@anytype.io", releaseVersion: "On demand"),
defaultValue: true
)

static let enableStreamSpaceType = FeatureDescription(
title: "Create stream space",
Expand Down
Loading