Skip to content

Commit c9d1f7a

Browse files
authored
Dump info again before zipping
1 parent 7d6edb6 commit c9d1f7a

17 files changed

+130
-85
lines changed

Signal/AppLaunch/AppDelegate.swift

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -561,6 +561,7 @@ final class AppDelegate: UIResponder, UIApplicationDelegate {
561561
presentLaunchFailureActionSheet(
562562
from: viewController,
563563
supportTag: "CorruptRegistrationState",
564+
logDumper: .fromGlobals(),
564565
title: OWSLocalizedString(
565566
"APP_LAUNCH_FAILURE_CORRUPT_REGISTRATION_TITLE",
566567
comment: "Title for an error indicating that the app couldn't launch because some unexpected error happened with the user's registration status."
@@ -1052,6 +1053,7 @@ final class AppDelegate: UIResponder, UIApplicationDelegate {
10521053
presentLaunchFailureActionSheet(
10531054
from: viewController,
10541055
supportTag: preflightError.supportTag,
1056+
logDumper: .preLaunch(),
10551057
title: title,
10561058
message: message,
10571059
actions: actions
@@ -1107,6 +1109,7 @@ final class AppDelegate: UIResponder, UIApplicationDelegate {
11071109
presentLaunchFailureActionSheet(
11081110
from: viewController,
11091111
supportTag: LaunchPreflightError.databaseUnrecoverablyCorrupted.supportTag,
1112+
logDumper: .preLaunch(),
11101113
title: OWSLocalizedString(
11111114
"APP_LAUNCH_FAILURE_COULD_NOT_LOAD_DATABASE",
11121115
comment: "Error indicating that the app could not launch because the database could not be loaded."
@@ -1129,6 +1132,7 @@ final class AppDelegate: UIResponder, UIApplicationDelegate {
11291132
private func presentLaunchFailureActionSheet(
11301133
from viewController: UIViewController,
11311134
supportTag: String,
1135+
logDumper: DebugLogDumper,
11321136
title: String,
11331137
message: String,
11341138
actions: [LaunchFailureActionSheetAction]
@@ -1141,6 +1145,7 @@ final class AppDelegate: UIResponder, UIApplicationDelegate {
11411145
self.presentLaunchFailureActionSheet(
11421146
from: viewController,
11431147
supportTag: supportTag,
1148+
logDumper: logDumper,
11441149
title: title,
11451150
message: message,
11461151
actions: actions
@@ -1173,20 +1178,20 @@ final class AppDelegate: UIResponder, UIApplicationDelegate {
11731178
switch action {
11741179
case .submitDebugLogsAndCrash:
11751180
addSubmitDebugLogsAction {
1176-
DebugLogs.submitLogsWithSupportTag(supportTag) {
1181+
DebugLogs.submitLogs(supportTag: supportTag, dumper: logDumper) {
11771182
owsFail("Exiting after submitting debug logs")
11781183
}
11791184
}
11801185
case .submitDebugLogsAndLaunchApp(let window, let launchContext):
11811186
addSubmitDebugLogsAction { [unowned window] in
1182-
DebugLogs.submitLogsWithSupportTag(supportTag) {
1187+
DebugLogs.submitLogs(supportTag: supportTag, dumper: logDumper) {
11831188
ignoreErrorAndLaunchApp(in: window, launchContext: launchContext)
11841189
}
11851190
}
11861191
case .submitDebugLogsWithDatabaseIntegrityCheckAndCrash(let databaseStorage):
11871192
addSubmitDebugLogsAction { [unowned viewController] in
11881193
SignalApp.showDatabaseIntegrityCheckUI(from: viewController, databaseStorage: databaseStorage) {
1189-
DebugLogs.submitLogsWithSupportTag(supportTag) {
1194+
DebugLogs.submitLogs(supportTag: supportTag, dumper: logDumper) {
11901195
owsFail("Exiting after submitting debug logs")
11911196
}
11921197
}

Signal/ConversationView/ConversationViewController+CVComponentDelegate.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -796,6 +796,7 @@ extension ConversationViewController: CVComponentDelegate {
796796
sessionRefreshedActionSheet.addAction(ActionSheetAction(title: CommonStrings.contactSupport) { _ in
797797
ContactSupportActionSheet.present(
798798
emailFilter: .custom("Signal iOS Session Refresh"),
799+
logDumper: .fromGlobals(),
799800
fromViewController: self
800801
)
801802
})

Signal/Notifications/NotificationActionHandler.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ public class NotificationActionHandler {
342342

343343
private class func submitDebugLogs() async {
344344
await withCheckedContinuation { continuation in
345-
DebugLogs.submitLogsWithSupportTag(nil) {
345+
DebugLogs.submitLogs(dumper: .fromGlobals()) {
346346
continuation.resume()
347347
}
348348
}

Signal/Provisioning/UserInterface/ProvisioningController.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ class ProvisioningController: NSObject {
120120

121121
@objc
122122
private func submitLogs() {
123-
DebugLogs.submitLogsWithSupportTag("Onboarding")
123+
DebugLogs.submitLogs(supportTag: "Onboarding", dumper: .fromGlobals())
124124
}
125125

126126
// MARK: - Transitions
@@ -672,6 +672,7 @@ class ProvisioningController: NSObject {
672672
// view controller.
673673
ContactSupportActionSheet.present(
674674
emailFilter: .backupImportFailed,
675+
logDumper: .fromGlobals(),
675676
fromViewController: viewController
676677
)
677678
}

Signal/Provisioning/UserInterface/ProvisioningTransferQRCodeViewController.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ class ProvisioningTransferQRCodeViewController: ProvisioningBaseViewController {
135135

136136
ContactSupportActionSheet.present(
137137
emailFilter: .deviceTransfer,
138+
logDumper: .fromGlobals(),
138139
fromViewController: self
139140
)
140141
}

Signal/Registration/UserInterface/RegistrationNavigationController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ public class RegistrationNavigationController: OWSNavigationController {
446446

447447
@objc
448448
private func didRequestToSubmitDebugLogs() {
449-
DebugLogs.submitLogsWithSupportTag("Registration")
449+
DebugLogs.submitLogs(supportTag: "Registration", dumper: .fromGlobals())
450450
}
451451
}
452452

Signal/Registration/UserInterface/RegistrationPinViewController.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -716,7 +716,11 @@ class RegistrationPinViewController: OWSViewController {
716716

717717
actionSheet.addAction(.init(title: CommonStrings.contactSupport) { [weak self] _ in
718718
guard let self else { return }
719-
ContactSupportActionSheet.present(emailFilter: .registrationPINMode(state.contactSupportMode), fromViewController: self)
719+
ContactSupportActionSheet.present(
720+
emailFilter: .registrationPINMode(state.contactSupportMode),
721+
logDumper: .fromGlobals(),
722+
fromViewController: self,
723+
)
720724
})
721725

722726
actionSheet.addAction(OWSActionSheets.cancelAction)

Signal/Registration/UserInterface/RegistrationTransferQRCodeViewController.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,7 @@ public class RegistrationTransferQRCodeViewController: OWSViewController, OWSNav
370370

371371
ContactSupportActionSheet.present(
372372
emailFilter: .deviceTransfer,
373+
logDumper: .fromGlobals(),
373374
fromViewController: self
374375
)
375376
}

Signal/src/ViewControllers/AppSettings/ComposeSupportEmailOperation.swift

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ struct SupportEmailModel {
1515

1616
/// Attempt to upload the logs and include the resulting URL in the email body
1717
/// If the upload fails for one reason or another, continue anyway
18-
case attemptUpload
18+
case attemptUpload(DebugLogDumper)
1919

2020
/// Upload the logs. If they fail to upload, fail the operation
21-
case requireUpload
21+
case requireUpload(DebugLogDumper)
2222

2323
/// Don't upload new logs, instead use the provided link
2424
case link(URL)
@@ -129,15 +129,15 @@ final class ComposeSupportEmailOperation: NSObject {
129129
debugUrlString = nil
130130
case .link(let url):
131131
debugUrlString = url.absoluteString
132-
case .attemptUpload:
132+
case .attemptUpload(let dumper):
133133
do {
134-
debugUrlString = try await uploadDebugLogWithTimeout().absoluteString
134+
debugUrlString = try await uploadDebugLogWithTimeout(dumper: dumper).absoluteString
135135
} catch {
136136
debugUrlString = "[Support note: Log upload failed — \(error.userErrorDescription)]"
137137
}
138-
case .requireUpload:
138+
case .requireUpload(let dumper):
139139
do {
140-
debugUrlString = try await uploadDebugLogWithTimeout().absoluteString
140+
debugUrlString = try await uploadDebugLogWithTimeout(dumper: dumper).absoluteString
141141
} catch {
142142
throw EmailError.logUploadFailure(underlyingError: (error as? LocalizedError))
143143
}
@@ -159,10 +159,18 @@ final class ComposeSupportEmailOperation: NSObject {
159159
}
160160
}
161161

162-
private func uploadDebugLogWithTimeout() async throws -> URL {
162+
private func uploadDebugLogWithTimeout(dumper: DebugLogDumper) async throws -> URL {
163163
do {
164164
return try await withCooperativeTimeout(seconds: 60) {
165-
return try await DebugLogs.uploadLog()
165+
do throws(DebugLogs.UploadDebugLogError) {
166+
return try await DebugLogs.uploadLogs(dumper: dumper)
167+
} catch {
168+
// FIXME: Should we do something with the local log file?
169+
if let logArchiveOrDirectoryPath = error.logArchiveOrDirectoryPath {
170+
_ = OWSFileSystem.deleteFile(logArchiveOrDirectoryPath)
171+
}
172+
throw DebugLogsUploadError(localizedDescription: error.localizedErrorMessage)
173+
}
166174
}
167175
} catch is CooperativeTimeoutError {
168176
throw EmailError.logUploadTimedOut
@@ -238,3 +246,11 @@ final class ComposeSupportEmailOperation: NSObject {
238246
.joined(separator: "\r\n")
239247
}
240248
}
249+
250+
struct DebugLogsUploadError: Error, LocalizedError, UserErrorDescriptionProvider {
251+
let localizedDescription: String
252+
253+
var errorDescription: String? {
254+
localizedDescription
255+
}
256+
}

Signal/src/ViewControllers/AppSettings/ContactSupportViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ final class ContactSupportViewController: OWSTableViewController2 {
254254
var emailRequest = SupportEmailModel()
255255
emailRequest.userDescription = descriptionField.text
256256
emailRequest.emojiMood = emojiPicker.selectedMood
257-
emailRequest.debugLogPolicy = debugSwitch.isOn ? .attemptUpload : .none
257+
emailRequest.debugLogPolicy = debugSwitch.isOn ? .attemptUpload(.fromGlobals()) : .none
258258
if let selectedFilter = selectedFilter {
259259
emailRequest.supportFilter = "iOS \(selectedFilter.emailFilterString)"
260260
}

0 commit comments

Comments
 (0)