Migrate to Swift 4.

pull/1/head
Matthew Chen 7 years ago
parent da5ae63bbc
commit 77b72b6b06

@ -4,13 +4,13 @@
import Foundation import Foundation
extension UIApplication { @objc public extension UIApplication {
var frontmostViewControllerIgnoringAlerts: UIViewController? { @objc public var frontmostViewControllerIgnoringAlerts: UIViewController? {
return findFrontmostViewController(ignoringAlerts: true) return findFrontmostViewController(ignoringAlerts: true)
} }
var frontmostViewController: UIViewController? { @objc public var frontmostViewController: UIViewController? {
return findFrontmostViewController(ignoringAlerts: false) return findFrontmostViewController(ignoringAlerts: false)
} }
@ -26,7 +26,7 @@ extension UIApplication {
return viewController.findFrontmostViewController(ignoringAlerts) return viewController.findFrontmostViewController(ignoringAlerts)
} }
func openSystemSettings() { @objc public func openSystemSettings() {
openURL(URL(string: UIApplicationOpenSettingsURLString)!) openURL(URL(string: UIApplicationOpenSettingsURLString)!)
} }

@ -1,5 +1,5 @@
// //
// Copyright (c) 2017 Open Whisper Systems. All rights reserved. // Copyright (c) 2018 Open Whisper Systems. All rights reserved.
// //
import Foundation import Foundation
@ -8,7 +8,7 @@ import Foundation
* Present call related notifications to the user. * Present call related notifications to the user.
*/ */
@objc(OWSCallNotificationsAdapter) @objc(OWSCallNotificationsAdapter)
class CallNotificationsAdapter: NSObject { public class CallNotificationsAdapter: NSObject {
let TAG = "[CallNotificationsAdapter]" let TAG = "[CallNotificationsAdapter]"
let adaptee: OWSCallNotificationsAdaptee let adaptee: OWSCallNotificationsAdaptee

@ -480,7 +480,8 @@ func setPageControlAppearance() {
pageControl.currentPageIndicatorTintColor = UIColor.ows_materialBlue pageControl.currentPageIndicatorTintColor = UIColor.ows_materialBlue
} }
class ExperienceUpgradesPageViewController: OWSViewController, UIPageViewControllerDataSource { @objc
public class ExperienceUpgradesPageViewController: OWSViewController, UIPageViewControllerDataSource {
let TAG = "[ExperienceUpgradeViewController]" let TAG = "[ExperienceUpgradeViewController]"
@ -494,7 +495,8 @@ class ExperienceUpgradesPageViewController: OWSViewController, UIPageViewControl
// MARK: - Initializers // MARK: - Initializers
required init(experienceUpgrades: [ExperienceUpgrade]) { @objc
public required init(experienceUpgrades: [ExperienceUpgrade]) {
self.experienceUpgrades = experienceUpgrades self.experienceUpgrades = experienceUpgrades
setPageControlAppearance() setPageControlAppearance()
@ -507,13 +509,14 @@ class ExperienceUpgradesPageViewController: OWSViewController, UIPageViewControl
} }
@available(*, unavailable, message:"unavailable, use initWithExperienceUpgrade instead") @available(*, unavailable, message:"unavailable, use initWithExperienceUpgrade instead")
required init?(coder aDecoder: NSCoder) { @objc
public required init?(coder aDecoder: NSCoder) {
fatalError("unimplemented") fatalError("unimplemented")
} }
// MARK: - View lifecycle // MARK: - View lifecycle
override func viewDidLoad() { @objc public override func viewDidLoad() {
guard let firstViewController = allViewControllers.first else { guard let firstViewController = allViewControllers.first else {
owsFail("\(TAG) no pages to show.") owsFail("\(TAG) no pages to show.")
dismiss(animated: true) dismiss(animated: true)
@ -524,7 +527,7 @@ class ExperienceUpgradesPageViewController: OWSViewController, UIPageViewControl
self.pageViewController.setViewControllers([ firstViewController ], direction: .forward, animated: false, completion: nil) self.pageViewController.setViewControllers([ firstViewController ], direction: .forward, animated: false, completion: nil)
} }
override func loadView() { @objc public override func loadView() {
self.view = UIView.container() self.view = UIView.container()
view.backgroundColor = UIColor.white view.backgroundColor = UIColor.white
@ -677,7 +680,7 @@ class ExperienceUpgradesPageViewController: OWSViewController, UIPageViewControl
allViewControllers.append(viewController) allViewControllers.append(viewController)
} }
override func dismiss(animated flag: Bool, completion: (() -> Void)? = nil) { @objc public override func dismiss(animated flag: Bool, completion: (() -> Void)? = nil) {
// Blocking write before dismiss, to be sure they're marked as complete // Blocking write before dismiss, to be sure they're marked as complete
// before HomeView.didAppear is re-fired. // before HomeView.didAppear is re-fired.
self.editingDBConnection.readWrite { transaction in self.editingDBConnection.readWrite { transaction in

@ -5,7 +5,8 @@
import Foundation import Foundation
import SignalServiceKit import SignalServiceKit
class SafetyNumberConfirmationAlert: NSObject { @objc
public class SafetyNumberConfirmationAlert: NSObject {
let TAG = "[SafetyNumberConfirmationAlert]" let TAG = "[SafetyNumberConfirmationAlert]"
@ -17,18 +18,22 @@ class SafetyNumberConfirmationAlert: NSObject {
self.primaryStorage = OWSPrimaryStorage.shared() self.primaryStorage = OWSPrimaryStorage.shared()
} }
@objc
public class func presentAlertIfNecessary(recipientId: String, confirmationText: String, contactsManager: OWSContactsManager, completion: @escaping (Bool) -> Void) -> Bool { public class func presentAlertIfNecessary(recipientId: String, confirmationText: String, contactsManager: OWSContactsManager, completion: @escaping (Bool) -> Void) -> Bool {
return self.presentAlertIfNecessary(recipientIds: [recipientId], confirmationText: confirmationText, contactsManager: contactsManager, completion: completion, beforePresentationHandler: nil) return self.presentAlertIfNecessary(recipientIds: [recipientId], confirmationText: confirmationText, contactsManager: contactsManager, completion: completion, beforePresentationHandler: nil)
} }
@objc
public class func presentAlertIfNecessary(recipientId: String, confirmationText: String, contactsManager: OWSContactsManager, completion: @escaping (Bool) -> Void, beforePresentationHandler: (() -> Void)? = nil) -> Bool { public class func presentAlertIfNecessary(recipientId: String, confirmationText: String, contactsManager: OWSContactsManager, completion: @escaping (Bool) -> Void, beforePresentationHandler: (() -> Void)? = nil) -> Bool {
return self.presentAlertIfNecessary(recipientIds: [recipientId], confirmationText: confirmationText, contactsManager: contactsManager, completion: completion, beforePresentationHandler: beforePresentationHandler) return self.presentAlertIfNecessary(recipientIds: [recipientId], confirmationText: confirmationText, contactsManager: contactsManager, completion: completion, beforePresentationHandler: beforePresentationHandler)
} }
@objc
public class func presentAlertIfNecessary(recipientIds: [String], confirmationText: String, contactsManager: OWSContactsManager, completion: @escaping (Bool) -> Void) -> Bool { public class func presentAlertIfNecessary(recipientIds: [String], confirmationText: String, contactsManager: OWSContactsManager, completion: @escaping (Bool) -> Void) -> Bool {
return self.presentAlertIfNecessary(recipientIds: recipientIds, confirmationText: confirmationText, contactsManager: contactsManager, completion: completion, beforePresentationHandler: nil) return self.presentAlertIfNecessary(recipientIds: recipientIds, confirmationText: confirmationText, contactsManager: contactsManager, completion: completion, beforePresentationHandler: nil)
} }
@objc
public class func presentAlertIfNecessary(recipientIds: [String], confirmationText: String, contactsManager: OWSContactsManager, completion: @escaping (Bool) -> Void, beforePresentationHandler: (() -> Void)? = nil) -> Bool { public class func presentAlertIfNecessary(recipientIds: [String], confirmationText: String, contactsManager: OWSContactsManager, completion: @escaping (Bool) -> Void, beforePresentationHandler: (() -> Void)? = nil) -> Bool {
return SafetyNumberConfirmationAlert(contactsManager: contactsManager).presentIfNecessary(recipientIds: recipientIds, return SafetyNumberConfirmationAlert(contactsManager: contactsManager).presentIfNecessary(recipientIds: recipientIds,
confirmationText: confirmationText, confirmationText: confirmationText,

@ -6,21 +6,22 @@ import Foundation
@objc @objc
public class ThreadViewModel: NSObject { public class ThreadViewModel: NSObject {
let hasUnreadMessages: Bool @objc public let hasUnreadMessages: Bool
let lastMessageDate: Date @objc public let lastMessageDate: Date
let isGroupThread: Bool @objc public let isGroupThread: Bool
let threadRecord: TSThread @objc public let threadRecord: TSThread
let unreadCount: UInt @objc public let unreadCount: UInt
let contactIdentifier: String? @objc public let contactIdentifier: String?
let name: String @objc public let name: String
let isMuted: Bool @objc public let isMuted: Bool
var isContactThread: Bool { var isContactThread: Bool {
return !isGroupThread return !isGroupThread
} }
let lastMessageText: String? @objc public let lastMessageText: String?
init(thread: TSThread, transaction: YapDatabaseReadTransaction) { @objc
public init(thread: TSThread, transaction: YapDatabaseReadTransaction) {
self.threadRecord = thread self.threadRecord = thread
self.lastMessageDate = thread.lastMessageDate() self.lastMessageDate = thread.lastMessageDate()
self.isGroupThread = thread.isGroupThread() self.isGroupThread = thread.isGroupThread()

@ -71,7 +71,7 @@ import SignalMessaging
* --[SS.Hangup]--> * --[SS.Hangup]-->
*/ */
enum CallError: Error { public enum CallError: Error {
case providerReset case providerReset
case assertionError(description: String) case assertionError(description: String)
case disconnected case disconnected
@ -207,7 +207,7 @@ private class SignalCallData: NSObject {
} }
// This class' state should only be accessed on the main queue. // This class' state should only be accessed on the main queue.
@objc class CallService: NSObject, CallObserver, PeerConnectionClientDelegate { @objc public class CallService: NSObject, CallObserver, PeerConnectionClientDelegate {
// MARK: - Properties // MARK: - Properties
@ -222,7 +222,7 @@ private class SignalCallData: NSObject {
// Exposed by environment.m // Exposed by environment.m
internal let notificationsAdapter: CallNotificationsAdapter internal let notificationsAdapter: CallNotificationsAdapter
internal var callUIAdapter: CallUIAdapter! @objc public var callUIAdapter: CallUIAdapter!
// MARK: Class // MARK: Class
@ -298,7 +298,7 @@ private class SignalCallData: NSObject {
} }
} }
required init(accountManager: AccountManager, contactsManager: OWSContactsManager, messageSender: MessageSender, notificationsAdapter: CallNotificationsAdapter) { @objc public required init(accountManager: AccountManager, contactsManager: OWSContactsManager, messageSender: MessageSender, notificationsAdapter: CallNotificationsAdapter) {
self.accountManager = accountManager self.accountManager = accountManager
self.contactsManager = contactsManager self.contactsManager = contactsManager
self.messageSender = messageSender self.messageSender = messageSender
@ -353,7 +353,7 @@ private class SignalCallData: NSObject {
/** /**
* Initiate an outgoing call. * Initiate an outgoing call.
*/ */
public func handleOutgoingCall(_ call: SignalCall) -> Promise<Void> { func handleOutgoingCall(_ call: SignalCall) -> Promise<Void> {
SwiftAssertIsOnMainThread(#function) SwiftAssertIsOnMainThread(#function)
guard self.call == nil else { guard self.call == nil else {
@ -938,7 +938,7 @@ private class SignalCallData: NSObject {
* *
* Used by notification actions which can't serialize a call object. * Used by notification actions which can't serialize a call object.
*/ */
public func handleAnswerCall(localId: UUID) { @objc public func handleAnswerCall(localId: UUID) {
SwiftAssertIsOnMainThread(#function) SwiftAssertIsOnMainThread(#function)
guard let call = self.call else { guard let call = self.call else {

@ -5,7 +5,7 @@
import Foundation import Foundation
import SignalServiceKit import SignalServiceKit
enum CallState: String { public enum CallState: String {
case idle case idle
case dialing case dialing
case answering case answering
@ -37,7 +37,7 @@ protocol CallObserver: class {
* *
* This class' state should only be accessed on the main queue. * This class' state should only be accessed on the main queue.
*/ */
@objc class SignalCall: NSObject { @objc public class SignalCall: NSObject {
let TAG = "[SignalCall]" let TAG = "[SignalCall]"

@ -82,7 +82,7 @@ extension CallUIAdaptee {
* Notify the user of call related activities. * Notify the user of call related activities.
* Driven by either a CallKit or System notifications adaptee * Driven by either a CallKit or System notifications adaptee
*/ */
@objc class CallUIAdapter: NSObject, CallServiceObserver { @objc public class CallUIAdapter: NSObject, CallServiceObserver {
let TAG = "[CallUIAdapter]" let TAG = "[CallUIAdapter]"
private let adaptee: CallUIAdaptee private let adaptee: CallUIAdaptee
@ -90,7 +90,7 @@ extension CallUIAdaptee {
internal let audioService: CallAudioService internal let audioService: CallAudioService
internal let callService: CallService internal let callService: CallService
required init(callService: CallService, contactsManager: OWSContactsManager, notificationsAdapter: CallNotificationsAdapter) { public required init(callService: CallService, contactsManager: OWSContactsManager, notificationsAdapter: CallNotificationsAdapter) {
SwiftAssertIsOnMainThread(#function) SwiftAssertIsOnMainThread(#function)
self.contactsManager = contactsManager self.contactsManager = contactsManager
@ -155,7 +155,7 @@ extension CallUIAdaptee {
return call return call
} }
internal func answerCall(localId: UUID) { @objc public func answerCall(localId: UUID) {
SwiftAssertIsOnMainThread(#function) SwiftAssertIsOnMainThread(#function)
adaptee.answerCall(localId: localId) adaptee.answerCall(localId: localId)

@ -1,24 +1,24 @@
// //
// Copyright (c) 2017 Open Whisper Systems. All rights reserved. // Copyright (c) 2018 Open Whisper Systems. All rights reserved.
// //
import Foundation import Foundation
import SignalServiceKit import SignalServiceKit
import SignalMessaging import SignalMessaging
class ExperienceUpgrade: TSYapDatabaseObject { @objc public class ExperienceUpgrade: TSYapDatabaseObject {
let title: String let title: String
let body: String let body: String
let image: UIImage? let image: UIImage?
required init(uniqueId: String, title: String, body: String, image: UIImage) { @objc public required init(uniqueId: String, title: String, body: String, image: UIImage) {
self.title = title self.title = title
self.body = body self.body = body
self.image = image self.image = image
super.init(uniqueId: uniqueId) super.init(uniqueId: uniqueId)
} }
override required init(uniqueId: String?) { @objc public override required init(uniqueId: String?) {
// This is the unfortunate seam between strict swift and fast-and-loose objc // 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 // we can't leave these properties nil, since we really "don't know" that the superclass
// will assign them. // will assign them.
@ -28,7 +28,7 @@ class ExperienceUpgrade: TSYapDatabaseObject {
super.init(uniqueId: uniqueId) super.init(uniqueId: uniqueId)
} }
required init!(coder: NSCoder) { @objc public required init!(coder: NSCoder) {
// This is the unfortunate seam between strict swift and fast-and-loose objc // 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 // we can't leave these properties nil, since we really "don't know" that the superclass
// will assign them. // will assign them.
@ -38,7 +38,7 @@ class ExperienceUpgrade: TSYapDatabaseObject {
super.init(coder: coder) super.init(coder: coder)
} }
required init(dictionary dictionaryValue: [AnyHashable : Any]!) throws { @objc public required init(dictionary dictionaryValue: [AnyHashable: Any]!) throws {
// This is the unfortunate seam between strict swift and fast-and-loose objc // 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 // we can't leave these properties nil, since we really "don't know" that the superclass
// will assign them. // will assign them.
@ -48,7 +48,7 @@ class ExperienceUpgrade: TSYapDatabaseObject {
try super.init(dictionary: dictionaryValue) try super.init(dictionary: dictionaryValue)
} }
override class func storageBehaviorForProperty(withKey propertyKey: String) -> MTLPropertyStorage { @objc public override class func storageBehaviorForProperty(withKey propertyKey: String) -> MTLPropertyStorage {
// These exist in a hardcoded set - no need to save them, plus it allows us to // 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 // update copy/image down the line if there was a typo and we want to re-expose
// these models in a "change log" archive. // these models in a "change log" archive.

@ -44,25 +44,26 @@ class ExperienceUpgradeFinder: NSObject {
return ExperienceUpgrade(uniqueId: ExperienceUpgradeId.introducingProfiles.rawValue, return ExperienceUpgrade(uniqueId: ExperienceUpgradeId.introducingProfiles.rawValue,
title: NSLocalizedString("UPGRADE_EXPERIENCE_INTRODUCING_PROFILES_TITLE", comment: "Header for upgrade experience"), title: NSLocalizedString("UPGRADE_EXPERIENCE_INTRODUCING_PROFILES_TITLE", comment: "Header for upgrade experience"),
body: NSLocalizedString("UPGRADE_EXPERIENCE_INTRODUCING_PROFILES_DESCRIPTION", comment: "Description of new profile feature for upgrading (existing) users"), body: NSLocalizedString("UPGRADE_EXPERIENCE_INTRODUCING_PROFILES_DESCRIPTION", comment: "Description of new profile feature for upgrading (existing) users"),
image:#imageLiteral(resourceName: "introductory_splash_profile")) image: #imageLiteral(resourceName: "introductory_splash_profile"))
} }
var introducingReadReceipts: ExperienceUpgrade { var introducingReadReceipts: ExperienceUpgrade {
return ExperienceUpgrade(uniqueId: ExperienceUpgradeId.introducingReadReceipts.rawValue, return ExperienceUpgrade(uniqueId: ExperienceUpgradeId.introducingReadReceipts.rawValue,
title: NSLocalizedString("UPGRADE_EXPERIENCE_INTRODUCING_READ_RECEIPTS_TITLE", comment: "Header for upgrade experience"), title: NSLocalizedString("UPGRADE_EXPERIENCE_INTRODUCING_READ_RECEIPTS_TITLE", comment: "Header for upgrade experience"),
body: NSLocalizedString("UPGRADE_EXPERIENCE_INTRODUCING_READ_RECEIPTS_DESCRIPTION", comment: "Description of new profile feature for upgrading (existing) users"), body: NSLocalizedString("UPGRADE_EXPERIENCE_INTRODUCING_READ_RECEIPTS_DESCRIPTION", comment: "Description of new profile feature for upgrading (existing) users"),
image:#imageLiteral(resourceName: "introductory_splash_read_receipts")) image: #imageLiteral(resourceName: "introductory_splash_read_receipts"))
} }
var configurableNotificationAudio: ExperienceUpgrade { var configurableNotificationAudio: ExperienceUpgrade {
return ExperienceUpgrade(uniqueId: ExperienceUpgradeId.introducingCustomNotificationAudio.rawValue, return ExperienceUpgrade(uniqueId: ExperienceUpgradeId.introducingCustomNotificationAudio.rawValue,
title: NSLocalizedString("UPGRADE_EXPERIENCE_INTRODUCING_NOTIFICATION_AUDIO_TITLE", comment: "Header for upgrade experience"), title: NSLocalizedString("UPGRADE_EXPERIENCE_INTRODUCING_NOTIFICATION_AUDIO_TITLE", comment: "Header for upgrade experience"),
body: NSLocalizedString("UPGRADE_EXPERIENCE_INTRODUCING_NOTIFICATION_AUDIO_DESCRIPTION", comment: "Description for notification audio customization"), body: NSLocalizedString("UPGRADE_EXPERIENCE_INTRODUCING_NOTIFICATION_AUDIO_DESCRIPTION", comment: "Description for notification audio customization"),
image:#imageLiteral(resourceName: "introductory_splash_custom_audio")) image: #imageLiteral(resourceName: "introductory_splash_custom_audio"))
} }
// Keep these ordered by increasing uniqueId. // Keep these ordered by increasing uniqueId.
private var allExperienceUpgrades: [ExperienceUpgrade] { @objc
public var allExperienceUpgrades: [ExperienceUpgrade] {
return [ return [
// Disable old experience upgrades. Most people have seen them by now, and accomodating multiple makes layout harder. // Disable old experience upgrades. Most people have seen them by now, and accomodating multiple makes layout harder.
// Note if we ever want to show multiple experience upgrades again // Note if we ever want to show multiple experience upgrades again

@ -5,9 +5,9 @@
import UIKit import UIKit
import SignalServiceKit import SignalServiceKit
@objc class AudioProgressView: UIView { @objc public class AudioProgressView: UIView {
override var bounds: CGRect { @objc public override var bounds: CGRect {
didSet { didSet {
if oldValue != bounds { if oldValue != bounds {
updateSubviews() updateSubviews()
@ -15,7 +15,7 @@ import SignalServiceKit
} }
} }
override var frame: CGRect { @objc public override var frame: CGRect {
didSet { didSet {
if oldValue != frame { if oldValue != frame {
updateSubviews() updateSubviews()
@ -23,13 +23,13 @@ import SignalServiceKit
} }
} }
var horizontalBarColor = UIColor.black { @objc public var horizontalBarColor = UIColor.black {
didSet { didSet {
updateContent() updateContent()
} }
} }
var progressColor = UIColor.blue { @objc public var progressColor = UIColor.blue {
didSet { didSet {
updateContent() updateContent()
} }
@ -38,7 +38,7 @@ import SignalServiceKit
private let horizontalBarLayer: CAShapeLayer private let horizontalBarLayer: CAShapeLayer
private let progressLayer: CAShapeLayer private let progressLayer: CAShapeLayer
var progress: CGFloat = 0 { @objc public var progress: CGFloat = 0 {
didSet { didSet {
if oldValue != progress { if oldValue != progress {
updateContent() updateContent()
@ -47,7 +47,7 @@ import SignalServiceKit
} }
@available(*, unavailable, message:"use other constructor instead.") @available(*, unavailable, message:"use other constructor instead.")
required init?(coder aDecoder: NSCoder) { @objc public required init?(coder aDecoder: NSCoder) {
fatalError("\(#function) is unimplemented.") fatalError("\(#function) is unimplemented.")
} }

@ -27,6 +27,7 @@ FOUNDATION_EXPORT const unsigned char SignalMessagingVersionString[];
#import <SignalMessaging/OWSContactsSyncing.h> #import <SignalMessaging/OWSContactsSyncing.h>
#import <SignalMessaging/OWSDatabaseMigration.h> #import <SignalMessaging/OWSDatabaseMigration.h>
#import <SignalMessaging/OWSFormat.h> #import <SignalMessaging/OWSFormat.h>
#import <SignalMessaging/OWSGroupAvatarBuilder.h>
#import <SignalMessaging/OWSLogger.h> #import <SignalMessaging/OWSLogger.h>
#import <SignalMessaging/OWSMath.h> #import <SignalMessaging/OWSMath.h>
#import <SignalMessaging/OWSNavigationController.h> #import <SignalMessaging/OWSNavigationController.h>
@ -37,10 +38,12 @@ FOUNDATION_EXPORT const unsigned char SignalMessagingVersionString[];
#import <SignalMessaging/OWSUserProfile.h> #import <SignalMessaging/OWSUserProfile.h>
#import <SignalMessaging/OWSWindowManager.h> #import <SignalMessaging/OWSWindowManager.h>
#import <SignalMessaging/Release.h> #import <SignalMessaging/Release.h>
#import <SignalMessaging/ScreenLockViewController.h>
#import <SignalMessaging/SharingThreadPickerViewController.h> #import <SignalMessaging/SharingThreadPickerViewController.h>
#import <SignalMessaging/SignalKeyingStorage.h> #import <SignalMessaging/SignalKeyingStorage.h>
#import <SignalMessaging/TSUnreadIndicatorInteraction.h> #import <SignalMessaging/TSUnreadIndicatorInteraction.h>
#import <SignalMessaging/ThreadUtil.h> #import <SignalMessaging/ThreadUtil.h>
#import <SignalMessaging/ThreadViewHelper.h>
#import <SignalMessaging/UIColor+OWS.h> #import <SignalMessaging/UIColor+OWS.h>
#import <SignalMessaging/UIFont+OWS.h> #import <SignalMessaging/UIFont+OWS.h>
#import <SignalMessaging/UIUtil.h> #import <SignalMessaging/UIUtil.h>

@ -39,6 +39,7 @@ public class ContactShareViewModel: NSObject {
self.avatarImageData = avatarImageData self.avatarImageData = avatarImageData
} }
@objc
public convenience init(contactShareRecord: OWSContact, transaction: YapDatabaseReadTransaction) { public convenience init(contactShareRecord: OWSContact, transaction: YapDatabaseReadTransaction) {
if let avatarAttachment = contactShareRecord.avatarAttachment(with: transaction) as? TSAttachmentStream { if let avatarAttachment = contactShareRecord.avatarAttachment(with: transaction) as? TSAttachmentStream {
self.init(contactShareRecord: contactShareRecord, avatarImageData: avatarAttachment.validStillImageData()) self.init(contactShareRecord: contactShareRecord, avatarImageData: avatarAttachment.validStillImageData())

@ -152,10 +152,10 @@ extension String {
static let TAG = "[DisplayableText]" static let TAG = "[DisplayableText]"
public let fullText: String @objc public let fullText: String
public let displayText: String @objc public let displayText: String
public let isTextTruncated: Bool @objc public let isTextTruncated: Bool
public let jumbomojiCount: UInt @objc public let jumbomojiCount: UInt
static let kMaxJumbomojiCount: UInt = 5 static let kMaxJumbomojiCount: UInt = 5
// This value is a bit arbitrary since we don't need to be 100% correct about // This value is a bit arbitrary since we don't need to be 100% correct about
@ -165,7 +165,7 @@ extension String {
// MARK: Initializers // MARK: Initializers
init(fullText: String, displayText: String, isTextTruncated: Bool) { @objc public init(fullText: String, displayText: String, isTextTruncated: Bool) {
self.fullText = fullText self.fullText = fullText
self.displayText = displayText self.displayText = displayText
self.isTextTruncated = isTextTruncated self.isTextTruncated = isTextTruncated

Loading…
Cancel
Save