Commit graph

154 commits

Author SHA1 Message Date
Michael Kirk bd370f1de4 Fix cropped Chinese/Japanese messages
The earlier fix for the broken ios10 emoji font ended up breaking
messages for some users with a tall font.

Here we have a lighter touch - ensuring we don't touch messages that
don't use emoji.

Also, introduce a different approach to the fix, rather than trying to
compute the bounding rect of an appropriately attributed string, just
add an extra bit of height per line.

This approach isn't ideal for long messages with only one emoji line in
them, but the previous approach was incompatible with Chinese messages
that also contain emoji. See the new
`MesssagesBubblesSizeCalculatorTest.swift` for test cases considered.

// FREEBIE
2016-11-03 16:22:33 -04:00
Michael Kirk 1dd06a5e6c Fix registration flow / Keep push tokens in sync
* Separate registering an account from registering for push notifications
  * Allows us to complete registration without prompting user for
    notification settings.

UX Changes
----------
* Automatically keep push tokens in sync on startup.
  Push tokens *can* change, though they rarely do. It happens more often
  for people switching between appstore/beta builds.

  fixes #1174

* Show alert with registration failure
  * add secret 8-tap debug log gesture to registration flow

* Move registration to separate flow
  * don't see flash of inbox when first launching

* show useful error messages when given wrong code / no code

* remove background fetch
  We werent using it, but only relying on a side effect of it which is
  no longer necessary.

Code Changes
------------

* More registration logging.

* Install PromiseKit with carthage

  Our dependencies are not yet framework compatible, so we can't use
  cocoapods.

* Merge preferences util "category" into superclass.

  The immediate reason for this is Swift interop was assuming optional
  types were not optional, and exploding when a value was nil.

  This is clearer anyway, since we were treating it like a subclass, and
  it was the only thing using the class anyway.

* auto-genstrings now searches *.swift (and *.h, which was previously
  broken) for translateable strings.

// FREEBIE
2016-11-03 16:13:49 -04:00
Mike 7c6b84c46b Outgoing message sound respects Settings toggle (#1373) 2016-11-03 14:51:38 -04:00
Michael Kirk 1eb234e8ba Attempt to fix intermittent crash in messages view controller
HACK to work around radar #28167779

  "UICollectionView performBatchUpdates can trigger a crash if the collection view is flagged for layout"
  more: https://github.com/PSPDFKit-labs/radar.apple.com/tree/master/28167779%20-%20CollectionViewBatchingIssue

I have never reproduced the crash, but it's appearing in about 0.05% of
<=2.6.2 sessions and an alarming ~5.0% of beta sessions >=2.6.3.8.

// FREEBIE
2016-11-01 10:05:11 -04:00
Michael Kirk 541ca39155 Partial revert of 33f6a95520 (#1421)
An existing related crash is much more common after 33f6a95520.

This is the only change proximate to the crash.

Crash looks like this:

    Last Exception Backtrace:
    0   CoreFoundation                  0x189c601c0 __exceptionPreprocess + 124 (NSException.m:165)
    1   libobjc.A.dylib                 0x18869855c objc_exception_throw + 56 (objc-exception.mm:521)
    2   CoreFoundation                  0x189c60094 +[NSException raise:format:arguments:] + 104 (NSException.m:131)
    3   Foundation                      0x18a6ea82c -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 112 (NSException.m:157)
    4   UIKit                           0x1903a534c -[UICollectionView _endItemAnimationsWithInvalidationContext:tentativelyForReordering:animator:] + 13428 (UICollectionView.m:5585)
    5   UIKit                           0x1903a8e98 -[UICollectionView _endUpdatesWithInvalidationContext:tentativelyForReordering:animator:] + 92 (UICollectionView.m:6401)
    6   UIKit                           0x1903a9178 -[UICollectionView _performBatchUpdates:completion:invalidationContext:tentativelyForReordering:animator:] + 384 (UICollectionView.m:6459)
    7   UIKit                           0x1903a8fd8 -[UICollectionView _performBatchUpdates:completion:invalidationContext:tentativelyForReordering:] + 96 (UICollectionView.m:6423)
    8   UIKit                           0x1903a8f5c -[UICollectionView _performBatchUpdates:completion:invalidationContext:] + 84 (UICollectionView.m:6418)
    9   UIKit                           0x18fc834ec -[UICollectionView performBatchUpdates:completion:] + 64 (UICollectionView.m:6407)
    10  Signal                          0x1000d7e90 -[MessagesViewController yapDatabaseModified:] + 756 (MessagesViewController.m:1863)

// FREEBIE
2016-10-28 09:36:39 -04:00
Michael Kirk 33f6a95520 Explain send failures for text and media messages
fixes #1231

Motivation
----------
Previously when messages failed to send, there was no reason given.
Furthermore, when media messages failed to send there was no indication
that any attempt to send the message even occurred, nor a retry
dialog.

UX Changes
----------
- Show "uploading" status for media
- Show specific error message in retry-send dialog
- Only scroll to bottom when new message is inserted
- Show specific errors when group creation fails

Code Changes
-----------
- Updated incorrect references to TSMessageAdapters which were actually
  references to OWSMessageData
- MessageSender was extracted from SSK MessagesManager
- access MessagesManager as property
- idiomatic init/properties for Env
- log contact intersections
- Move scroll-to-bottom animation to main thread.

// FREEBIE
2016-10-26 15:22:35 -04:00
Michael Kirk 7c32259a92 We aren't using ErrorMessage/InfoMessage. (#1412)
We incorrectly assumed some parameters were these types, but actually
they were TSMessageAdapters.

// FREEBIE
2016-10-23 13:39:42 -04:00
Matthew Douglass 722c3a5e78 Create TSOutgoingMessage with info on group change
TSOutgoingMessage is created with details about the group changes so that we see more than just “Group Updated.”

* Customizes message for new group creation

  Replaces GROUP_UPDATED with GROUP_CREATED for a brand new group. Localized for English only.

* Updates to use fixed SignalServiceKit branch

// FREEBIE
2016-10-20 20:32:30 -04:00
Michael Kirk 802d2bfdff Revert "Create TSOutgoingMessage with info on group change"
Inadvertently stole credit for work done when squashing the commits.
Reverting and re-merging giving appropriate credit.

This reverts commit 8242c9e381.
2016-10-20 20:31:54 -04:00
Michael Kirk 8242c9e381 Create TSOutgoingMessage with info on group change
TSOutgoingMessage is created with details about the group changes so that we see more than just “Group Updated.”

* Customizes message for new group creation
  Replaces GROUP_UPDATED with GROUP_CREATED for a brand new group. Localized for English only.

* Updates to use fixed SignalServiceKit branch

// FREEBIE
2016-10-20 20:20:41 -04:00
Michael Kirk 49de772997 Fix slow reloading conversation view. (#1397)
Fix animation memory leak exacerbated every time you reload a
conversation with expiration timers.

Stop animation on cells that aren't currently being displayed. This is
relatively minor compared to the above, but still, no reason to waste
cycles.

// FREEBIE
2016-10-15 16:41:40 -04:00
Michael Kirk da82c01f6e Restart timer animation when returning from background
// FREEBIE
2016-10-13 10:04:58 -04:00
Michael Kirk 6a4fc3168d Fix delivery shown for undelieverd disappearing messages.
fixes  #1380

// FREEBIE
2016-10-12 14:54:41 -04:00
Michael Kirk 85beb93e86 Style timer changes less alarmingly.
// FREEBIE
2016-10-12 09:30:25 -04:00
Michael Kirk 07ab1bd931 Call notifications appear immediately after call
previously you had to leave/return. This happens because we unregister
observers while our view is not visible.

// FREEBIE
2016-10-12 09:30:25 -04:00
Michael Kirk 7106eee4a3 Call notifications are deletable
// FREEBIE
2016-10-12 09:30:25 -04:00
Michael Kirk 405990a7d5 Don't select or copy info message text.
// FREEBIE
2016-10-12 09:30:25 -04:00
Michael Kirk dc95d328cb Don't expire messages until they are sent.
// FREEBIE
2016-10-12 09:30:25 -04:00
Michael Kirk 94a23021f8 Size error messages correctly.
* calculate size of info message using the info message font.
* offset by the info message header

There were instances of lines getting cropped, or an extra line being
added. The previous, more conservative, solution was to just make every
bubble too big, but it looked terrible.

// FREEBIE
2016-10-12 09:30:25 -04:00
Michael Kirk a28fea8384 Fix emoji message truncation on iOS10
fixes #1368

Apple switched emoji fonts from AppleColorEmoji to AppleColorEmojiUI.
The new font doesn't compute it's size correctly, causing containing
rectangles to be too small.

This commit scrubs strings of the new emoji font, and replaces it with
the old.

// FREEBIE
2016-10-12 09:30:25 -04:00
Michael Kirk 43a2eb9da1 Fix occasional crash when sending after deleting messages
// FREEBIE
2016-10-12 09:30:25 -04:00
Michael Kirk ee0cce75e8 Disappearing Messages
* Per thread settings menu accessed by tapping on thread title

  This removed the toggle-phone behavior. You'll be able to see the phone
  number in the settings table view.

  This removed the "add contact" functionality, although it was already
  broken for ios>=9 (which is basically everybody).

  The group actions menu was absorbed into this screen

* Added a confirm alert to leave group (fixes #938)

* New Translation Strings
* Extend "Add People" label to fit translations.
* resolved issues with translations not fitting in group menu

* Fix the long standing type warning where TSCalls were assigned to a TSMessageAdapter.

* Can delete info messages

  Follow the JSQMVC pattern and put UIResponder-able content in the
  messageBubbleContainer. This gives us more functionality *and* allows us
  to delete some code. yay!

  It's still not yet possible to delete phone messages. =(

* Fixed some compiler warnings.

* xcode8 touching storyboard. So long xcode7!

* Fixup multiline info messages.

  We were seeing info messages like "You set disappearing message timer to
  10" instead of "You set disappearing message timer to 10 seconds."

  Admittedly this isn't a very good fix, as now one liners feel like they
  have too much padding.

   If the message is well over one line, we were wrapping properly, but
  there's a problem when the message is *just barely* two lines, the cell
  height grows, but the label still thinks it's just one line (as evinced
  by the one line appearing in the center of the label frame. The result
  being that the last word of the label is cropped.

* Disable group actions after leaving group.

// FREEBIE
2016-10-12 09:30:25 -04:00
Michael Kirk 48336b6c53 Resetting session returns you to messages view with an indicator that
your session was reset.

// FREEBIE
2016-10-12 09:30:25 -04:00
Michael Kirk 11a586a835 New Fingerprint Format
Rather than verifying eachothers keys separately, you now verify the
privacy with your recipient by sharing a single composite number or
QRCode.

This is a breaking change, in coordination with Desktop and Android.

UX
--

Fingeprint is no longer in line with identity key error. Instead you
have the option of going to the full-screen safety number verification
experience.

Overhauled fingerprint design
-----------------------------

* use same modal dismiss button as elsewhere
* remove fingerprint from settings.
* quick slide in animation vs slow fade
  * existing was painfully slow
  * blur effect is better metaphor for something slide over top
  * anyway there was a rendering glitch in the end of fade where
    underlying navbar would "snap" out

Also Fixed
----------
Always provide a name string for contact

* Centralize all the nil-checking
* Fall back to "unknown contact"

allow multi-line error messages

// FREEBIE
2016-10-12 09:30:25 -04:00
Michael Kirk 5372173c4a Fix groups breaking without avatar (#1336)
- Group updates were appearing as "unsupported attachment"
- Couldn't message in a new group unless it had attachment.

// FREEBIE
2016-09-20 19:16:05 -04:00
Michael Kirk 7c3a07960f Device manager fixes
* Avoid intermittent crash in device manager via YapDatabaseModified
* Properly align refresh text when expecting new device
* Avoid glitchy activityIndicator while polling
* Expose edit mode toggle

Much of the code changes here were in the corresponding SSK update.

// FREEBIE
2016-09-06 17:16:42 -04:00
Michael Kirk dee26e6e0a Use PNG constant
// FREEBIE
2016-09-06 15:57:44 -04:00
Michael Kirk 428f7fca19 Adapt to nullability annotations in SignalServiceKit
// FREEBIE
2016-09-06 15:57:44 -04:00
Michael Kirk 6545161192 thread is set during notification callback.
It should *not* be non-atomic

// FREEBIE
2016-08-23 14:24:48 -04:00
Michael Kirk cc2d47fbd3 Update protocol (#1315)
* Update to latest SignalServiceProtocol
* Show SignalServiceKit compiler warnings

// FREEBIE

* Update to latest signal protocol

// FREEBIE
2016-08-22 16:54:31 -04:00
Michael Kirk 9f2bb5d2cc Fixes lingering interactions after removing thread (#1297)
Most of the work was done in SignalServiceKit 0.0.7, this adapts to
those changes.

Migration to clean any orphaned interactions/attachments.

- don't set new migration version until migration was successful.
- remove dead code from migrations

- rename message.attachments->message.attachmentIds
- Remove unused parameter from GroupModel
- formatting touched method/'s signatures

//FREEBIE
2016-07-31 15:25:07 -07:00
Michael Kirk 147cc15105 Input toolbar fits text size (#1290)
* Set height of toolbar based on actual font height. FIXES #1282
* max height for compose field FIXES #1186

Still absent is resizing to fit draft.

// FREEBIE
2016-07-22 00:05:24 -07:00
Michael Kirk 86f06593d8 Fix "can't reattach saved GIF" (and others) (#1288)
The root of the problem is we were using the deprecated ALAssetsLibrary
framework, which couldn't find certain assets.

By using the photos framework not only are we able to find these
assets, but it also cleans up our code:
* no more copying byte buffers
* no more detecting file type

// FREEBIE
2016-07-21 17:15:34 -07:00
Brandon Cheng 583d3e82ad Alternative solution for requiring direct taps for launching media view (#1235) (#1261)
// FREEBIE
2016-07-21 10:23:39 -07:00
Ronny e7affecc17 FIX: Leaving group should dismiss keyboard #1274 (#1278)
If we hide the input toolbar, we should hide the keyboard too

//FREEBIE
2016-07-21 08:50:41 -07:00
Michael Kirk 97fdabf9a2 Narrow the bubbles a bit. (#1269)
This is closer to the 2.3 version.

Seems like upstream sizing has changed since our JSQMVC upgrade. This wider size calculation makes sense if you're losing space to the avatar, but since we're not using avatars the full width bubbles can make the whole view seem a bit crowded when you have large blobs of text.

// FREEBIE
2016-07-20 13:21:20 -07:00
Michael Kirk 835021b0d3 Fix extra tall error messages by rendering timestamp (#1268)
We were ocassionally seeing extra tall error messages. This is because,
when appropriate, we were adding the space for a timestamp, but then
never actually rendering the time stamp.

So now:

- Error Messages aren't rendered too-tall
- Error Messages get a printed timestamp when appropriate

// FREEBIE
2016-07-20 11:59:18 -07:00
Michael Kirk df63c8624d fix compiler warnings
// FREEBIE
2016-07-19 09:10:39 -07:00
Michael Kirk e7d4763715 Must tap directly on bubble to launch fullscreen media view (#1260)
// FREEBIE
2016-07-18 18:51:40 -07:00
Michael Kirk 9db3b0db27 Consistent and efficient media Delete/Copy/Save UX
copy/save/delete is accessed via longpress for all media messages, just
like for simple text messages.

Notes
-----
We don't support saving audio attachments as it's not clear where they should go.
(I don't think users expect them to end up in their iTunes library.)

There is still no UX for "pasting" media into Signal.

Removed the now redundant (and confusing) "share" button interface.

//FREEBIE
2016-07-18 09:20:48 -07:00
Michael Kirk db3b2d443c Use upstream corner radius
The history here is that the radius I'm removing was added in #884 after
having straight edges added in our custom fork for a while.

So, rather than override our override, I'm just reverting to the
upstream value, which is close in proximity, and closer to iMessages
radius.

// FREEBIE
2016-07-14 23:28:42 -07:00
Michael Kirk 4ccb295dbb Send button disabled color and dynamically sized
Using upstream button and change notification allows us to delete some
code.

// FREEBIE
2016-07-14 23:15:06 -07:00
Michael Kirk f8d65ab0f5 Post JSQMVC code cleanup
* formatting
* referencing TODOS
* remove unnecessary logging

// FREEBIE
2016-07-14 23:15:06 -07:00
Michael Kirk b7dd51438e Move colors into style class
// FREEBIE
2016-07-14 23:15:06 -07:00
Michael Kirk 1a4b38e34b Modernize init, dealloc, dicts
* Use NS_DESIGNATE_INTIALIZER to ensure we're setting all the variables we need to be in OWSCall
* no need to nil properties in dealloc on ARC
* use declarative dictionaries for legability

// FREEBIE

use declarative dictionaries for clarity
2016-07-14 23:15:06 -07:00
Michael Kirk f7f1b6877b Remove unused call thumbnail code
// FREEBIE
2016-07-14 23:15:06 -07:00
Michael Kirk e930574b1b rename our custom JSQ classes to OWS so it's clear what is/not our code.
This was done as part of unforking JSQMessagesViewController, but is
intentionally a separate commit so we can separate formatting changes
from code changes in git history.

* Import frameworks like:
    #import <FrameworkName/HeaderName.h>
* instead of:
    #import "HeaderName.h"

// FREEBIE
2016-07-14 23:15:06 -07:00
Michael Kirk 4d320d6015 Unfork JSQMessagesViewController
Geting back on upstream fixes a couple bugs (see ##Bugfixes), and also
will make future updates easier.

The unforking process was basically this:

* move custom message types (Calls and DisplayedMessages) classes from our
  custom JSQMVC fork into Signal-iOS.
* Move any method customization into our subclass. Including
  ColletionView stuff, bubble sizing, and gesture behavior

Bug Fixes
---------
* Fix mis-sized incoming media bubbles.

Bubble size was being cached by interaction id. Which broke when
receiving an attachment. The problem is that incoming media messages
were initially the height of a "Downloading Attachment" info message.
Instead we use the mediaHash for media messages to expire the bubble
size when the media changes.

* fix missized bubble when MVC did appear

The MessagesViewController isn't sized correctly until ViewWillAppear.
This caused the first round of bubbles to be rendered incorrectly (they
assumed a larger container than they had).  I think is reflected in the
current version of the app by a reflow occurring shortly after the view
appears.

Chores
------
* bump travis to build with xcode8
* specify RQV development team for device build. required by xcode 8 beta

Cleanup
------
* Refactor messageing XIB so that elements are hangning outside of
  the views frame
* Fix compiler warning with explicit cast
* delete deprecated lineBreakmode, it's the default value anyway.

// FREEBIE
2016-07-14 23:15:05 -07:00
Michael Kirk d4f2c0f249 ensure picker source available to prevent crash
This is crashing on simulator, but presumable if it weren't available
for other reasons (permissions?) it would also crash.

// FREEBIE
2016-07-07 10:31:51 -07:00
Michael Kirk 26f5418500 Remove distinction between TS and RP users
* Ensure we're always showing call button for non-group threads.
* search phone strings directly rather than precomputing field

// FREEBIE
2016-06-28 08:58:29 -07:00