Commit Graph

84 Commits

Author SHA1 Message Date
Max Radermacher
93d97da82b
Split “in progress” & “saved” voice message drafts 2023-03-08 15:31:56 -08:00
Max Radermacher
7ac03076e6
Consolidate link preview fetching code 2023-02-21 12:49:25 -08:00
Ehren Kret
c0d77ee5c3
use consistent sign on last interaction row id 2023-02-18 00:33:44 -06:00
Max Radermacher
9a4bb85c44 Fix text story sharing from the share extension 2023-02-10 15:54:37 -08: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
Evan Hahn
b95a1c4363
Make FullTextSearchFinder stateless
This change should have no user impact. I think this is a useful
cleanup.
2023-02-06 13:33:43 -06:00
Evan Hahn
2f384bf7a9 Remove unused methods from FullTextSearcher
This removes `filterThreads`, `filterGroupThreads`, and their
dependencies.
2023-02-03 11:53:02 -08:00
Max Radermacher
1311d3f665
Refactor contact access code
Split it based on whether the purpose is “editing” or “sharing”. If
we’re editing, it generally means we have full access to contacts, and
that we’ve checked which of the contacts are registered on Signal. If
we’re “sharing”, we don’t care whether or not they’re registered.

If we’re “sharing”, we check whether or not we’ve prompted for the
contacts permission yet. If not, we’ll show the prompt.

If we’re “editing”, we assume we’ve already prompted (which is already
the case today), so `.notDetermined` isn’t a possible state.

Other things to note:

- The `supportsContactEditing` was always true, so it’s been removed.

- The error when contacts access isn’t allowed is now shown more
  consistently. Previously, it was sometimes shown in response to
  initializing a view controller.

- Some RecipientPickerViewController code was moved from Obj-C to Swift.
  This is probably useful on its own, but it’ll also make it easier to
  build some new UI in subsequent commits.
2023-01-12 09:55:30 -08:00
Max Radermacher
386ca8a006
Simplify InviteFlow 2023-01-10 18:45:48 -08:00
Max Radermacher
103f9ed8b8 Fix typo: Convsersation → Conversation 2022-12-30 09:18:49 -06:00
Igor Solomennikov
41b1469f7a
Convert OWSAudioPlayer to swift and lose 'OWS' prefix.
Also rename OWSAudioSession to AudioSession for consistency with everything else.
2022-12-06 16:00:58 -08:00
Evan Hahn
53642df893 Format credit/debit card donation inputs
This formats the text users enter on the card donation screen. For
example, "4242424242424242" becomes "4242 4242 4242 4242".

It uses [the `textField(_:shouldChangeCharactersIn:replacementString:)`
method of `UITextFieldDelegate`][0] to accomplish this, and implements a
helper that can handle all the cases (inserting, deleting, replacing,
pasting, and so on).

Tested this in an iPhone 14 simulator and on a physical iOS 12 device.

[0]: https://developer.apple.com/documentation/uikit/uitextfielddelegate/1619599-textfield
2022-11-23 18:49:21 -06:00
Sasha Weiss
242dfd2bce
Add all JobQueues to environment, via a wrapper
Currently, only some `JobQueue` types are initialized during startup
(as part of `Environment`, or `SSKEnvironment`). Initialization is
required, however, for a `JobQueue` type to restart any latent jobs.
That means that, for example, a durable `SendGiftBadge` job that failed,
and should be reattempted at a later date, will not in fact be restarted
since no `SendGiftBadgeJobQueue` will be initialized at launch.

This change adds `SSKJobQueues` and `SignalMessagingJobQueues` types,
which are intended to be singletons that hold within them a singleton
job queue for each of our `JobQueue` types. These wrappers are added to
`SSKEnvironment` and `Environment` (from SignalMessaging) respectively,
ensuring that all the `JobQueue`s they contain are initialized as part
of environment setup. The wrappers also avoid the need to add a new
property to the (already large) environment types for each new future
`JobQueue`.

This change also updates all existing call sites that accessed a
`JobQueue` from an environment object, to direct that access now through
the wrapper type.
2022-11-09 14:08:44 -06:00
Max Radermacher
49d7896f8e
Update “Find by Number/Username” to latest designs
Some changes:

- Convert most of the code to Swift.

- Update the search result section headers to “Find by Number”/“Find by
  Username” instead of “Phone number search”/“Username search”.

- Remove “New message to:” from the rows & update the icons.

- Don’t look up phone numbers until the user taps the row. As a result,
  there’s no “No user found. Invite via SMS?” row.

- Restore the invite via SMS feature if the user can’t be found. If a
  number appears unregistered, we’ll offer to send an SMS.

- Start showing search results after 3 digits (approximately).

- Show potentially-invalid phone numbers to avoid results that disappear
  if you happen to type a digit incorrectly.
2022-11-04 13:40:13 -07:00
Evan Hahn
25aef2ee45 Remove two unused blocklist methods
This removes `showBlockSignalAccountActionSheet` and
`showUnblockSignalAccountActionSheet`, neither of which are used (nor
return any results with `git grep` after this change).
2022-11-03 11:41:41 -07:00
Harry
2b6d1da564
Un-index deleted private story threads. Omit disabled private story threads from search results
* Un-index deleted private story threads. Omit disabled private story threads from search results

* Fix bad debug assert on empty picker search results

* remove extra didRemove FTS check
2022-11-02 11:18:55 -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
Sasha Weiss
e924cb50df
Hide the dropped-members banner more permanently when dismissed 2022-10-29 13:26:26 -07:00
Max Radermacher
a51ce6ba2d Remove presentAddThreadToProfileWhitelist
It’s unused as of aab95db806.
2022-10-24 10:19:06 -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
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
Max Radermacher
a98cf8ebb5
Ignore private stories in compose search results 2022-10-19 10:03:02 -07:00
Harry
df51a9f837
Story-related conversation picker fixes
* apply theme to cells when conversation picker theme changes

* Retain selection UI when reloading conversation picker cells

* Prioritize newly created story threads for conversation picker sort ordering

* Index private story threads for searching

* Add story search results to conversation picker and fix issues with reloading with stuff pre-selected

* PR feedback 1: efficient thread migration

* PR feedback 2: don't allow expansion of story search results
2022-10-18 16:14:16 -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
Nora Trapp
1ffb8332a2 Flatten mentions when sharing text to stories 2022-10-06 15:26:10 -07:00
Harry Sanabria
414d07db64 force delete action sheet on story replies to be dark theme 2022-10-06 15:15:40 -07:00
Nora Trapp
2fa8a64b6d Strip the URL from messages when sharing to stories 2022-10-06 14:35:48 -07:00
Nora Trapp
49ed068fcd Allow sharing text to stories 2022-10-03 21:35:32 -07:00
Sasha Weiss
f8bacbbf42
Better handle missing microphone recording permissions when using in-app camera 2022-09-27 11:00:36 -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
Sasha Weiss
6aaf11b5d8
Update indentation in GroupManager+GroupInvites 2022-09-14 11:53:41 -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
248dbd1263 Restrict media quality when sending to stories 2022-09-12 10:17:28 -07:00
Nora Trapp
de0ef9444b Fix some usage of NSLocalizedString 2022-09-11 10:36:23 -07:00
Nora Trapp
e1f770c40b Allow viewing sending state and resending failed stories from 'My Stories' view 2022-09-06 16:01:32 -07:00
Sasha Weiss
569cdb2aad
Durable jobs for leaving groups 2022-08-26 13:13:23 -07:00
Sasha Weiss
11e2729c49
Auto-leave groups when added by a blocked contact 2022-08-25 16:20:15 -07:00
Jordan Rose
50e8ef7ed8 Extract TSGroupThread.sortedGroupMembers(...) from FullTextSearcher
This will be used for deterministically listing group members in the
group call lobby, hence some customization that FullTextSearcher
doesn't need.
2022-08-24 12:15:48 -07:00
Nora Trapp
23ff1c17e4 Further AttachmentMultisend cleanup 2022-08-22 11:23:03 -07:00
Nora Trapp
b420ad1f95 Cleanup AttachmentMultisend 2022-08-19 14:23:59 -07:00
Nora Trapp
43b010d9be Allow TSOutgoingMessage to build its own transcript, that subclasses can override 2022-08-19 14:23:59 -07:00
Nora Trapp
f340250194 Support remote delete of stories 2022-08-19 14:23:59 -07:00
harry-signal
713e8f1483
fix stories video end lag on production builds
* fix stories video end lag on production builds

* diff options properly

* change assert to debug assert
2022-08-12 13:34:55 -07:00
harry-signal
2a23f61a3f
Video Story muting/unmuting
* Start muted, unmute when pressing volume buttons

* move ringer switch observation into its own class

* observe ringer switch in stories

* add foreground time to AppContext; use to drive mute foregrounding behavior

* dont double observe

* mix story volume with others, show volume controls
2022-08-10 16:25:49 -07:00
harry-signal
dce5402f9e
Fix VoiceOver when locking an audio message recording
While here, issue an accessibility layout notification as well, so that VoiceOver targets the send button once you lock the message.
2022-08-08 14:07:03 -05:00
harry-signal
f305b4a2aa
Allow changing playback rate on OWSAudioPlayer
* Allow changing playback rate on OWSAudioPlayer

* nits and remove audio playback rater getter

* add explicit thread and attachment ID types to CVAudioPlayback cache
2022-08-04 14:55:53 -07:00
Nora Trapp
7d1d133940 Dedupe when sending to multiple private story threads 2022-07-29 12:39:14 -07:00
Sasha Weiss
33cfe52529
Fix violations of nsobject_prefer_isequal 2022-07-21 16:00:42 -05:00
Sasha Weiss
1687152665
Rename GroupManager+SignalMessaging to GroupManager+GroupInvites 2022-07-18 15:14:51 -07:00
Nora Trapp
d9c0a92ed4 Move dependencies needed for private story creation to SignalUI 2022-07-15 15:05:03 -07:00