Use NSFileManager instead of SSZipArchive

This commit is contained in:
Max Radermacher
2024-10-30 13:53:41 -05:00
committed by GitHub
parent 36246dc128
commit f0da212a8b
7 changed files with 69 additions and 132 deletions

View File

@@ -62,7 +62,6 @@ target 'Signal' do
project 'Signal.xcodeproj', 'Debug' => :debug, 'Release' => :release
# Pods only available inside the main Signal app
pod 'SSZipArchive', podspec: 'ThirdParty/SSZipArchive.podspec'
ui_pods
target 'SignalTests' do

View File

@@ -38,7 +38,6 @@ PODS:
- SQLCipher/common (4.6.0)
- SQLCipher/standard (4.6.0):
- SQLCipher/common
- SSZipArchive (2.5.2)
- SwiftProtobuf (1.28.2)
- YYImage (1.0.4):
- YYImage/Core (= 1.0.4)
@@ -64,7 +63,6 @@ DEPENDENCIES:
- Reachability
- SignalRingRTC (from `https://github.com/signalapp/ringrtc`, tag `v2.48.4`)
- SQLCipher (from `https://github.com/signalapp/sqlcipher.git`, tag `v4.6.0-f_barrierfsync`)
- SSZipArchive (from `ThirdParty/SSZipArchive.podspec`)
- SwiftProtobuf (= 1.28.2)
- YYImage (from `https://github.com/signalapp/YYImage`)
- YYImage/libwebp (from `https://github.com/signalapp/YYImage`)
@@ -107,8 +105,6 @@ EXTERNAL SOURCES:
SQLCipher:
:git: https://github.com/signalapp/sqlcipher.git
:tag: v4.6.0-f_barrierfsync
SSZipArchive:
:podspec: ThirdParty/SSZipArchive.podspec
YYImage:
:git: https://github.com/signalapp/YYImage
@@ -159,10 +155,9 @@ SPEC CHECKSUMS:
Reachability: fd0ecd23705e2599e4cceeb943222ae02296cbc6
SignalRingRTC: ccf191d3598e03548f1e63f7d7644c56924ec8c3
SQLCipher: 30a8e81afa6128e600b17ffa77d0f92fa05ed208
SSZipArchive: 8c3485528a87fa6f90afdbfc33682eb61d985ae5
SwiftProtobuf: 4dbaffec76a39a8dc5da23b40af1a5dc01a4c02d
YYImage: f1ddd15ac032a58b78bbed1e012b50302d318331
PODFILE CHECKSUM: 3aef64e90a8232b44044628a206c3b35dcf9eeee
PODFILE CHECKSUM: 368a0dc15cf99174b55ec513d8981c5f5ded1658
COCOAPODS: 1.15.2

2
Pods

Submodule Pods updated: cb0a926c6e...86f576de5d

View File

@@ -15349,7 +15349,6 @@
"${BUILT_PRODUCTS_DIR}/Logging/Logging.framework",
"${BUILT_PRODUCTS_DIR}/MobileCoin/MobileCoin.framework",
"${BUILT_PRODUCTS_DIR}/PureLayout/PureLayout.framework",
"${BUILT_PRODUCTS_DIR}/SSZipArchive/SSZipArchive.framework",
"${BUILT_PRODUCTS_DIR}/lottie-ios/Lottie.framework",
"${BUILT_PRODUCTS_DIR}/CocoaLumberjack/CocoaLumberjack.framework",
"${PODS_XCFRAMEWORKS_BUILD_DIR}/SignalRingRTC/WebRTC/WebRTC.framework/WebRTC",
@@ -15372,7 +15371,6 @@
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Logging.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MobileCoin.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/PureLayout.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SSZipArchive.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Lottie.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CocoaLumberjack.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/WebRTC.framework",

View File

@@ -1570,35 +1570,6 @@ limitations under the License.
<key>Type</key>
<string>PSGroupSpecifier</string>
</dict>
<dict>
<key>FooterText</key>
<string>Copyright (c) 2015-2016 the fiat-crypto authors (see
https://github.com/mit-plv/fiat-crypto/blob/master/AUTHORS).
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.</string>
<key>License</key>
<string>MIT License</string>
<key>Title</key>
<string>boring-sys 4.9.0</string>
<key>Type</key>
<string>PSGroupSpecifier</string>
</dict>
<dict>
<key>FooterText</key>
<string>Copyright (c) 2014 Alex Crichton
@@ -1635,6 +1606,35 @@ DEALINGS IN THE SOFTWARE.
<key>Type</key>
<string>PSGroupSpecifier</string>
</dict>
<dict>
<key>FooterText</key>
<string>Copyright (c) 2015-2016 the fiat-crypto authors (see
https://github.com/mit-plv/fiat-crypto/blob/master/AUTHORS).
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.</string>
<key>License</key>
<string>MIT License</string>
<key>Title</key>
<string>boring-sys 4.9.0</string>
<key>Type</key>
<string>PSGroupSpecifier</string>
</dict>
<dict>
<key>FooterText</key>
<string>/* ====================================================================
@@ -10664,28 +10664,6 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
<key>Type</key>
<string>PSGroupSpecifier</string>
</dict>
<dict>
<key>FooterText</key>
<string> Copyright 2015-2016 Brian Smith.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.</string>
<key>License</key>
<string>ISC License</string>
<key>Title</key>
<string>ring 0.17.8</string>
<key>Type</key>
<string>PSGroupSpecifier</string>
</dict>
<dict>
<key>FooterText</key>
<string>Copyright (c) 2015-2016 the fiat-crypto authors (see
@@ -10716,6 +10694,28 @@ SOFTWARE.
<key>Type</key>
<string>PSGroupSpecifier</string>
</dict>
<dict>
<key>FooterText</key>
<string> Copyright 2015-2016 Brian Smith.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.</string>
<key>License</key>
<string>ISC License</string>
<key>Title</key>
<string>ring 0.17.8</string>
<key>Type</key>
<string>PSGroupSpecifier</string>
</dict>
<dict>
<key>FooterText</key>
<string>/* Copyright (c) 2015, Google Inc.
@@ -12327,36 +12327,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
<key>Type</key>
<string>PSGroupSpecifier</string>
</dict>
<dict>
<key>FooterText</key>
<string>Copyright (c) 2013-2021, ZipArchive, https://github.com/ZipArchive
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
</string>
<key>License</key>
<string>MIT</string>
<key>Title</key>
<string>SSZipArchive</string>
<key>Type</key>
<string>PSGroupSpecifier</string>
</dict>
<dict>
<key>FooterText</key>
<string>MIT License

View File

@@ -4,7 +4,6 @@
//
import Foundation
import SSZipArchive
import zlib
import SignalServiceKit
import SignalUI
@@ -229,17 +228,18 @@ class DebugLogs: NSObject {
}
// Phase 2. Zip up the log files.
let zipFilePath = zipDirPath.appendingFileExtension("zip")
let zipSuccess = SSZipArchive.createZipFile(
atPath: zipFilePath,
withContentsOfDirectory: zipDirPath,
keepParentDirectory: true,
compressionLevel: Z_DEFAULT_COMPRESSION,
password: nil,
aes: false,
progressHandler: nil
)
guard zipSuccess else {
let zipDirUrl = URL(fileURLWithPath: zipDirPath)
let zipFileUrl = URL(fileURLWithPath: zipDirPath.appendingFileExtension("zip"))
let fileCoordinator = NSFileCoordinator()
var zipError: NSError?
fileCoordinator.coordinate(readingItemAt: zipDirUrl, options: [.forUploading], error: &zipError) { temporaryFileUrl in
do {
try FileManager.default.copyItem(at: temporaryFileUrl, to: zipFileUrl)
} catch {
Logger.warn("Couldn't copy zipped file: \(error)")
}
}
if zipError != nil || !OWSFileSystem.fileOrFolderExists(url: zipFileUrl) {
let errorMessage = OWSLocalizedString(
"DEBUG_LOG_ALERT_COULD_NOT_PACKAGE_LOGS",
comment: "Error indicating that the debug logs could not be packaged."
@@ -248,22 +248,22 @@ class DebugLogs: NSObject {
return
}
OWSFileSystem.protectFileOrFolder(atPath: zipFilePath)
OWSFileSystem.protectFileOrFolder(atPath: zipFileUrl.path)
OWSFileSystem.deleteFile(zipDirPath)
// Phase 3. Upload the log files.
DebugLogUploader.uploadFile(
fileUrl: URL(fileURLWithPath: zipFilePath),
fileUrl: zipFileUrl,
mimeType: MimeType.applicationZip.rawValue
).done(on: DispatchQueue.global()) { url in
OWSFileSystem.deleteFile(zipFilePath)
OWSFileSystem.deleteFile(zipFileUrl.path)
wrappedSuccess(url)
}.catch(on: DispatchQueue.global()) { error in
let errorMessage = OWSLocalizedString(
"DEBUG_LOG_ALERT_ERROR_UPLOADING_LOG",
comment: "Error indicating that a debug log could not be uploaded."
)
wrappedFailure(errorMessage, zipFilePath)
wrappedFailure(errorMessage, zipFileUrl.path)
}
}

View File

@@ -1,25 +0,0 @@
# This custom podspec lowers the deployment target to 12.2, but should
# otherwise be the same as [the upstream podspec][0].
#
# [0]: https://github.com/ZipArchive/ZipArchive/blob/28312ba171da6647f410c6e5128a1fca9d2110b5/SSZipArchive.podspec
Pod::Spec.new do |s|
s.name = 'SSZipArchive'
s.version = '2.5.2'
s.summary = 'Utility class for zipping and unzipping files on iOS, tvOS, watchOS, and macOS.'
s.description = 'SSZipArchive is a simple utility class for zipping and unzipping files on iOS, tvOS, watchOS, and macOS. It supports AES and PKWARE encryption.'
s.homepage = 'https://github.com/ZipArchive/ZipArchive'
s.license = { :type => 'MIT', :file => 'LICENSE.txt' }
s.authors = { 'Sam Soffes' => 'sam@soff.es', 'Joshua Hudson' => nil, 'Wilson Chen' => nil }
s.source = { :git => 'https://github.com/ZipArchive/ZipArchive.git', :tag => "#{s.version}" }
s.ios.deployment_target = '12.2'
s.tvos.deployment_target = '15.4'
s.osx.deployment_target = '10.15'
s.watchos.deployment_target = '8.4'
s.source_files = 'SSZipArchive/*.{m,h}', 'SSZipArchive/include/*.{m,h}', 'SSZipArchive/minizip/*.{c,h}'
s.public_header_files = 'SSZipArchive/*.h'
s.libraries = 'z', 'iconv'
s.framework = 'Security'
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES',
'GCC_PREPROCESSOR_DEFINITIONS' => 'HAVE_INTTYPES_H HAVE_PKCRYPT HAVE_STDINT_H HAVE_WZAES HAVE_ZLIB ZLIB_COMPAT' }
end