Procházet zdrojové kódy

Merge pull request #308 from deltachat/remove-dead-code

remove unused ProfileView.swift file
cyBerta před 5 roky
rodič
revize
fbea73ec5a

+ 0 - 4
deltachat-ios.xcodeproj/project.pbxproj

@@ -12,7 +12,6 @@
 		3060119C22DDE24000C1CE6F /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 3060119E22DDE24000C1CE6F /* Localizable.strings */; };
 		306011B622E5E7FB00C1CE6F /* Localizable.stringsdict in Resources */ = {isa = PBXBuildFile; fileRef = 306011B422E5E7FB00C1CE6F /* Localizable.stringsdict */; };
 		30A4D9AE2332672700544344 /* QrInviteViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30A4D9AD2332672600544344 /* QrInviteViewController.swift */; };
-		30BD261422F8679200F399DF /* ProfileView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30BD261322F8679200F399DF /* ProfileView.swift */; };
 		30BD261622F8812700F399DF /* UIView+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30BD261522F8812700F399DF /* UIView+Extension.swift */; };
 		6795F63A82E94FF7CD2CEC0F /* Pods_deltachat_iosTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2F7009234DB9408201A6CDCB /* Pods_deltachat_iosTests.framework */; };
 		7070FB9B2101ECBB000DC258 /* GroupNameController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7070FB9A2101ECBB000DC258 /* GroupNameController.swift */; };
@@ -148,7 +147,6 @@
 		306011C822E5E83100C1CE6F /* zh-Hant-TW */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = "zh-Hant-TW"; path = "zh-Hant-TW.lproj/Localizable.stringsdict"; sourceTree = "<group>"; };
 		306011C922E5E83500C1CE6F /* uk */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = uk; path = uk.lproj/Localizable.stringsdict; sourceTree = "<group>"; };
 		30A4D9AD2332672600544344 /* QrInviteViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QrInviteViewController.swift; sourceTree = "<group>"; };
-		30BD261322F8679200F399DF /* ProfileView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileView.swift; sourceTree = "<group>"; usesTabs = 0; };
 		30BD261522F8812700F399DF /* UIView+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIView+Extension.swift"; sourceTree = "<group>"; usesTabs = 0; };
 		6241BE1534A653E79AD5D01D /* Pods_deltachat_ios.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_deltachat_ios.framework; sourceTree = BUILT_PRODUCTS_DIR; };
 		7070FB9A2101ECBB000DC258 /* GroupNameController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GroupNameController.swift; sourceTree = "<group>"; };
@@ -418,7 +416,6 @@
 				AE728F14229D5C390047565B /* PhotoPickerAlertAction.swift */,
 				AE52EA18229EB53C00C586C9 /* ContactDetailHeader.swift */,
 				AE9DAF0E22C278C6004C9591 /* ChatTitleView.swift */,
-				30BD261322F8679200F399DF /* ProfileView.swift */,
 			);
 			path = View;
 			sourceTree = "<group>";
@@ -730,7 +727,6 @@
 				78E45E4421D3F14A00D4B15E /* UIImage+Extension.swift in Sources */,
 				AE52EA20229EB9F000C586C9 /* EditGroupViewController.swift in Sources */,
 				70B08FCD21073B910097D3EA /* NewGroupMemberChoiceController.swift in Sources */,
-				30BD261422F8679200F399DF /* ProfileView.swift in Sources */,
 				78E45E3E21D3D28C00D4B15E /* DcNavigationController.swift in Sources */,
 				AE18F294228C602A0007B1BE /* SecuritySettingsController.swift in Sources */,
 				78ED838D21D577D000243125 /* events.swift in Sources */,

+ 0 - 156
deltachat-ios/View/ProfileView.swift

@@ -1,156 +0,0 @@
-import UIKit
-
-class ProfileView: UIView {
-
-    private let initialsLabelSize: CGFloat = 54
-    private let imgSize: CGFloat = 25
-
-    override init(frame: CGRect) {
-        super.init(frame: frame)
-        translatesAutoresizingMaskIntoConstraints = false
-        setupSubviews()
-    }
-
-    required init?(coder _: NSCoder) {
-        fatalError("init(coder:) has not been implemented")
-    }
-
-    let avatar: UIView = {
-        let avatar = UIView()
-        return avatar
-    }()
-
-    lazy var imgView: UIImageView = {
-        let imgView = UIImageView()
-        let img = UIImage(named: "approval")!.withRenderingMode(.alwaysTemplate)
-        imgView.isHidden = true
-        imgView.image = img
-        imgView.bounds = CGRect(
-            x: 0,
-            y: 0,
-            width: imgSize, height: imgSize
-        )
-        return imgView
-    }()
-
-    lazy var initialsLabel: UILabel = {
-        let initialsLabel = UILabel()
-        initialsLabel.textAlignment = NSTextAlignment.center
-        initialsLabel.textColor = UIColor.white
-        initialsLabel.font = UIFont.systemFont(ofSize: 22)
-        initialsLabel.backgroundColor = UIColor.green
-        let initialsLabelCornerRadius = (initialsLabelSize - 6) / 2
-        initialsLabel.layer.cornerRadius = initialsLabelCornerRadius
-        initialsLabel.clipsToBounds = true
-        return initialsLabel
-    }()
-
-    let nameLabel: UILabel = {
-        let label = UILabel()
-        label.font = UIFont.systemFont(ofSize: 16, weight: .medium)
-        label.lineBreakMode = .byTruncatingTail
-        label.textColor = UIColor(hexString: "2f3944")
-        // label.makeBorder()
-        return label
-
-    }()
-
-    let emailLabel: UILabel = {
-        let label = UILabel()
-        label.font = UIFont.systemFont(ofSize: 14)
-        label.textColor = UIColor(hexString: "848ba7")
-        label.lineBreakMode = .byTruncatingTail
-        return label
-    }()
-
-    var darkMode: Bool = false {
-        didSet {
-            if darkMode {
-                self.backgroundColor = UIColor.darkGray
-                nameLabel.textColor = UIColor.white
-                emailLabel.textColor = UIColor.white
-            }
-        }
-    }
-
-    private func setupSubviews() {
-        let margin: CGFloat = 10
-
-        initialsLabel.translatesAutoresizingMaskIntoConstraints = false
-        avatar.translatesAutoresizingMaskIntoConstraints = false
-        initialsLabel.widthAnchor.constraint(equalToConstant: initialsLabelSize - 6).isActive = true
-        initialsLabel.heightAnchor.constraint(equalToConstant: initialsLabelSize - 6).isActive = true
-
-        avatar.widthAnchor.constraint(equalToConstant: initialsLabelSize).isActive = true
-        avatar.heightAnchor.constraint(equalToConstant: initialsLabelSize).isActive = true
-
-        avatar.addSubview(initialsLabel)
-        self.addSubview(avatar)
-
-        initialsLabel.topAnchor.constraint(equalTo: avatar.topAnchor, constant: 3).isActive = true
-        initialsLabel.leadingAnchor.constraint(equalTo: avatar.leadingAnchor, constant: 3).isActive = true
-        initialsLabel.trailingAnchor.constraint(equalTo: avatar.trailingAnchor, constant: -3).isActive = true
-
-        avatar.leadingAnchor.constraint(equalTo: self.leadingAnchor, constant: margin).isActive = true
-        avatar.center.y = self.center.y
-        avatar.center.x += initialsLabelSize / 2
-        avatar.topAnchor.constraint(equalTo: self.topAnchor, constant: margin).isActive = true
-        avatar.bottomAnchor.constraint(lessThanOrEqualTo: self.bottomAnchor, constant: -margin).isActive = true
-        initialsLabel.center = avatar.center
-
-        let myStackView = UIStackView()
-        myStackView.translatesAutoresizingMaskIntoConstraints = false
-        myStackView.clipsToBounds = true
-
-        let toplineStackView = UIStackView()
-        toplineStackView.axis = .horizontal
-
-        let bottomLineStackView = UIStackView()
-        bottomLineStackView.axis = .horizontal
-
-        toplineStackView.addArrangedSubview(nameLabel)
-        bottomLineStackView.addArrangedSubview(emailLabel)
-
-        self.addSubview(myStackView)
-        myStackView.leadingAnchor.constraint(equalTo: avatar.trailingAnchor, constant: margin).isActive = true
-        myStackView.centerYAnchor.constraint(equalTo: avatar.centerYAnchor).isActive = true
-        myStackView.trailingAnchor.constraint(equalTo: self.trailingAnchor, constant: -margin).isActive = true
-        myStackView.axis = .vertical
-        myStackView.addArrangedSubview(toplineStackView)
-        myStackView.addArrangedSubview(bottomLineStackView)
-
-        imgView.tintColor = DcColors.primary
-
-        avatar.addSubview(imgView)
-
-        imgView.center.x = avatar.center.x + (avatar.frame.width / 2) + imgSize - 5
-        imgView.center.y = avatar.center.y + (avatar.frame.height / 2) + imgSize - 5
-    }
-
-    func setBackgroundColor(_ color: UIColor) {
-        self.backgroundColor = color
-    }
-
-    func setColor(_ color: UIColor) {
-        initialsLabel.backgroundColor = color
-    }
-
-    func setVerified(isVerified: Bool) {
-        imgView.isHidden = !isVerified
-    }
-
-    func setImage(_ img: UIImage) {
-        let attachment = NSTextAttachment()
-        attachment.image = img
-        initialsLabel.attributedText = NSAttributedString(attachment: attachment)
-    }
-
-    func setBackupImage(name: String, color: UIColor) {
-        let text = Utils.getInitials(inputName: name)
-
-        initialsLabel.textAlignment = .center
-        initialsLabel.text = text
-
-        setColor(color)
-    }
-}