InfiniTimeOrg / InfiniTime

Firmware for Pinetime smartwatch written in C++ and based on FreeRTOS
GNU General Public License v3.0
2.71k stars 926 forks source link

Companion app for iOS #486

Closed JF002 closed 2 years ago

JF002 commented 3 years ago

Recently, we've seen more and more users and potential users asking for a companion app running on Apple devices and more precisely on iOS. While we already have a companion app for Android (Gadgetbridge), and 2 for Linux (Amazfish and Siglo, we have no app for the Apple world.

If anyone is willing to either port an existing app to iOS/Apple or create a new app, know that your contributions will most likely be well received by the community !

Don't know where to start? Here are some ideas of functionalities:

Of course, these are just ideas, and not all of them are needed to make your future app enjoyable!

Do not let yourself discouraged by the cost of an Apple developer account, Pine64 will probably be able to arrange something for you :-)

gamelaster commented 3 years ago

iOS Companion app would be amazing! Also, I think the app can be made for example in Flutter, so it will even work on Android or PC.

(BTW About the Apple Developer Account license, I plan to purchase one for myself, so if there will be need for dev account, I can publish it 😊)

markjacksonfishing commented 3 years ago

I am going to try to see if I can make this work

moriel5 commented 3 years ago

@gamelaster Please, just not Flutter.

While it makes porting easier, the performance is amongst the worst I have seen (tested on low and high performance devices, on both Arm (including Arm64) and x86 (including x86-64), on Windows, Linux, and Android).

gamelaster commented 3 years ago

@moriel5 It was just idea, but I checked some benchmarks, and of course it will be not that fast as native, although I think it's performant (and from what I've seen it's faster than for example React Native).

Anyway, when I think about it now, it can be more problematic, since hard to say if Bluetooth LE library for Flutter will have all required features, also if there are libraries to work with iOS notifications etc.

fbanning commented 3 years ago

This may be totally off but it could the Kirigami framework be a good fit? I'm not 100% sure it will work on iOS but the landing page states that apps have been built for it. Big up-side would be that code could be written in C++/QML and that a single app could be used on all major platforms (streamlining dev efforts).

Avamander commented 3 years ago

Very little of the overall complexity is in the end in the UI alone. Reuse will be somewhat minimal. Most of it stems from what is platform-specific, like stable Bluetooth, reliable background services and integration with platform features.

Worth trying but don't underestimate the work required.

Avamander commented 3 years ago

@gamelaster

Anyway, when I think about it now, it can be more problematic, since hard to say if Bluetooth LE library for Flutter will have all required features, also if there are libraries to work with iOS notifications etc.

If you have characteristic write, read and notify then that's all you're going to need.

JF002 commented 3 years ago

@fbanning I think Amazfish is based on Kirigami, and it already supports InfiniTime!

laubblaeser commented 3 years ago

@fbanning I think Amazfish is based on Kirigami, and it already supports InfiniTime!

Cool, thanks for the info. I knew that it has always been a Qt app (coming from SFOS) but didn't know that they've been using Kirigami.
Maybe it's worth the effort to ask over there and see if it's possible or has been considered before. (I just did that with my private account since I just realised I'm using my work account here. 😅)

ocdtrekkie commented 3 years ago

Just got my PineTime, and a little shocked I can't even set the time on it without an Android or Linux device... so yeah, this would be really nice.

jbkim commented 3 years ago

@ocdtrekkie I found this https://hubmartin.github.io/WebBLEWatch/ and set the time.

ocdtrekkie commented 3 years ago

@jbkim Possibly helpful, but I make a point not to touch anything Google with a ten foot pole. The requirement on a Chrome-proprietary makes it as much use to me as an Android app. :/ I have some Linux devices, but apparently neither of those companion apps "just install" on my Pinebook Pro. (And sent me down another rabbit hole trying to figure out what I need to upgrade my Pinebook Pro to a supported OS... but I digress...)

I know this is experimental hardware with experimental software, but I feel like being able to use a watch to tell the time should be the first thing that "just works" without external hardware.

Looks like Chrome's Bluetooth support may have made it into Edge, which my Windows machines are burdened with... maybe your solution will work for me there. Thanks, I'll keep hacking on the problem.

ocdtrekkie commented 3 years ago

@jbkim Update: After finding a Windows device where I don't have that browser flag disabled by policy, that does have a Bluetooth radio... I have in fact, set the time on my watch. You're my hero. Thank you.

xan-m commented 3 years ago

I've been cracking away at an iOS app for a couple days now, and I'm happy to say that I have a VERY ROUGH proof of concept. So far, it can read and subscribe to HRM data (just prints to debug console for now, haven't implemented a UI component for heart rate), and perhaps most importantly, it sets the time on the watch when it connects!

This is my first time working with Swift, BLE, XCode, or pretty much anything other than python/shell scripts, so I'm sure it needs a lot of tidying.

I'll try to clean up what I can and make a repo later today. Hopefully someone who has touched Swift before can help me clean it up from there (or take over where I left off and turn it into something more professional).

ocdtrekkie commented 3 years ago

@xan-m That's really exciting. I'd be happy to test/give feedback once you have something distributable!

xan-m commented 3 years ago

I've got a repo up and running for my iOS companion app prototype! So far, I can:

Please come check it out! As I said above, I've never worked with this language or these technologies before, so please excuse any poorly-written code. If you have a Mac and are willing to try building the app to test it on your local machine, I'd really appreciate it. If not, it'll probably be a while before I'm ready to upload it to TestFlight so I can distribute betas, so hang in there!

I'm also 100% open to changing pretty much any part of this project, I just wanted to get the ball rolling on something. If you have a better idea for the name, feature suggestions, licensing suggestions, etc. please let me know!

https://github.com/xan-m/Infini-iOS

ocdtrekkie commented 3 years ago

Awesome, @xan-m. I don't have a Mac, so I'm probably holding for TestFlight or something of that nature, if you plan to publish, but I will take a look at the project a bit when I can.

MattiaFochesato commented 3 years ago

In order to implement music controls and notifications / calls on iOS, firmware support must be added. Apps on iOS don't have permissions to read notifications and to control music. Furthermore, it is not possible to be sure that the app is always open in the background.

It is necessary to implement in the firmware the specific functions that Apple makes available for BLE devices.

One method that could be used is that when the device is paired, it is told whether this is an iPhone or not. If it is an iPhone, the various controls are activated.

xan-m commented 3 years ago

Yep, we discussed this the other day in the PineTime chat. ANCS is definitely required for notifications and AMS is required for system-wide music controls. The main issue with ANCS right now is that it requires secure pairing. From what I can tell from the chat, secure pairing is not a priority until the current BLE connection stability issues are ironed out (please correct me if I'm wrong here!).

My dev kit is out for delivery as we speak, so I'll try to play around with AMS and ANCS implementations in the coming weeks.

xan-m commented 3 years ago

Infini-iOS is now available on TestFlight! iOS users, come grab it and let me know what you think!

https://testflight.apple.com/join/Z7u1Jxp4

ajack2001my commented 3 years ago

Sadly, I only have an iPhone 6 with iOS 12.x installed... :(

Avamander commented 2 years ago

I think this is resolved to at least the level of PoC.