mirror of https://github.com/oxen-io/session-ios
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
77 lines
3.0 KiB
Swift
77 lines
3.0 KiB
Swift
8 years ago
|
//
|
||
7 years ago
|
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
|
||
8 years ago
|
//
|
||
|
|
||
|
import Foundation
|
||
5 years ago
|
import SignalUtilitiesKit
|
||
|
import SignalUtilitiesKit
|
||
8 years ago
|
|
||
7 years ago
|
@objc public class ExperienceUpgrade: TSYapDatabaseObject {
|
||
8 years ago
|
let title: String
|
||
|
let body: String
|
||
|
let image: UIImage?
|
||
|
|
||
7 years ago
|
@objc public required init(uniqueId: String, title: String, body: String, image: UIImage) {
|
||
8 years ago
|
self.title = title
|
||
|
self.body = body
|
||
|
self.image = image
|
||
|
super.init(uniqueId: uniqueId)
|
||
|
}
|
||
|
|
||
7 years ago
|
@objc
|
||
|
public override init() {
|
||
|
// This is the unfortunate seam between strict swift and fast-and-loose objc
|
||
|
// we can't leave these properties nil, since we really "don't know" that the superclass
|
||
|
// will assign them.
|
||
|
self.title = "New Feature"
|
||
|
self.body = "Bug fixes and performance improvements."
|
||
|
self.image = nil
|
||
|
super.init()
|
||
|
}
|
||
|
|
||
7 years ago
|
@objc public override required init(uniqueId: String?) {
|
||
8 years ago
|
// This is the unfortunate seam between strict swift and fast-and-loose objc
|
||
|
// we can't leave these properties nil, since we really "don't know" that the superclass
|
||
|
// will assign them.
|
||
|
self.title = "New Feature"
|
||
|
self.body = "Bug fixes and performance improvements."
|
||
|
self.image = nil
|
||
|
super.init(uniqueId: uniqueId)
|
||
|
}
|
||
8 years ago
|
|
||
7 years ago
|
@objc public required init!(coder: NSCoder) {
|
||
8 years ago
|
// This is the unfortunate seam between strict swift and fast-and-loose objc
|
||
|
// we can't leave these properties nil, since we really "don't know" that the superclass
|
||
|
// will assign them.
|
||
|
self.title = "New Feature"
|
||
|
self.body = "Bug fixes and performance improvements."
|
||
|
self.image = nil
|
||
|
super.init(coder: coder)
|
||
|
}
|
||
8 years ago
|
|
||
5 years ago
|
@objc public required init(dictionary dictionaryValue: [String: Any]!) throws {
|
||
8 years ago
|
// This is the unfortunate seam between strict swift and fast-and-loose objc
|
||
|
// we can't leave these properties nil, since we really "don't know" that the superclass
|
||
|
// will assign them.
|
||
|
self.title = "New Feature"
|
||
|
self.body = "Bug fixes and performance improvements."
|
||
|
self.image = nil
|
||
|
try super.init(dictionary: dictionaryValue)
|
||
|
}
|
||
|
|
||
7 years ago
|
@objc public override class func storageBehaviorForProperty(withKey propertyKey: String) -> MTLPropertyStorage {
|
||
8 years ago
|
// These exist in a hardcoded set - no need to save them, plus it allows us to
|
||
|
// update copy/image down the line if there was a typo and we want to re-expose
|
||
|
// these models in a "change log" archive.
|
||
|
if propertyKey == "title" || propertyKey == "body" || propertyKey == "image" {
|
||
|
return MTLPropertyStorageNone
|
||
|
} else if propertyKey == "uniqueId" || propertyKey == "seenAt" {
|
||
|
return super.storageBehaviorForProperty(withKey: propertyKey)
|
||
|
} else {
|
||
|
// Being conservative here in case we rename a property.
|
||
7 years ago
|
owsFailDebug("unknown property \(propertyKey)")
|
||
8 years ago
|
return super.storageBehaviorForProperty(withKey: propertyKey)
|
||
|
}
|
||
|
}
|
||
|
}
|