Prevent expanded view on message selection

My iMessage extension is more or less a picker to select an item to be sent. It doesn't make sense to view the full item in the extension because that would replicate the whole app within the extension. So when the user selects an app message I directly open the host app using openUrl. This works fine, however it still shows the expanded layout briefly and the animation looks ugly.


Here's my code:


override func willBecomeActive(with conversation: MSConversation) {
  super.willBecomeActive(with: conversation)

  if let url = conversation.selectedMessage?.url {
    dismiss()
    extensionContext?.open(url, completionHandler: nil)
  }
}


I dismiss the extension before opening the URL but apparently this is only executed after it is fully shown.


Do I miss anything how to prevent showing the iMessage extension layout when selecting a message?



Filed as (open) radar 27480594 as well.

Replies

What's the difference then between what you show in compact mode versus expanded mode? Always kicking the user out of Messages when they select one of your messages defeats the utility of iMessage apps which is to allow people to stay in the conversation they're having, but have the functionality that your app provides. Perhaps if you could give some more details of what your apps (both iMessage and parent) do then that might clear things up.

The app is a POI finder app. The iMessage extension allows to easily send place information by picking or searching a place from the list. Expanded and compact mode both show the list of places with the exception that search switches to expanded mode because the keyboard is needed.


The recipient sees the basic place information right away in the message. To know more details or start a navigation, the user is kicked to the host application. We feel that's the right thing to do because otherwise we would have to replicate the whole app in the iMessage extension. Showing just a bit more info in the iMessage extension and then switching to the main app for more details only shifts the context switch to a later point in time which doesn't feel right either.


I definitely think it would be useful if the extension could control what to do when a message is selected. E.g. there might be other use cases where it's more appropriate to show the extension in compact mode.


Also, when the extension is already running, I have to implement -willSelectMessage:conversation: and there it's all under my control how to present the UI or not. So it would be consistent to give us the same choice in case the extension isn't already running.

I definitely think it would be useful if the extension could control what to do when a message is selected. E.g. there might be other use cases where it's more appropriate to show the extension in compact mode.


This would make for a good bug report requesting that ability if that works best for your app.

Already filed a radar, as noted in my initial post: r27480594 "iMessage extension: can't prevent full size view on message selection"