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
4 changes: 4 additions & 0 deletions phoenix-ios/phoenix-ios.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@
DC5631C72C5944CF00DCB5BF /* KotlinExtensions+Manager.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC5631C62C5944CF00DCB5BF /* KotlinExtensions+Manager.swift */; };
DC5631C82C59466000DCB5BF /* KotlinExtensions+Manager.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC5631C62C5944CF00DCB5BF /* KotlinExtensions+Manager.swift */; };
DC5631CA2C597B8600DCB5BF /* SourceInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC5631C92C597B8600DCB5BF /* SourceInfo.swift */; };
DC5895D02E57856D00CBCCF9 /* TorNetworkIssueSheet.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC5895CF2E57856600CBCCF9 /* TorNetworkIssueSheet.swift */; };
DC59377127516297003B4B53 /* Sequence+Sum.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC59377027516296003B4B53 /* Sequence+Sum.swift */; };
DC5A935329846044004F19FD /* FileHandle+Async.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC5A935229846043004F19FD /* FileHandle+Async.swift */; };
DC5CA4ED28F83C3B0048A737 /* DrainWalletView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC5CA4EC28F83C3B0048A737 /* DrainWalletView.swift */; };
Expand Down Expand Up @@ -663,6 +664,7 @@
DC5631C42C541E5C00DCB5BF /* Experimental.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Experimental.swift; sourceTree = "<group>"; };
DC5631C62C5944CF00DCB5BF /* KotlinExtensions+Manager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "KotlinExtensions+Manager.swift"; sourceTree = "<group>"; };
DC5631C92C597B8600DCB5BF /* SourceInfo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SourceInfo.swift; sourceTree = "<group>"; };
DC5895CF2E57856600CBCCF9 /* TorNetworkIssueSheet.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TorNetworkIssueSheet.swift; sourceTree = "<group>"; };
DC59377027516296003B4B53 /* Sequence+Sum.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Sequence+Sum.swift"; sourceTree = "<group>"; };
DC5A935229846043004F19FD /* FileHandle+Async.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "FileHandle+Async.swift"; sourceTree = "<group>"; };
DC5CA4EC28F83C3B0048A737 /* DrainWalletView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DrainWalletView.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1795,6 +1797,7 @@
DCDD9ED1286377C5001800A3 /* MainView_Small.swift */,
DC5E28C92C62D37A0037B3D3 /* NavigationCoordinator.swift */,
DCDD9ED328637EBB001800A3 /* ToolsButton.swift */,
DC5895CF2E57856600CBCCF9 /* TorNetworkIssueSheet.swift */,
);
path = main;
sourceTree = "<group>";
Expand Down Expand Up @@ -2355,6 +2358,7 @@
DC9CF8412D2ECF08003F3B0F /* IncomingBalancePopover.swift in Sources */,
DCDD9ED2286377C5001800A3 /* MainView_Small.swift in Sources */,
DC4CBC752D64DAC600129BDB /* Details_Incoming_Bolt11.swift in Sources */,
DC5895D02E57856D00CBCCF9 /* TorNetworkIssueSheet.swift in Sources */,
C8D7AFF5BC5754DBBEEB2688 /* ElectrumConfigurationView.swift in Sources */,
DC2210D92DE4F7E30096D8D2 /* LabelAlignment.swift in Sources */,
DCC3E57F2D08A63900CCDA40 /* XPC+Foreground.swift in Sources */,
Expand Down
21 changes: 21 additions & 0 deletions phoenix-ios/phoenix-ios/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -8572,6 +8572,9 @@
}
}
}
},
"Cannot access the Tor network. Phoenix will not function correctly." : {

},
"Cannot be swapped anymore, after 4 months waiting. These funds must be spent manually." : {
"localizations" : {
Expand Down Expand Up @@ -20890,6 +20893,9 @@
}
}
}
},
"If you don't have a Tor VPN app, install one. We recommend Orbot." : {

},
"If you enable [Advanced Data Protection](https://support.apple.com/en-us/108756) for iCloud, your recovery phrase will be encrypted end-to-end, and Apple cannot access it." : {
"localizations" : {
Expand Down Expand Up @@ -25046,6 +25052,9 @@
}
}
}
},
"Make sure your Tor Proxy VPN app is up and running, and that it's connected to Tor." : {

},
"Make sure your Tor VPN is active and running." : {
"localizations" : {
Expand Down Expand Up @@ -27052,6 +27061,9 @@
}
}
}
},
"No access to the Tor network" : {

},
"No address yet..." : {
"localizations" : {
Expand Down Expand Up @@ -28597,6 +28609,12 @@
}
}
}
},
"Open Orbot website" : {

},
"Open Tor settings" : {

},
"Opening the app" : {

Expand Down Expand Up @@ -30940,6 +30958,9 @@
}
}
}
},
"Phoenix needs access to Tor to function properly." : {

},
"Phoenix uses payment channels to make Bitcoin fast and private." : {
"localizations" : {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -635,11 +635,12 @@ struct ConfigurationList: View {
case .electrum : newNavLinkTag = .ElectrumServer ; delay *= 1
case .backgroundPayments : newNavLinkTag = .PaymentOptions ; delay *= 2
case .liquiditySettings : newNavLinkTag = .ChannelManagement ; delay *= 1
case .torSettings : newNavLinkTag = .Tor ; delay *= 1
case .forceCloseChannels : newNavLinkTag = .ForceCloseChannels ; delay *= 1
case .swapInWallet : newNavLinkTag = .WalletInfo ; delay *= 2
case .finalWallet : newNavLinkTag = .WalletInfo ; delay *= 2
case .appAccess : newNavLinkTag = .AppAccess ; delay *= 1
case .walletMetadata : newNavLinkTag = .WalletMetadata ; delay *= 1
case .walletMetadata : newNavLinkTag = .WalletMetadata ; delay *= 1
}

if let newNavLinkTag {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,7 @@ struct WalletInfoView: View {
case .electrum : break
case .backgroundPayments : break
case .liquiditySettings : break
case .torSettings : break
case .forceCloseChannels : break
case .swapInWallet : newNavLinkTag = NavLinkTag.SwapInWalletDetails
case .finalWallet : newNavLinkTag = NavLinkTag.FinalWalletDetails
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,7 @@ struct PaymentOptionsList: View {
case .electrum : break
case .backgroundPayments : newNavLinkTag = NavLinkTag.BackgroundPaymentsSelector
case .liquiditySettings : break
case .torSettings : break
case .forceCloseChannels : break
case .swapInWallet : break
case .finalWallet : break
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ struct TorConfigurationView: View {
@State var isTorEnabled = GroupPrefs.current.isTorEnabled

@State var ignoreToggleStateChange = false

@State var didAppear = false

@EnvironmentObject var deepLinkManager: DeepLinkManager
@EnvironmentObject var popoverState: PopoverState
@EnvironmentObject var smartModalState: SmartModalState

Expand All @@ -36,6 +39,9 @@ struct TorConfigurationView: View {
}
.listStyle(.insetGrouped)
.listBackgroundColor(.primaryBackground)
.onAppear() {
onAppear()
}
}

@ViewBuilder
Expand Down Expand Up @@ -78,6 +84,25 @@ struct TorConfigurationView: View {
}
}

// --------------------------------------------------
// MARK: Notifications
// --------------------------------------------------

func onAppear() {
log.trace(#function)

if !didAppear {
didAppear = true

if let deepLink = deepLinkManager.deepLink, deepLink == .torSettings {
// Reached our destination
DispatchQueue.main.async { // iOS 14 issues workaround
deepLinkManager.unbroadcast(deepLink)
}
}
}
}

// --------------------------------------------------
// MARK: Actions
// --------------------------------------------------
Expand Down Expand Up @@ -106,14 +131,14 @@ struct TorConfigurationView: View {
}

func usingTorSheet_didCancel() {
log.trace("usingTorSheet_didCancel()")
log.trace(#function)

ignoreToggleStateChange = true
toggleState = false
}

func usingTorSheet_didConfirm() {
log.trace("usingTorSheet_didConfirm()")
log.trace(#function)

isTorEnabled = true
GroupPrefs.current.isTorEnabled = true
Expand All @@ -124,14 +149,14 @@ struct TorConfigurationView: View {
}

func disablingTorSheet_didCancel() {
log.trace("disablingTorSheet_didCancel()")
log.trace(#function)

ignoreToggleStateChange = true
toggleState = true
}

func disablingTorSheet_didConfirm() {
log.trace("disablingTorSheet_didConfirm()")
log.trace(#function)

isTorEnabled = false
GroupPrefs.current.isTorEnabled = false
Expand All @@ -142,7 +167,7 @@ struct TorConfigurationView: View {
}

func openLink() {
log.trace("openLink()")
log.trace(#function)

guard let link = URL(string: "https://phoenix.acinq.co/faq#how-to-use-tor-on-phoenix") else {
return
Expand Down
2 changes: 2 additions & 0 deletions phoenix-ios/phoenix-ios/views/environment/DeepLink.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ enum DeepLink: Equatable, CustomStringConvertible {
case electrum
case backgroundPayments
case liquiditySettings
case torSettings
case forceCloseChannels
case swapInWallet
case finalWallet
Expand All @@ -30,6 +31,7 @@ enum DeepLink: Equatable, CustomStringConvertible {
case .electrum : "electrum"
case .backgroundPayments : "backgroundPayments"
case .liquiditySettings : "liquiditySettings"
case .torSettings : "torSettings"
case .forceCloseChannels : "forceCloseChannels"
case .swapInWallet : "swapInWallet"
case .finalWallet : "finalWallet"
Expand Down
35 changes: 26 additions & 9 deletions phoenix-ios/phoenix-ios/views/main/HomeView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ struct HomeView : MVIView {

@EnvironmentObject var deviceInfo: DeviceInfo
@EnvironmentObject var popoverState: PopoverState
@EnvironmentObject var smartModalState: SmartModalState
@EnvironmentObject var deepLinkManager: DeepLinkManager

// --------------------------------------------------
Expand Down Expand Up @@ -481,6 +482,8 @@ struct HomeView : MVIView {
navigationToBackgroundPayments()
} else if noticeMonitor.hasNotice_watchTower {
fixBackgroundAppRefreshDisabled()
} else if noticeMonitor.hasNotice_torNetworkIssue {
showTorNetworkIssueSheet()
} else if noticeMonitor.hasNotice_mempoolFull {
openMempoolFullURL()
}
Expand Down Expand Up @@ -520,6 +523,10 @@ struct HomeView : MVIView {
NotificationCell.mempoolFull()
.font(.footnote)

} else if noticeMonitor.hasNotice_torNetworkIssue {
NotificationCell.torNetworkIssue()
.font(.footnote)

} else if let item = bizNotifications_watchtower.first {
let location = isSingle ?
BizNotificationCell.Location.HomeView_Single(preAction: {})
Expand Down Expand Up @@ -735,6 +742,7 @@ struct HomeView : MVIView {
if noticeMonitor.hasNotice_mempoolFull { count += 1 }
if noticeMonitor.hasNotice_backgroundPayments { count += 1 }
if noticeMonitor.hasNotice_watchTower { count += 1 }
if noticeMonitor.hasNotice_torNetworkIssue { count += 1 }

count += bizNotifications_watchtower.count

Expand Down Expand Up @@ -809,6 +817,7 @@ struct HomeView : MVIView {
case .electrum : break
case .backgroundPayments : break
case .liquiditySettings : break
case .torSettings : break
case .forceCloseChannels : break
case .swapInWallet : break
case .finalWallet : break
Expand Down Expand Up @@ -989,7 +998,7 @@ struct HomeView : MVIView {
// --------------------------------------------------

func toggleCurrencyType() -> Void {
log.trace("toggleCurrencyType()")
log.trace(#function)

// bitcoin -> fiat -> hidden

Expand All @@ -1008,7 +1017,7 @@ struct HomeView : MVIView {
}

func showIncomingBalancePopover() {
log.trace("showIncomingBalancePopover()")
log.trace(#function)

popoverState.display(dismissable: true) {
IncomingBalancePopover(
Expand All @@ -1025,49 +1034,57 @@ struct HomeView : MVIView {
}

func openNotificationsSheet() {
log.trace("openNotificationSheet()")
log.trace(#function)

if activeSheet == nil {
activeSheet = .notificationsView
}
}

func navigateToBackup() {
log.trace("navigateToBackup()")
log.trace(#function)

deepLinkManager.broadcast(DeepLink.backup)
}

func navigationToElecrumServer() {
log.trace("navigateToElectrumServer()")
log.trace(#function)

deepLinkManager.broadcast(DeepLink.electrum)
}

func navigationToBackgroundPayments() {
log.trace("navigateToBackgroundPayments()")
log.trace(#function)

deepLinkManager.broadcast(DeepLink.backgroundPayments)
}

func openMempoolFullURL() {
log.trace("openMempoolFullURL()")
log.trace(#function)

if let url = URL(string: "https://phoenix.acinq.co/faq#high-mempool-size-impacts") {
openURL(url)
}
}

func fixBackgroundAppRefreshDisabled() {
log.trace("fixBackgroundAppRefreshDisabled()")
log.trace(#function)

popoverState.display(dismissable: true) {
BgRefreshDisabledPopover()
}
}

func showTorNetworkIssueSheet() {
log.trace(#function)

smartModalState.display(dismissable: true) {
TorNetworkIssueSheet()
}
}

func didSelectPayment(row: WalletPaymentInfo) -> Void {
log.trace("didSelectPayment()")
log.trace(#function)

if activeSheet == nil {
activeSheet = .paymentView(payment: row)
Expand Down
5 changes: 5 additions & 0 deletions phoenix-ios/phoenix-ios/views/main/MainView_Big.swift
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,7 @@ struct MainView_Big: View {
case .electrum : showSettings()
case .backgroundPayments : showSettings()
case .liquiditySettings : showSettings()
case .torSettings : showSettings()
case .forceCloseChannels : showSettings()
case .swapInWallet : showSettings()
case .finalWallet : showSettings()
Expand Down Expand Up @@ -654,6 +655,10 @@ struct MainView_Big: View {
navCoordinator_settings.path.removeAll()
navCoordinator_settings.path.append(ConfigurationList.NavLinkTag.ChannelManagement)

case .torSettings:
navCoordinator_settings.path.removeAll()
navCoordinator_settings.path.append(ConfigurationList.NavLinkTag.Tor)

case .forceCloseChannels:
navCoordinator_settings.path.removeAll()
navCoordinator_settings.path.append(ConfigurationList.NavLinkTag.ForceCloseChannels)
Expand Down
7 changes: 6 additions & 1 deletion phoenix-ios/phoenix-ios/views/main/MainView_Small.swift
Original file line number Diff line number Diff line change
Expand Up @@ -689,6 +689,10 @@ struct MainView_Small: View {
navCoordinator.path.append(NavLinkTag.ConfigurationView)
navCoordinator.path.append(ConfigurationList.NavLinkTag.ChannelManagement)

case .torSettings:
navCoordinator.path.append(NavLinkTag.ConfigurationView)
navCoordinator.path.append(ConfigurationList.NavLinkTag.Tor)

case .forceCloseChannels:
navCoordinator.path.append(NavLinkTag.ConfigurationView)
navCoordinator.path.append(ConfigurationList.NavLinkTag.ForceCloseChannels)
Expand Down Expand Up @@ -726,7 +730,8 @@ struct MainView_Small: View {
case .drainWallet : newNavLinkTag = .ConfigurationView ; delay *= 2
case .electrum : newNavLinkTag = .ConfigurationView ; delay *= 2
case .backgroundPayments : newNavLinkTag = .ConfigurationView ; delay *= 3
case .liquiditySettings : newNavLinkTag = .ConfigurationView ; delay *= 3
case .liquiditySettings : newNavLinkTag = .ConfigurationView ; delay *= 2
case .torSettings : newNavLinkTag = .ConfigurationView ; delay *= 2
case .forceCloseChannels : newNavLinkTag = .ConfigurationView ; delay *= 2
case .swapInWallet : newNavLinkTag = .ConfigurationView ; delay *= 2
case .finalWallet : newNavLinkTag = .ConfigurationView ; delay *= 2
Expand Down
Loading