Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Profile the timeline performance #141

Merged
merged 6 commits into from
Sep 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 23 additions & 25 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,46 +1,45 @@
GEM
remote: https://rubygems.org/
specs:
CFPropertyList (3.0.5)
CFPropertyList (3.0.6)
rexml
activesupport (6.1.6)
activesupport (7.0.7.2)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
tzinfo (~> 2.0)
zeitwerk (~> 2.3)
addressable (2.8.0)
public_suffix (>= 2.0.2, < 5.0)
addressable (2.8.5)
public_suffix (>= 2.0.2, < 6.0)
algoliasearch (1.27.5)
httpclient (~> 2.8, >= 2.8.3)
json (>= 1.5.1)
arkana (1.1.1)
colorize (~> 0.8)
arkana (1.5.0)
dotenv (~> 2.7)
rainbow (~> 3.1.1)
yaml (~> 0.2)
atomos (0.1.3)
claide (1.1.0)
cocoapods (1.11.3)
cocoapods (1.12.1)
addressable (~> 2.8)
claide (>= 1.0.2, < 2.0)
cocoapods-core (= 1.11.3)
cocoapods-core (= 1.12.1)
cocoapods-deintegrate (>= 1.0.3, < 2.0)
cocoapods-downloader (>= 1.4.0, < 2.0)
cocoapods-downloader (>= 1.6.0, < 2.0)
cocoapods-plugins (>= 1.0.0, < 2.0)
cocoapods-search (>= 1.0.0, < 2.0)
cocoapods-trunk (>= 1.4.0, < 2.0)
cocoapods-trunk (>= 1.6.0, < 2.0)
cocoapods-try (>= 1.1.0, < 2.0)
colored2 (~> 3.1)
escape (~> 0.0.4)
fourflusher (>= 2.3.0, < 3.0)
gh_inspector (~> 1.0)
molinillo (~> 0.8.0)
nap (~> 1.0)
ruby-macho (>= 1.0, < 3.0)
ruby-macho (>= 2.3.0, < 3.0)
xcodeproj (>= 1.21.0, < 2.0)
cocoapods-clean (0.0.1)
cocoapods-core (1.11.3)
activesupport (>= 5.0, < 7)
cocoapods-core (1.12.1)
activesupport (>= 5.0, < 8)
addressable (~> 2.8)
algoliasearch (~> 1.0)
concurrent-ruby (~> 1.1)
Expand All @@ -59,32 +58,32 @@ GEM
netrc (~> 0.11)
cocoapods-try (1.2.0)
colored2 (3.1.2)
colorize (0.8.1)
concurrent-ruby (1.1.10)
dotenv (2.7.6)
concurrent-ruby (1.2.2)
dotenv (2.8.1)
escape (0.0.4)
ethon (0.15.0)
ethon (0.16.0)
ffi (>= 1.15.0)
ffi (1.15.5)
fourflusher (2.3.1)
fuzzy_match (2.0.4)
gh_inspector (1.1.3)
httpclient (2.8.3)
i18n (1.10.0)
i18n (1.14.1)
concurrent-ruby (~> 1.0)
json (2.6.2)
minitest (5.16.2)
json (2.6.3)
minitest (5.19.0)
molinillo (0.8.0)
nanaimo (0.3.0)
nap (1.1.0)
netrc (0.11.0)
public_suffix (4.0.7)
rexml (3.2.5)
rainbow (3.1.1)
rexml (3.2.6)
rouge (2.0.7)
ruby-macho (2.5.1)
typhoeus (1.4.0)
ethon (>= 0.9.0)
tzinfo (2.0.4)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
xcodeproj (1.22.0)
CFPropertyList (>= 2.3.3, < 4.0)
Expand All @@ -95,8 +94,7 @@ GEM
rexml (~> 3.2.4)
xcpretty (0.3.0)
rouge (~> 2.0.7)
yaml (0.2.0)
zeitwerk (2.6.0)
yaml (0.2.1)

PLATFORMS
arm64-darwin-21
Expand Down
4 changes: 2 additions & 2 deletions NotificationService/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>CFBundleShortVersionString</key>
<string>2.0.1</string>
<string>2.1.0</string>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key>
Expand All @@ -19,7 +19,7 @@
<key>CFBundlePackageType</key>
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleVersion</key>
<string>140</string>
<string>142</string>
<key>NSExtension</key>
<dict>
<key>NSExtensionPointIdentifier</key>
Expand Down
4 changes: 2 additions & 2 deletions ShareExtension/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
<key>CFBundlePackageType</key>
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key>
<string>2.0.1</string>
<string>2.1.0</string>
<key>CFBundleVersion</key>
<string>140</string>
<string>142</string>
<key>NSExtension</key>
<dict>
<key>NSExtensionAttributes</key>
Expand Down
2 changes: 1 addition & 1 deletion TwidereSDK/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ let package = Package(
.package(url: "https://github.com/krzyzanowskim/CryptoSwift.git", from: "1.6.0"),
.package(url: "https://github.com/tid-kijyun/Kanna.git", from: "5.2.7"),
.package(url: "https://github.com/JohnSundell/CollectionConcurrencyKit.git", from: "0.2.0"),
.package(url: "https://github.com/TwidereProject/TwitterSDK.git", exact: "0.17.0"),
.package(url: "https://github.com/TwidereProject/TwitterSDK.git", exact: "0.18.0"),
.package(name: "ArkanaKeys", path: "../dependencies/ArkanaKeys"),
.package(name: "CoverFlowStackLayout", path: "../CoverFlowStackLayout"),
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ extension NotificationView {

@Published public var viewLayoutFrame = ViewLayoutFrame()


// input
public let notification: NotificationObject
public let authContext: AuthContext?
Expand Down Expand Up @@ -131,10 +130,18 @@ extension NotificationView.ViewModel {
if let info = _info {
let _notificationHeaderViewModel = StatusHeaderView.ViewModel(
image: info.iconImage,
label: info.textMetaContent
label: info.textMetaContent,
delegate: self
)
_notificationHeaderViewModel.hasHangingAvatar = true
_notificationHeaderViewModel.delegate = self
self.notificationHeaderViewModel = _notificationHeaderViewModel
}
} // end init
}

// MARK: - StatusHeaderViewDelegate
extension NotificationView.ViewModel: StatusHeaderViewDelegate {
public func headerViewDidPressed(_ viewModel: StatusHeaderView.ViewModel) {
// FIXME:
}
}
43 changes: 33 additions & 10 deletions TwidereSDK/Sources/TwidereUI/Content/StatusHeaderView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ import TwidereLocalization
import Meta
import Kingfisher

public protocol StatusHeaderViewDelegate: AnyObject {
func headerViewDidPressed(_ viewModel: StatusHeaderView.ViewModel)
}

public struct StatusHeaderView: View {

static var iconImageTrailingSpacing: CGFloat { 4.0 }
Expand All @@ -33,38 +37,57 @@ public struct StatusHeaderView: View {
VectorImageView(image: viewModel.image)
.frame(width: iconImageDimension, height: iconImageDimension)
.offset(y: -1)
LabelRepresentable(
metaContent: viewModel.label,
textStyle: .statusHeader,
setupLabel: { label in
// do nothing
}
)
.fixedSize(horizontal: false, vertical: true)
if viewModel.isLabelContainsMeta {
LabelRepresentable(
metaContent: viewModel.label,
textStyle: .statusHeader,
setupLabel: { label in
// do nothing
}
)
} else {
Text(viewModel.label.string)
.font(Font(TextStyle.statusHeader.font))
.foregroundColor(Color(uiColor: TextStyle.statusHeader.textColor))
.lineLimit(1)
}
Spacer()
} // HStack
} // HStack
.fixedSize(horizontal: false, vertical: true)
.onTapGesture {
// TODO:
viewModel.delegate?.headerViewDidPressed(viewModel)
}
} // end body

}

extension StatusHeaderView {
public class ViewModel: ObservableObject {

weak var delegate: StatusHeaderViewDelegate?

@Published public var image: UIImage
@Published public var label: MetaContent
@Published public var isLabelContainsMeta: Bool

@Published public var hasHangingAvatar: Bool = false
@Published public var avatarDimension: CGFloat = StatusView.hangingAvatarButtonDimension

public init(
image: UIImage,
label: MetaContent
label: MetaContent,
delegate: StatusHeaderViewDelegate?
) {
self.image = image
self.label = label
self.delegate = delegate
self.isLabelContainsMeta = label.entities.contains(where: { entity in
switch entity.meta {
case .emoji: return true
default: return false
}
})
}
}
}
Loading