Skip to content

Commit

Permalink
#4090 - Corrected dark theme appearance.
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanceriu committed Jun 3, 2021
1 parent 3dbbfe7 commit b126854
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 24 deletions.
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{
"images" : [
{
"filename" : "voice_message_cancel_fade.png",
"filename" : "voice_message_cancel_gradient.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "voice_message_cancel_fade@2x.png",
"filename" : "voice_message_cancel_gradient@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "voice_message_cancel_fade@3x.png",
"filename" : "voice_message_cancel_gradient@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
Expand Down
2 changes: 1 addition & 1 deletion Riot/Generated/Images.swift
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ internal enum Asset {
internal static let videoCall = ImageAsset(name: "video_call")
internal static let voiceCallHangonIcon = ImageAsset(name: "voice_call_hangon_icon")
internal static let voiceCallHangupIcon = ImageAsset(name: "voice_call_hangup_icon")
internal static let voiceMessageCancelFade = ImageAsset(name: "voice_message_cancel_fade")
internal static let voiceMessageCancelGradient = ImageAsset(name: "voice_message_cancel_gradient")
internal static let voiceMessageRecordButtonDefault = ImageAsset(name: "voice_message_record_button_default")
internal static let voiceMessageRecordButtonRecording = ImageAsset(name: "voice_message_record_button_recording")
internal static let addMemberFloatingAction = ImageAsset(name: "add_member_floating_action")
Expand Down
13 changes: 8 additions & 5 deletions Riot/Modules/Room/Views/InputToolbar/RoomInputToolbarView.m
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ @interface RoomInputToolbarView()
UIAlertController *actionSheet;
}

@property (nonatomic, weak) IBOutlet UIView *voiceMessageToolbarContainerView;
@property (nonatomic, strong) VoiceMessageToolbarView *voiceMessageToolbarView;

@end
Expand Down Expand Up @@ -80,9 +79,13 @@ - (void)awakeFromNib
self.isEncryptionEnabled = _isEncryptionEnabled;

self.voiceMessageToolbarView = [VoiceMessageToolbarView instanceFromNib];
self.voiceMessageToolbarView.frame = self.voiceMessageToolbarContainerView.bounds;
self.voiceMessageToolbarView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
[self.voiceMessageToolbarContainerView addSubview:self.voiceMessageToolbarView];
self.voiceMessageToolbarView.translatesAutoresizingMaskIntoConstraints = NO;
[self addSubview:self.voiceMessageToolbarView];

[NSLayoutConstraint activateConstraints:@[[self.mainToolbarView.topAnchor constraintEqualToAnchor:self.voiceMessageToolbarView.topAnchor],
[self.mainToolbarView.leftAnchor constraintEqualToAnchor:self.voiceMessageToolbarView.leftAnchor],
[self.mainToolbarView.bottomAnchor constraintEqualToAnchor:self.voiceMessageToolbarView.bottomAnchor],
[self.mainToolbarView.rightAnchor constraintEqualToAnchor:self.voiceMessageToolbarView.rightAnchor]]];

[self _updateUIWithTextMessage:nil animated:NO];
}
Expand Down Expand Up @@ -434,7 +437,7 @@ - (void)_updateUIWithTextMessage:(NSString *)textMessage animated:(BOOL)animated

[UIView animateWithDuration:(animated ? 0.15f : 0.0f) animations:^{
self.rightInputToolbarButton.alpha = textMessage.length ? 1.0f : 0.0f;
self.voiceMessageToolbarContainerView.alpha = textMessage.length ? 0.0f : 1.0;
self.voiceMessageToolbarView.alpha = textMessage.length ? 0.0f : 1.0;
}];
}

Expand Down
9 changes: 0 additions & 9 deletions Riot/Modules/Room/Views/InputToolbar/RoomInputToolbarView.xib
Original file line number Diff line number Diff line change
Expand Up @@ -106,29 +106,21 @@
<action selector="onTouchUpInside:" destination="iN0-l3-epB" eventType="touchUpInside" id="Y9g-uz-rAz"/>
</connections>
</button>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="zp9-EN-PLT" customClass="PassthroughView" customModule="Riot" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="600" height="58"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</view>
</subviews>
<constraints>
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="58" id="1FO-iu-urG"/>
<constraint firstItem="Hga-l8-Wua" firstAttribute="leading" secondItem="a84-Vc-6ud" secondAttribute="leading" constant="12" id="31r-fn-347"/>
<constraint firstItem="QWp-NV-uh5" firstAttribute="leading" secondItem="Hga-l8-Wua" secondAttribute="trailing" constant="12" id="M9f-je-3zO"/>
<constraint firstAttribute="bottom" secondItem="QWp-NV-uh5" secondAttribute="bottom" constant="13" id="NGr-2o-sOP"/>
<constraint firstItem="zp9-EN-PLT" firstAttribute="top" secondItem="a84-Vc-6ud" secondAttribute="top" id="OFZ-RG-O8K"/>
<constraint firstAttribute="trailing" secondItem="G8Z-CM-tGs" secondAttribute="trailing" constant="12" id="Sua-LC-3yW"/>
<constraint firstItem="ESv-9w-KJF" firstAttribute="leading" secondItem="Hga-l8-Wua" secondAttribute="trailing" constant="12" id="TIe-py-lFJ"/>
<constraint firstItem="QWp-NV-uh5" firstAttribute="top" secondItem="a84-Vc-6ud" secondAttribute="top" constant="9" id="WyZ-3i-OHi"/>
<constraint firstAttribute="bottom" secondItem="G8Z-CM-tGs" secondAttribute="bottom" constant="12" id="Yam-dS-zwr"/>
<constraint firstAttribute="height" constant="58" id="Yjj-ua-rbe"/>
<constraint firstAttribute="bottom" secondItem="Hga-l8-Wua" secondAttribute="bottom" constant="12" id="b0G-CY-AmP"/>
<constraint firstAttribute="trailing" secondItem="QWp-NV-uh5" secondAttribute="trailing" constant="56" id="hXO-cY-Jgz"/>
<constraint firstItem="zp9-EN-PLT" firstAttribute="leading" secondItem="a84-Vc-6ud" secondAttribute="leading" id="iDd-At-1f7"/>
<constraint firstAttribute="trailing" secondItem="ESv-9w-KJF" secondAttribute="trailing" id="jCS-Tf-vxr"/>
<constraint firstAttribute="bottom" secondItem="zp9-EN-PLT" secondAttribute="bottom" id="o7N-Dj-dCH"/>
<constraint firstAttribute="bottom" secondItem="ESv-9w-KJF" secondAttribute="bottom" constant="12" id="v8r-ac-MKn"/>
<constraint firstAttribute="trailing" secondItem="zp9-EN-PLT" secondAttribute="trailing" id="yEl-3y-oBb"/>
</constraints>
</view>
</subviews>
Expand Down Expand Up @@ -159,7 +151,6 @@
<outlet property="messageComposerContainerBottomConstraint" destination="NGr-2o-sOP" id="oez-6D-IKA"/>
<outlet property="messageComposerContainerTopConstraint" destination="WyZ-3i-OHi" id="OcO-1f-bNA"/>
<outlet property="rightInputToolbarButton" destination="G8Z-CM-tGs" id="NCk-5m-aNF"/>
<outlet property="voiceMessageToolbarContainerView" destination="zp9-EN-PLT" id="St9-oc-beM"/>
</connections>
<point key="canvasLocation" x="137.59999999999999" y="151.12443778110946"/>
</view>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class VoiceMessageToolbarView: PassthroughView, Themable, UIGestureRecognizerDel
@IBOutlet private var slideToCancelContainerView: UIView!
@IBOutlet private var slideToCancelLabel: UILabel!
@IBOutlet private var slideToCancelChevron: UIImageView!
@IBOutlet private var slideToCancelFade: UIImageView!
@IBOutlet private var slideToCancelGradient: UIImageView!

private var cancelLabelToRecordButtonDistance: CGFloat = 0.0

Expand All @@ -59,6 +59,8 @@ class VoiceMessageToolbarView: PassthroughView, Themable, UIGestureRecognizerDel
override func awakeFromNib() {
super.awakeFromNib()

slideToCancelGradient.image = Asset.Images.voiceMessageCancelGradient.image.withRenderingMode(.alwaysTemplate)

let longPressGesture = UILongPressGestureRecognizer(target: self, action: #selector(handleLongPress))
longPressGesture.delegate = self
longPressGesture.minimumPressDuration = 0.1
Expand Down Expand Up @@ -117,15 +119,15 @@ class VoiceMessageToolbarView: PassthroughView, Themable, UIGestureRecognizerDel
case .idle:
self.slideToCancelContainerView.alpha = 0.0
self.backgroundView.alpha = 0.0
self.slideToCancelFade.alpha = 0.0
self.slideToCancelGradient.alpha = 0.0
self.recordButtonsContainerView.transform = .identity
self.slideToCancelContainerView.transform = .identity
self.primaryRecordButton.alpha = 1.0
self.secondaryRecordButton.alpha = 0.0
case .recording:
self.slideToCancelContainerView.alpha = 1.0
self.backgroundView.alpha = 1.0
self.slideToCancelFade.alpha = 1.0
self.slideToCancelGradient.alpha = 1.0
self.primaryRecordButton.alpha = 0.0
self.secondaryRecordButton.alpha = 1.0
}
Expand All @@ -138,6 +140,7 @@ class VoiceMessageToolbarView: PassthroughView, Themable, UIGestureRecognizerDel
self.primaryRecordButton.tintColor = theme.textSecondaryColor
self.slideToCancelLabel.textColor = theme.textSecondaryColor
self.slideToCancelChevron.tintColor = theme.textSecondaryColor
self.slideToCancelGradient.tintColor = theme.backgroundColor
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
</label>
</subviews>
</stackView>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="voice_message_cancel_fade" translatesAutoresizingMaskIntoConstraints="NO" id="BYJ-HN-opT">
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="voice_message_cancel_gradient" translatesAutoresizingMaskIntoConstraints="NO" id="BYJ-HN-opT">
<rect key="frame" x="0.0" y="0.0" width="414" height="40"/>
</imageView>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="7OQ-1F-5qT">
Expand Down Expand Up @@ -98,15 +98,15 @@
<outlet property="secondaryRecordButton" destination="rel-Fo-ROL" id="KXM-gt-9hS"/>
<outlet property="slideToCancelChevron" destination="82A-vC-KEp" id="Chg-EH-UBv"/>
<outlet property="slideToCancelContainerView" destination="6FH-4Q-Z5e" id="qCc-rl-vQX"/>
<outlet property="slideToCancelFade" destination="BYJ-HN-opT" id="qbb-Q9-xSo"/>
<outlet property="slideToCancelGradient" destination="BYJ-HN-opT" id="qbb-Q9-xSo"/>
<outlet property="slideToCancelLabel" destination="Ydw-Nb-zP6" id="l4Y-Eg-Qwc"/>
</connections>
<point key="canvasLocation" x="-84" y="234"/>
</view>
</objects>
<resources>
<image name="chevron.left" catalog="system" width="96" height="128"/>
<image name="voice_message_cancel_fade" width="104" height="47"/>
<image name="voice_message_cancel_gradient" width="104" height="47"/>
<image name="voice_message_record_button_default" width="22" height="26.5"/>
<image name="voice_message_record_button_recording" width="52" height="52"/>
</resources>
Expand Down

0 comments on commit b126854

Please sign in to comment.