Cap-go / native-audio

Capacitor plugin for native audio engine.
https://capgo.app
MIT License
30 stars 14 forks source link

The resolve() call is missing in the stop function. (IOS) #131

Closed KovendiMozes closed 1 week ago

KovendiMozes commented 1 week ago

https://github.com/Cap-go/native-audio/blob/e9b24a43cb9b66eded64c0550643930866e80c1d/ios/Plugin/Plugin.swift#L229

The linked code is missing the resolve() call and because of this I cannot wait for the promise to resolve in this function.

Could someone possibly fix this? Thank you in advance.

riderx commented 1 week ago

You can PR it, i merge and deploy direct:)

KovendiMozes commented 1 week ago

I got stuck at the point where I don't have permission to push the branch I created.

Screenshot from 2024-09-06 12-50-06

If you'd rather do it yourself, here are the changes I need.

Screenshot from 2024-09-06 13-11-58

In my opinion: Meanwhile, I noticed that a few more places are missing this 'call' function, which would be good for added security.

iOS Reject:

  1. if the condition "if" is not met https://github.com/Cap-go/native-audio/blob/ec55599d65a29585d9b03ed5a829d0b9918926d9/ios/Plugin/Plugin.swift#L138 https://github.com/Cap-go/native-audio/blob/ec55599d65a29585d9b03ed5a829d0b9918926d9/ios/Plugin/Plugin.swift#L142 https://github.com/Cap-go/native-audio/blob/ec55599d65a29585d9b03ed5a829d0b9918926d9/ios/Plugin/Plugin.swift#L145

  2. before return https://github.com/Cap-go/native-audio/blob/ec55599d65a29585d9b03ed5a829d0b9918926d9/ios/Plugin/Plugin.swift#L187 https://github.com/Cap-go/native-audio/blob/ec55599d65a29585d9b03ed5a829d0b9918926d9/ios/Plugin/Plugin.swift#L197 https://github.com/Cap-go/native-audio/blob/ec55599d65a29585d9b03ed5a829d0b9918926d9/ios/Plugin/Plugin.swift#L207 https://github.com/Cap-go/native-audio/blob/ec55599d65a29585d9b03ed5a829d0b9918926d9/ios/Plugin/Plugin.swift#L216 https://github.com/Cap-go/native-audio/blob/ec55599d65a29585d9b03ed5a829d0b9918926d9/ios/Plugin/Plugin.swift#L237 https://github.com/Cap-go/native-audio/blob/ec55599d65a29585d9b03ed5a829d0b9918926d9/ios/Plugin/Plugin.swift#L262 https://github.com/Cap-go/native-audio/blob/ec55599d65a29585d9b03ed5a829d0b9918926d9/ios/Plugin/Plugin.swift#L273 https://github.com/Cap-go/native-audio/blob/ec55599d65a29585d9b03ed5a829d0b9918926d9/ios/Plugin/Plugin.swift#L283

Android Resolve: https://github.com/Cap-go/native-audio/blob/ec55599d65a29585d9b03ed5a829d0b9918926d9/android/src/main/java/ee/forgr/audio/NativeAudio.java#L396

riderx commented 1 week ago

Yes to push it was required to fork first, github is a bit dumb for that. We will look at it thanks

riderx commented 1 week ago

@KovendiMozes I did some fix: 1.if the condition "if" is not met:

I did also simplify the code to remove a lot of intrication of if, and put the error in IF instead of good cases.