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.
We frequently send outgoing messages with some parameters, like "link
preview" or "quoted reply", empty.
This change lets those parameters be omitted (instead of explicitly
empty) for brevity.
This is a stylistic change and should have no user impact.
Tested this by sending a regular message, a message with a link preview,
and two messages with photos.
You can add callbacks to be executed when a transaction completes. We
usually do this when sending messages, but not always.
Previously, the logic was "add a callback that runs the completion
function, if it exists." Now, the logic is "if the completion function
exists, add a callback that runs it."
I think this slightly better reflects our intent, and helps reduce
memory usage (and potential capturing?) slightly.
* Little fix for context menu
* Add 'My Stories' section to stories tab
* Add new story thread types
* Show stories in conversation picker
* Support for sending stories
* Update story list when sending stories
* Add basic 'My Stories' view controller
* Initial stories settings screens
* Consolidate TSPrivateStoryThread and TSMyStoryThread into one class
* Require an explicit read transaction to initialize an outgoing message
* Fix linting
* Allow enabling group story from internal settings
* Fix tests
* PR Feedback
_I recommend reviewing this with whitespace changes disabled._
This fixes violations of [SwiftLint's `implicit_getter` rule][0] by
removing explicit getters when an implicit one would do.
[0]: https://realm.github.io/SwiftLint/implicit_getter.html
_I recommend reviewing this with whitespace changes disabled._
This is a minor change; it have no direct user impact.
We have a "pending changes action sheet" which shows up to warn users
that their changes may not be saved. The localization key and comment
indicated that its strings were only for groups, but that's not
true—it's used for lots of things, such as editing your profile or
updating a group's metadata.
Steps to reproduce:
• open group chat and type a message containing "@" but don't send it.
• tap on + and select last photo/video from the strip.
• observe app crashing.
Cause of crash:
Attempting to access a child view controller of UIPageViewController
while using force unwrap when UIPageViewController's view is not yet loaded.
The fix:
• Remove force unwrapping (linter was complaining about that too).
• Add "isViewLoaded" check to the method that was causing the crash.
By moving the check after the `isLoggingEnabled()` check, there isn’t
unreachable code, so the compiler warning goes away. (The `_isDebug…`
check has to be second, or the `isLoggingEnabled()` call would be
unreachable code.)
For the other case, I wrapped the entire check in a single `assert`,
avoiding the `_isDebugAssertConfiguration` call altogether. (This one
wasn’t a warning, but I think this approach is more canonical, and it’s
probably best to avoid `_` functions where possible.)
This removes calls to `arc4random` and `arc4random_uniform` and replaces
them with calls to `Int.random` or equivalent.
These are a little less readable, which may be [why SwiftLint doesn't
like them][0]. (SwiftLint calls them "legacy", possibly because they're
not strong random number generators, but I couldn't find a clear
explanation for this anywhere, including [the original PR][1].)
This is the kind of change that's error-prone, so I wrote [a simple
script to help avoid regressions][2]. The script runs 10,000 iterations
of the old and new RNG and compares the ranges, reporting differences.
(Some differences are likely, like the ones that involve floats; others
are very unlikely to have differences.)
`git grep arc4random | grep swift` returns no results after this change.
Same for [everything else SwiftLint checks for][3].
[0]: https://realm.github.io/SwiftLint/legacy_random.html
[1]: https://github.com/realm/SwiftLint/pull/2419
[2]: https://gist.github.com/EvanHahn-Signal/9c75c9f484f4778149cbde3eafc9b285
[3]: ea6cc50890/Source/SwiftLintFramework/Rules/Idiomatic/LegacyRandomRule.swift (L23-L27)
_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.
UIView.autoPin(toEdgesOf:withInset:) was creating incorrect vertical
edge constraints.
Also rename the method to better match conventions: `withInsets` instead
of `withInset`.
GradientView would not work if its colors were passed during initialization
and never changed after. This was caused by the fact that `CAGradientLayer`'s
colors were updated in `GradientView.colors.didSet`, which isn't
called during `init()`.
Also allow access to `GradientView.gradientLayer` so that users of
that class can build more advanced gradients.
This fixes 10 of our Xcode warnings:
- `MessageReactionPicker.swift` was declaring a variable and not using
it, leading to "Immutable value 'emoji' was never used". I simply
removed it.
- `Stripe.swift` had a bunch of unnecessary `public`s, which caused
"'public' modifier is redundant for static property declared in a
public extension".
- `SubscriptionManager.swift` had an unnecessary `try`, causing "No
calls to throwing functions occur within 'try' expression".
- `CallService.swift:696` was calling a function and not using its
result, so I annotated that function with `@discardableResult`.
- `MobileCoinAPI+Configuration.swift` declared a variable with `var`
that should've used `let`.
Nothing major here, but wanted to find ones that were easy to fix.
notImplemented() ends up forwarding to fatalError() anyway, but before
it does so it flushes our logs. That's probably good to have. I think
most of these come from the default implementations Xcode provides for
you with a fix-it.
• use NSKeyedArchiver.archivedData(withRootObject:requiringSecureCoding:)
instead of NSKeyedArchiver.archivedData(withRootObject).
• use NSKeyedArchived.unarchivedObject(ofClass:from:) instead of
NSKeyedArchiver.unarchiveTopLevelObjectWithData().