mirror of
https://github.com/lux-tel/session-ios.git
synced 2026-10-30 20:38:32 +00:00
• Added the ability to set the custom file server via env variables for testing • Disable image editing on the share extension if there isn't enough RAM available to edit the image (ie. prevent crashes due to insufficient memory) • Tweaked image loading to avoid pre-decoding large static images to reduce memory spikes (was crashing the share extension on some devices) • Updated link previews to load images using the ImageDataManager • Fixed an issue where the file id on the message info screen would include extra info • Fixed an issue where sharing a file wouldn't show the preview correctly • Fixed an issue where the re-upload job could run when a display picture file was missing • Fixed an issue where deleting messages across all devices in Note to Self was using the wrong deletion function • Fixed an issue where an invalid database value could result in no attachments being able to be loaded in a conversation • Fixed an issue where images with orientation metadata would be incorrectly rotated and letterboxed
51 lines
1.5 KiB
Swift
51 lines
1.5 KiB
Swift
//
|
|
// Copyright (c) 2019 Open Whisper Systems. All rights reserved.
|
|
//
|
|
|
|
import UIKit
|
|
import SessionUIKit
|
|
|
|
public extension NSObject {
|
|
func navigationBarButton(imageName: String, enabled: Bool = true, selector: Selector) -> UIView {
|
|
let button = OWSButton()
|
|
button.setImage(imageName: imageName)
|
|
button.themeTintColor = .textPrimary
|
|
button.isEnabled = enabled
|
|
button.addTarget(self, action: selector, for: .touchUpInside)
|
|
|
|
return button
|
|
}
|
|
}
|
|
|
|
// MARK: -
|
|
|
|
public extension UIViewController {
|
|
|
|
func updateNavigationBar(navigationBarItems: [UIView]) {
|
|
guard navigationBarItems.count > 0 else {
|
|
self.navigationItem.rightBarButtonItems = []
|
|
return
|
|
}
|
|
|
|
let spacing: CGFloat = 16
|
|
let stackView = UIStackView(arrangedSubviews: navigationBarItems)
|
|
stackView.axis = .horizontal
|
|
stackView.spacing = spacing
|
|
stackView.alignment = .center
|
|
|
|
// Ensure layout works on older versions of iOS.
|
|
var stackSize = CGSize.zero
|
|
for item in navigationBarItems {
|
|
let itemSize = item.sizeThatFits(.zero)
|
|
stackSize.width += itemSize.width + spacing
|
|
stackSize.height = max(stackSize.height, itemSize.height)
|
|
}
|
|
if navigationBarItems.count > 0 {
|
|
stackSize.width -= spacing
|
|
}
|
|
stackView.frame = CGRect(origin: .zero, size: stackSize)
|
|
|
|
self.navigationItem.rightBarButtonItem = UIBarButtonItem(customView: stackView)
|
|
}
|
|
}
|