Commit Graph

60 Commits

Author SHA1 Message Date
Pete Walters
43b7f38ac9
Remove uses of sharedBackground queues. 2023-09-28 07:46:52 -05:00
Elaine
fe7ec307b6
Story sticker improvements 2023-09-07 12:18:55 -06:00
Elaine
ae59ef4b91
Add analog clock story stickers 2023-08-30 14:42:53 -06:00
Elaine
f476f27a0c
Add digital clock story stickers 2023-08-30 13:32:38 -06:00
Elaine
0dca391137
Media editor stickers 2023-08-28 09:26:05 -06:00
Igor Solomennikov
87b00e8587
Fix an issue that could leave media editor in an inconsistent state. 2023-07-31 15:21:58 -07:00
Igor Solomennikov
0e9d511d1d
SignalUI cleanup.
• convert ObjC code from UIView+SignalUI to Swift.
• separate code from UIView+SignalUI to smaller files by functionality.
2023-06-23 14:36:21 -07:00
Igor Solomennikov
52f0015dfe
New set of icons. 2023-06-22 17:38:01 -07:00
Igor Solomennikov
0686b39547 Add necessary imports to Swift files.
Those would be required for future PRs.
2023-06-13 14:46:12 -07:00
Igor Solomennikov
c054f3de91
Remove unnecessary "@objc" in SignalUI. 2023-05-16 16:39:19 -07:00
Igor Solomennikov
6dd3d9a6f2
Convert all convenience methods in UIFont+OWS to Swift. 2023-04-18 17:14:51 -07:00
Harry
003cc19e62
Update SignalCoreKit. Use explicit DispatchQueue instead of relying on the implicit type on promise 'on' params
* Use explicit DispatchQueue instead of relying on the implicit type on promise 'on' params

* Update SignalCoreKit
2023-02-07 16:14:39 -08:00
Igor Solomennikov
743c4e261c
Fix background for text overlays in media editor not preserving rounded corners. 2023-02-07 12:55:51 -08:00
Igor Solomennikov
b46ee3380e
Fix debug crash when doing double-tap on image in media review screen. 2023-02-03 17:40:39 -08:00
Max Radermacher
0c3cec9146
Update SignalCoreKit
* Update filterForDisplay call sites
2023-01-31 12:34:07 -08:00
Igor Solomennikov
f264b4b70d
Improvements for "Media Review" screen.
* 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.
2023-01-11 16:22:40 -08:00
Igor Solomennikov
36954792b3
Larger margins around text overlay with a background in image editor. 2022-11-30 17:47:46 -08:00
Igor Solomennikov
8a2fc1134f
Update text overlay UI in photo editor to match text story composer UI.
• 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.
2022-11-08 11:26:54 -08:00
Harry
c745f9a6ae
Refactor OWSViewController
* 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
2022-11-03 13:12:13 -07:00
Igor Solomennikov
2f3ad73dc3
Fix photo overlay text might be clipped in image editor.
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.
2022-11-02 15:42:44 -07:00
Igor Solomennikov
9000a5cbb9
Add support for appropriate fonts for different scripts in Text Story composer / viewer. 2022-11-01 16:16:12 -07:00
Max Radermacher
ab55cf3929 Import SignalMessaging where it’s needed
The next commit removes a file that, through assorted Swift/Obj-C bridge
magic, resulted in SignalMessaging being available to all these files.
2022-10-24 10:19:06 -07:00
Evan Hahn
370ff654e7
Change license to AGPL
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
2022-10-13 08:25:37 -05:00
Igor Solomennikov
bb9d0edabb
Update text color adjustment behavior in photo editor and text story creation.
• 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.
2022-10-12 23:19:07 -07:00
Igor Solomennikov
d25a595f55
Media Composer: text styling toolbar now reflects currently selected font. 2022-10-11 10:55:02 -07:00
Igor Solomennikov
c8831ed921
Improved appearance for text on colored background in text story composer.
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.
2022-09-20 12:52:43 -07:00
Igor Solomennikov
a6ff75a24c
Text story composer
* 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.
2022-09-12 11:38:28 -07:00
Igor Solomennikov
b5ee24febe
Fix an issue causing incorrect line wraps in media editor's text overlays.
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.
2022-08-30 10:36:41 -07:00
Igor Solomennikov
37c0447a6e
Update to allow re-use of code related to text overlays in photo editor.
• 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.
2022-08-23 17:30:20 -07:00
Jordan Rose
0f694d318c Allow ToastController to present from the top as well 2022-08-17 17:59:19 -07:00
Igor Solomennikov
f10ed33cb2
A couple of minor UI improvements in the media editor.
• fix Reset button in Crop screen is too high on non-notch devices.
• hide status bar in Crop screen on non-notch iphones.
2022-08-15 17:18:22 -07:00
Igor Solomennikov
17c3dba264
Allow to change font of text overlays in media editor.
Possible options match the ones used in text story viewer and currently are:
regular, bold, serif, script, condensed.
2022-08-09 14:21:18 -07:00
Igor Solomennikov
ee2f39d3d1
Fix an issue where buttons in text overlay toolbar could be too small.
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`.
2022-08-03 17:59:53 -07:00
Igor Solomennikov
cf003035a9
Animate transition from rounded image corners in Review to square in Draw tool. 2022-07-27 16:19:51 -07:00
Igor Solomennikov
6548e374e2
Improved crop tool in media editor.
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.
2022-07-26 14:11:03 -07:00
igor-signal
3ad6c41a94
Fix "-0" could be displayed as current tilt (rotation) angle in Crop media view. (#4613) 2022-07-19 21:23:02 -07:00
Igor Solomennikov
75ef7d1482 Play haptic feedback when rotation control in Crop view crosses a mark. 2022-07-19 15:47:25 -07:00
igor-signal
e586969b57 Fix issue with rotation control in the media editor's crop tool.
Rotation control would show value outside of -45..45 range after leaving
crop tool and opening it again.
2022-07-14 12:12:04 -07:00
igor-signal
fc6bf2eca1
Increase max stroke width for drawing tools.
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.
2022-07-13 22:46:14 -07:00
Igor Solomennikov
50a54d0e73 Fix incorrect layout in review screen after rotating an image in Crop tool. 2022-07-13 17:55:28 -07:00
igor-signal
8b5ef88a88
Use "translucent dark" style for action sheets in media flow. (#4559) 2022-07-12 19:11:12 -07:00
igor-signal
c64320e75b
Improve crop view presentation.
Keep image center intact when transitioning to/from crop view to
eliminate unpleasant "jump".
2022-07-12 12:03:55 -07:00
Igor Solomennikov
f9e124145a [Media Editor] Don't slide buttons on the bottom when drawing and moving text.
Only slide buttons on-/off-screen when entering/leaving image editor.
2022-07-08 22:21:21 -07:00
Igor Solomennikov
72d47eba28 Temporarily remove Sticker button from the media editor. 2022-07-07 13:13:53 -07:00
Igor Solomennikov
ef1a56a299 Media Editor: Improved layout in for tall images (eg screenshots).
Fixes an issue where image would be displayed under bottom toolbar.
2022-07-07 08:37:34 -07:00
Igor Solomennikov
2fd17eda12 Animate controls on the crop screens in and out.
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.
2022-07-07 08:37:34 -07:00
Igor Solomennikov
7f4a5f3f7b Merge branch igor/media-editor-updates. 2022-07-06 14:54:26 -07:00
Evan Hahn
24ca5abf9c Remove unneeded breaks
This fixes our violations of [the SwiftLint `unneeded_break_in_switch`
rule][0].

[0]: https://realm.github.io/SwiftLint/unneeded_break_in_switch.html
2022-06-03 17:52:28 +00:00
Igor Solomennikov
8b3ea9d27d Fix typo: "Gausian" -> "Gaussian". 2022-05-17 19:25:30 -07:00
Evan Hahn
29c0ddf60e Fix violations of SwiftLint's attributes rule
_I recommend reviewing this with whitespace changes disabled._

Most of these were `@objc` being on the same line, which I fixed with [a
silly script][1]—probably could've used `sed` if I were wiser. The rest
were manual fixes.

See [the SwiftLint documentation for this rule][0].

[0]: https://realm.github.io/SwiftLint/attributes.html
[1]: https://gist.github.com/EvanHahn-Signal/d353c93fa269c82b96baca0a1086521f
2022-05-14 09:07:42 -05:00