Signal-iOS/SignalServiceKit
Evan Hahn 160d46ef77
Fix debug assert when proto message has no addresses
This restores the behavior prior to
4a0141be41, where I made a mistake that
affect development builds.

Previously, the generated code looked like this, to prevent
instantiation of `SignalServiceAddress`es with no identifiers:

    // This is a sketch!
    let address: SignalServiceAddress? = {
      guard hasUuid || hasE164 else { return nil }
      let address = SignalServiceAddress(uuid: uuid, e164: e164)
      guard address.isValid else {
        owsFailDebug("address was unexpectedly invalid")
        return nil
      }
      return address
    }()

It makes sense (to me) to do this, because all proto fields are
optional. That means you can have a valid message that lacks both of
these fields, which is allowed. It shouldn't error.

However, I changed it to the equivalent of this, which caused an error
in `SignalServiceAddress`'s initializer:

    let address: SignalServiceAddress? = {
      let address = SignalServiceAddress(uuid: uuid, e164: e164)
      guard address.isValid else {
        return nil
      }
      return address
    }()

This reverts that to avoid the debug assertion failure. I don't think
this ever affected "real" builds beyond some extra logging.
2022-10-05 07:31:59 -07:00
..
Experience Upgrades Skip inactive experience IDs, and opportunistically clear unknown ones 2022-10-04 12:22:24 -07:00
protobuf Omit E164 from outgoing envelopes 2022-10-03 23:55:39 +00:00
Resources Add StoryContextAssociatedData to compute story tab badge count without hidden stories 2022-10-03 21:16:01 -07:00
src Fix debug assert when proto message has no addresses 2022-10-05 07:31:59 -07:00
tests Clean up registration ID generation 2022-10-05 14:09:07 +00:00
.clang-format Update clang-format with AllowShortEnumsOnASingleLine: false 2022-03-14 11:20:20 -07:00
.gitignore
.travis.yml
SignalServiceKit-Prefix.pch SignalServiceKit: no longer a separate pod 2022-08-05 16:14:15 -05:00
SignalServiceKit.h Swiftify fake message sender 2022-10-05 10:50:53 +00:00