tuntorius / mightier_amp

An alternative app for controlling NUX Mighty amps.
MIT License
191 stars 20 forks source link

Question about IOS #16

Closed timuckun closed 1 year ago

timuckun commented 3 years ago

In the readme it says Apple wouldn't allow this in their app store. My question is whether or not it's even technically possible to do with with an IOS app.

I guess also whether anybody has tried submitting such an app to the store.

This would be awesome paired with an ipad.

tuntorius commented 3 years ago

In fact I'm not 100% sure Apple would not allow it. They have very strict rules especially for apps that control another hardware, but I think BLE devices might be an exclusion.

As for the technical standpoint I don't see why it won't work. I'm using Flutter which is a multiplatform framework and when I need plugins I choose those that support both platforms. There are few things that I wrote which are Android only, like the file pickers for preset import/export and audio library browsing. Those would need to be coded for iOS as well. The other problem is that I can't even try to publish it in the app store because in order to submit it I must have an apple computer, an iphone or ipad and also apple development subscription which costs 99$ per year. All of those things are pretty big investment for me just to publish this app. In fact I tried to setup a mac VM on my pc to test whether it would work and the app ran successfully in the iphone emulator. Of course the bluetooth didn't work because it doesn't emulate it. Also the file pickers and the whole jamtracks section didn't work for the reasons I mentioned above. It would be great if an apple developer is willing to help for that.

EDIT: I just checked whether katana librarian (another third party app that controls amps) is available in the app store and it's not. So maybe they really won't allow it.

mikaelholmgren commented 3 years ago

The current state is that i have it running on a physical device now. Bluetooth is working, but it seems that for some reason when trying to connect to the Nux, the event ConfigReceived isn't fired and so the timeout takes the connection down. So just to test, i temporarily moved that codeblock from the DeviceConnectionState.configReceived block into the end of DeviceConnectionState.connectedStart in main.dart. Now, i can control the NUX's params, but the presets are not loaded, so it seems that something is going wrong with configreception or presetloading.

tuntorius commented 3 years ago

It seems the BLE connection is successfully established every time but there's a problem in receiving the amp config. I can give you some tips:

  1. For some reason if I send a BLE message immediately after the connection establishment, it fails and the device will not respond to further messages. As a workaround, I added a 1-second delay in requestFirmwareVersion function in NuxDeviceControl.dart line 292. I'm not sure if it's something to do with the device or with android but you may try to increase it to see if it will make a difference.
  2. When the connection to the device is established, the app receives a single empty data packet. I use that as an indication to send the firmware request message i.e. to call the requestFirwareVersion mentioned above. Maybe that message is not sent by the device but is some android thing that doesn't happen in ios? See if you can set a breakpoint at the beginning of _onDataReceive (NuxDeviceControl.dart line 261) to see whether this happens on ios too. If it doesn't - you can call that function manually from NuxDeviceControl:_onConnect. That will be the better way to do it anyway.
mikaelholmgren commented 3 years ago

Thanks for that! It was 2:nd one, sort of. I did receive something from the Nux. But it didn't trigger the requestFirmwareVersion, so i just put that last in the onConnect and that seems to have solved it. Has been working so far. That's great! I'll play around a bit and then we can think how to proceed. One step could of course be to put it on Apple's beta platform TestFlight first, so more people can try if they want. I could certainly do that if you'd like, and if there's interest

tuntorius commented 3 years ago

I'm glad to hear it works. There were many people who asked for iOS version so I'm definitely in for that.

Here's a summary of what won't work out of the box: qr_utils plugin - the camera scan should work and also the QR generation should work. I added a method to scan a QR from the image gallery of the phone, which is android only. Also it depends on a file/image picker that is also written by me and android only.

audio_picker plugin - it is used when importing songs for the jam tracks - JamTracks -> Tracks -> + button -> File Browser. Originally it works for both platforms but supported single file selection only. I added multiple file selection for android. I also wrote part of the ios implementation but it needs to be finished.

flutter_audio_query - this plugin lets you import songs from the media library - JamTracks -> Tracks -> + button -> Media Library. It originally was android only, but somebody forked it on github and wrote an iOS version. I added it but I'm not sure if it works.

Importing and exporting presets - I wrote the file pickers myself. The file open picker is also used to pick an image for the qr image scan mentioned above.

Displaying the audio waveform inside the jamtracks editor - I couldn't find a flutter plugin for this but found an android code that decodes an audio file and returns an array of samples. I don't understand much of the code, just made it work. It's platform specific. That was nearly an year ago and I just looked if there is a new plugin for that and to my surprise there is something promising that was published just 2 days ago: https://pub.dev/packages/just_waveform I'm not sure if it'll work as it's very recent and maybe buggy, but it's written by the same author that wrote just_audio which is an amazing audio player plugin that I'm using for the jamtracks functionality.

I'll have a look if there's something new for the other features as well. I was surprised that there weren't any good file picker plugins an year ago.

mjeshurun commented 1 year ago

I own a Mighty Plug Pro, an iPad Mini 6 and an iPhone 11 Pro. I would be happy to help test any iOS/iPadOS beta versions.

tuntorius commented 1 year ago

@mjeshurun If you're a developer you can download the source code and build it yourself. Almost everything works now. Unfortunately, Apple doesn't allow sideloading apps so unless the app is published in the store, building it yourself is the only way to install it on your phone. It's not possible for me to build it and just give you an install package. However, even if you do build it yourself, the app expires in 7 days and stops working. You have to renew it each time, and I'm not sure if it keeps its data - you might lose your presets this way.

mikaelholmgren commented 1 year ago

Haven't been into this for a while, but if enough interest from people exists, i could reactivate my Apple developer program and see if it would be possible to get something working firstly into the beta program so that it could be installed a bit esier for non-devs.

mjeshurun commented 1 year ago

If you're a developer

Thanks for the info @tuntorius , but, unfortunately, I'm not a developer.

but if enough interest from people exists, i could reactivate my Apple developer program and see if it would be possible to get something working firstly into the beta program so that it could be installed a bit esier for non-devs.

@mikaelholmgren If you can do this, it will be awesome! I'm not a developer, so an easy install of the app using Testflight will be a wonderful solution 🙏🙏🙏

mikaelholmgren commented 1 year ago

@mikaelholmgren If you can do this, it will be awesome! I'm not a developer, so an easy install of the app using Testflight will be a wonderful solution 🙏🙏🙏 @mjeshurun, ok so will look into that then.

mjeshurun commented 1 year ago

@mikaelholmgren If you can do this, it will be awesome! I'm not a developer, so an easy install of the app using Testflight will be a wonderful solution 🙏🙏🙏 @mjeshurun, ok so will look into that then.

Amazing!! Many thanks 🙏🙏🙏

tf5bassist commented 1 year ago

Just throwing my support behind an iOS release as well. here's to high hopes!

tuntorius commented 1 year ago

Not exactly the iOS support you'd like, but might be a start. Here's Mightier Amp as a web app: https://mightieramp.web.app/ In order for this to work, your browser must support Web Bluetooth standard! Safari doesn't, but there are other browsers that claim to work, such as Bluefy - https://apps.apple.com/us/app/bluefy-web-ble-browser/id1492822055 Bear in mind this is a test version and many of Mightier Amp features don't work. Try it, if you like. If the BLE connection works well, I may implement the rest of the features. A bonus will be that it will work on any device - desktop or mobile - as long as it supports web bluetooth.

tf5bassist commented 1 year ago

Oh interesting, I'll give it a shot and see how it works. I think Chrome supports Web Bluetooth, so I'll give it a spin on my iPhone, iPad, and MBP.

tf5bassist commented 1 year ago

Just a heads up, but I did attempt to use this site on both my iPhone and iPad using the Bluefy browser (Chrome on iOS doesn't support Web Bluetooth yet), but it refused to connect to the amp on either of them. Do you have any tips or tricks that may get the connection to work?

It sees the amp in the list of devices and looks like it tries to connect, but never actually does it. The Disconnect button never shows up or anything.

tuntorius commented 1 year ago

I purchased an Apple developer account now, just for publishing Mightier Amp. As an author, I should be the one publishing it, to avoid the risk of the other publisher disappearing and leaving me unable to update the iOS version.

However, when I attempted to register the app bundle in the developer portal, it was rejected because it's taken. Maybe someone in this thread tried to publish the app and registered it? There's no live app with this id, but it's enough for somebody to register it for development to become unavailable.

@mikaelholmgren you said you'll try to publish it. Maybe you've registered the bundle id 'com.tuntori.mightieramp'? If that's the case, please, delete it so I can use it. If it's not you, then maybe somebody else in this thread?

mikaelholmgren commented 1 year ago

@tuntorius That's good, because that was one of the conserns i had. I didn't try to publish, but the bundleId could be mine - i'll have a look and delete it if its there.

tuntorius commented 1 year ago

@mikaelholmgren Thank you! I successfully registered it now.

mikaelholmgren commented 1 year ago

That's great, but then it must have been someone else or some other issue because I didn't had the time to check it yet.

tuntorius commented 1 year ago

I'm happy to announce that an important milestone has been reached. Mightier Amp for iOS has just been approved for beta testing.

Who wants to test it? Give me your iCloud email here or send it to mightieramp@gmail.com and I'll send you an invitation.

mikaelholmgren commented 1 year ago

That's awesome, since i've been into this for a while i'll jump onto TestFlight. I'll send my email to the given emailaddress.

mjeshurun commented 1 year ago

I'm happy to announce that an important milestone has been reached. Mightier Amp for iOS has just been approved for beta testing.

Who wants to test it? Give me your iCloud email here or send it to mightieramp@gmail.com and I'll send you an invitation.

Is there anything in particular you would like us to test during the beta? I’m fairly new to the Mighty Plug Pro, and I know how to use very few features of the official app, so if you have anything you’d like us to test, it will help if you make a list and we’ll go over it and check if everything is working as it should 🙏

tf5bassist commented 1 year ago

Good idea. I did fire it up last night after firmware updating my devices. I only tried with my MPP, but it seems to work as I would expect the Mighty Amp app to work. I also tried using my M-Vave Chocolate for the first time, and that works as well.

So far, off to a good start!

tuntorius commented 1 year ago

It's important to test the platform-dependent things. Is the Bluetooth connection stable? Can you add music to the jam tracks module and does the playback work well? Does the QR scan and generation work? It's good to hear that midi controllers work.

I have found 2 bugs already: Every second attempt to generate a QR code fails.

The media picker for the jam tracks doesn't let me deselect a track after it's selected. Instead, the resulting list it gives to my app after I close it has that track duplicated as many times as I have tapped on it. However, the picker is a system thing, it's not made by me and this sounds like a bug in it. The best I can do is to remove duplicates from the list, unless there's an option to make deselect working.

tuntorius commented 1 year ago

The iOS version is out.