* Go to chat list view after registration
* sync system contacts during registration
* Use explicit local credentials for storage service operations during registration
* fix tests
* Quick hack to get through double pin confirmation
* Finishing touches
* lint
* fix build
* reload phone number discoverability after storage service sync
* fix tests again
* Take chat auth on account and contact record initializers
* Change around branches for clarity in OWSUserProfile
* pr comments
* Split ChatServiceAuth into the same and AuthedAccount
* fix tests
* merge woes
The Donations screen doesn't currently handle backend
subscription failures well. An example of this is when
the backend encounters a repeated payment processing
failure. Currently, in these situations the donation
screens will display an active donation along with the
renewal date.
To remedy this, the UI now checks that the subscription
status is 'active' before displaying any of the
active subscription UI.
This is similar to 227f05e932.
This change should have no user impact.
This changes the "delete subscriber ID" request in the following ways:
- Adds tests
- Converts it to Swift
- Renames `deleteSubscriptionIDRequest` to `deleteSubscriberID`
- Serializes the data inside the method, rather than requiring callers
to do so
This change should have no user impact.
This changes the "set subscriber ID" request in the following ways:
- Adds tests
- Converts it to Swift
- Renames `setSubscriptionIDRequest` to `setSubscriberID`
- Serializes the data inside the method, rather than requiring callers
to do so
Tested this with automated tests and manually starting a subscription in
staging.
This change should have no user impact.
This argument was never used so we can remove it.
I also fixed a doc comment. It wasn't exactly wrong, but it wasn't
parsed as intended.
This change should have no user impact except a *very* small speedup.
Previously, we were inconsistent in this file. Now, we always call
`recordPendingLocalAccountUpdates()` outside of a write transaction.
For example, if we get the `expired_card` error code back from Stripe,
we should show a specific error to the user.
This introduces some TODOs around error messages in a couple of spots.
We will revisit this when implementing PayPal monthly donations, as is
explained in the comments.
I tested this by using some of [Stripe's test numbers][0] (as well as
automated tests).
[0]: https://stripe.com/docs/testing#declined-payments
[3D Secure][0] is an additional authentication layer that some
credit/debit cards use. Typically, users open a browser and do some
authentication check before the transaction can proceed.
This adds 3DS support for credit/debit card donations.
If you want to try this yourself, I recommend using one of [Stripe's
test 3DS cards][1] in a staging build.
See also: [the equivalent commit in Signal Android][0].
[0]: https://stripe.com/docs/payments/3d-secure
[1]: https://stripe.com/docs/payments/3d-secure?platform=ios#three-ds-cards
[2]: d1df069669
This adds very basic support for donations via credit/debit card. It's
missing important features which is why it's behind an internal-only
feature flag.
At a high level, this adds a new screen with a card form. This card data
is submitted to Stripe and then uses the same "rails" as our existing
Apple Pay donations.
This change is missing a few important features, intended to be added
soon:
- [3D Secure][3DS] support
- Validation error messages
- Input formatting (e.g., "1234" becomes "12/34")
- Gift badge support (currently only supports Apple Pay)
- Various smaller UI changes
[3DS]: https://stripe.com/docs/payments/3d-secure
We shouldn't ask for Apple Pay when users update their subscriptions.
The update should just happen, unless there was previously a charge
failure.
This also fixes two other bugs:
- Some race conditions around observing subscription jobs
- One-time donations used the wrong progress spinner
This makes an upcoming change easier but is also useful on its own.
This change should have no user impact. It:
- Removes unnecessary `throws` annotations for methods that don't throw
- Uses `Currency.Code` instead of `String` in a few places
- Removes some comments I felt were obvious
- Changes some whitespace
I think these are useful on their own, but they'll also make an upcoming
change easier.
_I recommend reviewing this with whitespace changes disabled._
The server's `global.donations.apayDisabledRegions` is a list of regions
(phone number prefixes) where Apple Pay is disallowed. This respects
that.
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.
_I recommend reviewing this with whitespace changes disabled._
We need to generate a "receipt request" before doing a donation. This is
is entirely on-device and is unlikely to fail, but it technically could.
Previously, `generateReceiptRequest` would throw if this failed. We did
a bad job handling these failures (in some cases, we just ignored the
failures completely!).
Because this represents such a catastrophic failure, we'd _like_ this to
crash the app so we can investigate it more urgently.
Previously, one-time donations were on one screen and monthly donations
were on another. Now, they're on a single screen with a picker.
Most of the interesting changes are in `DonateViewController`.
Other things of note:
- There are some new TODOs here for existing bugs I didn't fix. For
example, one-time donations don't do so well if there are any problems
at all.
- Even though we only support Apple Pay, there's code that alludes to
additional payment methods. For example,
`DonateChoosePaymentMethodSheet`. We'll expand on this in the future.
- Users should only be able to select currencies that the server
supports. For example, you shouldn't be able to select EUR if the
server doesn't support euros. This wasn't working correctly before,
but is fixed here.
We already fixed one part, where users could change to an unsupported
currency (see dab02f30ae). However, if
your _default_ currency is unsupported and you didn't change it,
that's no good. This is unlikely for most users but could happen.
I fixed this by changing it from (effectively)
`Locale.current.currencyCode ?? "USD"`, which might not be supported,
to a preference list, choosing the first one the server likes.
- I skip animations if the Reduce Motion setting is enabled.
- On the donation screen, the logic for the preview badge has changed
slightly. If you already have a badge, we'll always use that.
This change should have no user impact.
We commonly pair a currency, like USD, and an amount, like 1.23. This
adds the `FiatMoney` struct. It's a simple struct with two fields.
After adding it, I tried to use it everywhere. (It's possible I missed a
spot.)
I think this is a useful change on its own, but it'll be nice for an
upcoming change, too.
See also: [Android's equivalent class][0].
[0]: cb65347bb3/core-util/src/main/java/org/signal/core/util/money/FiatMoney.java (L1)
This change should have no user impact.
We use `NSDecimalNumber` and `Decimal`. This tries to standardize on
`Decimal` where possible (though the former is still needed in a few
places).
Mostly a mechanical change, though a few little things changed.
We fetch the cost of gift badges and suggested one-time donation
amounts. For example, gift badges cost $5 and £4.
Previously, we parsed these as `UInt`s. This had two disadvantages:
1. There was no way to represent fractional amounts (like $1.23)
2. It was inconsistent with a lot of our code, which expects `Decimal`s
or `NSDecimalNumber`s
This changes these to use `Decimal` instead.
Tested this by:
- Adding some automated tests
- Making a one-time donation (with a non-default currency)
- Sending a gift badge (with a non-default currency)
- Checking donation receipts
We also had some hard-coded presets for one-time donations, which were
unused. I removed these.
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