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

Widget #12

Open
samuelclay opened this issue Nov 20, 2019 · 14 comments
Open

Widget #12

samuelclay opened this issue Nov 20, 2019 · 14 comments
Labels
deferred On hold for now. high idea

Comments

@samuelclay
Copy link
Owner

Now that we have action buttons (#4), let's make a widget!

https://developer.apple.com/design/human-interface-guidelines/ios/extensions/widgets/

If possible, have it mirror the app (4 modes, 4 buttons) and allow switching between the four apps (3 apps if we're in 12 button mode).

@samuelclay
Copy link
Owner Author

If there's no interaction allowed, then display all four apps with 4 diamonds one above the other?

@Dejal
Copy link
Collaborator

Dejal commented Nov 20, 2019

Should be fun (and useful). Interaction should be allowed, e.g. PCalc's widget supports tapping buttons to perform calculations. May need a bit of refactoring to support accessing and performing actions from an extension, though.

Dejal added a commit that referenced this issue May 1, 2020
- Added widget target to project.
Dejal added a commit that referenced this issue May 1, 2020
- Adding Turn Touch code, WIP.
Dejal added a commit that referenced this issue May 1, 2020
- WIP.
Dejal added a commit that referenced this issue May 1, 2020
- WIP.
Dejal added a commit that referenced this issue May 1, 2020
- First workingish build.
Dejal added a commit that referenced this issue May 1, 2020
- Drawing nicely in collapsed and expanded.
Dejal added a commit that referenced this issue May 1, 2020
- Drawing improvements.
- A couple of modes working.
- Sam Widget target added.
@Dejal
Copy link
Collaborator

Dejal commented May 1, 2020

I have added a new widget branch with the current work-in-progress on the widget.

It isn't finished yet, but the widget is available, and the Phone and Music modes are functional. Other modes will follow in the future. For now, unsupported modes are replaced with the Phone one.

If you want to try it, note that you'll need to set your developer team in the Widget Extension target in the project. The Dejal app and widget targets are ones I can build, since I don't have access to your personal developer account.

Here's a screenshot of the collapsed appearance (a bit tight):

IMG_9916

And the expanded appearance:

IMG_9917

@samuelclay
Copy link
Owner Author

Screenshots looking great and show lots of promise.

I'm having trouble getting the widget to show up in notification center. I changed the app group to the one I registered online, changed the team, and compiled just fine, but no widget. It's being embedded (and not signed) but it's not showing up for some reason. Any ideas?

@Dejal
Copy link
Collaborator

Dejal commented May 1, 2020

You shouldn't have had to change the app group, though may have needed to click the reload button below it. Though maybe you would have needed to, if linked to the developer account; I'm not sure.

If you changed the app group name from group.com.turntouch.ios-remote, some code will need to be correspondingly changed.

Here are what my signing settings look like for the Dejal targets, if that helps; the app:

Screen Shot 2020-05-01 at 08 23 25

The widget:

Screen Shot 2020-05-01 at 08 23 15

Note that the widget won't show up by default; you have to scroll to the bottom of the widgets and click Edit, and add the widget.

@samuelclay
Copy link
Owner Author

Yeah I changed both of those app groups to the one I already had registered (group.com.turntouch.appgroup). And I've been checking the bottom of the Edit screen.

@Dejal
Copy link
Collaborator

Dejal commented May 1, 2020

Fair enough. Make sure you change the code to use that group, too. And commit your changes once you get it working, so I don't stomp on them when I resume working on it (no urgency; won't be until the last week of May).

That won't affect the widget appearing, though.

Ah, I notice that the iOS Deployment Target in the widget's Build Settings is set to 13.4; if you're using an older iOS version, that could explain it. That is too high. The app is iOS 12, so you can change it to match that.

If that doesn't solve it, try deleting the app from the phone and re-installing.

@samuelclay
Copy link
Owner Author

Yep, I was on 13.3.X and not 13.4. Upgraded and it wasn't there, but then I launched the app and it was immediately there. So the app needs to launch first before it's discoverable.

Looks great! We should probably tint the background 30% on tap, since the tiny blue outline isn't doing much (and let's remove that blue color as well).

Can we lower the font size more in miniature mode?

@Dejal
Copy link
Collaborator

Dejal commented May 1, 2020

I'm glad that solved it.

Yeah, need some visual tweaks. I'll note those.

Dejal added a commit that referenced this issue May 31, 2020
- Added separate entitlements files for the Dejal targets, to use the old app groups (they are tied to the app identifiers).
Dejal added a commit that referenced this issue May 31, 2020
- Changed deployment target to iOS 12 at the project level.
- The widget now tints the background on tap.
- Reduced the font size in the collapsed state.
Dejal added a commit that referenced this issue May 31, 2020
- Added more modes.
- Fixed group access for Dejal targets.
Dejal added a commit that referenced this issue May 31, 2020
- Added support for the widget to open the app to perform actions that it can't do in the widget (due to needing a view controller or state that doesn't work in the widget).
- Added more modes.
- Fixed the Camera mode.
@Dejal
Copy link
Collaborator

Dejal commented May 31, 2020

More progress on the widget, including the UI tweaks, and support for opening the app to handle actions that can't be done in the widget (due to requiring state or UI not supported there).

A few more modes remaining to do before completion.

@samuelclay
Copy link
Owner Author

Excellent, I love that this is the season of widgets.

Dejal added a commit that referenced this issue Jun 18, 2020
- Improved communication with main app.
- Widget-compatible network requests.
- HomeKit mode.
- IFTTT mode.
- A few more modes to go....
@Dejal
Copy link
Collaborator

Dejal commented Jun 24, 2020

WWDC20 has deprecated the current widget mechanism, in favor of a SwiftUI-based non-interactive design.

For Turn Touch, this is problematic. We wouldn't be able to switch modes in the widget — or if we did, we'd have to have the widget open the app to do so. Similarly, tapping any action would have to open the app to perform it. Several of the modes already do that, since they have state that can't be done in the current widget, but it'd have to do that even for the simplest actions like changing the volume.

The widget would also have to be rewritten using SwiftUI. The current implementation is still supported for now, but is limited to the bottom of the Today view instead of the home screen on iOS 14, and will probably stop working before long.

So I'm not sure it's worthwhile to continue working on this?

@samuelclay
Copy link
Owner Author

Yeah let's hold off on this for now. If I see other IoT widgets doing it then maybe we'll find a way.

@Dejal
Copy link
Collaborator

Dejal commented Jun 24, 2020

I was very disappointed by this change. I can see why Apple wanted to go with the timeline-based model (like for Apple Watch complications), so they don't have to wait for things to load, but surely iPhones are powerful enough to run a few widgets in the background if necessary, or other solutions that allow real functionality. Several other kinds of widget won't be possible anymore, e.g. calculators (e.g. PCalc), podcast players (e.g. Overcast), etc. Hopefully they'll reconsider this in a future iOS version.

I won't do any more work on this for now.

@Dejal Dejal added the deferred On hold for now. label Jun 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deferred On hold for now. high idea
Projects
None yet
Development

No branches or pull requests

2 participants