Resolve more errors
This commit is contained in:
parent
ef41ea22fa
commit
90027c4a04
|
@ -31,6 +31,7 @@ typedef void (^AppReadyBlock)(void);
|
||||||
// on app launch, especially work that uses other components.
|
// on app launch, especially work that uses other components.
|
||||||
// * We should usually use "did become ready" blocks since they are safer.
|
// * We should usually use "did become ready" blocks since they are safer.
|
||||||
+ (void)runNowOrWhenAppWillBecomeReady:(AppReadyBlock)block NS_SWIFT_NAME(runNowOrWhenAppWillBecomeReady(_:));
|
+ (void)runNowOrWhenAppWillBecomeReady:(AppReadyBlock)block NS_SWIFT_NAME(runNowOrWhenAppWillBecomeReady(_:));
|
||||||
|
+ (void)runNowOrWhenAppDidBecomeReadySync:(AppReadyBlock)block NS_SWIFT_NAME(runNowOrWhenAppDidBecomeReadySync(_:));
|
||||||
+ (void)runNowOrWhenAppDidBecomeReady:(AppReadyBlock)block NS_SWIFT_NAME(runNowOrWhenAppDidBecomeReady(_:));
|
+ (void)runNowOrWhenAppDidBecomeReady:(AppReadyBlock)block NS_SWIFT_NAME(runNowOrWhenAppDidBecomeReady(_:));
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -73,6 +73,13 @@ NS_ASSUME_NONNULL_BEGIN
|
||||||
[self.appWillBecomeReadyBlocks addObject:block];
|
[self.appWillBecomeReadyBlocks addObject:block];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
+ (void)runNowOrWhenAppDidBecomeReadySync:(AppReadyBlock)block
|
||||||
|
{
|
||||||
|
DispatchSyncMainThreadSafe(^{
|
||||||
|
[self.sharedManager runNowOrWhenAppDidBecomeReady:block];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
+ (void)runNowOrWhenAppDidBecomeReady:(AppReadyBlock)block
|
+ (void)runNowOrWhenAppDidBecomeReady:(AppReadyBlock)block
|
||||||
{
|
{
|
||||||
DispatchMainThreadSafe(^{
|
DispatchMainThreadSafe(^{
|
||||||
|
|
|
@ -393,3 +393,48 @@ public extension UIBarButtonItem {
|
||||||
self.accessibilityIdentifier = accessibilityIdentifier
|
self.accessibilityIdentifier = accessibilityIdentifier
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MARK: -
|
||||||
|
|
||||||
|
@objc
|
||||||
|
public extension UIButton {
|
||||||
|
|
||||||
|
func setTemplateImage(_ templateImage: UIImage?, tintColor: UIColor) {
|
||||||
|
guard let templateImage = templateImage else {
|
||||||
|
owsFailDebug("Missing image")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
setImage(templateImage.withRenderingMode(.alwaysTemplate), for: .normal)
|
||||||
|
self.tintColor = tintColor
|
||||||
|
}
|
||||||
|
|
||||||
|
func setTemplateImageName(_ imageName: String, tintColor: UIColor) {
|
||||||
|
guard let image = UIImage(named: imageName) else {
|
||||||
|
owsFailDebug("Couldn't load image: \(imageName)")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
setTemplateImage(image, tintColor: tintColor)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: -
|
||||||
|
@objc
|
||||||
|
public extension UIImageView {
|
||||||
|
|
||||||
|
func setTemplateImage(_ templateImage: UIImage?, tintColor: UIColor) {
|
||||||
|
guard let templateImage = templateImage else {
|
||||||
|
owsFailDebug("Missing image")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
self.image = templateImage.withRenderingMode(.alwaysTemplate)
|
||||||
|
self.tintColor = tintColor
|
||||||
|
}
|
||||||
|
|
||||||
|
func setTemplateImageName(_ imageName: String, tintColor: UIColor) {
|
||||||
|
guard let image = UIImage(named: imageName) else {
|
||||||
|
owsFailDebug("Couldn't load image: \(imageName)")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
setTemplateImage(image, tintColor: tintColor)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue