Merge pull request #801 from j-f1/remove-NotificationAvatarButton

Remove unused NotificationAvatarButton and RoundedImageView classes
This commit is contained in:
Nathan Mattes 2022-12-26 15:38:45 +01:00 committed by GitHub
commit b445bb4754
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 0 additions and 98 deletions

View File

@ -135,7 +135,6 @@
DB0618032785A7100030EE79 /* RegisterSection.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB0618022785A7100030EE79 /* RegisterSection.swift */; };
DB0618052785A73D0030EE79 /* RegisterItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB0618042785A73D0030EE79 /* RegisterItem.swift */; };
DB0A322E280EE9FD001729D2 /* DiscoveryIntroBannerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB0A322D280EE9FD001729D2 /* DiscoveryIntroBannerView.swift */; };
DB0C947726A7FE840088FB11 /* NotificationAvatarButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB0C947626A7FE840088FB11 /* NotificationAvatarButton.swift */; };
DB0EF72B26FDB1D200347686 /* SidebarListCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB0EF72A26FDB1D200347686 /* SidebarListCollectionViewCell.swift */; };
DB0EF72E26FDB24F00347686 /* SidebarListContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB0EF72D26FDB24F00347686 /* SidebarListContentView.swift */; };
DB0F8150264D1E2500F2A12B /* PickServerLoaderTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB0F814F264D1E2500F2A12B /* PickServerLoaderTableViewCell.swift */; };
@ -669,7 +668,6 @@
DB0618042785A73D0030EE79 /* RegisterItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RegisterItem.swift; sourceTree = "<group>"; };
DB0618062785A8880030EE79 /* MastodonRegisterViewModel+Diffable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "MastodonRegisterViewModel+Diffable.swift"; sourceTree = "<group>"; };
DB0A322D280EE9FD001729D2 /* DiscoveryIntroBannerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DiscoveryIntroBannerView.swift; sourceTree = "<group>"; };
DB0C947626A7FE840088FB11 /* NotificationAvatarButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationAvatarButton.swift; sourceTree = "<group>"; };
DB0EF72A26FDB1D200347686 /* SidebarListCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SidebarListCollectionViewCell.swift; sourceTree = "<group>"; };
DB0EF72D26FDB24F00347686 /* SidebarListContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SidebarListContentView.swift; sourceTree = "<group>"; };
DB0F814E264CFFD300F2A12B /* ar */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ar; path = ar.lproj/InfoPlist.strings; sourceTree = "<group>"; };
@ -1635,14 +1633,6 @@
path = View;
sourceTree = "<group>";
};
DB0C947826A7FE950088FB11 /* Button */ = {
isa = PBXGroup;
children = (
DB0C947626A7FE840088FB11 /* NotificationAvatarButton.swift */,
);
path = Button;
sourceTree = "<group>";
};
DB0EF72C26FDB1D600347686 /* View */ = {
isa = PBXGroup;
children = (
@ -2392,7 +2382,6 @@
isa = PBXGroup;
children = (
DB63F765279A5E5600455B82 /* NotificationTimeline */,
DB0C947826A7FE950088FB11 /* Button */,
2D35237F26256F470031AF25 /* Cell */,
DB9D6BF725E4F5690051B173 /* NotificationViewController.swift */,
2D607AD726242FC500B70763 /* NotificationViewModel.swift */,
@ -3273,7 +3262,6 @@
DB603113279EBEBA00A935FE /* DataSourceFacade+Block.swift in Sources */,
DB63F777279A9A2A00455B82 /* NotificationView+Configuration.swift in Sources */,
DB029E95266A20430062874E /* MastodonAuthenticationController.swift in Sources */,
DB0C947726A7FE840088FB11 /* NotificationAvatarButton.swift in Sources */,
5B90C461262599800002E742 /* SettingsLinkTableViewCell.swift in Sources */,
DB6180DD263918E30018D199 /* MediaPreviewViewController.swift in Sources */,
DBE3CDEC261C6B2900430CC6 /* FavoriteViewController.swift in Sources */,

View File

@ -1,86 +0,0 @@
//
// NotificationAvatarButton.swift
// Mastodon
//
// Created by MainasuK Cirno on 2021-7-21.
//
import UIKit
import FLAnimatedImage
import MastodonUI
final class NotificationAvatarButton: AvatarButton {
// Size fixed
static let containerSize = CGSize(width: 35, height: 35)
static let badgeImageViewSize = CGSize(width: 24, height: 24)
static let badgeImageMaskSize = CGSize(width: badgeImageViewSize.width + 4, height: badgeImageViewSize.height + 4)
let badgeImageView: UIImageView = {
let imageView = RoundedImageView()
imageView.contentMode = .center
imageView.isOpaque = true
imageView.layer.shouldRasterize = true
imageView.layer.rasterizationScale = UIScreen.main.scale
return imageView
}()
override func _init() {
super._init()
size = CGSize(width: 35, height: 35)
let path: CGPath = {
let path = CGMutablePath()
path.addRect(CGRect(origin: .zero, size: NotificationAvatarButton.containerSize))
let x: CGFloat = {
if UIApplication.shared.userInterfaceLayoutDirection == .rightToLeft {
return -0.5 * NotificationAvatarButton.badgeImageMaskSize.width
} else {
return NotificationAvatarButton.containerSize.width - 0.5 * NotificationAvatarButton.badgeImageMaskSize.width
}
}()
path.addPath(UIBezierPath(
ovalIn: CGRect(
x: x,
y: NotificationAvatarButton.containerSize.height - 0.5 * NotificationAvatarButton.badgeImageMaskSize.width,
width: NotificationAvatarButton.badgeImageMaskSize.width,
height: NotificationAvatarButton.badgeImageMaskSize.height
)
).cgPath)
return path
}()
let maskShapeLayer = CAShapeLayer()
maskShapeLayer.backgroundColor = UIColor.black.cgColor
maskShapeLayer.fillRule = .evenOdd
maskShapeLayer.path = path
avatarImageView.layer.mask = maskShapeLayer
badgeImageView.translatesAutoresizingMaskIntoConstraints = false
addSubview(badgeImageView)
NSLayoutConstraint.activate([
badgeImageView.centerXAnchor.constraint(equalTo: trailingAnchor),
badgeImageView.centerYAnchor.constraint(equalTo: bottomAnchor),
badgeImageView.widthAnchor.constraint(equalToConstant: NotificationAvatarButton.badgeImageViewSize.width).priority(.required - 1),
badgeImageView.heightAnchor.constraint(equalToConstant: NotificationAvatarButton.badgeImageViewSize.height).priority(.required - 1),
])
}
override func updateAppearance() {
super.updateAppearance()
badgeImageView.alpha = primaryActionState.contains(.highlighted) ? 0.6 : 1.0
}
}
final class RoundedImageView: UIImageView {
override func layoutSubviews() {
super.layoutSubviews()
layer.masksToBounds = true
layer.cornerRadius = bounds.width / 2
layer.cornerCurve = .circular
}
}