-
Notifications
You must be signed in to change notification settings - Fork 255
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move privacy to main setting. Make stats only for premium
- Loading branch information
Showing
9 changed files
with
151 additions
and
151 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
59 changes: 59 additions & 0 deletions
59
UnstoppableWallet/UnstoppableWallet/Modules/Settings/Privacy/PrivacyPolicyView.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,59 @@ | ||
import SwiftUI | ||
|
||
struct PrivacyPolicyView: View { | ||
@StateObject var viewModel: PrivacyPolicyViewModel | ||
|
||
@State var subscriptionPresented = false | ||
|
||
init(config: PrivacyPolicyViewModel.Config) { | ||
_viewModel = StateObject(wrappedValue: PrivacyPolicyViewModel(config: config)) | ||
} | ||
|
||
var body: some View { | ||
ScrollableThemeView { | ||
VStack(spacing: .margin24) { | ||
HighlightedTextView(text: viewModel.config.description) | ||
|
||
VStack(spacing: 0) { | ||
PremiumListSectionHeader() | ||
ListSection { | ||
premiumRow(statsRow()) | ||
} | ||
.modifier(ColoredBorder()) | ||
ListSectionFooter(text: "settings.privacy.allow.description".localized) | ||
} | ||
} | ||
.padding(EdgeInsets(top: .margin12, leading: .margin16, bottom: .margin32, trailing: .margin16)) | ||
.sheet(isPresented: $subscriptionPresented) { | ||
PurchasesView() | ||
} | ||
} | ||
.navigationTitle("settings.privacy".localized) | ||
.navigationBarTitleDisplayMode(.inline) | ||
} | ||
|
||
@ViewBuilder private func premiumRow(_ view: some View) -> some View { | ||
if viewModel.premiumEnabled { | ||
ListRow { | ||
view | ||
} | ||
} else { | ||
ClickableRow { | ||
subscriptionPresented = true | ||
} content: { | ||
view | ||
} | ||
} | ||
} | ||
|
||
@ViewBuilder private func statsRow() -> some View { | ||
Toggle(isOn: Binding(get: { viewModel.statsEnabled }, set: { viewModel.set(allowed: $0) })) { | ||
HStack(spacing: .margin16) { | ||
Image("share_1_24").themeIcon(color: .themeJacob) | ||
Text("settings.privacy.allow".localized).themeBody() | ||
} | ||
} | ||
.allowsHitTesting(viewModel.premiumEnabled) | ||
.toggleStyle(SwitchToggleStyle(tint: .themeYellow)) | ||
} | ||
} |
Oops, something went wrong.