Merge branch 'mlin/PR/FixWarnings'

This commit is contained in:
Michelle Linington 2021-10-21 22:16:23 -07:00
commit 2293a2af35
64 changed files with 652 additions and 759 deletions

19
Podfile
View File

@ -116,6 +116,7 @@ post_install do |installer|
enable_extension_support_for_purelayout(installer)
configure_warning_flags(installer)
configure_testable_build(installer)
promote_minimum_supported_version(installer)
disable_bitcode(installer)
disable_armv7(installer)
strip_valid_archs(installer)
@ -184,6 +185,24 @@ def configure_testable_build(installer)
end
end
# Xcode 13 dropped support for some older iOS versions. We only need them
# to support our project's minimum version, so let's bump each Pod's min
# version to our min to suppress these warnings.
def promote_minimum_supported_version(installer)
project_min_version = current_target_definition.platform.deployment_target
installer.pods_project.targets.each do |target|
target.build_configurations.each do |build_configuration|
target_version_string = build_configuration.build_settings['IPHONEOS_DEPLOYMENT_TARGET']
target_version = Version.create(target_version_string)
if target_version < project_min_version
build_configuration.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = project_min_version.version
end
end
end
end
def disable_bitcode(installer)
installer.pods_project.targets.each do |target|

View File

@ -357,7 +357,7 @@ CHECKOUT OPTIONS:
:commit: aaa24f6efae6114f1252ae86f02aeedc69a8b151
:git: https://github.com/signalapp/libsignal-client.git
SignalCoreKit:
:commit: 83b856734ebec1483f36eee6ec710ad9908c197d
:commit: 04920eef158f9c3c88bc33fa75d9f18c3f2879e8
:git: "git@github.com:signalapp/SignalCoreKit"
SignalMetadataKit:
:commit: 90f1776e631e8e232360bbe11db620c77f078567
@ -422,6 +422,6 @@ SPEC CHECKSUMS:
YYImage: f1ddd15ac032a58b78bbed1e012b50302d318331
ZKGroup: 81ba58bf87b5614b03d49364db221390bf257dd7
PODFILE CHECKSUM: 9f8a44c506114cbc5e155dea666f1d1cf48e4162
PODFILE CHECKSUM: 2b9a3b19a25cb8362e446c82b27ac3533fe44793
COCOAPODS: 1.10.1

2
Pods

@ -1 +1 @@
Subproject commit 639f5b7e810e08aa4198b47d8e785bce8811b317
Subproject commit adfbc68ee60c53a119c6d736197c42f56245e9f1

View File

@ -175,6 +175,8 @@ class EmojiGenerator {
}
static func generate() {
// This URL has been unavailable the past couple of weeks. If you're seeing failures here, try:
// https://raw.githubusercontent.com/iamcal/emoji-data/master/emoji.json
guard let jsonData = try? Data(contentsOf: URL(string: "https://unicodey.com/emoji-data/emoji.json")!) else {
fatalError("Failed to download emoji-data json")
}
@ -391,7 +393,7 @@ class EmojiGenerator {
fileHandle.writeLine("extension Emoji {")
// Value lookup per emoji
fileHandle.writeLine(" var name: String? {")
fileHandle.writeLine(" var name: String {")
fileHandle.writeLine(" switch self {")
for emojiData in sortedEmojiData {
@ -399,8 +401,6 @@ class EmojiGenerator {
fileHandle.writeLine(" case .\(emojiData.enumName): return \"\(name)\"")
}
fileHandle.writeLine(" default: return nil")
fileHandle.writeLine(" }")
fileHandle.writeLine(" }")

View File

@ -1765,24 +1765,20 @@ public extension %(class_name)s {
let uniqueIds = anyAllUniqueIds(transaction: transaction)
var index: Int = 0
do {
try Batching.loop(batchSize: Batching.kDefaultBatchSize,
loopBlock: { stop in
guard index < uniqueIds.count else {
stop.pointee = true
return
}
let uniqueId = uniqueIds[index]
index = index + 1
guard let instance = anyFetch(uniqueId: uniqueId, transaction: transaction) else {
owsFailDebug("Missing instance.")
return
}
instance.anyRemove(transaction: transaction)
})
} catch {
owsFailDebug("Error: \(error)")
}
Batching.loop(batchSize: Batching.kDefaultBatchSize,
loopBlock: { stop in
guard index < uniqueIds.count else {
stop.pointee = true
return
}
let uniqueId = uniqueIds[index]
index = index + 1
guard let instance = anyFetch(uniqueId: uniqueId, transaction: transaction) else {
owsFailDebug("Missing instance.")
return
}
instance.anyRemove(transaction: transaction)
})
if shouldBeIndexedForFTS {
FullTextSearchFinder.allModelsWereRemoved(collection: collection(), transaction: transaction)

View File

@ -7442,6 +7442,7 @@
ENABLE_STRICT_OBJC_MSGSEND = YES;
EXCLUDED_ARCHS = armv7;
FRAMEWORK_SEARCH_PATHS = "$(PROJECT_DIR)/ThirdParty/WebRTC/Build";
GCC_ENABLE_OBJC_EXCEPTIONS = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_PREPROCESSOR_DEFINITIONS = (
"TESTABLE_BUILD=1",
@ -7478,7 +7479,6 @@
ONLY_ACTIVE_ARCH = YES;
OTHER_CFLAGS = (
"-DNS_BLOCK_ASSERTIONS=1",
"-fobjc-arc-exceptions",
"-DTESTABLE_BUILDS",
"-DNEW_CV_ARCHITECTURE",
);
@ -7582,6 +7582,7 @@
"$(inherited)",
"$(SRCROOT)",
);
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
GCC_GENERATE_TEST_COVERAGE_FILES = NO;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
@ -7611,6 +7612,10 @@
"$(inherited)",
"$(SRCROOT)",
);
OTHER_CFLAGS = (
"$(inherited)",
"-fobjc-arc-exceptions",
);
OTHER_LDFLAGS = (
"-all_load",
"-ObjC",
@ -7795,6 +7800,7 @@
"$(inherited)",
"$(SRCROOT)",
);
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
GCC_GENERATE_TEST_COVERAGE_FILES = NO;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
@ -7825,6 +7831,10 @@
"$(inherited)",
"$(SRCROOT)",
);
OTHER_CFLAGS = (
"$(inherited)",
"-fobjc-arc-exceptions",
);
OTHER_LDFLAGS = (
"-all_load",
"-ObjC",
@ -7856,6 +7866,7 @@
"$(inherited)",
"$(SRCROOT)",
);
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
GCC_GENERATE_TEST_COVERAGE_FILES = NO;
GCC_OPTIMIZATION_LEVEL = s;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
@ -7885,6 +7896,10 @@
"$(inherited)",
"$(SRCROOT)",
);
OTHER_CFLAGS = (
"$(inherited)",
"-fobjc-arc-exceptions",
);
OTHER_LDFLAGS = (
"-all_load",
"-ObjC",
@ -7917,6 +7932,7 @@
"$(inherited)",
"$(SRCROOT)",
);
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
GCC_GENERATE_TEST_COVERAGE_FILES = NO;
GCC_OPTIMIZATION_LEVEL = s;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
@ -7946,6 +7962,10 @@
"$(inherited)",
"$(SRCROOT)",
);
OTHER_CFLAGS = (
"$(inherited)",
"-fobjc-arc-exceptions",
);
OTHER_LDFLAGS = (
"-all_load",
"-ObjC",
@ -7995,6 +8015,7 @@
ENABLE_STRICT_OBJC_MSGSEND = YES;
EXCLUDED_ARCHS = armv7;
FRAMEWORK_SEARCH_PATHS = "$(PROJECT_DIR)/ThirdParty/WebRTC/Build";
GCC_ENABLE_OBJC_EXCEPTIONS = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_PREPROCESSOR_DEFINITIONS = "TESTABLE_BUILD=1";
GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES;
@ -8026,10 +8047,7 @@
HEADER_SEARCH_PATHS = "";
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
ONLY_ACTIVE_ARCH = YES;
OTHER_CFLAGS = (
"-DNS_BLOCK_ASSERTIONS=1",
"-fobjc-arc-exceptions",
);
OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
OTHER_SWIFT_FLAGS = "-DTESTABLE_BUILD";
SDKROOT = iphoneos;
SWIFT_COMPILATION_MODE = wholemodule;
@ -8129,6 +8147,7 @@
"$(inherited)",
"$(SRCROOT)",
);
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
GCC_GENERATE_TEST_COVERAGE_FILES = NO;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
@ -8158,6 +8177,10 @@
"$(inherited)",
"$(SRCROOT)",
);
OTHER_CFLAGS = (
"$(inherited)",
"-fobjc-arc-exceptions",
);
OTHER_LDFLAGS = (
"-all_load",
"-ObjC",
@ -8341,6 +8364,7 @@
"$(inherited)",
"$(SRCROOT)",
);
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
GCC_GENERATE_TEST_COVERAGE_FILES = NO;
GCC_OPTIMIZATION_LEVEL = s;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
@ -8370,6 +8394,10 @@
"$(inherited)",
"$(SRCROOT)",
);
OTHER_CFLAGS = (
"$(inherited)",
"-fobjc-arc-exceptions",
);
OTHER_LDFLAGS = (
"-all_load",
"-ObjC",
@ -8684,6 +8712,7 @@
ENABLE_TESTABILITY = YES;
EXCLUDED_ARCHS = armv7;
FRAMEWORK_SEARCH_PATHS = "$(PROJECT_DIR)/ThirdParty/WebRTC/Build";
GCC_ENABLE_OBJC_EXCEPTIONS = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_PREPROCESSOR_DEFINITIONS = (
"$(inherited)",
@ -8720,7 +8749,6 @@
HEADER_SEARCH_PATHS = "";
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
ONLY_ACTIVE_ARCH = YES;
OTHER_CFLAGS = "-fobjc-arc-exceptions";
OTHER_SWIFT_FLAGS = "-DTESTABLE_BUILD -DNEW_CV_ARCHITECTURE";
SDKROOT = iphoneos;
SWIFT_VERSION = 4.0;
@ -8768,6 +8796,7 @@
ENABLE_STRICT_OBJC_MSGSEND = YES;
EXCLUDED_ARCHS = armv7;
FRAMEWORK_SEARCH_PATHS = "$(PROJECT_DIR)/ThirdParty/WebRTC/Build";
GCC_ENABLE_OBJC_EXCEPTIONS = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES;
GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = YES;
@ -8798,10 +8827,7 @@
HEADER_SEARCH_PATHS = "";
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
ONLY_ACTIVE_ARCH = NO;
OTHER_CFLAGS = (
"-DNS_BLOCK_ASSERTIONS=1",
"-fobjc-arc-exceptions",
);
OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
SDKROOT = iphoneos;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OPTIMIZATION_LEVEL = "-O";
@ -8972,6 +8998,7 @@
"$(inherited)",
"$(SRCROOT)",
);
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
GCC_GENERATE_TEST_COVERAGE_FILES = NO;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
@ -9002,6 +9029,10 @@
"$(inherited)",
"$(SRCROOT)",
);
OTHER_CFLAGS = (
"$(inherited)",
"-fobjc-arc-exceptions",
);
OTHER_LDFLAGS = (
"-all_load",
"-ObjC",
@ -9034,6 +9065,7 @@
"$(inherited)",
"$(SRCROOT)",
);
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
GCC_GENERATE_TEST_COVERAGE_FILES = NO;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
@ -9063,6 +9095,10 @@
"$(inherited)",
"$(SRCROOT)",
);
OTHER_CFLAGS = (
"$(inherited)",
"-fobjc-arc-exceptions",
);
OTHER_LDFLAGS = (
"-all_load",
"-ObjC",

View File

@ -794,8 +794,8 @@ void uncaughtExceptionHandler(NSException *exception)
* create a document for your app to open using a URL.
*/
- (BOOL)application:(UIApplication *)application
continueUserActivity:(nonnull NSUserActivity *)userActivity
restorationHandler:(nonnull void (^)(NSArray *_Nullable))restorationHandler
continueUserActivity:(NSUserActivity *)userActivity
restorationHandler:(void (^)(NSArray<id<UIUserActivityRestoring>> *_Nullable))restorationHandler
{
OWSAssertIsOnMainThread();

View File

@ -26,10 +26,12 @@ NSString *const OWSQueryItemNameEncodedPublicKeyKey = @"pub_key";
_ephemeralDeviceId = queryItem.value;
} else if ([queryItem.name isEqualToString:OWSQueryItemNameEncodedPublicKeyKey]) {
NSString *encodedPublicKey = queryItem.value;
@try {
_publicKey = [[NSData dataFromBase64String:encodedPublicKey] throws_removeKeyType];
} @catch (NSException *exception) {
OWSFailDebug(@"exception: %@", exception);
NSData *annotatedKey = [NSData dataFromBase64String:encodedPublicKey];
NSError *_Nullable error = nil;
_publicKey = [annotatedKey removeKeyTypeAndReturnError:&error];
if (error) {
OWSFailDebug(@"failed to strip key type: %@", error);
}
} else {
OWSLogWarn(@"Unknown query item in provisioning string: %@", queryItem.name);

View File

@ -241,15 +241,15 @@ final class ContactSupportViewController: OWSTableViewController2 {
}.done(on: .main) { _ in
self.navigationController?.presentingViewController?.dismiss(animated: true, completion: nil)
}.ensure(on: .main) {
self.currentEmailComposeOperation = nil
self.showSpinnerOnNextButton = false
}.catch(on: .main) { error in
let alertTitle = error.userErrorDescription
let alertMessage = NSLocalizedString("SUPPORT_EMAIL_ERROR_ALERT_DESCRIPTION",
comment: "Message for alert dialog presented when a support email failed to send")
OWSActionSheets.showActionSheet(title: alertTitle, message: alertMessage)
}.ensure(on: .main) {
self.currentEmailComposeOperation = nil
self.showSpinnerOnNextButton = false
}
}
}

View File

@ -197,11 +197,8 @@ public class CVColorOrGradientView: ManualLayoutViewWithLayer {
// coordinate space with lower-left origin. But the
// observed behavior is that they use an upper-left origin.
// I can't figure out why.
if false {
return CGPoint(x: point.x, y: (1 - point.y))
} else {
return point
}
// return CGPoint(x: point.x, y: (1 - point.y))
return point
}
// Control points within the local CALayer viewport.
// Expressed as unit values with lower-left origin.

View File

@ -95,7 +95,7 @@ public protocol CVComponentDelegate {
typealias EndCellAnimation = () -> Void
func cvc_beginCellAnimation(maximumDuration: TimeInterval) -> EndCellAnimation
var view: UIView { get }
var view: UIView! { get }
var isConversationPreview: Bool { get }

View File

@ -195,7 +195,7 @@ extension CVItemViewModelImpl {
}
}
func shareMediaAction(sender: Any) {
func shareMediaAction(sender: Any?) {
guard !isViewOnce else {
return
}

View File

@ -97,7 +97,7 @@ struct CVLoadRequest {
function: String = #function,
line: Int = #line) {
if CVLoader.verboseLogging {
var logString = "\(label)[\(requestId)]. duration: \(loadStartDateFormatted), schedule delay: \(loadScheduleDelayIntervalFormatted)"
let logString = "\(label)[\(requestId)]. duration: \(loadStartDateFormatted), schedule delay: \(loadScheduleDelayIntervalFormatted)"
Logger.info(logString, file: file, function: function, line: line)
}
}

View File

@ -550,9 +550,6 @@ public enum CVPresentationStatus: UInt, CustomStringConvertible {
return ".firstViewDidAppearHasBegun"
case .firstViewDidAppearHasCompleted:
return ".firstViewDidAppearHasCompleted"
@unknown default:
owsFailDebug("unexpected value: \(self.rawValue)")
return "Unknown"
}
}
}

View File

@ -21,17 +21,4 @@ NS_ASSUME_NONNULL_BEGIN
@end
#pragma mark -
typedef void (^ObjCTryBlock)(void);
typedef void (^ObjCTryFailureBlock)(void);
#pragma mark -
@interface ObjCTry : NSObject
+ (void)perform:(ObjCTryBlock)tryBlock failureBlock:(ObjCTryFailureBlock)failureBlock label:(NSString *)label;
@end
NS_ASSUME_NONNULL_END

View File

@ -119,29 +119,4 @@ NS_ASSUME_NONNULL_BEGIN
@end
#pragma mark -
@implementation ObjCTry
+ (void)perform:(ObjCTryBlock)tryBlock failureBlock:(ObjCTryFailureBlock)failureBlock label:(NSString *)label
{
@try {
tryBlock();
} @catch (NSException *exception) {
OWSLogError(@"Exception: %@.", label);
OWSLogError(@"Exception stack: %@.", exception.callStackSymbols);
OWSFailDebug(@"Exception: %@ of type: %@ with reason: %@, user info: %@.",
exception.description,
exception.name,
exception.reason,
exception.userInfo);
failureBlock();
@throw exception;
}
}
@end
NS_ASSUME_NONNULL_END

View File

@ -3,100 +3,66 @@
//
import Foundation
import SignalCoreKit
public extension ConversationCollectionView {
typealias CVCPerformBatchUpdatesBlock = () -> Void
typealias CVCPerformBatchUpdatesCompletion = (Bool) -> Void
typealias CVCPerformBatchUpdatesFailure = () -> Void
func cvc_reloadData(animated: Bool, cvc: ConversationViewController) {
AssertIsOnMainThread()
ObjCTry.perform({
cvc.layout.willReloadData()
if animated {
cvc.layout.willReloadData()
if animated {
super.reloadData()
} else {
UIView.performWithoutAnimation {
super.reloadData()
} else {
UIView.performWithoutAnimation {
super.reloadData()
}
}
cvc.layout.invalidateLayout()
cvc.layout.didReloadData()
}, failureBlock: {
Logger.warn("Render state: \(cvc.currentRenderStateDebugDescription)")
})
}
cvc.layout.invalidateLayout()
cvc.layout.didReloadData()
}
func cvc_performBatchUpdates(_ batchUpdates: @escaping CVCPerformBatchUpdatesBlock,
completion: @escaping CVCPerformBatchUpdatesCompletion,
failure: @escaping CVCPerformBatchUpdatesFailure,
animated: Bool,
scrollContinuity: ScrollContinuity,
lastKnownDistanceFromBottom: CGFloat?,
cvc: ConversationViewController) {
AssertIsOnMainThread()
let tryFailure: ObjCTryFailureBlock = {
Logger.warn("Render state: \(cvc.currentRenderStateDebugDescription)")
failure()
}
let updateBlock = {
ObjCTry.perform({
let layout = cvc.layout
layout.willPerformBatchUpdates(scrollContinuity: scrollContinuity,
lastKnownDistanceFromBottom: lastKnownDistanceFromBottom)
super.performBatchUpdates(batchUpdates) { (finished: Bool) in
AssertIsOnMainThread()
let layout = cvc.layout
layout.willPerformBatchUpdates(scrollContinuity: scrollContinuity,
lastKnownDistanceFromBottom: lastKnownDistanceFromBottom)
super.performBatchUpdates(batchUpdates) { (finished: Bool) in
AssertIsOnMainThread()
ObjCTry.perform({
layout.didCompleteBatchUpdates()
completion(finished)
}, failureBlock: tryFailure)
}
layout.didPerformBatchUpdates()
}, failureBlock: tryFailure)
layout.didCompleteBatchUpdates()
completion(finished)
}
layout.didPerformBatchUpdates()
}
ObjCTry.perform({
if animated {
updateBlock()
} else {
// HACK: We use `UIView.animateWithDuration:0` rather than `UIView.performWithAnimation` to work around a
// UIKit Crash like:
//
// *** Assertion failure in -[ConversationViewLayout prepareForCollectionViewUpdates:],
// /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit_Sim/UIKit-3600.7.47/UICollectionViewLayout.m:760
// *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'While
// preparing update a visible view at <NSIndexPath: 0xc000000011c00016> {length = 2, path = 0 - 142}
// wasn't found in the current data model and was not in an update animation. This is an internal
// error.'
//
// I'm unclear if this is a bug in UIKit, or if we're doing something crazy in
// ConversationViewLayout#prepareLayout. To reproduce, rapidily insert and delete items into the
// conversation. See `DebugUIMessages#thrashCellsInThread:`
UIView.animate(withDuration: 0, animations: updateBlock)
}
}, failureBlock: tryFailure)
}
}
// MARK: -
extension ObjCTry {
public static func perform(_ tryBlock: @escaping ObjCTryBlock,
failureBlock: @escaping ObjCTryFailureBlock,
file: String = #file,
function: String = #function,
line: Int = #line) {
let filename = (file as NSString).lastPathComponent
// We format the filename & line number in a format compatible
// with XCode's "Open Quickly..." feature.
let label = "[\(filename):\(line) \(function)]"
self.perform(tryBlock, failureBlock: failureBlock, label: label)
if animated {
updateBlock()
} else {
// HACK: We use `UIView.animateWithDuration:0` rather than `UIView.performWithAnimation` to work around a
// UIKit Crash like:
//
// *** Assertion failure in -[ConversationViewLayout prepareForCollectionViewUpdates:],
// /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit_Sim/UIKit-3600.7.47/UICollectionViewLayout.m:760
// *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'While
// preparing update a visible view at <NSIndexPath: 0xc000000011c00016> {length = 2, path = 0 - 142}
// wasn't found in the current data model and was not in an update animation. This is an internal
// error.'
//
// I'm unclear if this is a bug in UIKit, or if we're doing something crazy in
// ConversationViewLayout#prepareLayout. To reproduce, rapidily insert and delete items into the
// conversation. See `DebugUIMessages#thrashCellsInThread:`
UIView.animate(withDuration: 0, animations: updateBlock)
}
}
}

View File

@ -640,19 +640,9 @@ extension ConversationViewController: CVLoadCoordinatorDelegate {
}
}
let logFailureBlock = {
for item in items {
Logger.warn("item: \(item.logSafeDescription)")
}
Logger.warn("Layout: \(self.layout.debugDescription)")
Logger.warn("prevRenderState: \(update.prevRenderState.debugDescription)")
Logger.warn("renderState: \(update.renderState.debugDescription)")
}
// We use an obj-c free function so that we can handle NSException.
self.collectionView.cvc_performBatchUpdates(batchUpdatesBlock,
completion: completion,
failure: logFailureBlock,
animated: shouldAnimateUpdate,
scrollContinuity: scrollContinuity,
lastKnownDistanceFromBottom: updateToken.lastKnownDistanceFromBottom,

View File

@ -319,19 +319,6 @@ extension ConversationViewController: ConversationSearchControllerDelegate {
// MARK: -
extension ConversationViewController: UIDocumentMenuDelegate {
public func documentMenu(_ documentMenu: UIDocumentMenuViewController,
didPickDocumentPicker documentPicker: UIDocumentPickerViewController) {
AssertIsOnMainThread()
documentPicker.delegate = self
dismissKeyBoard()
presentFormSheet(documentPicker, animated: true)
}
}
// MARK: -
extension ConversationViewController: InputAccessoryViewPlaceholderDelegate {
public func inputAccessoryPlaceholderKeyboardIsPresenting(animationDuration: TimeInterval,
animationCurve: UIView.AnimationCurve) {

View File

@ -265,21 +265,29 @@ public extension DebugUIScreenshots {
comment: "This is for a group of people interested in discussing books they've read."),
avatarData: buildAvatarData(bundleFilename: "address-group-book.jpg"),
transaction: transaction)
let timestampMessage1 = startingDateMS - (3 * kDayInMs + 4 * kHourInMs)
let message1 = self.buildOutgoingMessage(thread: thread, messageBody: NSLocalizedString("SCREENSHOT_THREAD_GROUP_ONE_MESSAGE_ONE",
comment: "This is for a message in the 'Book Club' group chat"),
timestamp: timestampMessage1, transaction: transaction)
let timestampMessage2 = startingDateMS - (3 * kDayInMs + 4 * kMinuteInMs)
let attachmentMessage2 = buildAttachment(bundleFilename: "1984.txt",
mimeType: "text/plain",
sourceFilename: NSLocalizedString("SCREENSHOT_THREAD_GROUP_ONE_FILE_NAME",
comment: "1984 is the book title. The file extension is a text file."),
transaction: transaction)
let message2 = self.buildOutgoingMessage(thread: thread,
messageBody: nil,
timestamp: timestampMessage2,
attachments: [attachmentMessage2],
transaction: transaction)
buildOutgoingMessage(
thread: thread,
messageBody: NSLocalizedString(
"SCREENSHOT_THREAD_GROUP_ONE_MESSAGE_ONE",
comment: "This is for a message in the 'Book Club' group chat"),
timestamp: startingDateMS - (3 * kDayInMs + 4 * kHourInMs),
transaction: transaction)
let attachmentMessage2 = buildAttachment(
bundleFilename: "1984.txt",
mimeType: "text/plain",
sourceFilename: NSLocalizedString(
"SCREENSHOT_THREAD_GROUP_ONE_FILE_NAME",
comment: "1984 is the book title. The file extension is a text file."),
transaction: transaction)
buildOutgoingMessage(
thread: thread,
messageBody: nil,
timestamp: startingDateMS - (3 * kDayInMs + 4 * kMinuteInMs),
attachments: [attachmentMessage2],
transaction: transaction)
}
// Group incoming attachment + caption
@ -295,21 +303,30 @@ public extension DebugUIScreenshots {
comment: "This is for a group chat for people who want weather updates."),
avatarData: buildAvatarData(bundleFilename: "nature-2-trees.JPG"),
transaction: transaction)
let timestampMessage1 = startingDateMS - (2 * kDayInMs + 8 * kHourInMs)
let message1 = self.buildOutgoingMessage(thread: thread, messageBody: NSLocalizedString("SCREENSHOT_THREAD_GROUP_TWO_MESSAGE_ONE",
comment: "This is a message. Please include the emoji if possible."),
timestamp: timestampMessage1, transaction: transaction)
let timestampMessage2 = startingDateMS - (2 * kDayInMs + 8 * kHourInMs + 1 * kMinuteInMs)
let attachmentMessage2 = buildAttachment(bundleFilename: "test-jpg-2.JPG",
mimeType: OWSMimeTypeImageJpeg,
transaction: transaction)
let message2 = self.buildIncomingMessage(thread: thread,
authorAddress: address9,
messageBody: NSLocalizedString("SCREENSHOT_THREAD_GROUP_TWO_MESSAGE_TWO",
comment: "This is a message sent with an attachment."),
timestamp: timestampMessage2,
attachments: [attachmentMessage2],
transaction: transaction)
buildOutgoingMessage(
thread: thread,
messageBody: NSLocalizedString(
"SCREENSHOT_THREAD_GROUP_TWO_MESSAGE_ONE",
comment: "This is a message. Please include the emoji if possible."),
timestamp: startingDateMS - (2 * kDayInMs + 8 * kHourInMs),
transaction: transaction)
let attachmentMessage2 = buildAttachment(
bundleFilename: "test-jpg-2.JPG",
mimeType: OWSMimeTypeImageJpeg,
transaction: transaction)
let message2 = buildIncomingMessage(
thread: thread,
authorAddress: address9,
messageBody: NSLocalizedString(
"SCREENSHOT_THREAD_GROUP_TWO_MESSAGE_TWO",
comment: "This is a message sent with an attachment."),
timestamp: startingDateMS - (2 * kDayInMs + 8 * kHourInMs + 1 * kMinuteInMs),
attachments: [attachmentMessage2],
transaction: transaction)
message2.debugonly_markAsReadNow(transaction: transaction)
}
@ -368,20 +385,27 @@ public extension DebugUIScreenshots {
comment: "Please include emoji. This is a group name/channel name for pictures of the sun in the sky."),
avatarData: buildAvatarData(bundleFilename: "nature-4-sunset.jpg"),
transaction: transaction)
let timestampMessage1 = startingDateMS - (1 * kDayInMs + 18 * kHourInMs)
let message1 = self.buildOutgoingMessage(thread: thread, messageBody: NSLocalizedString("SCREENSHOT_THREAD_GROUP_FOUR_MESSAGE_ONE",
comment: "This is a message in the Sunsets group chat."),
timestamp: timestampMessage1, transaction: transaction)
let timestampMessage2 = startingDateMS - (1 * kDayInMs + 18 * kHourInMs + 10 * kMinuteInMs)
let attachmentMessage2 = buildAttachment(bundleFilename: "nature-3-road.JPG",
mimeType: OWSMimeTypeImageJpeg,
transaction: transaction)
let message2 = self.buildOutgoingMessage(thread: thread,
messageBody: nil,
timestamp: timestampMessage2,
attachments: [attachmentMessage2],
isViewOnceMessage: true,
transaction: transaction)
buildOutgoingMessage(
thread: thread,
messageBody: NSLocalizedString(
"SCREENSHOT_THREAD_GROUP_FOUR_MESSAGE_ONE",
comment: "This is a message in the Sunsets group chat."),
timestamp: startingDateMS - (1 * kDayInMs + 18 * kHourInMs),
transaction: transaction)
let attachmentMessage2 = buildAttachment(
bundleFilename: "nature-3-road.JPG",
mimeType: OWSMimeTypeImageJpeg,
transaction: transaction)
buildOutgoingMessage(
thread: thread,
messageBody: nil,
timestamp: startingDateMS - (1 * kDayInMs + 18 * kHourInMs + 10 * kMinuteInMs),
attachments: [attachmentMessage2],
isViewOnceMessage: true,
transaction: transaction)
}
// Example of how to make a simple 1:1 thread.
@ -393,15 +417,22 @@ public extension DebugUIScreenshots {
let attachmentMessage1 = buildAttachment(bundleFilename: "test-jpg-3.JPG",
mimeType: OWSMimeTypeImageJpeg,
transaction: transaction)
let message1 = self.buildOutgoingMessage(thread: thread,
messageBody: nil,
timestamp: timestampMessage1,
attachments: [attachmentMessage1], transaction: transaction)
let timestampMessage2 = startingDateMS - (8 * kHourInMs + 27 * kMinuteInMs)
let message2 = self.buildOutgoingMessage(thread: thread,
messageBody: NSLocalizedString("SCREENSHOT_THREAD_DIRECT_FIVE_MESSAGE_ONE",
comment: "This is a message expressing support/happiness/awe/shock."),
timestamp: timestampMessage2, transaction: transaction)
buildOutgoingMessage(
thread: thread,
messageBody: nil,
timestamp: timestampMessage1,
attachments: [attachmentMessage1],
transaction: transaction)
buildOutgoingMessage(
thread: thread,
messageBody: NSLocalizedString(
"SCREENSHOT_THREAD_DIRECT_FIVE_MESSAGE_ONE",
comment: "This is a message expressing support/happiness/awe/shock."),
timestamp: startingDateMS - (8 * kHourInMs + 27 * kMinuteInMs),
transaction: transaction)
GroupManager.remoteUpdateDisappearingMessages(withContactOrV1GroupThread: thread,
disappearingMessageToken: DisappearingMessageToken(isEnabled: true, durationSeconds: UInt32(24 * kHourInterval)),
groupUpdateSourceAddress: localAddress,
@ -483,15 +514,21 @@ public extension DebugUIScreenshots {
avatarData: buildAvatarData(bundleFilename: "address-group-family.jpg"),
// avatarData: nil,
transaction: transaction)
let message1 = self.buildOutgoingMessage(thread: thread, messageBody: NSLocalizedString("SCREENSHOT_THREAD_GROUP_FIVE_MESSAGE_ONE",
comment: "This is a message in the group chat of family members."),
transaction: transaction)
let timestampMessage2 = startingDateMS - (1 * kHourInMs + 58 * kMinuteInMs)
let message2 = self.buildIncomingMessage(thread: thread,
authorAddress: address6,
messageBody: NSLocalizedString("SCREENSHOT_THREAD_GROUP_FIVE_MESSAGE_TWO",
comment: "This is a message in the group chat of family members."),
timestamp: timestampMessage2, transaction: transaction)
buildOutgoingMessage(
thread: thread,
messageBody: NSLocalizedString(
"SCREENSHOT_THREAD_GROUP_FIVE_MESSAGE_ONE",
comment: "This is a message in the group chat of family members."),
transaction: transaction)
buildIncomingMessage(
thread: thread,
authorAddress: address6,
messageBody: NSLocalizedString(
"SCREENSHOT_THREAD_GROUP_FIVE_MESSAGE_TWO",
comment: "This is a message in the group chat of family members."),
timestamp: startingDateMS - (1 * kHourInMs + 58 * kMinuteInMs),
transaction: transaction)
}
// 1:1 sent media
@ -508,10 +545,11 @@ public extension DebugUIScreenshots {
let attachmentMessage2 = buildAttachment(bundleFilename: "test-jpg-3.JPG",
mimeType: OWSMimeTypeImageJpeg,
transaction: transaction)
let message2 = self.buildOutgoingMessage(thread: thread,
messageBody: nil,
timestamp: timestampMessage2,
attachments: [attachmentMessage2], transaction: transaction)
buildOutgoingMessage(
thread: thread,
messageBody: nil,
timestamp: timestampMessage2,
attachments: [attachmentMessage2], transaction: transaction)
}
// Group other file types -- in focus
@ -525,12 +563,12 @@ public extension DebugUIScreenshots {
// You can find files in the repo using something like this...
// find . | grep -i "test-jpg"
// ...where test-jpg is a partial file name.
let attachment1 = buildAttachment(bundleFilename: "test-jpg-2.JPG",
mimeType: OWSMimeTypeImageJpeg,
transaction: transaction)
let attachment2 = buildAttachment(bundleFilename: "test-jpg-2.JPG",
mimeType: OWSMimeTypeImageJpeg,
transaction: transaction)
buildAttachment(bundleFilename: "test-jpg-2.JPG",
mimeType: OWSMimeTypeImageJpeg,
transaction: transaction)
buildAttachment(bundleFilename: "test-jpg-2.JPG",
mimeType: OWSMimeTypeImageJpeg,
transaction: transaction)
let memberAddresses = [
address1,
@ -617,13 +655,12 @@ public extension DebugUIScreenshots {
let attachmentMessage7 = buildAttachment(bundleFilename: "test-jpg-3.JPG",
mimeType: OWSMimeTypeImageJpeg,
transaction: transaction)
let timestampMessage7 = startingDateMS - (9 * kMinuteInMs)
let message7 = self.buildOutgoingMessage(thread: thread,
messageBody: nil,
timestamp: timestampMessage7,
attachments: [attachmentMessage7],
isViewOnceMessage: true,
transaction: transaction)
buildOutgoingMessage(thread: thread,
messageBody: nil,
timestamp: startingDateMS - (9 * kMinuteInMs),
attachments: [attachmentMessage7],
isViewOnceMessage: true,
transaction: transaction)
let attachmentMessage8 = buildAttachment(bundleFilename: "certificate.PDF",
mimeType: "application/pdf",
sourceFilename: NSLocalizedString("SCREENSHOT_THREAD_GROUP_SIX_FILE_NAME", comment: "This is a file name 'Instructions' for the cat chat group."),
@ -645,37 +682,40 @@ public extension DebugUIScreenshots {
// you can fix that by saying:
// _ = self.buildOutgoingMessage(...)
let timestampMessage7 = startingDateMS - (4 * kMinuteInMs)
let message1 = self.buildIncomingMessage(thread: thread, authorAddress: otherAddress, messageBody: "1", timestamp: timestampMessage7, transaction: transaction)
let message2 = self.buildIncomingMessage(thread: thread, authorAddress: otherAddress, messageBody: "2", timestamp: timestampMessage7, transaction: transaction)
let message3 = self.buildIncomingMessage(thread: thread, authorAddress: otherAddress, messageBody: "3", timestamp: timestampMessage7, transaction: transaction)
let message4 = self.buildIncomingMessage(thread: thread, authorAddress: otherAddress, messageBody: "4.", timestamp: timestampMessage7, transaction: transaction)
let message5 = self.buildIncomingMessage(thread: thread, authorAddress: otherAddress, messageBody: "5", timestamp: timestampMessage7, transaction: transaction)
let message6 = self.buildIncomingMessage(thread: thread, authorAddress: otherAddress, messageBody: "6", timestamp: timestampMessage7, transaction: transaction)
buildIncomingMessage(thread: thread, authorAddress: otherAddress, messageBody: "1", timestamp: timestampMessage7, transaction: transaction)
buildIncomingMessage(thread: thread, authorAddress: otherAddress, messageBody: "2", timestamp: timestampMessage7, transaction: transaction)
buildIncomingMessage(thread: thread, authorAddress: otherAddress, messageBody: "3", timestamp: timestampMessage7, transaction: transaction)
buildIncomingMessage(thread: thread, authorAddress: otherAddress, messageBody: "4.", timestamp: timestampMessage7, transaction: transaction)
buildIncomingMessage(thread: thread, authorAddress: otherAddress, messageBody: "5", timestamp: timestampMessage7, transaction: transaction)
buildIncomingMessage(thread: thread, authorAddress: otherAddress, messageBody: "6", timestamp: timestampMessage7, transaction: transaction)
let attachmentMessage7 = buildAttachment(bundleFilename: "sonarping.mp3",
mimeType: "audio/mp3",
transaction: transaction)
attachmentMessage7.attachmentType = .voiceMessage
attachmentMessage7.anyOverwritingUpdate(transaction: transaction)
let message7 = self.buildIncomingMessage(thread: thread,
authorAddress: otherAddress,
messageBody: nil,
timestamp: timestampMessage7,
attachments: [attachmentMessage7], transaction: transaction)
buildIncomingMessage(thread: thread, authorAddress: otherAddress, messageBody: nil, timestamp: timestampMessage7, attachments: [attachmentMessage7], transaction: transaction)
}
// Second Thread -- Missed call or emoji on iPad
if true {
let otherAddress = address1
let thread = TSContactThread.getOrCreateThread(withContactAddress: otherAddress, transaction: transaction)
let timestampMessage1 = startingDateMS - (3 * kMinuteInMs)
let message1 = self.buildIncomingMessage(thread: thread, authorAddress: otherAddress,
messageBody: "🤣🤣🤣",
timestamp: timestampMessage1, transaction: transaction)
let timestampMessage2 = startingDateMS - (2 * kMinuteInMs)
let message2 = self.buildIncomingMessage(thread: thread, authorAddress: otherAddress,
messageBody: NSLocalizedString("SCREENSHOT_THREAD_DIRECT_SEVEN_MESSAGE_ONE", comment: "This is a message before a call."),
timestamp: timestampMessage1, transaction: transaction)
let timestampCall1 = startingDateMS
buildIncomingMessage(
thread: thread,
authorAddress: otherAddress,
messageBody: "🤣🤣🤣",
timestamp: startingDateMS - (3 * kMinuteInMs),
transaction: transaction)
buildIncomingMessage(
thread: thread,
authorAddress: otherAddress,
messageBody: NSLocalizedString(
"SCREENSHOT_THREAD_DIRECT_SEVEN_MESSAGE_ONE",
comment: "This is a message before a call."),
timestamp: startingDateMS - (2 * kMinuteInMs),
transaction: transaction)
// Replace .incomingIncomplete with other values to create other record types.
// Note that you have to remove the obj-c enum prefix.
//
@ -1007,6 +1047,7 @@ public extension DebugUIScreenshots {
emails: [])
}
@discardableResult
private class func buildOutgoingMessage(thread: TSThread,
messageBody: String?,
timestamp: UInt64? = nil,
@ -1063,6 +1104,7 @@ public extension DebugUIScreenshots {
return message
}
@discardableResult
private class func buildIncomingMessage(thread: TSThread,
authorAddress: SignalServiceAddress,
messageBody: String?,
@ -1099,6 +1141,7 @@ public extension DebugUIScreenshots {
return try! Data(contentsOf: fileUrl)
}
@discardableResult
private class func buildAttachment(bundleFilename: String,
mimeType: String,
sourceFilename: String? = nil,

View File

@ -49,7 +49,7 @@ NS_ASSUME_NONNULL_BEGIN
NSMutableData *flippedKey = [NSMutableData new];
const char *currentKeyBytes = currentKey.bytes;
for (NSUInteger i = 0; i < currentKey.length; i++) {
const char xorByte = currentKeyBytes[i] ^ 0xff;
const char xorByte = currentKeyBytes[i] ^ (char)0xff;
[flippedKey appendBytes:&xorByte length:1];
}
OWSAssertDebug(flippedKey.length == currentKey.length);

View File

@ -979,6 +979,5 @@ public class HVTableView: UITableView {
@available(*, unavailable, message: "use other constructor instead.")
required init?(coder: NSCoder) {
notImplemented()
fatalError("init(coder:) has not been implemented")
}
}

View File

@ -10,7 +10,7 @@ class MediaDismissAnimationController: NSObject {
var transitionView: UIView?
var fromMediaFrame: CGRect?
var pendingCompletion: (() -> Promise<Void>)?
var pendingCompletion: (() -> Void)?
init(galleryItem: MediaGalleryItem, interactionController: MediaInteractiveDismiss? = nil) {
self.item = .gallery(galleryItem)
@ -149,8 +149,7 @@ extension MediaDismissAnimationController: UIViewControllerAnimatedTransitioning
let duration = transitionDuration(using: transitionContext)
let completion = { () -> Promise<Void> in
let completion = {
let destinationFrame: CGRect
let destinationCornerRadius: CGFloat
if transitionContext.transitionWasCancelled {
@ -168,7 +167,7 @@ extension MediaDismissAnimationController: UIViewControllerAnimatedTransitioning
destinationCornerRadius = fromMediaContext.cornerRadius
}
return UIView.animate(.promise,
UIView.animate(.promise,
duration: duration,
delay: 0.0,
options: [.beginFromCurrentState, .curveEaseInOut]) {
@ -215,15 +214,15 @@ extension MediaDismissAnimationController: UIViewControllerAnimatedTransitioning
options: [.beginFromCurrentState, .curveEaseInOut]) {
fromTransitionalOverlayView?.alpha = 0.0
fromView.alpha = 0.0
}.then { (_: Bool) -> Promise<Void> in
}.done { _ in
guard let pendingCompletion = self.pendingCompletion else {
Logger.verbose("pendingCompletion already ran by the time fadeout completed.")
return Promise.value(())
return
}
Logger.verbose("ran pendingCompletion after fadeout")
self.pendingCompletion = nil
return pendingCompletion()
pendingCompletion()
}
}
}
@ -250,7 +249,7 @@ extension MediaDismissAnimationController: InteractiveDismissDelegate {
if let pendingCompletion = pendingCompletion {
Logger.verbose("interactive gesture started pendingCompletion during fadeout")
self.pendingCompletion = nil
_ = pendingCompletion()
pendingCompletion()
}
}

View File

@ -1072,7 +1072,6 @@ private class AnimationController: NSObject, UIViewControllerAnimatedTransitioni
let bottomView: UIView
let isPushing = operation == .push
let isInteractive = percentDrivenTransition != nil
if isPushing {
topView = fromView

View File

@ -963,7 +963,7 @@ class CaptureOutput: NSObject {
videoInput.expectsMediaDataInRealTime = true
assetWriter.add(videoInput)
let audioSettings: [String: Any]? = self.audioDataOutput.recommendedAudioSettingsForAssetWriter(writingTo: .mp4) as? [String: Any]
let audioSettings: [String: Any]? = self.audioDataOutput.recommendedAudioSettingsForAssetWriter(writingTo: .mp4)
let audioInput = AVAssetWriterInput(mediaType: .audio, outputSettings: audioSettings)
audioInput.expectsMediaDataInRealTime = true
if audioSettings != nil {

View File

@ -743,8 +743,13 @@ public class OnboardingController: NSObject {
self.kbsAuth = nil
if self.hasPendingRestoration {
self.accountManager.performInitialStorageServiceRestore()
.ensure { completion(.success) }
firstly {
self.accountManager.performInitialStorageServiceRestore()
}.recover { error in
Logger.warn("Timed out performing storage service restore: \(error). Ignoring...")
}.done {
completion(.success)
}
} else {
// We've restored our keys, we can now re-run this method to post our registration token

View File

@ -157,17 +157,17 @@ extension DeviceTransferService: MCSessionDelegate {
owsFail("Restore failed. Will try again on next launch. Error: \(error)")
}
firstly(on: .main) { () -> Promise<Void> in
firstly(on: .main) { () -> Guarantee<Void> in
// A successful restoration means we've updated our database path.
// Extensions will learn of this through NSUserDefaults KVO and exit ASAP
self.databaseStorage.reloadDatabase()
}.then(on: .main) { () -> Promise<Void> in
}.then(on: .main) { () -> Guarantee<Void> in
self.finalizeRestorationIfNecessary()
}.done(on: .main) {
// After transfer our push token has changed, update it.
SyncPushTokensJob.run()
SignalApp.shared().showConversationSplitView()
}.cauterize() // TODO: Everything in this promise chain is a guarantee.
}
stopTransfer()
}

View File

@ -354,8 +354,7 @@ extension DeviceTransferService {
success = true
}
if success {
// TODO: This should return a guarantee
finalizeRestorationIfNecessary().cauterize()
finalizeRestorationIfNecessary()
}
return success
}
@ -542,10 +541,11 @@ extension DeviceTransferService {
GRDBDatabaseStorageAdapter.promoteTransferDirectoryToPrimary()
}
func finalizeRestorationIfNecessary() -> Promise<Void> {
@discardableResult
func finalizeRestorationIfNecessary() -> Guarantee<Void> {
resetTransferDirectory()
let (promise, future) = Promise<Void>.pending()
let (promise, future) = Guarantee<Void>.pending()
AppReadiness.runNowOrWhenAppDidBecomeReadySync {
self.tsAccountManager.isTransferInProgress = false

View File

@ -5,7 +5,7 @@
// This file is generated by EmojiGenerator.swift, do not manually edit it.
extension Emoji {
var name: String? {
var name: String {
switch self {
case .grinning: return "GRINNING FACE"
case .smiley: return "SMILING FACE WITH OPEN MOUTH"
@ -1824,7 +1824,6 @@ extension Emoji {
case .flagEngland: return "England Flag"
case .flagScotland: return "Scotland Flag"
case .flagWales: return "Wales Flag"
default: return nil
}
}
}

View File

@ -126,8 +126,6 @@ public class PaymentsProcessor: NSObject {
transaction: transaction)
}
let intervalSinceLaunch = abs(CurrentAppContext().appLaunchTime.timeIntervalSinceNow)
paymentModels.sort { (left, right) -> Bool in
left.sortDate.compare(right.sortDate) == .orderedAscending
}

View File

@ -2,6 +2,8 @@
// Copyright (c) 2021 Open Whisper Systems. All rights reserved.
//
#import <SignalServiceKit/SignalServiceKit-Swift.h>
NS_ASSUME_NONNULL_BEGIN
extern NSString *const OWSSyncManagerConfigurationSyncDidCompleteNotification;

View File

@ -49,7 +49,7 @@ public extension GroupsV2Migration {
// the service.
static func tryToMigrate(groupThread: TSGroupThread,
migrationMode: GroupsV2MigrationMode) -> Promise<TSGroupThread> {
firstly(on: .global()) {
firstly(on: .global()) { () -> Bool in
if migrationMode == .isAlreadyMigratedOnService ||
migrationMode == .possiblyAlreadyMigratedOnService {
return true

View File

@ -486,24 +486,20 @@ public extension OWSDisappearingMessagesConfiguration {
let uniqueIds = anyAllUniqueIds(transaction: transaction)
var index: Int = 0
do {
try Batching.loop(batchSize: Batching.kDefaultBatchSize,
loopBlock: { stop in
guard index < uniqueIds.count else {
stop.pointee = true
return
}
let uniqueId = uniqueIds[index]
index = index + 1
guard let instance = anyFetch(uniqueId: uniqueId, transaction: transaction) else {
owsFailDebug("Missing instance.")
return
}
instance.anyRemove(transaction: transaction)
})
} catch {
owsFailDebug("Error: \(error)")
}
Batching.loop(batchSize: Batching.kDefaultBatchSize,
loopBlock: { stop in
guard index < uniqueIds.count else {
stop.pointee = true
return
}
let uniqueId = uniqueIds[index]
index = index + 1
guard let instance = anyFetch(uniqueId: uniqueId, transaction: transaction) else {
owsFailDebug("Missing instance.")
return
}
instance.anyRemove(transaction: transaction)
})
if shouldBeIndexedForFTS {
FullTextSearchFinder.allModelsWereRemoved(collection: collection(), transaction: transaction)

View File

@ -537,24 +537,20 @@ public extension SignalAccount {
let uniqueIds = anyAllUniqueIds(transaction: transaction)
var index: Int = 0
do {
try Batching.loop(batchSize: Batching.kDefaultBatchSize,
loopBlock: { stop in
guard index < uniqueIds.count else {
stop.pointee = true
return
}
let uniqueId = uniqueIds[index]
index = index + 1
guard let instance = anyFetch(uniqueId: uniqueId, transaction: transaction) else {
owsFailDebug("Missing instance.")
return
}
instance.anyRemove(transaction: transaction)
})
} catch {
owsFailDebug("Error: \(error)")
}
Batching.loop(batchSize: Batching.kDefaultBatchSize,
loopBlock: { stop in
guard index < uniqueIds.count else {
stop.pointee = true
return
}
let uniqueId = uniqueIds[index]
index = index + 1
guard let instance = anyFetch(uniqueId: uniqueId, transaction: transaction) else {
owsFailDebug("Missing instance.")
return
}
instance.anyRemove(transaction: transaction)
})
if shouldBeIndexedForFTS {
FullTextSearchFinder.allModelsWereRemoved(collection: collection(), transaction: transaction)

View File

@ -500,24 +500,20 @@ public extension SignalRecipient {
let uniqueIds = anyAllUniqueIds(transaction: transaction)
var index: Int = 0
do {
try Batching.loop(batchSize: Batching.kDefaultBatchSize,
loopBlock: { stop in
guard index < uniqueIds.count else {
stop.pointee = true
return
}
let uniqueId = uniqueIds[index]
index = index + 1
guard let instance = anyFetch(uniqueId: uniqueId, transaction: transaction) else {
owsFailDebug("Missing instance.")
return
}
instance.anyRemove(transaction: transaction)
})
} catch {
owsFailDebug("Error: \(error)")
}
Batching.loop(batchSize: Batching.kDefaultBatchSize,
loopBlock: { stop in
guard index < uniqueIds.count else {
stop.pointee = true
return
}
let uniqueId = uniqueIds[index]
index = index + 1
guard let instance = anyFetch(uniqueId: uniqueId, transaction: transaction) else {
owsFailDebug("Missing instance.")
return
}
instance.anyRemove(transaction: transaction)
})
if shouldBeIndexedForFTS {
FullTextSearchFinder.allModelsWereRemoved(collection: collection(), transaction: transaction)

View File

@ -504,24 +504,20 @@ public extension TSGroupMember {
let uniqueIds = anyAllUniqueIds(transaction: transaction)
var index: Int = 0
do {
try Batching.loop(batchSize: Batching.kDefaultBatchSize,
loopBlock: { stop in
guard index < uniqueIds.count else {
stop.pointee = true
return
}
let uniqueId = uniqueIds[index]
index = index + 1
guard let instance = anyFetch(uniqueId: uniqueId, transaction: transaction) else {
owsFailDebug("Missing instance.")
return
}
instance.anyRemove(transaction: transaction)
})
} catch {
owsFailDebug("Error: \(error)")
}
Batching.loop(batchSize: Batching.kDefaultBatchSize,
loopBlock: { stop in
guard index < uniqueIds.count else {
stop.pointee = true
return
}
let uniqueId = uniqueIds[index]
index = index + 1
guard let instance = anyFetch(uniqueId: uniqueId, transaction: transaction) else {
owsFailDebug("Missing instance.")
return
}
instance.anyRemove(transaction: transaction)
})
if shouldBeIndexedForFTS {
FullTextSearchFinder.allModelsWereRemoved(collection: collection(), transaction: transaction)

View File

@ -825,24 +825,20 @@ public extension TSThread {
let uniqueIds = anyAllUniqueIds(transaction: transaction)
var index: Int = 0
do {
try Batching.loop(batchSize: Batching.kDefaultBatchSize,
loopBlock: { stop in
guard index < uniqueIds.count else {
stop.pointee = true
return
}
let uniqueId = uniqueIds[index]
index = index + 1
guard let instance = anyFetch(uniqueId: uniqueId, transaction: transaction) else {
owsFailDebug("Missing instance.")
return
}
instance.anyRemove(transaction: transaction)
})
} catch {
owsFailDebug("Error: \(error)")
}
Batching.loop(batchSize: Batching.kDefaultBatchSize,
loopBlock: { stop in
guard index < uniqueIds.count else {
stop.pointee = true
return
}
let uniqueId = uniqueIds[index]
index = index + 1
guard let instance = anyFetch(uniqueId: uniqueId, transaction: transaction) else {
owsFailDebug("Missing instance.")
return
}
instance.anyRemove(transaction: transaction)
})
if shouldBeIndexedForFTS {
FullTextSearchFinder.allModelsWereRemoved(collection: collection(), transaction: transaction)

View File

@ -506,24 +506,20 @@ public extension OWSDevice {
let uniqueIds = anyAllUniqueIds(transaction: transaction)
var index: Int = 0
do {
try Batching.loop(batchSize: Batching.kDefaultBatchSize,
loopBlock: { stop in
guard index < uniqueIds.count else {
stop.pointee = true
return
}
let uniqueId = uniqueIds[index]
index = index + 1
guard let instance = anyFetch(uniqueId: uniqueId, transaction: transaction) else {
owsFailDebug("Missing instance.")
return
}
instance.anyRemove(transaction: transaction)
})
} catch {
owsFailDebug("Error: \(error)")
}
Batching.loop(batchSize: Batching.kDefaultBatchSize,
loopBlock: { stop in
guard index < uniqueIds.count else {
stop.pointee = true
return
}
let uniqueId = uniqueIds[index]
index = index + 1
guard let instance = anyFetch(uniqueId: uniqueId, transaction: transaction) else {
owsFailDebug("Missing instance.")
return
}
instance.anyRemove(transaction: transaction)
})
if shouldBeIndexedForFTS {
FullTextSearchFinder.allModelsWereRemoved(collection: collection(), transaction: transaction)

View File

@ -862,24 +862,20 @@ public extension TSAttachment {
let uniqueIds = anyAllUniqueIds(transaction: transaction)
var index: Int = 0
do {
try Batching.loop(batchSize: Batching.kDefaultBatchSize,
loopBlock: { stop in
guard index < uniqueIds.count else {
stop.pointee = true
return
}
let uniqueId = uniqueIds[index]
index = index + 1
guard let instance = anyFetch(uniqueId: uniqueId, transaction: transaction) else {
owsFailDebug("Missing instance.")
return
}
instance.anyRemove(transaction: transaction)
})
} catch {
owsFailDebug("Error: \(error)")
}
Batching.loop(batchSize: Batching.kDefaultBatchSize,
loopBlock: { stop in
guard index < uniqueIds.count else {
stop.pointee = true
return
}
let uniqueId = uniqueIds[index]
index = index + 1
guard let instance = anyFetch(uniqueId: uniqueId, transaction: transaction) else {
owsFailDebug("Missing instance.")
return
}
instance.anyRemove(transaction: transaction)
})
if shouldBeIndexedForFTS {
FullTextSearchFinder.allModelsWereRemoved(collection: collection(), transaction: transaction)

View File

@ -4361,24 +4361,20 @@ public extension TSInteraction {
let uniqueIds = anyAllUniqueIds(transaction: transaction)
var index: Int = 0
do {
try Batching.loop(batchSize: Batching.kDefaultBatchSize,
loopBlock: { stop in
guard index < uniqueIds.count else {
stop.pointee = true
return
}
let uniqueId = uniqueIds[index]
index = index + 1
guard let instance = anyFetch(uniqueId: uniqueId, transaction: transaction) else {
owsFailDebug("Missing instance.")
return
}
instance.anyRemove(transaction: transaction)
})
} catch {
owsFailDebug("Error: \(error)")
}
Batching.loop(batchSize: Batching.kDefaultBatchSize,
loopBlock: { stop in
guard index < uniqueIds.count else {
stop.pointee = true
return
}
let uniqueId = uniqueIds[index]
index = index + 1
guard let instance = anyFetch(uniqueId: uniqueId, transaction: transaction) else {
owsFailDebug("Missing instance.")
return
}
instance.anyRemove(transaction: transaction)
})
if shouldBeIndexedForFTS {
FullTextSearchFinder.allModelsWereRemoved(collection: collection(), transaction: transaction)

View File

@ -505,24 +505,20 @@ public extension TSMention {
let uniqueIds = anyAllUniqueIds(transaction: transaction)
var index: Int = 0
do {
try Batching.loop(batchSize: Batching.kDefaultBatchSize,
loopBlock: { stop in
guard index < uniqueIds.count else {
stop.pointee = true
return
}
let uniqueId = uniqueIds[index]
index = index + 1
guard let instance = anyFetch(uniqueId: uniqueId, transaction: transaction) else {
owsFailDebug("Missing instance.")
return
}
instance.anyRemove(transaction: transaction)
})
} catch {
owsFailDebug("Error: \(error)")
}
Batching.loop(batchSize: Batching.kDefaultBatchSize,
loopBlock: { stop in
guard index < uniqueIds.count else {
stop.pointee = true
return
}
let uniqueId = uniqueIds[index]
index = index + 1
guard let instance = anyFetch(uniqueId: uniqueId, transaction: transaction) else {
owsFailDebug("Missing instance.")
return
}
instance.anyRemove(transaction: transaction)
})
if shouldBeIndexedForFTS {
FullTextSearchFinder.allModelsWereRemoved(collection: collection(), transaction: transaction)

View File

@ -42,7 +42,6 @@
#import "TSThread.h"
#import <SignalCoreKit/NSData+OWS.h>
#import <SignalCoreKit/NSDate+OWS.h>
#import <SignalCoreKit/SCKExceptionWrapper.h>
#import <SignalCoreKit/Threading.h>
#import <SignalMetadataKit/NSData+messagePadding.h>
#import <SignalMetadataKit/SignalMetadataKit-Swift.h>

View File

@ -227,7 +227,7 @@ void AssertIsOnDisappearingMessagesQueue()
dispatch_once(&onceToken, ^{
dateFormatter = [NSDateFormatter new];
dateFormatter.dateStyle = NSDateFormatterNoStyle;
dateFormatter.timeStyle = kCFDateFormatterMediumStyle;
dateFormatter.timeStyle = NSDateFormatterMediumStyle;
dateFormatter.locale = [NSLocale systemLocale];
});

View File

@ -514,24 +514,20 @@ public extension OWSMessageContentJob {
let uniqueIds = anyAllUniqueIds(transaction: transaction)
var index: Int = 0
do {
try Batching.loop(batchSize: Batching.kDefaultBatchSize,
loopBlock: { stop in
guard index < uniqueIds.count else {
stop.pointee = true
return
}
let uniqueId = uniqueIds[index]
index = index + 1
guard let instance = anyFetch(uniqueId: uniqueId, transaction: transaction) else {
owsFailDebug("Missing instance.")
return
}
instance.anyRemove(transaction: transaction)
})
} catch {
owsFailDebug("Error: \(error)")
}
Batching.loop(batchSize: Batching.kDefaultBatchSize,
loopBlock: { stop in
guard index < uniqueIds.count else {
stop.pointee = true
return
}
let uniqueId = uniqueIds[index]
index = index + 1
guard let instance = anyFetch(uniqueId: uniqueId, transaction: transaction) else {
owsFailDebug("Missing instance.")
return
}
instance.anyRemove(transaction: transaction)
})
if shouldBeIndexedForFTS {
FullTextSearchFinder.allModelsWereRemoved(collection: collection(), transaction: transaction)

View File

@ -496,24 +496,20 @@ public extension OWSMessageDecryptJob {
let uniqueIds = anyAllUniqueIds(transaction: transaction)
var index: Int = 0
do {
try Batching.loop(batchSize: Batching.kDefaultBatchSize,
loopBlock: { stop in
guard index < uniqueIds.count else {
stop.pointee = true
return
}
let uniqueId = uniqueIds[index]
index = index + 1
guard let instance = anyFetch(uniqueId: uniqueId, transaction: transaction) else {
owsFailDebug("Missing instance.")
return
}
instance.anyRemove(transaction: transaction)
})
} catch {
owsFailDebug("Error: \(error)")
}
Batching.loop(batchSize: Batching.kDefaultBatchSize,
loopBlock: { stop in
guard index < uniqueIds.count else {
stop.pointee = true
return
}
let uniqueId = uniqueIds[index]
index = index + 1
guard let instance = anyFetch(uniqueId: uniqueId, transaction: transaction) else {
owsFailDebug("Missing instance.")
return
}
instance.anyRemove(transaction: transaction)
})
if shouldBeIndexedForFTS {
FullTextSearchFinder.allModelsWereRemoved(collection: collection(), transaction: transaction)

View File

@ -531,24 +531,20 @@ public extension OWSReaction {
let uniqueIds = anyAllUniqueIds(transaction: transaction)
var index: Int = 0
do {
try Batching.loop(batchSize: Batching.kDefaultBatchSize,
loopBlock: { stop in
guard index < uniqueIds.count else {
stop.pointee = true
return
}
let uniqueId = uniqueIds[index]
index = index + 1
guard let instance = anyFetch(uniqueId: uniqueId, transaction: transaction) else {
owsFailDebug("Missing instance.")
return
}
instance.anyRemove(transaction: transaction)
})
} catch {
owsFailDebug("Error: \(error)")
}
Batching.loop(batchSize: Batching.kDefaultBatchSize,
loopBlock: { stop in
guard index < uniqueIds.count else {
stop.pointee = true
return
}
let uniqueId = uniqueIds[index]
index = index + 1
guard let instance = anyFetch(uniqueId: uniqueId, transaction: transaction) else {
owsFailDebug("Missing instance.")
return
}
instance.anyRemove(transaction: transaction)
})
if shouldBeIndexedForFTS {
FullTextSearchFinder.allModelsWereRemoved(collection: collection(), transaction: transaction)

View File

@ -514,24 +514,20 @@ public extension InstalledSticker {
let uniqueIds = anyAllUniqueIds(transaction: transaction)
var index: Int = 0
do {
try Batching.loop(batchSize: Batching.kDefaultBatchSize,
loopBlock: { stop in
guard index < uniqueIds.count else {
stop.pointee = true
return
}
let uniqueId = uniqueIds[index]
index = index + 1
guard let instance = anyFetch(uniqueId: uniqueId, transaction: transaction) else {
owsFailDebug("Missing instance.")
return
}
instance.anyRemove(transaction: transaction)
})
} catch {
owsFailDebug("Error: \(error)")
}
Batching.loop(batchSize: Batching.kDefaultBatchSize,
loopBlock: { stop in
guard index < uniqueIds.count else {
stop.pointee = true
return
}
let uniqueId = uniqueIds[index]
index = index + 1
guard let instance = anyFetch(uniqueId: uniqueId, transaction: transaction) else {
owsFailDebug("Missing instance.")
return
}
instance.anyRemove(transaction: transaction)
})
if shouldBeIndexedForFTS {
FullTextSearchFinder.allModelsWereRemoved(collection: collection(), transaction: transaction)

View File

@ -499,24 +499,20 @@ public extension KnownStickerPack {
let uniqueIds = anyAllUniqueIds(transaction: transaction)
var index: Int = 0
do {
try Batching.loop(batchSize: Batching.kDefaultBatchSize,
loopBlock: { stop in
guard index < uniqueIds.count else {
stop.pointee = true
return
}
let uniqueId = uniqueIds[index]
index = index + 1
guard let instance = anyFetch(uniqueId: uniqueId, transaction: transaction) else {
owsFailDebug("Missing instance.")
return
}
instance.anyRemove(transaction: transaction)
})
} catch {
owsFailDebug("Error: \(error)")
}
Batching.loop(batchSize: Batching.kDefaultBatchSize,
loopBlock: { stop in
guard index < uniqueIds.count else {
stop.pointee = true
return
}
let uniqueId = uniqueIds[index]
index = index + 1
guard let instance = anyFetch(uniqueId: uniqueId, transaction: transaction) else {
owsFailDebug("Missing instance.")
return
}
instance.anyRemove(transaction: transaction)
})
if shouldBeIndexedForFTS {
FullTextSearchFinder.allModelsWereRemoved(collection: collection(), transaction: transaction)

View File

@ -541,24 +541,20 @@ public extension StickerPack {
let uniqueIds = anyAllUniqueIds(transaction: transaction)
var index: Int = 0
do {
try Batching.loop(batchSize: Batching.kDefaultBatchSize,
loopBlock: { stop in
guard index < uniqueIds.count else {
stop.pointee = true
return
}
let uniqueId = uniqueIds[index]
index = index + 1
guard let instance = anyFetch(uniqueId: uniqueId, transaction: transaction) else {
owsFailDebug("Missing instance.")
return
}
instance.anyRemove(transaction: transaction)
})
} catch {
owsFailDebug("Error: \(error)")
}
Batching.loop(batchSize: Batching.kDefaultBatchSize,
loopBlock: { stop in
guard index < uniqueIds.count else {
stop.pointee = true
return
}
let uniqueId = uniqueIds[index]
index = index + 1
guard let instance = anyFetch(uniqueId: uniqueId, transaction: transaction) else {
owsFailDebug("Missing instance.")
return
}
instance.anyRemove(transaction: transaction)
})
if shouldBeIndexedForFTS {
FullTextSearchFinder.allModelsWereRemoved(collection: collection(), transaction: transaction)

View File

@ -523,24 +523,20 @@ public extension IncomingGroupsV2MessageJob {
let uniqueIds = anyAllUniqueIds(transaction: transaction)
var index: Int = 0
do {
try Batching.loop(batchSize: Batching.kDefaultBatchSize,
loopBlock: { stop in
guard index < uniqueIds.count else {
stop.pointee = true
return
}
let uniqueId = uniqueIds[index]
index = index + 1
guard let instance = anyFetch(uniqueId: uniqueId, transaction: transaction) else {
owsFailDebug("Missing instance.")
return
}
instance.anyRemove(transaction: transaction)
})
} catch {
owsFailDebug("Error: \(error)")
}
Batching.loop(batchSize: Batching.kDefaultBatchSize,
loopBlock: { stop in
guard index < uniqueIds.count else {
stop.pointee = true
return
}
let uniqueId = uniqueIds[index]
index = index + 1
guard let instance = anyFetch(uniqueId: uniqueId, transaction: transaction) else {
owsFailDebug("Missing instance.")
return
}
instance.anyRemove(transaction: transaction)
})
if shouldBeIndexedForFTS {
FullTextSearchFinder.allModelsWereRemoved(collection: collection(), transaction: transaction)

View File

@ -611,24 +611,20 @@ public extension TSPaymentModel {
let uniqueIds = anyAllUniqueIds(transaction: transaction)
var index: Int = 0
do {
try Batching.loop(batchSize: Batching.kDefaultBatchSize,
loopBlock: { stop in
guard index < uniqueIds.count else {
stop.pointee = true
return
}
let uniqueId = uniqueIds[index]
index = index + 1
guard let instance = anyFetch(uniqueId: uniqueId, transaction: transaction) else {
owsFailDebug("Missing instance.")
return
}
instance.anyRemove(transaction: transaction)
})
} catch {
owsFailDebug("Error: \(error)")
}
Batching.loop(batchSize: Batching.kDefaultBatchSize,
loopBlock: { stop in
guard index < uniqueIds.count else {
stop.pointee = true
return
}
let uniqueId = uniqueIds[index]
index = index + 1
guard let instance = anyFetch(uniqueId: uniqueId, transaction: transaction) else {
owsFailDebug("Missing instance.")
return
}
instance.anyRemove(transaction: transaction)
})
if shouldBeIndexedForFTS {
FullTextSearchFinder.allModelsWereRemoved(collection: collection(), transaction: transaction)

View File

@ -525,24 +525,20 @@ public extension TSPaymentRequestModel {
let uniqueIds = anyAllUniqueIds(transaction: transaction)
var index: Int = 0
do {
try Batching.loop(batchSize: Batching.kDefaultBatchSize,
loopBlock: { stop in
guard index < uniqueIds.count else {
stop.pointee = true
return
}
let uniqueId = uniqueIds[index]
index = index + 1
guard let instance = anyFetch(uniqueId: uniqueId, transaction: transaction) else {
owsFailDebug("Missing instance.")
return
}
instance.anyRemove(transaction: transaction)
})
} catch {
owsFailDebug("Error: \(error)")
}
Batching.loop(batchSize: Batching.kDefaultBatchSize,
loopBlock: { stop in
guard index < uniqueIds.count else {
stop.pointee = true
return
}
let uniqueId = uniqueIds[index]
index = index + 1
guard let instance = anyFetch(uniqueId: uniqueId, transaction: transaction) else {
owsFailDebug("Missing instance.")
return
}
instance.anyRemove(transaction: transaction)
})
if shouldBeIndexedForFTS {
FullTextSearchFinder.allModelsWereRemoved(collection: collection(), transaction: transaction)

View File

@ -384,7 +384,7 @@ NSError *RemoteAttestationSigningCertificateErrorMake(RemoteAttestationSigningCe
return nil;
}
unsigned char *entryName = ASN1_STRING_data(entryData);
const unsigned char *entryName = ASN1_STRING_get0_data(entryData);
if (entryName == NULL) {
OWSFailDebug(@"could not extract entry string.");
return nil;

View File

@ -514,24 +514,20 @@ public extension OWSRecipientIdentity {
let uniqueIds = anyAllUniqueIds(transaction: transaction)
var index: Int = 0
do {
try Batching.loop(batchSize: Batching.kDefaultBatchSize,
loopBlock: { stop in
guard index < uniqueIds.count else {
stop.pointee = true
return
}
let uniqueId = uniqueIds[index]
index = index + 1
guard let instance = anyFetch(uniqueId: uniqueId, transaction: transaction) else {
owsFailDebug("Missing instance.")
return
}
instance.anyRemove(transaction: transaction)
})
} catch {
owsFailDebug("Error: \(error)")
}
Batching.loop(batchSize: Batching.kDefaultBatchSize,
loopBlock: { stop in
guard index < uniqueIds.count else {
stop.pointee = true
return
}
let uniqueId = uniqueIds[index]
index = index + 1
guard let instance = anyFetch(uniqueId: uniqueId, transaction: transaction) else {
owsFailDebug("Missing instance.")
return
}
instance.anyRemove(transaction: transaction)
})
if shouldBeIndexedForFTS {
FullTextSearchFinder.allModelsWereRemoved(collection: collection(), transaction: transaction)

View File

@ -138,8 +138,7 @@ public class SDSDatabaseStorage: SDSTransactable {
}
}
// TODO: This should return a guarantee
public func reloadDatabase() -> Promise<Void> {
public func reloadDatabase() -> Guarantee<Void> {
AssertIsOnMainThread()
assert(storageCoordinatorState == .GRDB)
@ -147,7 +146,7 @@ public class SDSDatabaseStorage: SDSTransactable {
let wasRegistered = TSAccountManager.shared.isRegistered
let (promise, future) = Promise<Void>.pending()
let (promise, future) = Guarantee<Void>.pending()
reopenGRDBStorage {
_ = GRDBSchemaMigrator().runSchemaMigrations()

View File

@ -365,7 +365,7 @@ public class SDSKeyValueStore: NSObject {
@objc
public func allValues(transaction: SDSAnyReadTransaction) -> [Any] {
return allKeys(transaction: transaction).map { key in
return allKeys(transaction: transaction).compactMap { key in
return self.read(key, transaction: transaction)
}
}

View File

@ -855,24 +855,20 @@ public extension SSKJobRecord {
let uniqueIds = anyAllUniqueIds(transaction: transaction)
var index: Int = 0
do {
try Batching.loop(batchSize: Batching.kDefaultBatchSize,
loopBlock: { stop in
guard index < uniqueIds.count else {
stop.pointee = true
return
}
let uniqueId = uniqueIds[index]
index = index + 1
guard let instance = anyFetch(uniqueId: uniqueId, transaction: transaction) else {
owsFailDebug("Missing instance.")
return
}
instance.anyRemove(transaction: transaction)
})
} catch {
owsFailDebug("Error: \(error)")
}
Batching.loop(batchSize: Batching.kDefaultBatchSize,
loopBlock: { stop in
guard index < uniqueIds.count else {
stop.pointee = true
return
}
let uniqueId = uniqueIds[index]
index = index + 1
guard let instance = anyFetch(uniqueId: uniqueId, transaction: transaction) else {
owsFailDebug("Missing instance.")
return
}
instance.anyRemove(transaction: transaction)
})
if shouldBeIndexedForFTS {
FullTextSearchFinder.allModelsWereRemoved(collection: collection(), transaction: transaction)

View File

@ -495,24 +495,20 @@ public extension ExperienceUpgrade {
let uniqueIds = anyAllUniqueIds(transaction: transaction)
var index: Int = 0
do {
try Batching.loop(batchSize: Batching.kDefaultBatchSize,
loopBlock: { stop in
guard index < uniqueIds.count else {
stop.pointee = true
return
}
let uniqueId = uniqueIds[index]
index = index + 1
guard let instance = anyFetch(uniqueId: uniqueId, transaction: transaction) else {
owsFailDebug("Missing instance.")
return
}
instance.anyRemove(transaction: transaction)
})
} catch {
owsFailDebug("Error: \(error)")
}
Batching.loop(batchSize: Batching.kDefaultBatchSize,
loopBlock: { stop in
guard index < uniqueIds.count else {
stop.pointee = true
return
}
let uniqueId = uniqueIds[index]
index = index + 1
guard let instance = anyFetch(uniqueId: uniqueId, transaction: transaction) else {
owsFailDebug("Missing instance.")
return
}
instance.anyRemove(transaction: transaction)
})
if shouldBeIndexedForFTS {
FullTextSearchFinder.allModelsWereRemoved(collection: collection(), transaction: transaction)

View File

@ -522,24 +522,20 @@ public extension OWSBackupFragment {
let uniqueIds = anyAllUniqueIds(transaction: transaction)
var index: Int = 0
do {
try Batching.loop(batchSize: Batching.kDefaultBatchSize,
loopBlock: { stop in
guard index < uniqueIds.count else {
stop.pointee = true
return
}
let uniqueId = uniqueIds[index]
index = index + 1
guard let instance = anyFetch(uniqueId: uniqueId, transaction: transaction) else {
owsFailDebug("Missing instance.")
return
}
instance.anyRemove(transaction: transaction)
})
} catch {
owsFailDebug("Error: \(error)")
}
Batching.loop(batchSize: Batching.kDefaultBatchSize,
loopBlock: { stop in
guard index < uniqueIds.count else {
stop.pointee = true
return
}
let uniqueId = uniqueIds[index]
index = index + 1
guard let instance = anyFetch(uniqueId: uniqueId, transaction: transaction) else {
owsFailDebug("Missing instance.")
return
}
instance.anyRemove(transaction: transaction)
})
if shouldBeIndexedForFTS {
FullTextSearchFinder.allModelsWereRemoved(collection: collection(), transaction: transaction)

View File

@ -602,24 +602,20 @@ public extension OWSUserProfile {
let uniqueIds = anyAllUniqueIds(transaction: transaction)
var index: Int = 0
do {
try Batching.loop(batchSize: Batching.kDefaultBatchSize,
loopBlock: { stop in
guard index < uniqueIds.count else {
stop.pointee = true
return
}
let uniqueId = uniqueIds[index]
index = index + 1
guard let instance = anyFetch(uniqueId: uniqueId, transaction: transaction) else {
owsFailDebug("Missing instance.")
return
}
instance.anyRemove(transaction: transaction)
})
} catch {
owsFailDebug("Error: \(error)")
}
Batching.loop(batchSize: Batching.kDefaultBatchSize,
loopBlock: { stop in
guard index < uniqueIds.count else {
stop.pointee = true
return
}
let uniqueId = uniqueIds[index]
index = index + 1
guard let instance = anyFetch(uniqueId: uniqueId, transaction: transaction) else {
owsFailDebug("Missing instance.")
return
}
instance.anyRemove(transaction: transaction)
})
if shouldBeIndexedForFTS {
FullTextSearchFinder.allModelsWereRemoved(collection: collection(), transaction: transaction)

View File

@ -550,24 +550,20 @@ public extension TestModel {
let uniqueIds = anyAllUniqueIds(transaction: transaction)
var index: Int = 0
do {
try Batching.loop(batchSize: Batching.kDefaultBatchSize,
loopBlock: { stop in
guard index < uniqueIds.count else {
stop.pointee = true
return
}
let uniqueId = uniqueIds[index]
index = index + 1
guard let instance = anyFetch(uniqueId: uniqueId, transaction: transaction) else {
owsFailDebug("Missing instance.")
return
}
instance.anyRemove(transaction: transaction)
})
} catch {
owsFailDebug("Error: \(error)")
}
Batching.loop(batchSize: Batching.kDefaultBatchSize,
loopBlock: { stop in
guard index < uniqueIds.count else {
stop.pointee = true
return
}
let uniqueId = uniqueIds[index]
index = index + 1
guard let instance = anyFetch(uniqueId: uniqueId, transaction: transaction) else {
owsFailDebug("Missing instance.")
return
}
instance.anyRemove(transaction: transaction)
})
if shouldBeIndexedForFTS {
FullTextSearchFinder.allModelsWereRemoved(collection: collection(), transaction: transaction)

View File

@ -708,9 +708,6 @@ public class ShareViewController: UIViewController, ShareViewDelegate, SAEFailed
return "pdf"
case .pkPass:
return "pkPass"
@unknown default:
owsFailDebug("Unknown value.")
return "unknown"
}
}
}

View File

@ -141,11 +141,9 @@ public class ColorOrGradientSwatchView: ManualLayoutViewWithLayer {
// coordinate space with lower-left origin. But the
// observed behavior is that they use an upper-left origin.
// I can't figure out why.
if false {
return CGPoint(x: point.x, y: (1 - point.y))
} else {
return point
}
//
// return CGPoint(x: point.x, y: (1 - point.y))
return point
}
let startPointLL = convertToLayerUnit(startPointUL)
let endPointLL = convertToLayerUnit(endPointUL)

View File

@ -591,7 +591,7 @@ CGFloat ScaleFromIPhone5(CGFloat iPhone5Value)
hairlineView.backgroundColor = color;
[hairlineView autoSetDimension:ALDimensionHeight toSize:1];
[self insertArrangedSubview:hairlineView atIndex:(NSInteger)index];
[self insertArrangedSubview:hairlineView atIndex:(NSUInteger)index];
}
- (UIView *)addBackgroundViewWithBackgroundColor:(UIColor *)backgroundColor