Commit Graph

186 Commits

Author SHA1 Message Date
Igor Solomennikov
9000a5cbb9
Add support for appropriate fonts for different scripts in Text Story composer / viewer. 2022-11-01 16:16:12 -07:00
Evan Hahn
a941c82c14
Prefer isEmpty with strings
This change may improve performance slightly but should have no other
user impact.

`myString.isEmpty` is faster than `myString.count == 0` or equivalent,
because computing `count` may require iterating over the string.

I tried to fix all occurrences of this.

Tested this by sending a message in a group and doing a full
re-registration, just in case I broke something there.
2022-11-01 17:53:46 -05:00
Max Radermacher
00378ea208
Handle theme changes in ReminderView
Co-authored-by: Evan Hahn <69474926+EvanHahn-Signal@users.noreply.github.com>
2022-10-31 15:45:06 -07:00
Adam Mork
2dd98c37b3
[Payments] Show alert if client is outdated
Co-authored-by: Phil Larson <phil.larson@icloud.com>
Co-authored-by: Max Radermacher <max@signal.org>
2022-10-25 15:43:43 -07:00
Harry
075133be72
Observe story viewed ring changes in ConversationAvatarView
* Observe story viewed ring changes in ConversationAvatarView itself

* Manage ConversationAvatarView's story observation based on the context

* remove story state from thread view model, now unused

* pr feedback renames
2022-10-25 12:57:52 -07:00
Igor Solomennikov
550f9b0a8a
Fix link preview not expanding to full-size in some cases. 2022-10-24 16:10:49 -07:00
Igor Solomennikov
3235eb6618
Render condensed text style (AA) in all caps in text story composer.
Preserve case-sensitive user input and make UITextView display ALLCAPS if
AA style is selected.
2022-10-24 13:33:48 -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
Igor Solomennikov
6005d55c11
Expand link preview vertically in composer if user deletes text.
In text story composer, link preview might be collapsed to "compact" layout 
after user enough text so that there's no more vertical room for both text 
and link preview.

This change improves composer behavior to expand link preview back to 
"regular" layout if user deletes some or all text and there's now room for both.
2022-10-20 17:23:11 -07:00
Igor Solomennikov
55be3e6405
Make text input cursor same color as text in text story composer and photo editor. 2022-10-20 15:52:49 -07:00
Harry
87db4ab0aa
Better multisend of text stories
* Shuffle code around, adding UnsentTextAttachment

* Replace usages of TextAttachment with UnsentTextAttachment where applicable, creating an actual TextAttachment (and associated OWSlinkPreview image TSAttachment, if applicable) only per-recipient

* Only upload one text story link preview image attachment and propagate it to the individual TSAttachments created for each destination

* update comments so I don't lose my mind the next time I read this code

* Dedupe text stories sent to the same person via multiple private threads

* fix non-compiling tests

* pr feedback
2022-10-20 11:04:25 -07:00
Harry
dc15f61a90
Fix text story link thumbnail blinking
* dont reload story thumbnails if the attachment hasn't changed

* Cache text attachment link preview images
2022-10-19 15:39:38 -07:00
Evan Hahn
b459e22026 Improve "dim when highlighted" logic for OWSButtons
This dims the button:

    let button = OWSButton()
    button.dimsWhenHighlighted = true
    button.isHighlighted = true

This did not, and I think it should (last 2 lines are switched):

    let button = OWSButton()
    button.isHighlighted = true
    button.dimsWhenHighlighted = true

This also removes an unnecessary `@objc` annotation.

I think this is a useful change on its own but I expect it to make an
upcoming change easier, too.
2022-10-13 12:45:02 -05: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
e1ed6cae08
Fix incorrect layout of bottom bar when editing text story without on-screen keyboard. 2022-10-12 10:10:45 -07:00
Igor Solomennikov
f8a0066284
Better layout for text story composer on iPad.
• Constrain text styling toolbar width to the width of the story card.

• Align Add Link and Background buttons with the leading edge of text story card.
2022-10-11 22:32:13 -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
f01f4d4a7c Fix no rounded corners for gradient backgrounds in text story composer. 2022-10-06 22:00:38 -07:00
Igor Solomennikov
e926b26f5d
Text stories UI improvements
* Allow to force "compact" style for a link preview view.

Link previews should be displayed in "compact" mode when there's a significant
amount of text.

* RoundMediaButton should never be allowed to be made smaller than its desired size.

* Improved layout for text stories: both composer and viewer.

There is now a shared UI layout logic between editor and viewer, editor being
a subclass of viewer.

New behavior for composer:
 • text view will grow in height as much as possible and becomes scollable
   when max height is reached.
 • link preview starts in "regular" layout (image above the text) and then
   is updated to "compact" layout (image on the left, text on the right)
   as text view grows.

New behavior for viewer:
 • updated font sizes for match spec.
 • for extra tall stories text label is scaled down to fit.

* Fix bug where Proceed button would stay disabled after composing a text story.

* Fix two UX issues reported in PR review.
2022-10-05 12:46:03 -07:00
Harry
29fbb192d5
Add my story privacy settings learn more
* Add my story privacy settings learn more

* light fixes for boost sheet

* PR feedback

* audit usages of InteractiveSheetViewController
2022-10-04 15:11:16 -07:00
Harry
6a88e6c967
Revert "Remove pre-Xcode 14 status bar workarounds"
This reverts commit 9f731edae9.
2022-10-04 09:17:33 -07:00
Nora Trapp
3c2096ad71 fix reversal of photo and story view buttons 2022-10-03 21:35:32 -07:00
Harry
9f731edae9
Remove pre-Xcode 14 status bar workarounds 2022-10-03 15:29:49 -05:00
Igor Solomennikov
28faf6e0ae
Use "compact" layout for link preview panel when no image. 2022-09-30 12:27:33 -07:00
Igor Solomennikov
7d862d87ae
Fix link preview image size when there's 5 lines of text
Let thumbnail grow vertically to match text height.
2022-09-27 06:17:32 -05:00
Igor Solomennikov
19cf2d07f6 Change font weight for 'regular' text style in text stories from Bold to Medium. 2022-09-21 11:33:27 -07:00
Michelle Linington
4ada6b3a3f Derive bundle ID from an Xcode build setting
See [#5423][5423].

[5423]: https://github.com/signalapp/Signal-iOS/pull/5423
2022-09-21 18:10:42 +00:00
Igor Solomennikov
5c98fcfeb7
Updated look for link previews in text stories. 2022-09-20 12:57:22 -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
Harry
e2b5570646
Compensate for extra status bar height on iPhone 14 pro devices
* Compensate for extra status bar height on iPhone 14 pro devices

* use string sysctlKey

* more commenting
2022-09-19 15:46:17 -07:00
Sasha Weiss
c96144ad38
Always configure the textLabel in a CVComponentSysteMessage 2022-09-19 14:14:50 -07:00
Harry
ae4837e600
Segment story videos longer than 30s
* initial approach commit, needs cleanup

* Keep >30s videos for non-story recipients, but split for stories

* Some cleanup

* fix too many chats toast offset

* show tooltip in the send flow

* pr feedback
2022-09-16 15:29:44 -07:00
Evan Hahn
4d55d95869 Autofix SwiftLint whitespace issues
I recommend reviewing this with whitespace changes disabled.
2022-09-15 16:37:44 +00:00
Igor Solomennikov
607fdc810e
Add support for multi-point gradient background in text stories.
Also update palette of background colors and gradients to latest spec.
2022-09-14 08:26:23 -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
Nora Trapp
b60a862e17 allow choosing if you want to view story or avatar 2022-09-12 11:23:23 -07:00
Nora Trapp
da9f52c67d Update conversation split view styling 2022-09-12 10:48:28 -07:00
Nora Trapp
95ddec00b5 Redesigned story privacy settings 2022-09-12 10:14:09 -07:00
Sasha Weiss
07a5e95d6a
Show the MemberActionSheet for tapped names in group system messages, reapplied 2022-09-06 14:40:01 -07:00
Harry
87d9e5df2a
Set story hidden state from stories view controller context menu
* Set hidden state from stories view controller context menu

* fix toasts when shown on controllers with UIScrollViews as their root views

* delete when hiding the onboarding story

* run translations script

* respond to pr feedback

* add hidden state to systemStoryManager

* use hidden state from SystemStoryManager for onboarding story

* remove unused method
2022-09-06 09:48:06 -07:00
Evan Hahn
03dd818cdb
"Add to Another Group": show archived groups, order by recency
Previously, archived groups didn't show up in the "Add to Another Group"
view. Now, they do!

This also orders groups entirely by recency.

This view used `ThreadViewHelper`, which (1) omitted archived groups
(2) had a bunch of dormant database observation code. I removed this
class and replaced it with some inline code that fetches groups.
2022-09-01 08:41:42 -05:00
Igor Solomennikov
a74c7e0885
Modify link preview panel UI used in stories viewer to allow its re-use.
• Extract the code into a new TextAttachmentView.LinkPreviewView class.
• Modify the code to accept wider variety of link preview data.
2022-08-31 16:53:38 -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
6c1ed8d0dd
GradientView API improvement.
Allow to set just the gradient colors, without locations, relying on CAGradientLayer's
uniform color distribution logic.

Also update all the uses of GradientView to only specify colors because all the
places were using just two locations: 0 and 1.
2022-08-26 20:58:04 -07:00
Max Radermacher
6955b6f53a Revert tapping names in group system messages
- Revert "More flexible selection styling in CVTextLabel"
  (commit e1317d814c)

- Revert "Show the MemberActionSheet for tapped names in group system messages"
  (commit 48bc3c07d0)
2022-08-26 11:43:58 -07:00
Sasha Weiss
e1317d814c
More flexible selection styling in CVTextLabel 2022-08-25 15:33:28 -07:00
Sasha Weiss
48bc3c07d0
Show the MemberActionSheet for tapped names in group system messages 2022-08-25 13:03:38 -07:00
Jordan Rose
ecc48d7935 Remove dedicated "Call is Full" screen
With more information on the group call lobby screen, it doesn't make
sense to have the entire camera feed replaced with a "Call is Full"
message. Instead, disable the Join button as before, and show a toast
if the user taps on it anyway.
2022-08-24 12:15:48 -07:00
Sasha Weiss
36eb0be145
Make CVComponentDelegate not an @objc protocol anymore 2022-08-23 22:50:27 -07:00