-
Notifications
You must be signed in to change notification settings - Fork 329
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into create-feedback-survey-event
- Loading branch information
Showing
36 changed files
with
948 additions
and
158 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 70 additions & 0 deletions
70
RevenueCatUI/CustomerCenter/Views/ManageSubscriptionsButtonsView.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
// | ||
// Copyright RevenueCat Inc. All Rights Reserved. | ||
// | ||
// Licensed under the MIT License (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// https://opensource.org/licenses/MIT | ||
// | ||
// ManageSubscriptionsButtonsView.swift | ||
// | ||
// Created by Cesar de la Vega on 2/12/24. | ||
|
||
import Foundation | ||
import RevenueCat | ||
import SwiftUI | ||
|
||
#if os(iOS) | ||
|
||
@available(iOS 15.0, *) | ||
@available(macOS, unavailable) | ||
@available(tvOS, unavailable) | ||
@available(watchOS, unavailable) | ||
struct ManageSubscriptionsButtonsView: View { | ||
|
||
@ObservedObject | ||
var viewModel: ManageSubscriptionsViewModel | ||
@Binding | ||
var loadingPath: CustomerCenterConfigData.HelpPath? | ||
@Environment(\.openURL) | ||
var openURL | ||
|
||
@Environment(\.localization) | ||
private var localization: CustomerCenterConfigData.Localization | ||
|
||
var body: some View { | ||
ForEach(self.viewModel.paths, id: \.id) { path in | ||
ManageSubscriptionButton(path: path, viewModel: self.viewModel) | ||
} | ||
} | ||
|
||
} | ||
|
||
@available(iOS 15.0, *) | ||
@available(macOS, unavailable) | ||
@available(tvOS, unavailable) | ||
@available(watchOS, unavailable) | ||
struct ManageSubscriptionButton: View { | ||
|
||
let path: CustomerCenterConfigData.HelpPath | ||
@ObservedObject var viewModel: ManageSubscriptionsViewModel | ||
|
||
@Environment(\.appearance) private var appearance: CustomerCenterConfigData.Appearance | ||
|
||
var body: some View { | ||
AsyncButton(action: { | ||
await self.viewModel.determineFlow(for: path) | ||
}, label: { | ||
if self.viewModel.loadingPath?.id == path.id { | ||
TintedProgressView() | ||
} else { | ||
Text(path.title) | ||
} | ||
}) | ||
.disabled(self.viewModel.loadingPath != nil) | ||
} | ||
|
||
} | ||
|
||
#endif |
Oops, something went wrong.