Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App Launching for 4.0 #99

Merged
merged 18 commits into from
May 19, 2015
Merged

App Launching for 4.0 #99

merged 18 commits into from
May 19, 2015

Conversation

joeljfischer
Copy link
Contributor

Based on #45, refactored for new project structure

🐱 Not Ready to Merge 🐱

Summary

This PR will involve several pieces to allow an iOS application to track available applications on the users phone that can be launched with SmartDeviceLink. This will involve 4 major pieces.

  1. Head Unit tracking of the foregrounded application on a user's phone.
  2. Head Unit requested querying of a server URL to retrieve a list of applications that are SDL compatible.
  3. Parsing the response from the server, and determining which apps installed on the user's phone can be launched, and sending the filtered response to the HU.
  4. Responding to a request from the HU to launch a specific app, and launching it.

In Depth

Tracking Foregrounded Application

The SDL Proxy object, upon opening a connection, will poll the application for its state, and send that across. It will also immediately set up observers on application state changes. Upon firing of those observers, it will recheck the application for its state, and push a new notification to the HU.

This PR also introduces the ability to send notifications from the Mobile API (issue #34). This is required because application state changes are sent via a pre-existing RPC Notification that was previously only sent from the HU, onHMIStatus. FULL is equivalent to foreground, LIMITED is equivalent to background.

Query Apps Server HTTP Request

The HU will request, via a OnSystemRequest, that the mobile device retrieve an application list from the server. The application may (this has not yet been determined) cache the response for a specified period.

Query Apps Filter Installed Applications

The server will respond with a set response, described here which will be parsed by the library. The library will then run a system call to determine which apps are installed on the phone. The library will then filter the list passed by the server so that only installed apps are represented, and forward it on to the HU.

Launch App

The HU will send an OnSystemRequest with a URL field that contains the URL scheme of the app they wish to launch to the foregrounded application. The library running in that application will then attempt to launch the application specified by the url scheme passed in. This will, of course, foreground that application, and background the application making the call.

TODO

General
Tracking Foreground State
  • Track Application State
  • Add the ability to send RPCNotifications (by sending any type of RPCMessage)
  • Send an OnHMIStatus notification to connected HU when application state changes
  • Remove app state observers when session closes
  • Properly log and handle errors
Query Apps Server HTTP Request
  • Create new SystemRequest enum type for Query Apps
  • Capture OnSystemRequests for Query Apps and Launch App commands
  • Make a query apps web call to the server specified in the OnSystemRequest to retrieve a list of URLs
  • Parse the response from the server, determine applications to be checked
  • Properly log and handle errors
  • Determine if NSURLSessionUploadTask should be NSURLSessionDataTask
Query App Filter Installed Applications
  • Test each application to see if it's installed on the phone
  • Filter the response from the server based on which apps are installed on the phone
  • Send the filtered response to the Head Unit
  • Properly log and handle errors
Launch App
  • Create new SystemRequest enum type for Launch App
  • Parse a Launch App OnSystemRequest
  • Open the specified application from a Launch App OnSystemRequest
  • Properly log and handle errors
Other
  • Test changes to query apps did not adversely affect Policy Server requests
  • Refactor into new develop project layout

@joeljfischer
Copy link
Contributor Author

This fixes #64

@joeljfischer joeljfischer changed the title [WIP] App Launching for 4.0 App Launching for 4.0 Mar 17, 2015
@joeljfischer joeljfischer mentioned this pull request Mar 27, 2015
16 tasks
@joeljfischer joeljfischer added this to the 4.0.0 milestone Mar 30, 2015
_version = 1;
_messageID = 0;
_sessionID = 0;
_recieveQueue = dispatch_queue_create("com.sdl.recieve", DISPATCH_QUEUE_SERIAL);
_sendQueue = dispatch_queue_create("com.sdl.send.defaultpriority", DISPATCH_QUEUE_SERIAL);
prioritizedCollection = [SDLPrioritizedObjectCollection new];

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please get rid of these.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I had to guess, I would say they were automatic Xcode changes in response to spacing inconsistencies? I can't really tell what happened here.

return nil;
}

return JSONDicationary;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Misspelling

Joel Fischer added 3 commits April 24, 2015 15:45
Conflicts:
	SmartDeviceLink-iOS/SmartDeviceLink-iOS.xcodeproj/project.pbxproj
	SmartDeviceLink-iOS/SmartDeviceLink/SDLAbstractProtocol.m
	SmartDeviceLink-iOS/SmartDeviceLink/SDLDimension.h
	SmartDeviceLink-iOS/SmartDeviceLink/SDLProtocol.m
	SmartDeviceLink-iOS/SmartDeviceLink/SDLProtocolHeader.m
	SmartDeviceLink-iOS/SmartDeviceLink/SDLProxy.m
	SmartDeviceLink-iOS/SmartDeviceLink/SDLRPCMessage.m
	SmartDeviceLink-iOS/SmartDeviceLink/SDLRPCMessageType.h
	SmartDeviceLink-iOS/SmartDeviceLink/SDLRPCMessageType.m
	SmartDeviceLink-iOS/SmartDeviceLink/SDLRequestType.h
	SmartDeviceLink-iOS/SmartDeviceLink/SDLRequestType.m
	SmartDeviceLink-iOS/SmartDeviceLink/SDLV2ProtocolHeader.h
	SmartDeviceLink-iOS/SmartDeviceLink/SDLV2ProtocolHeader.m
Fix 'task' in SDLProxy being captured by block when it wasn't initialized
@joeljfischer
Copy link
Contributor Author

@hugh22 I merged in the current develop code to this branch, which appears to make following along with the code changes much easier. I'm pretty confident that the merge went well, but there were a number of errors to be resolved so just keep that in mind as well.

Joel Fischer added 4 commits May 5, 2015 11:19
Fix a bug in TCPCallback to no longer attempt to parse zero length data
Conflicts:
	SmartDeviceLink-iOS/SmartDeviceLink/SDLRPCMessageType.h
@joeljfischer
Copy link
Contributor Author

@hugh22 If you could take another look and see if your issues are resolved, that would be great!

@hugh22
Copy link
Contributor

hugh22 commented May 13, 2015

Looks good to me.

Conflicts:
	SmartDeviceLink-iOS/SmartDeviceLink/SDLV2ProtocolHeader.h
@joeljfischer joeljfischer merged commit d4339d9 into develop May 19, 2015
@joeljfischer joeljfischer deleted the feature/app_launching branch May 19, 2015 20:16
@joeljfischer joeljfischer mentioned this pull request Jul 9, 2015
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants