Skip to content

Commit f20ca7a

Browse files
tomekkuzma-megaJPedroAmorim
authored andcommitted
T16622735: share extension background
1 parent a2b0bc1 commit f20ca7a

File tree

3 files changed

+47
-8
lines changed

3 files changed

+47
-8
lines changed

iMEGA/Extensions/MEGAShare/ShareDestinationTableViewController+TableViewDataSource.swift

+40-1
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,50 @@ extension ShareDestinationTableViewController {
112112
footer.textLabel?.textColor = secondaryTextColor
113113
}
114114

115+
private var designTokenEnabled: Bool {
116+
DIContainer.featureFlagProvider.isFeatureFlagEnabled(for: .designToken)
117+
}
118+
115119
private var secondaryTextColor: UIColor {
116-
if DIContainer.featureFlagProvider.isFeatureFlagEnabled(for: .designToken) {
120+
if designTokenEnabled {
117121
TokenColors.Text.secondary
118122
} else {
119123
UIColor.secondaryLabel
120124
}
121125
}
126+
127+
private func separatorColor(for traitCollection: UITraitCollection) -> UIColor {
128+
if designTokenEnabled {
129+
return TokenColors.Border.strong
130+
} else {
131+
switch traitCollection.userInterfaceStyle {
132+
case .unspecified, .light:
133+
return UIColor.gray3C3C4330
134+
case .dark:
135+
return UIColor.gray54545865
136+
@unknown default:
137+
return UIColor.gray3C3C4330
138+
}
139+
}
140+
}
141+
142+
private func secondaryBackground(for traitCollection: UITraitCollection) -> UIColor {
143+
if designTokenEnabled {
144+
return TokenColors.Background.page
145+
} else {
146+
switch traitCollection.userInterfaceStyle {
147+
case .unspecified, .light:
148+
return UIColor.whiteF7F7F7
149+
case .dark:
150+
return UIColor.black1C1C1E
151+
@unknown default:
152+
return UIColor.black1C1C1E
153+
}
154+
}
155+
}
156+
157+
@objc func updateAppearance() {
158+
tableView.separatorColor = separatorColor(for: traitCollection)
159+
tableView.backgroundColor = secondaryBackground(for: traitCollection)
160+
}
122161
}

iMEGA/Extensions/MEGAShare/ShareDestinationTableViewController.m

-6
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,6 @@ - (void)traitCollectionDidChange:(UITraitCollection *)previousTraitCollection {
7676

7777
#pragma mark - Private
7878

79-
- (void)updateAppearance {
80-
self.tableView.separatorColor = [UIColor mnz_separatorForTraitCollection:self.traitCollection];
81-
self.tableView.backgroundColor = [UIColor pageBackgroundForTraitCollection:self.traitCollection];
82-
[self.tableView reloadData];
83-
}
84-
8579
- (void)hideKeyboard {
8680
[self.view endEditing:YES];
8781
}

iMEGA/Extensions/MEGAShare/Views/ShareAttachmentCellView.swift

+7-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ struct ShareAttachmentCellView: View {
3232

3333
Text(viewModel.fileExtension)
3434
.font(.system(size: 15))
35-
.foregroundColor(foregroundColor)
35+
.foregroundColor(foregroundColorFileExtension)
3636
.fixedSize()
3737
}
3838
}
@@ -55,6 +55,12 @@ struct ShareAttachmentCellView: View {
5555
}
5656
}
5757

58+
var foregroundColorFileExtension: Color {
59+
isDesignTokenEnabled
60+
? TokenColors.Text.secondary.swiftUI
61+
: Color(UIColor.gray8E8E93)
62+
}
63+
5864
var backgroundColor: Color {
5965
if isDesignTokenEnabled {
6066
TokenColors.Background.page.swiftUI

0 commit comments

Comments
 (0)