mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
Rework appearance of voice messages and audio attachments.
// FREEBIE
This commit is contained in:
parent
ea34cec0d9
commit
a15d11c3e6
23
Signal/Images.xcassets/voice-message-large-white.imageset/Contents.json
vendored
Normal file
23
Signal/Images.xcassets/voice-message-large-white.imageset/Contents.json
vendored
Normal file
|
@ -0,0 +1,23 @@
|
|||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "voice-message-large-white@1x.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "voice-message-large-white@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "voice-message-large-white@3x.png",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
BIN
Signal/Images.xcassets/voice-message-large-white.imageset/voice-message-large-white@1x.png
vendored
Normal file
BIN
Signal/Images.xcassets/voice-message-large-white.imageset/voice-message-large-white@1x.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 2 KiB |
BIN
Signal/Images.xcassets/voice-message-large-white.imageset/voice-message-large-white@2x.png
vendored
Normal file
BIN
Signal/Images.xcassets/voice-message-large-white.imageset/voice-message-large-white@2x.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.2 KiB |
BIN
Signal/Images.xcassets/voice-message-large-white.imageset/voice-message-large-white@3x.png
vendored
Normal file
BIN
Signal/Images.xcassets/voice-message-large-white.imageset/voice-message-large-white@3x.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.6 KiB |
|
@ -78,7 +78,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
|
||||
- (CGFloat)bubbleHeight
|
||||
{
|
||||
return 35.f;
|
||||
return 45.f;
|
||||
}
|
||||
|
||||
- (CGFloat)iconSize
|
||||
|
|
|
@ -346,6 +346,8 @@ typedef enum : NSUInteger {
|
|||
|
||||
@property (nonatomic) UIView *voiceMemoUI;
|
||||
|
||||
@property (nonatomic) UIView *voiceMemoContentView;
|
||||
|
||||
@property (nonatomic) NSDate *voiceMemoStartTime;
|
||||
|
||||
@property (nonatomic) NSTimer *voiceMemoUpdateTimer;
|
||||
|
@ -387,25 +389,70 @@ typedef enum : NSUInteger {
|
|||
[self addSubview:self.voiceMemoUI];
|
||||
self.voiceMemoUI.frame = CGRectMake(0, 0, self.bounds.size.width, self.bounds.size.height);
|
||||
|
||||
self.voiceMemoContentView = [UIView new];
|
||||
[self.voiceMemoUI addSubview:self.voiceMemoContentView];
|
||||
[self.voiceMemoContentView autoPinWidthToSuperview];
|
||||
[self.voiceMemoContentView autoPinHeightToSuperview];
|
||||
|
||||
self.recordingLabel = [UILabel new];
|
||||
self.recordingLabel.textColor = [UIColor ows_materialBlueColor];
|
||||
self.recordingLabel.textColor = [UIColor ows_destructiveRedColor];
|
||||
self.recordingLabel.font = [UIFont ows_mediumFontWithSize:14.f];
|
||||
[self.voiceMemoUI addSubview:self.recordingLabel];
|
||||
[self.voiceMemoContentView addSubview:self.recordingLabel];
|
||||
[self updateVoiceMemo];
|
||||
|
||||
UIImage *icon = [UIImage imageNamed:@"voice-memo-button"];
|
||||
OWSAssert(icon);
|
||||
UIImageView *imageView =
|
||||
[[UIImageView alloc] initWithImage:[icon imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]];
|
||||
imageView.tintColor = [UIColor ows_materialBlueColor];
|
||||
[self.voiceMemoUI addSubview:imageView];
|
||||
imageView.tintColor = [UIColor ows_destructiveRedColor];
|
||||
[self.voiceMemoContentView addSubview:imageView];
|
||||
|
||||
NSMutableAttributedString *cancelString = [NSMutableAttributedString new];
|
||||
const CGFloat cancelArrowFontSize = ScaleFromIPhone5To7Plus(18.4, 20.f);
|
||||
const CGFloat cancelFontSize = ScaleFromIPhone5To7Plus(14.f, 16.f);
|
||||
[cancelString
|
||||
appendAttributedString:[[NSAttributedString alloc]
|
||||
initWithString:@"\uf104 "
|
||||
attributes:@{
|
||||
NSFontAttributeName : [UIFont ows_fontAwesomeFont:cancelArrowFontSize],
|
||||
NSForegroundColorAttributeName : [UIColor ows_destructiveRedColor],
|
||||
NSBaselineOffsetAttributeName : @(-1.f),
|
||||
}]];
|
||||
[cancelString
|
||||
appendAttributedString:[[NSAttributedString alloc]
|
||||
initWithString:NSLocalizedString(@"VOICE_MESSAGE_CANCEL_INSTRUCTIONS",
|
||||
@"Indicates how to cancel a voice message.")
|
||||
attributes:@{
|
||||
NSFontAttributeName : [UIFont ows_mediumFontWithSize:cancelFontSize],
|
||||
NSForegroundColorAttributeName : [UIColor ows_destructiveRedColor],
|
||||
}]];
|
||||
[cancelString
|
||||
appendAttributedString:[[NSAttributedString alloc]
|
||||
initWithString:@" \uf104"
|
||||
attributes:@{
|
||||
NSFontAttributeName : [UIFont ows_fontAwesomeFont:cancelArrowFontSize],
|
||||
NSForegroundColorAttributeName : [UIColor ows_destructiveRedColor],
|
||||
NSBaselineOffsetAttributeName : @(-1.f),
|
||||
}]];
|
||||
UILabel *cancelLabel = [UILabel new];
|
||||
cancelLabel.textColor = [UIColor ows_destructiveRedColor];
|
||||
cancelLabel.font = [UIFont ows_mediumFontWithSize:14.f];
|
||||
cancelLabel.text
|
||||
= NSLocalizedString(@"VOICE_MESSAGE_CANCEL_INSTRUCTIONS", @"Indicates how to cancel a voice message.");
|
||||
[self.voiceMemoUI addSubview:cancelLabel];
|
||||
cancelLabel.attributedText = cancelString;
|
||||
[self.voiceMemoContentView addSubview:cancelLabel];
|
||||
|
||||
const CGFloat kRedCircleSize = 100.f;
|
||||
UIView *redCircleView = [UIView new];
|
||||
redCircleView.backgroundColor = [UIColor ows_destructiveRedColor];
|
||||
redCircleView.layer.cornerRadius = kRedCircleSize * 0.5f;
|
||||
[redCircleView autoSetDimension:ALDimensionWidth toSize:kRedCircleSize];
|
||||
[redCircleView autoSetDimension:ALDimensionHeight toSize:kRedCircleSize];
|
||||
[self.voiceMemoContentView addSubview:redCircleView];
|
||||
[redCircleView autoAlignAxis:ALAxisHorizontal toSameAxisOfView:self.contentView.rightBarButtonItem];
|
||||
[redCircleView autoAlignAxis:ALAxisVertical toSameAxisOfView:self.contentView.rightBarButtonItem];
|
||||
|
||||
UIImage *whiteIcon = [UIImage imageNamed:@"voice-message-large-white"];
|
||||
OWSAssert(whiteIcon);
|
||||
UIImageView *whiteIconView = [[UIImageView alloc] initWithImage:whiteIcon];
|
||||
[redCircleView addSubview:whiteIconView];
|
||||
[whiteIconView autoCenterInSuperview];
|
||||
|
||||
[imageView autoVCenterInSuperview];
|
||||
[imageView autoPinEdgeToSuperviewEdge:ALEdgeLeft withInset:10];
|
||||
|
@ -491,9 +538,7 @@ typedef enum : NSUInteger {
|
|||
|
||||
// Fade out the voice message views as the cancel gesture
|
||||
// proceeds as feedback.
|
||||
for (UIView *subview in self.voiceMemoUI.subviews) {
|
||||
subview.layer.opacity = MAX(0.f, MIN(1.f, 1.f - (float)cancelAlpha));
|
||||
}
|
||||
self.voiceMemoContentView.layer.opacity = MAX(0.f, MIN(1.f, 1.f - (float)cancelAlpha));
|
||||
}
|
||||
|
||||
- (void)updateVoiceMemo
|
||||
|
@ -3504,6 +3549,7 @@ typedef enum : NSUInteger {
|
|||
DDLogInfo(@"voiceMemoGestureDidStart");
|
||||
|
||||
[((OWSMessagesInputToolbar *)self.inputToolbar)showVoiceMemoUI];
|
||||
AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
|
||||
[self startRecordingVoiceMemo];
|
||||
}
|
||||
|
||||
|
@ -3515,6 +3561,7 @@ typedef enum : NSUInteger {
|
|||
|
||||
[((OWSMessagesInputToolbar *)self.inputToolbar) hideVoiceMemoUI:YES];
|
||||
[self endRecordingVoiceMemo];
|
||||
AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
|
||||
}
|
||||
|
||||
- (void)voiceMemoGestureDidCancel
|
||||
|
@ -3525,6 +3572,7 @@ typedef enum : NSUInteger {
|
|||
|
||||
[((OWSMessagesInputToolbar *)self.inputToolbar) hideVoiceMemoUI:NO];
|
||||
[self cancelRecordingVoiceMemo];
|
||||
AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
|
||||
}
|
||||
|
||||
- (void)voiceMemoGestureDidChange:(CGFloat)cancelAlpha
|
||||
|
|
Loading…
Reference in a new issue