[TIMOB-19412] WatchOS2 template should demonstrate use of WatchConnectivity
GitHub Issue | n/a |
---|---|
Type | Improvement |
Priority | Medium |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2015-08-31T20:20:29.000+0000 |
Affected Version/s | Release 5.0.0 |
Fix Version/s | Release 5.0.0 |
Components | iOS |
Labels | watchOS2 |
Reporter | Fokke Zandbergen |
Assignee | Lee Morris |
Created | 2015-08-26T12:47:01.000+0000 |
Updated | 2017-03-16T22:45:33.000+0000 |
Description
Out of the box the WatchOS2 template does not connect with the Titanium app it is bundled with.
The storyboard should have some buttons and the
InterfaceController.m
and .h
some basic code to demonstrate how to import and use WatchConnectivity/WatchConnectivity.h
.
Current template InterfaceController:
https://github.com/appcelerator/titanium_mobile/blob/master/templates/applewatch/watchos2/template/%7B%7BExtName%7D%7D%20WatchApp%20Extension/InterfaceController.m.ejs
Kiat's sample app with basic UI and logic:
https://github.com/cheekiatng/Titanium-WatchOS2-Sample-App/blob/master/extensions/SGDemoWatchOS2/SGDemoWatchOS2%20WatchApp%20Extension/InterfaceController.m
Can't we just do this via the docs?
It's just a few lines and improves the dev experience. At least import the header and start the session so that when they add the watchsession code in the app it can find the watch app.
Submit a PR and assign me as the reviewer and it'll get merged.
[~cng] The [5.0 sample app](https://github.com/appcelerator-developer-relations/appc-sample-ti500) based on yours is still in progress and since my Obj-C is not fluent, would you be able to do a PR for this?
Ok. I was trying to get complication working as an example though. But i'll just submit a PR of the first version first.
Complications? O yes please: https://github.com/appcelerator-developer-relations/appc-sample-ti500/blob/master/README.md#todo ;)
[~fokkezb] are complications yet implemented? I will work on this ticket on monday as discussed with [~cng]
The WatchSession part of 5.0 sample is done, except for complications. You can maybe use some of it for the template: https://github.com/appcelerator-developer-relations/appc-sample-ti500
Pending PR (reflecting the code used in [~cng]'s demo): https://github.com/appcelerator/titanium_mobile/pull/7093
I was thinking if we should also implement a default code sample in the titanium app as well, otherwise the code in the Xcode extension project is meaningless. And also whether to have an option flag for developers to either choose empty project or with this sample code. [~cbarber], [~ingo], [~fokkezb], thoughts?
Bleh. Just realised that it's not that straight forward, because in studio, we are generating the ti watch Xcode project at the tiapp.xml GUI when we press 'enable watch'. That implies that there's already the default alloy template implemented on the titanium app. Have to think through this a bit.
Apart from generating a
watch
controller (if that doesn't already exist) with the sample code I don't see good way to also generate Titanium app sample code. But since our users are JS devs and its the Obj-C part they will need guidance with most, I think it's OK to only have that part in the template. Then at least as soon as you use an API in the Titanium app, the Watch app will respond out of the box. Updated PR based on https://github.com/appcelerator-developer-relations/appc-sample-ti500/tree/master/extensions/appc-sample-ti500 https://github.com/appcelerator/titanium_mobile/pull/7095[~cbarber], can you review and see if we can get this out with 5.0.0? Thanks [~fokkezb]!
Closing ticket as fixed.