Skip to content

Commit

Permalink
Replace earth with SF-symbol (#250)
Browse files Browse the repository at this point in the history
  • Loading branch information
zeitschlag committed Apr 11, 2024
1 parent 1b98c0c commit d198547
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 48 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import MastodonCore
import MastodonAsset
import MastodonLocalization
import MastodonUI
import MastodonSDK

public protocol NotificationViewDelegate: AnyObject {
func notificationView(_ notificationView: NotificationView, authorAvatarButtonDidPressed button: AvatarButton)
Expand Down Expand Up @@ -93,7 +94,7 @@ public final class NotificationView: UIView {
let imageView = UIImageView()
imageView.tintColor = Asset.Colors.Label.secondary.color
imageView.contentMode = .scaleAspectFit
imageView.image = Asset.Scene.Compose.earth.image.withRenderingMode(.alwaysTemplate)
imageView.image = Mastodon.Entity.Status.Visibility.public.image.withRenderingMode(.alwaysTemplate)
return imageView
}()

Expand Down

This file was deleted.

Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
//

import Foundation
import UIKit
import MastodonLocalization

extension Mastodon.Entity {

Expand Down Expand Up @@ -109,9 +111,9 @@ extension Mastodon.Entity.Status {
case unlisted
case `private`
case direct

case _other(String)

public init?(rawValue: String) {
switch rawValue {
case "public": self = .public
Expand All @@ -121,7 +123,7 @@ extension Mastodon.Entity.Status {
default: self = ._other(rawValue)
}
}

public var rawValue: String {
switch self {
case .public: return "public"
Expand All @@ -131,6 +133,27 @@ extension Mastodon.Entity.Status {
case ._other(let value): return value
}
}

public var title: String {
switch self {
case .public: return L10n.Scene.Compose.Visibility.public
case .unlisted: return L10n.Scene.Compose.Visibility.unlisted
case .private: return L10n.Scene.Compose.Visibility.private
case .direct: return L10n.Scene.Compose.Visibility.direct
case ._other(let value): return value
}
}

public var image: UIImage {
switch self {
case .public: return UIImage(systemName: "globe.europe.africa")!.withRenderingMode(.alwaysTemplate)
case .unlisted: return UIImage(systemName: "moon")!.withRenderingMode(.alwaysTemplate)
case .private: return UIImage(systemName: "lock")!.withRenderingMode(.alwaysTemplate)
case .direct: return UIImage(systemName: "at")!.withRenderingMode(.alwaysTemplate)
case ._other: return UIImage(systemName: "ellipsis")!.withRenderingMode(.alwaysTemplate)
}
}

}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,19 @@
import UIKit
import CoreDataStack
import MastodonAsset
import MastodonSDK

extension MastodonVisibility {

public var image: UIImage {
let asset: ImageAsset
let asset: UIImage
switch self {
case .public: asset = Asset.Scene.Compose.earth
case .unlisted: asset = Asset.Scene.Compose.people
case .private: asset = Asset.Scene.Compose.peopleAdd
case .direct: asset = Asset.Scene.Compose.mention
case ._other: asset = Asset.Scene.Compose.questionmarkCircle
case .public: asset = Mastodon.Entity.Status.Visibility.public.image
case .unlisted: asset = Asset.Scene.Compose.people.image
case .private: asset = Asset.Scene.Compose.peopleAdd.image
case .direct: asset = Asset.Scene.Compose.mention.image
case ._other: asset = Asset.Scene.Compose.questionmarkCircle.image
}
return asset.image.withRenderingMode(.alwaysTemplate)
return asset.withRenderingMode(.alwaysTemplate)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ extension ComposeContentToolbarView.ViewModel {
case .contentWarning:
return Asset.Scene.Compose.chatWarningFill.image.withRenderingMode(.alwaysTemplate)
case .visibility:
return Asset.Scene.Compose.earth.image.withRenderingMode(.alwaysTemplate)
return Mastodon.Entity.Status.Visibility.public.image.withRenderingMode(.alwaysTemplate)
case .language:
fatalError("Language’s active image is never accessed")
}
Expand All @@ -82,7 +82,7 @@ extension ComposeContentToolbarView.ViewModel {
case .contentWarning:
return Asset.Scene.Compose.chatWarning.image.withRenderingMode(.alwaysTemplate)
case .visibility:
return Asset.Scene.Compose.earth.image.withRenderingMode(.alwaysTemplate)
return Mastodon.Entity.Status.Visibility.public.image
case .language:
fatalError("Language’s inactive image is never accessed")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,23 +220,4 @@ extension ComposeContentToolbarView {
}

extension Mastodon.Entity.Status.Visibility {
fileprivate var title: String {
switch self {
case .public: return L10n.Scene.Compose.Visibility.public
case .unlisted: return L10n.Scene.Compose.Visibility.unlisted
case .private: return L10n.Scene.Compose.Visibility.private
case .direct: return L10n.Scene.Compose.Visibility.direct
case ._other(let value): return value
}
}

fileprivate var image: UIImage {
switch self {
case .public: return UIImage(systemName: "globe.europe.africa")!.withRenderingMode(.alwaysTemplate)
case .unlisted: return UIImage(systemName: "moon")!.withRenderingMode(.alwaysTemplate)
case .private: return UIImage(systemName: "lock")!.withRenderingMode(.alwaysTemplate)
case .direct: return UIImage(systemName: "at")!.withRenderingMode(.alwaysTemplate)
case ._other: return UIImage(systemName: "ellipsis")!.withRenderingMode(.alwaysTemplate)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import MetaTextKit
import MastodonAsset
import MastodonCore
import MastodonLocalization
import MastodonSDK

public class StatusAuthorView: UIStackView {
private var _disposeBag = Set<AnyCancellable>() // which lifetime same to view scope
Expand Down Expand Up @@ -49,7 +50,7 @@ public class StatusAuthorView: UIStackView {
let imageView = UIImageView()
imageView.tintColor = Asset.Colors.Label.secondary.color
imageView.contentMode = .scaleAspectFit
imageView.image = Asset.Scene.Compose.earth.image.withRenderingMode(.alwaysTemplate)
imageView.image = Mastodon.Entity.Status.Visibility.public.image
return imageView
}()

Expand Down

0 comments on commit d198547

Please sign in to comment.