Skip to content

Commit

Permalink
Ensure properties expected by Mantle encoding are marked @objc
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisballinger committed Oct 26, 2017
1 parent 960bd57 commit 5fe6ef7
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 18 deletions.
9 changes: 4 additions & 5 deletions ChatSecure.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3426,7 +3426,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.chrisballinger.ChatSecure.ChatSecureUITests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.0;
TEST_TARGET_NAME = ChatSecure;
};
name = Debug;
Expand All @@ -3444,7 +3444,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.chrisballinger.ChatSecure.ChatSecureUITests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.0;
TEST_TARGET_NAME = ChatSecure;
};
name = Release;
Expand Down Expand Up @@ -3657,8 +3657,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
SWIFT_OBJC_BRIDGING_HEADER = "ChatSecureTests/ChatSecureTests-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.0;
};
name = Debug;
};
Expand All @@ -3680,7 +3679,7 @@
PRODUCT_BUNDLE_IDENTIFIER = "com.chrisballinger.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "ChatSecureTests/ChatSecureTests-Bridging-Header.h";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.0;
};
name = Release;
};
Expand Down
4 changes: 2 additions & 2 deletions ChatSecure/Classes/Model/Yap Storage/PushContainers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ let kBuddyTokenRelationshipEdgeName = "OTRPushBuddyTokenRelationshipEdgeName"
let kAccountTokenRelationshipEdgeName = "OTRPushAccountTokenRelationshipEdgeName"

open class DeviceContainer: OTRYapDatabaseObject, YapDatabaseRelationshipNode {
var pushDevice:Device?
var pushAccountKey:String?
@objc var pushDevice:Device?
@objc var pushAccountKey:String?



Expand Down
6 changes: 3 additions & 3 deletions ChatSecure/Classes/Model/Yap Storage/PushMessage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import Foundation

///A simple message object to mark when push or knock messages were sent off
@objc open class PushMessage: OTRYapDatabaseObject {
open var originId:String?
open var stanzaId:String?
@objc open var originId:String?
@objc open var stanzaId:String?

/// The buddy the knock was sent to
@objc open var buddyKey:String?
Expand All @@ -20,7 +20,7 @@ import Foundation
@objc open var error:NSError?

/// the date the push was sent, used for sorting
open var pushDate:Date = Date()
@objc open var pushDate:Date = Date()

///Send it to the same collection of other messages
open class override var collection: String {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ import YapTaskQueue

open class BuddyAction: OTRYapDatabaseObject, YapActionable {

open var action:BuddyActionType = .delete
open var buddy:OTRBuddy?
@objc open var action:BuddyActionType = .delete
@objc open var buddy:OTRBuddy?

open func yapActionItems() -> [YapActionItem]? {

Expand Down
9 changes: 4 additions & 5 deletions ChatSecureTests/ChatSecureModelTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import ChatSecure_Push_iOS

class ChatSecureModelTest: XCTestCase {


func testDeviceArchiving() {
let date = Date()
let id = "id"
Expand All @@ -25,10 +24,10 @@ class ChatSecureModelTest: XCTestCase {
container.pushAccountKey = accountID

let data = NSKeyedArchiver.archivedData(withRootObject: container)
let newContainer = NSKeyedUnarchiver.unarchiveObject(with: data)!
XCTAssertEqual(container.pushAccountKey, (newContainer as AnyObject).pushAccountKey)
XCTAssertEqual(container.pushDevice?.registrationID, (newContainer as AnyObject).pushDevice!!.registrationID)
XCTAssertEqual(container.pushDevice?.id, (newContainer as AnyObject).pushDevice!!.id)
let newContainer = NSKeyedUnarchiver.unarchiveObject(with: data) as! DeviceContainer
XCTAssertEqual(container.pushAccountKey, newContainer.pushAccountKey)
XCTAssertEqual(container.pushDevice?.registrationID, newContainer.pushDevice!.registrationID)
XCTAssertEqual(container.pushDevice?.id, newContainer.pushDevice!.id)
}
}

2 changes: 1 addition & 1 deletion ChatSecureTests/OTRImageTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class OTRImageTest: XCTestCase {
}

func imageForName(_ name:String, type:String) -> UIImage? {
let bundle = Bundle(for: type(of: self))
let bundle = Bundle(for: OTRImageTest.self)
guard let path = bundle.path(forResource: name, ofType: type) else {
return nil
}
Expand Down

0 comments on commit 5fe6ef7

Please sign in to comment.