Browse Source

Merge pull request #849 from deltachat/location_streaming_icon_tweak

tweak location streaming indicator icon:
cyBerta 5 years ago
parent
commit
38c8e59341

BIN
deltachat-ios/Assets.xcassets/ic_location.imageset/ic_location_on_white_24pt_1x.png


BIN
deltachat-ios/Assets.xcassets/ic_location.imageset/ic_location_on_white_24pt_2x.png


BIN
deltachat-ios/Assets.xcassets/ic_location.imageset/ic_location_on_white_24pt_3x.png


+ 1 - 5
deltachat-ios/View/ContactCell.swift

@@ -90,11 +90,7 @@ class ContactCell: UITableViewCell {
     }()
 
     private let locationStreamingIndicator: UIImageView = {
-        let view = UIImageView()
-        view.translatesAutoresizingMaskIntoConstraints = false
-        view.widthAnchor.constraint(equalToConstant: 16).isActive = true
-        view.tintColor = DcColors.checkmarkGreen
-        view.image = #imageLiteral(resourceName: "ic_location").withRenderingMode(.alwaysTemplate)
+        let view = LocationStreamingIndicator(height: 16)
         view.isHidden = true
         view.contentMode = .scaleAspectFit
         return view

+ 8 - 1
deltachat-ios/View/LocationStreamingIndicator.swift

@@ -3,10 +3,17 @@ import DcCore
 
 class LocationStreamingIndicator: UIImageView {
 
+    private let aspectRatio: CGFloat = 16/22
+
     convenience init() {
         self.init(frame: .zero)
     }
 
+    convenience init(height: CGFloat) {
+        let rect = CGRect(x: 0, y: 0, width: 0, height: height)
+        self.init(frame: rect)
+    }
+
     override init(frame: CGRect) {
         super.init(frame: frame)
         let size: CGFloat = frame == .zero ? 28 : frame.height
@@ -22,6 +29,6 @@ class LocationStreamingIndicator: UIImageView {
         image =  #imageLiteral(resourceName: "ic_location").withRenderingMode(.alwaysTemplate)
         translatesAutoresizingMaskIntoConstraints = false
         heightAnchor.constraint(equalToConstant: size).isActive = true
-        widthAnchor.constraint(equalToConstant: size).isActive = true
+        widthAnchor.constraint(equalToConstant: aspectRatio * size).isActive = true
     }
 }