Merge branch 'mkirk/compiler-warnings-1'
This commit is contained in:
commit
29ecab20f0
@ -200,7 +200,7 @@ public class ConversationMessageMapping: NSObject {
|
||||
throw assertionError("could not find interaction")
|
||||
}
|
||||
|
||||
let threadInteractionCount = try interactionFinder.count(transaction: transaction)
|
||||
let threadInteractionCount = interactionFinder.count(transaction: transaction)
|
||||
guard index < threadInteractionCount else {
|
||||
throw assertionError("invalid index")
|
||||
}
|
||||
|
||||
@ -12,7 +12,7 @@ public extension DebugUIMessages {
|
||||
|
||||
let interactionFinder = InteractionFinder(threadUniqueId: thread.uniqueId!)
|
||||
|
||||
let messageCount = try! interactionFinder.count(transaction: transaction)
|
||||
let messageCount = interactionFinder.count(transaction: transaction)
|
||||
|
||||
var messageIndices: [UInt] = Array((0..<messageCount))
|
||||
var interactions: [TSInteraction] = []
|
||||
|
||||
@ -87,8 +87,12 @@ public class MediaGalleryItem: Equatable, Hashable {
|
||||
|
||||
// MARK: Hashable
|
||||
|
||||
public var hashValue: Int {
|
||||
return attachmentStream.uniqueId?.hashValue ?? attachmentStream.hashValue
|
||||
public func hash(into hasher: inout Hasher) {
|
||||
if let uniqueId = attachmentStream.uniqueId {
|
||||
hasher.combine(uniqueId)
|
||||
} else {
|
||||
hasher.combine(attachmentStream)
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: Sorting
|
||||
@ -185,8 +189,9 @@ public struct GalleryDate: Hashable, Comparable, Equatable {
|
||||
|
||||
// MARK: Hashable
|
||||
|
||||
public var hashValue: Int {
|
||||
return month.hashValue ^ year.hashValue
|
||||
public func hash(into hasher: inout Hasher) {
|
||||
hasher.combine(month)
|
||||
hasher.combine(year)
|
||||
}
|
||||
|
||||
// MARK: Comparable
|
||||
|
||||
@ -461,7 +461,7 @@ extension PhotoCapture: CaptureOutputDelegate {
|
||||
// AVCaptureMovieFileOutput records to .mov, but for compatibility we need to send mp4's.
|
||||
// Because we take care to record with h264 compression (not hevc), this conversion
|
||||
// doesn't require re-encoding the media streams and happens quickly.
|
||||
let (attachmentPromise, exportSession) = SignalAttachment.compressVideoAsMp4(dataSource: dataSource, dataUTI: kUTTypeMPEG4 as String)
|
||||
let (attachmentPromise, _) = SignalAttachment.compressVideoAsMp4(dataSource: dataSource, dataUTI: kUTTypeMPEG4 as String)
|
||||
attachmentPromise.map { [weak self] attachment in
|
||||
guard let self = self else { return }
|
||||
self.delegate?.photoCapture(self, didFinishProcessingAttachment: attachment)
|
||||
|
||||
@ -603,7 +603,7 @@ private struct CameraCaptureAttachment: Hashable, Equatable {
|
||||
}
|
||||
|
||||
func hash(into hasher: inout Hasher) {
|
||||
signalAttachment.hash(into: &hasher)
|
||||
hasher.combine(signalAttachment)
|
||||
}
|
||||
|
||||
static func ==(lhs: CameraCaptureAttachment, rhs: CameraCaptureAttachment) -> Bool {
|
||||
@ -616,7 +616,7 @@ private struct MediaLibraryAttachment: Hashable, Equatable {
|
||||
let attachmentApprovalItemPromise: Promise<AttachmentApprovalItem>
|
||||
|
||||
func hash(into hasher: inout Hasher) {
|
||||
asset.hash(into: &hasher)
|
||||
hasher.combine(asset)
|
||||
}
|
||||
|
||||
static func ==(lhs: MediaLibraryAttachment, rhs: MediaLibraryAttachment) -> Bool {
|
||||
|
||||
@ -77,12 +77,14 @@ struct AudioSource: Hashable {
|
||||
return lhsPortDescription.uid == rhsPortDescription.uid
|
||||
}
|
||||
|
||||
var hashValue: Int {
|
||||
public func hash(into hasher: inout Hasher) {
|
||||
guard let portDescription = self.portDescription else {
|
||||
assert(self.isBuiltInSpeaker)
|
||||
return "Built In Speaker".hashValue
|
||||
hasher.combine("Built In Speaker")
|
||||
return
|
||||
}
|
||||
return portDescription.uid.hash
|
||||
|
||||
hasher.combine(portDescription.uid)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// Copyright (c) 2019 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
|
||||
#import <AVFoundation/AVAudioSession.h>
|
||||
#import <AVFoundation/AVFoundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
|
||||
@ -240,7 +240,7 @@ open class MarqueeLabel: UILabel, CAAnimationDelegate {
|
||||
}
|
||||
}
|
||||
|
||||
@available(*, deprecated : 2.6, message : "Use speed property instead")
|
||||
@available(iOS, deprecated: 2.6, message : "Use speed property instead")
|
||||
@IBInspectable open var scrollDuration: CGFloat {
|
||||
get {
|
||||
switch speed {
|
||||
@ -253,7 +253,7 @@ open class MarqueeLabel: UILabel, CAAnimationDelegate {
|
||||
}
|
||||
}
|
||||
|
||||
@available(*, deprecated : 2.6, message : "Use speed property instead")
|
||||
@available(iOS, deprecated: 2.6, message : "Use speed property instead")
|
||||
@IBInspectable open var scrollRate: CGFloat {
|
||||
get {
|
||||
switch speed {
|
||||
|
||||
@ -12,11 +12,6 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
- (instancetype)init;
|
||||
|
||||
@property (nonatomic) OWSContactsManager *contactsManager;
|
||||
@property (nonatomic) OWSPreferences *preferences;
|
||||
@property (nonatomic) OWSSounds *sounds;
|
||||
@property (nonatomic) OWSWindowManager *windowManager;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
|
||||
// Copyright (c) 2019 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
@ -26,7 +26,7 @@ class ByteParserTest: SignalBaseTest {
|
||||
}
|
||||
|
||||
func testGetShort_littleEndian() {
|
||||
let data = Data(bytes: [0x01, 0x00, 0x00, 0x01, 0x01, 0x01 ])
|
||||
let data = Data([0x01, 0x00, 0x00, 0x01, 0x01, 0x01])
|
||||
let parser = ByteParser(data: data, littleEndian: true)
|
||||
XCTAssertNotNil(parser)
|
||||
XCTAssertFalse(parser.hasError)
|
||||
@ -45,7 +45,7 @@ class ByteParserTest: SignalBaseTest {
|
||||
}
|
||||
|
||||
func testGetShort_bigEndian() {
|
||||
let data = Data(bytes: [0x01, 0x00, 0x00, 0x01, 0x01, 0x01 ])
|
||||
let data = Data([0x01, 0x00, 0x00, 0x01, 0x01, 0x01])
|
||||
let parser = ByteParser(data: data, littleEndian: false)
|
||||
XCTAssertNotNil(parser)
|
||||
XCTAssertFalse(parser.hasError)
|
||||
@ -73,7 +73,7 @@ class ByteParserTest: SignalBaseTest {
|
||||
}
|
||||
|
||||
func testGetInt_littleEndian() {
|
||||
let data = Data(bytes: [0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00 ])
|
||||
let data = Data([0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00])
|
||||
let parser = ByteParser(data: data, littleEndian: true)
|
||||
XCTAssertNotNil(parser)
|
||||
XCTAssertFalse(parser.hasError)
|
||||
@ -92,7 +92,7 @@ class ByteParserTest: SignalBaseTest {
|
||||
}
|
||||
|
||||
func testGetInt_bigEndian() {
|
||||
let data = Data(bytes: [0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01 ])
|
||||
let data = Data([0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01])
|
||||
let parser = ByteParser(data: data, littleEndian: false)
|
||||
XCTAssertNotNil(parser)
|
||||
XCTAssertFalse(parser.hasError)
|
||||
@ -120,7 +120,7 @@ class ByteParserTest: SignalBaseTest {
|
||||
}
|
||||
|
||||
func testGetLong_littleEndian() {
|
||||
let data = Data(bytes: [0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ])
|
||||
let data = Data([0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00])
|
||||
let parser = ByteParser(data: data, littleEndian: true)
|
||||
XCTAssertNotNil(parser)
|
||||
XCTAssertFalse(parser.hasError)
|
||||
@ -139,7 +139,7 @@ class ByteParserTest: SignalBaseTest {
|
||||
}
|
||||
|
||||
func testGetLong_bigEndian() {
|
||||
let data = Data(bytes: [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01 ])
|
||||
let data = Data([0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01])
|
||||
let parser = ByteParser(data: data, littleEndian: false)
|
||||
XCTAssertNotNil(parser)
|
||||
XCTAssertFalse(parser.hasError)
|
||||
@ -167,7 +167,7 @@ class ByteParserTest: SignalBaseTest {
|
||||
}
|
||||
|
||||
func testReadZero() {
|
||||
let data = Data(bytes: [0x00, 0x01, 0x00, 0x00, 0x01, 0x00])
|
||||
let data = Data([0x00, 0x01, 0x00, 0x00, 0x01, 0x00])
|
||||
let parser = ByteParser(data: data, littleEndian: true)
|
||||
XCTAssertNotNil(parser)
|
||||
XCTAssertFalse(parser.hasError)
|
||||
@ -198,21 +198,21 @@ class ByteParserTest: SignalBaseTest {
|
||||
}
|
||||
|
||||
func testReadBytes() {
|
||||
let data = Data(bytes: [0x00, 0x01, 0x02, 0x03, 0x04, 0x05])
|
||||
let data = Data([0x00, 0x01, 0x02, 0x03, 0x04, 0x05])
|
||||
let parser = ByteParser(data: data, littleEndian: true)
|
||||
XCTAssertNotNil(parser)
|
||||
XCTAssertFalse(parser.hasError)
|
||||
|
||||
XCTAssertEqual(Data(bytes: [0x00 ]), parser.readBytes(1))
|
||||
XCTAssertEqual(Data([0x00]), parser.readBytes(1))
|
||||
XCTAssertFalse(parser.hasError)
|
||||
|
||||
XCTAssertEqual(Data(bytes: [0x01 ]), parser.readBytes(1))
|
||||
XCTAssertEqual(Data([0x01]), parser.readBytes(1))
|
||||
XCTAssertFalse(parser.hasError)
|
||||
|
||||
XCTAssertEqual(Data(bytes: [0x02, 0x03]), parser.readBytes(2))
|
||||
XCTAssertEqual(Data([0x02, 0x03]), parser.readBytes(2))
|
||||
XCTAssertFalse(parser.hasError)
|
||||
|
||||
XCTAssertEqual(Data(bytes: [0x04, 0x05]), parser.readBytes(2))
|
||||
XCTAssertEqual(Data([0x04, 0x05]), parser.readBytes(2))
|
||||
XCTAssertFalse(parser.hasError)
|
||||
|
||||
XCTAssertNil(parser.readBytes(1))
|
||||
|
||||
@ -61,7 +61,7 @@ public class AttachmentApprovalItem: Hashable {
|
||||
// MARK: Hashable
|
||||
|
||||
public func hash(into hasher: inout Hasher) {
|
||||
return attachment.hash(into: &hasher)
|
||||
return hasher.combine(attachment)
|
||||
}
|
||||
|
||||
// MARK: Equatable
|
||||
|
||||
@ -217,7 +217,7 @@ public class ManageStickersViewController: OWSTableViewController {
|
||||
}
|
||||
|
||||
private func buildTableCell(installedStickerPack stickerPack: StickerPack) -> UITableViewCell {
|
||||
var actionIconName = CurrentAppContext().isRTL ? "reply-filled-24" : "reply-filled-reversed-24"
|
||||
let actionIconName = CurrentAppContext().isRTL ? "reply-filled-24" : "reply-filled-reversed-24"
|
||||
return buildTableCell(stickerPack: stickerPack,
|
||||
stickerInfo: stickerPack.coverInfo,
|
||||
title: stickerPack.title,
|
||||
|
||||
@ -123,7 +123,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
UIFontTextStyleCaption1 : @(18.0),
|
||||
UIFontTextStyleCaption2 : @(17.0),
|
||||
} mutableCopy];
|
||||
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(11, 0)) {
|
||||
if (@available(iOS 11.0, *)) {
|
||||
map[UIFontTextStyleLargeTitle] = @(40.0);
|
||||
}
|
||||
maxPointSizeMap = map;
|
||||
@ -144,7 +144,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
+ (UIFont *)ows_dynamicTypeLargeTitle1ClampedFont
|
||||
{
|
||||
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(11, 0)) {
|
||||
if (@available(iOS 11.0, *)) {
|
||||
return [UIFont preferredFontForTextStyleClamped:UIFontTextStyleLargeTitle];
|
||||
} else {
|
||||
return [UIFont preferredFontForTextStyleClamped:UIFontTextStyleTitle1];
|
||||
|
||||
@ -357,7 +357,8 @@ public class SystemContactsFetcher: NSObject {
|
||||
}
|
||||
|
||||
Logger.info("fetched \(contacts.count) contacts.")
|
||||
let contactsHash = HashableArray(contacts).hashValue
|
||||
|
||||
let contactsHash = contacts.hashValue
|
||||
|
||||
DispatchQueue.main.async {
|
||||
var shouldNotifyDelegate = false
|
||||
@ -414,25 +415,3 @@ public class SystemContactsFetcher: NSObject {
|
||||
return contactStoreAdapter.fetchCNContact(contactId: contactId)
|
||||
}
|
||||
}
|
||||
|
||||
struct HashableArray<Element: Hashable>: Hashable {
|
||||
var elements: [Element]
|
||||
init(_ elements: [Element]) {
|
||||
self.elements = elements
|
||||
}
|
||||
|
||||
var hashValue: Int {
|
||||
// random generated 32bit number
|
||||
let base = 224712574
|
||||
var position = 0
|
||||
return elements.reduce(base) { (result, element) -> Int in
|
||||
// Make sure change in sort order invalidates hash
|
||||
position += 1
|
||||
return result ^ element.hashValue + position
|
||||
}
|
||||
}
|
||||
|
||||
static func == (lhs: HashableArray, rhs: HashableArray) -> Bool {
|
||||
return lhs.hashValue == rhs.hashValue
|
||||
}
|
||||
}
|
||||
|
||||
@ -462,6 +462,8 @@ class CDSFeedbackOperation: OWSOperation {
|
||||
self.makeRequest(result: .unexpectedError(reason: "CDS assertionError: \(reason ?? "unknown")"))
|
||||
case .attestationFailed:
|
||||
self.makeRequest(result: .attestationError(reason: "CDS attestationFailed: \(reason ?? "unknown")"))
|
||||
@unknown default:
|
||||
self.makeRequest(result: .unexpectedError(reason: "CDS assertionError: unknown cdsError.code"))
|
||||
}
|
||||
case ContactDiscoveryError.assertionError(let assertionDescription):
|
||||
self.makeRequest(result: .unexpectedError(reason: "assertionError: \(assertionDescription)"))
|
||||
|
||||
@ -34,15 +34,6 @@ NSString *NSStringFromCallType(RPRecentCallType callType);
|
||||
callType:(RPRecentCallType)callType
|
||||
inThread:(TSContactThread *)thread NS_DESIGNATED_INITIALIZER;
|
||||
|
||||
- (instancetype)initWithUniqueId:(NSString *)uniqueId
|
||||
receivedAtTimestamp:(uint64_t)receivedAtTimestamp
|
||||
sortId:(uint64_t)sortId
|
||||
timestamp:(uint64_t)timestamp
|
||||
uniqueThreadId:(NSString *)uniqueThreadId
|
||||
callSchemaVersion:(NSUInteger)callSchemaVersion
|
||||
callType:(RPRecentCallType)callType
|
||||
read:(BOOL)read NS_DESIGNATED_INITIALIZER;
|
||||
|
||||
// --- CODE GENERATION MARKER
|
||||
|
||||
// This snippet is generated by /Scripts/sds_codegen/sds_generate.py. Do not manually edit it, instead run `sds_codegen.sh`.
|
||||
|
||||
@ -15,7 +15,7 @@ typedef NS_ERROR_ENUM(SSKJobRecordErrorDomain, JobRecordError){
|
||||
JobRecordError_IllegalStateTransition,
|
||||
};
|
||||
|
||||
typedef NS_ENUM(NSUInteger, SSKJobRecordStatus) {
|
||||
typedef NS_CLOSED_ENUM(NSUInteger, SSKJobRecordStatus){
|
||||
SSKJobRecordStatus_Unknown,
|
||||
SSKJobRecordStatus_Ready,
|
||||
SSKJobRecordStatus_Running,
|
||||
|
||||
@ -205,11 +205,7 @@ public extension JobQueue {
|
||||
databaseStorage.write { transaction in
|
||||
let runningRecords = self.finder.allRecords(label: self.jobRecordLabel, status: .running, transaction: transaction)
|
||||
Logger.info("marking old `running` JobRecords as ready: \(runningRecords.count)")
|
||||
for record in runningRecords {
|
||||
guard let jobRecord = record as? JobRecordType else {
|
||||
owsFailDebug("unexpected jobRecord: \(record)")
|
||||
continue
|
||||
}
|
||||
for jobRecord in runningRecords {
|
||||
do {
|
||||
try jobRecord.saveRunningAsReady(transaction: transaction)
|
||||
self.didMarkAsReady(oldJobRecord: jobRecord, transaction: transaction)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
|
||||
// Copyright (c) 2019 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
|
||||
#import "SSKBaseTestObjC.h"
|
||||
@ -77,10 +77,15 @@
|
||||
NSKeyedArchiver *archiver = [NSKeyedArchiver new];
|
||||
[archiver encodeBytes:publicKeyBytes length:ECCKeyLength forKey:@"TSECKeyPairPublicKey"];
|
||||
[archiver encodeBytes:privateKeyBytes length:ECCKeyLength forKey:@"TSECKeyPairPrivateKey"];
|
||||
NSData *serialized = [archiver encodedData];
|
||||
|
||||
NSKeyedUnarchiver *unarchiver = [[NSKeyedUnarchiver alloc] initForReadingWithData:serialized];
|
||||
return [[ECKeyPair alloc] initWithCoder:unarchiver];
|
||||
|
||||
if (@available(iOS 10.0, *)) {
|
||||
NSData *serialized = [archiver encodedData];
|
||||
NSKeyedUnarchiver *unarchiver = [[NSKeyedUnarchiver alloc] initForReadingWithData:serialized];
|
||||
return [[ECKeyPair alloc] initWithCoder:unarchiver];
|
||||
} else {
|
||||
XCTFail(@"This test is only supported on iOS10+");
|
||||
return [ECKeyPair new];
|
||||
}
|
||||
}
|
||||
|
||||
- (NSData *)knownData
|
||||
|
||||
@ -691,15 +691,11 @@ public class ShareViewController: UIViewController, ShareViewDelegate, SAEFailed
|
||||
}
|
||||
return isUrlItem(itemProvider: itemProvider)
|
||||
}) {
|
||||
if let itemProvider = preferredAttachment as? NSItemProvider {
|
||||
return [itemProvider]
|
||||
} else {
|
||||
owsFailDebug("Unexpected attachment type: \(String(describing: preferredAttachment))")
|
||||
}
|
||||
return [preferredAttachment]
|
||||
}
|
||||
|
||||
// else return whatever is available
|
||||
if let itemProvider = inputItem.attachments?.first as? NSItemProvider {
|
||||
if let itemProvider = inputItem.attachments?.first {
|
||||
return [itemProvider]
|
||||
} else {
|
||||
owsFailDebug("Missing attachment.")
|
||||
|
||||
Loading…
Reference in New Issue
Block a user