Skip to content

Commit

Permalink
Merge pull request #1575 from anyproto/release-to-dev
Browse files Browse the repository at this point in the history
Release to dev
  • Loading branch information
ignatovv authored Jun 6, 2024
2 parents 1c7ddf9 + bca19d8 commit 6da5987
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import SwiftUI
import StoreKit
import Services
import Combine
import AnytypeCore


struct MembershipModuleView: View {
Expand Down Expand Up @@ -92,8 +93,10 @@ struct MembershipModuleView: View {
}

Spacer.fixedHeight(32)
contactUs
Spacer.fixedHeight(24)
if !FeatureFlags.hideCoCreator {
contactUs
Spacer.fixedHeight(24)
}
restorePurchases
}
}
Expand Down
5 changes: 4 additions & 1 deletion Anytype/Sources/ServiceLayer/Auth/LoginStateService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,11 @@ final class LoginStateService: LoginStateServiceProtocol {
await accountParticipantsStorage.startSubscription()
await activeSpaceParticipantStorage.startSubscription()
await participantSpacesStorage.startSubscription()
await membershipStatusStorage.startSubscription()
storeKitService.startListenForTransactions()

Task {
await membershipStatusStorage.startSubscription()
}
}

private func stopSubscriptions() async {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ protocol MembershipMetadataProviderProtocol {
func owningState(tier: MembershipTier) async -> MembershipTierOwningState

func purchaseType(status: MembershipStatus) async -> MembershipPurchaseType
func purchaseAvailablitiy(tier: MembershipTier) async -> MembershipPurchaseAvailablitiy
func purchaseAvailablitiy(tier: MembershipTier, status: MembershipStatus) async -> MembershipPurchaseAvailablitiy
}

final class MembershipMetadataProvider: MembershipMetadataProviderProtocol {
Expand All @@ -28,7 +28,7 @@ final class MembershipMetadataProvider: MembershipMetadataProviderProtocol {
}
}

let purchaseAvailablitiy = await purchaseAvailablitiy(tier: tier)
let purchaseAvailablitiy = await purchaseAvailablitiy(tier: tier, status: status)
return .unowned(purchaseAvailablitiy)
}

Expand All @@ -50,7 +50,7 @@ final class MembershipMetadataProvider: MembershipMetadataProviderProtocol {
}
}

func purchaseAvailablitiy(tier: MembershipTier) async -> MembershipPurchaseAvailablitiy {
func purchaseAvailablitiy(tier: MembershipTier, status: MembershipStatus) async -> MembershipPurchaseAvailablitiy {
switch tier.paymentType {
case .appStore(let info):
return await appStoreAvailability(info: info)
Expand All @@ -59,7 +59,10 @@ final class MembershipMetadataProvider: MembershipMetadataProviderProtocol {
case nil:
anytypeAssertionFailure(
"No payment type for unowned tier",
info: ["Tier": String(reflecting: tier)]
info: [
"Tier": String(reflecting: tier),
"Status": String(reflecting: status)
]
)
return .external(url: URL(string: AboutApp.pricingLink)!)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,7 @@ final class MembershipModelBuilder: MembershipModelBuilderProtocol {
}

private func buildPaymentUrl(tier: Anytype_Model_MembershipTierData) -> URL {
// TODO: Uncomment when middleware is ready
// anytypeAssert(tier.iosManageURL.isNotEmpty, "Empty iosManageURL", info: ["tier": tier.debugDescription])
anytypeAssert(tier.iosManageURL.isNotEmpty, "Empty iosManageURL", info: ["tier": tier.debugDescription])

return URL(string: tier.iosManageURL) ?? URL(string: "https://anytype.io/pricing")!
}
Expand Down

0 comments on commit 6da5987

Please sign in to comment.