-
Notifications
You must be signed in to change notification settings - Fork 250
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
297 additions
and
400 deletions.
There are no files selected for viewing
30 changes: 12 additions & 18 deletions
30
UnstoppableWallet/UnstoppableWallet.xcodeproj/project.pbxproj
Large diffs are not rendered by default.
Oops, something went wrong.
21 changes: 6 additions & 15 deletions
21
UnstoppableWallet/UnstoppableWallet/Core/Managers/TermsManager.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 |
---|---|---|
@@ -1,32 +1,23 @@ | ||
import RxSwift | ||
import RxRelay | ||
import Combine | ||
import HsExtensions | ||
import StorageKit | ||
|
||
class TermsManager { | ||
private let keyTermsAccepted = "key_terms_accepted" | ||
private let storage: StorageKit.ILocalStorage | ||
|
||
private let termsAcceptedRelay = PublishRelay<Bool>() | ||
@DistinctPublished var termsAccepted: Bool | ||
|
||
init(storage: StorageKit.ILocalStorage) { | ||
self.storage = storage | ||
} | ||
|
||
termsAccepted = storage.value(for: keyTermsAccepted) ?? false | ||
} | ||
} | ||
|
||
extension TermsManager { | ||
|
||
var termsAccepted: Bool { | ||
storage.value(for: keyTermsAccepted) ?? false | ||
} | ||
|
||
var termsAcceptedObservable: Observable<Bool> { | ||
termsAcceptedRelay.asObservable() | ||
} | ||
|
||
func setTermsAccepted() { | ||
storage.set(value: true, for: keyTermsAccepted) | ||
termsAcceptedRelay.accept(true) | ||
termsAccepted = true | ||
} | ||
|
||
} |
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
16 changes: 8 additions & 8 deletions
16
UnstoppableWallet/UnstoppableWallet/Modules/Settings/About/AboutModule.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 |
---|---|---|
@@ -1,15 +1,15 @@ | ||
import UIKit | ||
import SwiftUI | ||
|
||
struct AboutModule { | ||
static func viewController() -> UIViewController { | ||
let service = AboutService( | ||
termsManager: App.shared.termsManager, | ||
systemInfoManager: App.shared.systemInfoManager | ||
) | ||
static func view() -> some View { | ||
let releaseNotesService = ReleaseNotesService(appVersionManager: App.shared.appVersionManager) | ||
|
||
let viewModel = AboutViewModel(service: service, releaseNotesService: releaseNotesService) | ||
let viewModel = AboutViewModel( | ||
termsManager: App.shared.termsManager, | ||
systemInfoManager: App.shared.systemInfoManager, | ||
releaseNotesService: releaseNotesService | ||
) | ||
|
||
return AboutViewController(viewModel: viewModel, urlManager: UrlManager(inApp: true)) | ||
return AboutView(viewModel: viewModel) | ||
} | ||
} |
25 changes: 0 additions & 25 deletions
25
UnstoppableWallet/UnstoppableWallet/Modules/Settings/About/AboutService.swift
This file was deleted.
Oops, something went wrong.
125 changes: 125 additions & 0 deletions
125
UnstoppableWallet/UnstoppableWallet/Modules/Settings/About/AboutView.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,125 @@ | ||
import SwiftUI | ||
|
||
struct AboutView: View { | ||
@ObservedObject var viewModel: AboutViewModel | ||
|
||
@State private var termsPresented = false | ||
@State private var linkUrl: URL? | ||
|
||
var body: some View { | ||
ScrollableThemeView { | ||
VStack(spacing: .margin24) { | ||
HStack(spacing: .margin16) { | ||
Image(uiImage: UIImage(named: AppIcon.main.imageName) ?? UIImage()) | ||
.resizable() | ||
.scaledToFit() | ||
.clipShape(RoundedRectangle(cornerRadius: .cornerRadius16, style: .continuous)) | ||
.frame(width: 72, height: 72) | ||
|
||
VStack(spacing: .margin8) { | ||
Text("settings.about_app.app_name".localized(AppConfig.appName)).themeHeadline1() | ||
Text("version".localized(viewModel.appVersion)).themeSubhead2() | ||
} | ||
} | ||
.padding(.horizontal, .margin24) | ||
|
||
Text("settings.about_app.description".localized(AppConfig.appName, AppConfig.appName)) | ||
.font(.themeBody) | ||
.foregroundColor(.themeBran) | ||
.padding(.horizontal, .margin32) | ||
.padding(.vertical, .margin12) | ||
|
||
VStack(spacing: .margin32) { | ||
if let releaseNotesUrl = viewModel.releaseNotesUrl { | ||
ListSection { | ||
NavigationRow(destination: { | ||
MarkdownModule.gitReleaseNotesMarkdownView(url: releaseNotesUrl, presented: false) | ||
.ignoresSafeArea() | ||
}) { | ||
Image("circle_information_24").themeIcon() | ||
Text("settings.about_app.whats_new".localized).themeBody() | ||
Image.disclosureIcon | ||
} | ||
} | ||
} | ||
|
||
ListSection { | ||
NavigationRow(destination: { | ||
AppStatusModule.view() | ||
}) { | ||
Image("app_status_24").themeIcon() | ||
Text("app_status.title".localized).themeBody() | ||
Image.disclosureIcon | ||
} | ||
|
||
ClickableRow(action: { | ||
termsPresented = true | ||
}) { | ||
Image("unordered_24").themeIcon() | ||
Text("terms.title".localized).themeBody() | ||
|
||
if viewModel.termsAlert { | ||
Image("warning_2_20").themeIcon(color: .themeLucian).padding(.trailing, -.margin8) | ||
} | ||
|
||
Image.disclosureIcon | ||
} | ||
|
||
NavigationRow(destination: { | ||
PrivacyPolicyView(config: .privacy) | ||
.navigationTitle(PrivacyPolicyViewController.Config.privacy.title) | ||
.ignoresSafeArea() | ||
}) { | ||
Image("user_24").themeIcon() | ||
Text("settings.privacy".localized).themeBody() | ||
Image.disclosureIcon | ||
} | ||
} | ||
|
||
ListSection { | ||
ClickableRow(action: { | ||
linkUrl = URL(string: "https://github.com/\(AppConfig.appGitHubAccount)/\(AppConfig.appGitHubRepository)") | ||
}) { | ||
Image("github_24").themeIcon() | ||
Text("GitHub").themeBody() | ||
Image.disclosureIcon | ||
} | ||
|
||
ClickableRow(action: { | ||
let account = AppConfig.appTwitterAccount | ||
|
||
if let appUrl = URL(string: "twitter://user?screen_name=\(account)"), UIApplication.shared.canOpenURL(appUrl) { | ||
UIApplication.shared.open(appUrl) | ||
} else { | ||
linkUrl = URL(string: "https://twitter.com/\(account)") | ||
} | ||
}) { | ||
Image("twitter_24").themeIcon() | ||
Text("Twitter").themeBody() | ||
Image.disclosureIcon | ||
} | ||
|
||
ClickableRow(action: { | ||
linkUrl = URL(string: AppConfig.appWebPageLink) | ||
}) { | ||
Image("globe_24").themeIcon() | ||
Text("settings.about_app.website".localized).themeBody() | ||
Image.disclosureIcon | ||
} | ||
} | ||
} | ||
.padding(.horizontal, .margin16) | ||
} | ||
.padding(EdgeInsets(top: .margin24, leading: 0, bottom: .margin32, trailing: 0)) | ||
.sheet(isPresented: $termsPresented) { | ||
TermsModule.view() | ||
.ignoresSafeArea() | ||
} | ||
.sheet(item: $linkUrl) { url in | ||
SFSafariView(url: url) | ||
.ignoresSafeArea() | ||
} | ||
} | ||
.navigationTitle("settings.about_app.title".localized) | ||
} | ||
} |
Oops, something went wrong.