* Enable zooming for photos and videos.
* Shrink media when keyboard is up.
* Fix minor animation issues on iPad.
* Fix "Add Message" placeholder not fading out properly.
• same layout of text styling toolbar (Done button is new in the UI).
• default text color to white.
• now only allow to change text styling (color, font etc) while editing text;
previously one could also update style after simply selecting a text overlay.
• clean up keyboard handling in photo editor's text overlay tool.
* Remove the useless shouldUseTheme
* Remove the useless shouldBottomViewReserveSpaceForKeyboard
* Add ViewControllerLifecycle
* Use more sensible constraints for keyboard layouts
* Consistent theme updates. themeDidChange is what you subclass, applyTheme is each class' internal application of theme changes, if needed
* Add app lifecycle hooks
* pr feedback
* pass through touches on the keyboard layout view(s)
* fix lint
Use NSTextStorage instead of NSMutableAttributed string when calculating text size.
NSTextStorage surprisingly provides more accurate text metrics when text contains
emojis and certain "complex" glyphs (eg Chinese hieroglyphs).
Also fix another minor issue that might cause text to be laid out differently
when being edited.
Change license to AGPL
This commit:
- Updates the `LICENSE` file
- Start every file with something like:
// Copyright YEAR_FIRST_PUBLISHED Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
---
First, I removed existing license headers with this Ruby 3.1.2 script:
require 'set'
EXTENSIONS_TO_CHECK = Set['.h', '.hpp', '.cpp', '.m', '.mm', '.pch', '.swift']
same = 0
different = 0
all_files = `git ls-files`.lines.map { |line| line.strip }
all_files.each do |relative_path|
if relative_path == 'Pods'
next
end
unless EXTENSIONS_TO_CHECK.include? File.extname(relative_path)
next
end
path = File.expand_path(relative_path)
contents = File.read(path)
new_contents = contents.sub(/\/\/\n\/\/ Copyright .*\n\/\/\n\n/, '')
if contents == new_contents
same += 1
else
different += 1
end
File.write(path, new_contents)
end
puts "updated #{different} file(s), left #{same} untouched"
I'm sure this script could be improved, but it worked well enough.
Then, I created `Scripts/lint/lint-license-headers` and ran it to auto-
fix a lot of files. This changed the mode of some files, but I think
that's actually desirable. For example,
`SignalServiceKit/src/Util/AppContext.m` previously had a mode of
`0755/-rwxr-xr-x`, and it's now `0644/-rw-r--r--`.
Then I fixed some stragglers and updated the precommit script.
See [a similar change in the Desktop app][0].
[0]: 8bfaf598af
• text story composer now has three options: colored text with no background,
colored text on white background, white text on colored background.
• text/background color is switched to black if user chooses background/text
color close to white, to avoid white on white look.
• photo editor has three options from above + white text with colored underline.
Also in photo editing UI - for text overlays.
Previous implementation used NSAttributedString's ability to set text background
color. Appearance wasn't impressive though as there wasn't a way to add padding
around the text or round corners for the background.
New approach is to add a rectangle background underneath the text - which
story viewer was already doing.
* Hide camera controls when switching to TEXT.
* Streamline camera capture session state tracking.
Stop camera when switching to TEXT.
* Basic text story composer.
All UI works, but needs fine-tuning and tapping on Next (->) doesn't do anything.
* Run auto-genstrings.
* Adjust text size and alignment as user enters text.
1..49 characters: 34 pt, center-aligned.
50..199 characters: 24 pt, center-aligned.
200.. characters: 18 pt, natural alignment.
* Change default text color in text story composer to white.
* Added support for changing background of text story composer.
Selection is allowed from palette of 5 gradients and 11 solid colors.
* Improve vertical alignment of text in text story composer.
Text (and possible link preview panel in the future) should be vertically
centered in the area above either bottom controls or onscreen keyboard.
* Add UI for attaching a link preview to a text story.
* Add support for posting text stories.
* Lint.
When calculating layout size of the photo overlay text max width is capped at
how wide UITextView was during editing, with the purpose of preserving wrapping
between editor (UITextView) and overlay (CATextLayer).
Previously though, UITextView was set to auto-shrink its width to content size,
which caused max width to not be not enough after changing the font to a bolder variant.
The fix is to pin UITextView's width to view margins so that all available width
is always used when measuring text overlay height.
• rename VAlignTextView to MediaTextView.
• rename ImageEditorPaletteView to ColorPickerBarView.
• move text style declarations from ImageEditorTextItem to MediaTextView because
those would no longer be specific to image editor.
• extract TextToolbar from ImageEditorViewController to a standalone public class
that is supposed to work in conjunction with MediaTextView.
The cause of this issue was that ImageEditorViewController's view was created
with zero dimensions. Those dimensions were then used to pre-calculate size
of the toolbar which ended up being incorrect.
The fix is to let UIKit create the root view and move everything we did in `loadView`
to `viewDidLoad`.
Re-do all crop view controller with pure Auto Layout which allowed to animate layout changes and transitions between UI states.
Image rotation using two fingers was removed to match native Photos app: tilt control UI at the bottom allows much more precise rotation and two finger gesture is now purely for zooming and panning.
We want the default stroke width to be represented by a position
close to the center of the stroke width slider, with max value being
eight times the default value (four times for the blur tool) and min
value being 20% of the default value.
To do that slider value (which grows linearly) is raised
to power of 3 (2 for blur) when that value is > 1, and only then
that value becomes a multiplier for default stroke width.
This change also fixes a bug when bottom buttons in the crop screen
were not visible. That happened because ImageEditorBottomBar by default
had its controls hidden (with the intent that they are animated in once
view controller's view is visible). That was a poor design choice on my
end and is fixed in this commit.
_I recommend reviewing this with whitespace changes disabled._
Signal has renamed its primary branch to `main`. This updates references
to the old name, `master`, to either reference `main` or a specific
commit hash.
I also fixed a couple of small whitespace issues in a file I was
editing.
We extend `UIView` with a new method, `renderAsImage`. It always returns a `UIImage`, but we marked its return type as `UIImage?`.
This removes that optionality and updates all callers.