Reuse Issue from Core

This commit is contained in:
Davide De Rosa 2019-09-05 22:50:56 +02:00
parent f0188a0a5c
commit f90a84f1a4
4 changed files with 11 additions and 25 deletions

View File

@ -29,24 +29,6 @@ import MessageUI
import PassepartoutCore
class IssueReporter: NSObject {
struct Attachments {
let debugLog: Bool
let configurationURL: URL?
var description: String?
init(debugLog: Bool, configurationURL: URL?) {
self.debugLog = debugLog
self.configurationURL = configurationURL
}
init(debugLog: Bool, profile: ConnectionProfile) {
let url = TransientStore.shared.service.configurationURL(for: profile)
self.init(debugLog: debugLog, configurationURL: url)
}
}
static let shared = IssueReporter()
private weak var viewController: UIViewController?
@ -55,7 +37,7 @@ class IssueReporter: NSObject {
super.init()
}
func present(in viewController: UIViewController, withAttachments attachments: Attachments) {
func present(in viewController: UIViewController, withIssue issue: Issue) {
guard MFMailComposeViewController.canSendMail() else {
let app = UIApplication.shared
let V = AppConstants.IssueReporter.Email.self
@ -72,17 +54,17 @@ class IssueReporter: NSObject {
self.viewController = viewController
if attachments.debugLog {
if issue.debugLog {
let alert = Macros.alert(L10n.Core.IssueReporter.title, L10n.Core.IssueReporter.message)
alert.addDefaultAction(L10n.Core.IssueReporter.Buttons.accept) {
VPN.shared.requestDebugLog(fallback: AppConstants.Log.debugSnapshot) {
self.composeEmail(withDebugLog: $0, configurationURL: attachments.configurationURL, description: attachments.description)
self.composeEmail(withDebugLog: $0, configurationURL: issue.configurationURL, description: issue.description)
}
}
alert.addCancelAction(L10n.Core.Global.cancel)
viewController.present(alert, animated: true, completion: nil)
} else {
composeEmail(withDebugLog: nil, configurationURL: attachments.configurationURL, description: attachments.description)
composeEmail(withDebugLog: nil, configurationURL: issue.configurationURL, description: issue.description)
}
}

View File

@ -450,8 +450,8 @@ class ServiceViewController: UIViewController, TableModelHost {
}
private func reportConnectivityIssue() {
let attach = IssueReporter.Attachments(debugLog: true, profile: uncheckedProfile)
IssueReporter.shared.present(in: self, withAttachments: attach)
let issue = Issue(debugLog: true, profile: uncheckedProfile)
IssueReporter.shared.present(in: self, withIssue: issue)
}
private func requireDownload() {

View File

@ -106,6 +106,7 @@
0EDE8DC820C86910004C739C /* Passepartout-Tunnel.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = 0EDE8DBF20C86910004C739C /* Passepartout-Tunnel.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
0EE3BBB2215ED3A900F30952 /* AboutViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EE3BBB1215ED3A900F30952 /* AboutViewController.swift */; };
0EEB53B2225D525B00746300 /* Downloader.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EEB53B1225D525B00746300 /* Downloader.swift */; };
0EEF23412321AC55000AEBE3 /* Issue.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EEF23402321AC55000AEBE3 /* Issue.swift */; };
0EF56BBB2185AC8500B0C8AB /* SwiftGen+Segues.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EF56BBA2185AC8500B0C8AB /* SwiftGen+Segues.swift */; };
0EF5CF252141CE58004FF1BD /* HUD.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EF5CF242141CE58004FF1BD /* HUD.swift */; };
0EF5CF292141F31F004FF1BD /* Utils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E4FD7ED20D539A0002221FF /* Utils.swift */; };
@ -297,6 +298,7 @@
0EDE8DED20C93E4C004C739C /* GroupConstants.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GroupConstants.swift; sourceTree = "<group>"; };
0EE3BBB1215ED3A900F30952 /* AboutViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AboutViewController.swift; sourceTree = "<group>"; };
0EEB53B1225D525B00746300 /* Downloader.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Downloader.swift; sourceTree = "<group>"; };
0EEF23402321AC55000AEBE3 /* Issue.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Issue.swift; path = Submodules/Core/Passepartout/Sources/Issue.swift; sourceTree = SOURCE_ROOT; };
0EF56BBA2185AC8500B0C8AB /* SwiftGen+Segues.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "SwiftGen+Segues.swift"; sourceTree = "<group>"; };
0EF5CF242141CE58004FF1BD /* HUD.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HUD.swift; sourceTree = "<group>"; };
0EFB901722764689006405E4 /* ProfileNetworkSettings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileNetworkSettings.swift; sourceTree = "<group>"; };
@ -590,6 +592,7 @@
0E6BE13920CFB76800A6DD36 /* ApplicationError.swift */,
0EDE8DED20C93E4C004C739C /* GroupConstants.swift */,
0ECF12D6230612F5008E4924 /* InAppHelper.swift */,
0EEF23402321AC55000AEBE3 /* Issue.swift */,
0E78179E21BE852200950C58 /* Reviewer.swift */,
0E4FD7ED20D539A0002221FF /* Utils.swift */,
);
@ -979,6 +982,7 @@
0E3152CE223FA05400F61841 /* ConnectionService.swift in Sources */,
0ED993B1223FF8C700B0F9C9 /* IntentDispatcher.swift in Sources */,
0E3152BE223FA03D00F61841 /* Reviewer.swift in Sources */,
0EEF23412321AC55000AEBE3 /* Issue.swift in Sources */,
0E3152C3223FA04800F61841 /* StandardVPNProvider.swift in Sources */,
0E3152D1223FA05400F61841 /* Credentials.swift in Sources */,
0E3152CD223FA05400F61841 /* ConnectionProfile.swift in Sources */,

@ -1 +1 @@
Subproject commit d30b99b57f896f3a77ac7e5fb833405c5d386664
Subproject commit 2feaee7f328f9a030baf8a6c2a60c05ae5541103