commons-app / apps-android-commons

The Wikimedia Commons Android app allows users to upload pictures from their Android phone/tablet to Wikimedia Commons
https://commons-app.github.io/
Apache License 2.0
980 stars 1.18k forks source link

[Bug]: Voice input icon should be shown only when corresponding services are available #5698

Open sivaraam opened 2 months ago

sivaraam commented 2 months ago

Summary

It's great to see the voice input option in the description and caption elements. There is a possibility that there are no speech-to-text services available on the device. Right now we seem to show the speech-to-text icon even in that case. We should identify this case and avoid showing the icon.

Steps to reproduce

  1. Open the app on a device that does not have speech-to-text services (disabling the existing service should be sufficient)
  2. Initiate an upload
  3. Tap on the speech-to-text icon near the description / caption fields

Expected behaviour

We don't show the speech-to-text icon at all as the same is not available on the device.

Actual behaviour

We show the speech-to-text icon but tapping on the same has no effect.

Device name

OnePlus Nord

Android version

Android 12

Commons app version

main

Device logs

No response

Screen-shots

No response

Would you like to work on the issue?

Prefer not

rohit9625 commented 2 months ago

I have question, i.e., what is the case or device that doesn't have speech to text feature?

sivaraam commented 2 months ago

I have question, i.e., what is the case or device that doesn't have speech to text feature?

Just try uninstalling / disabling Google's speech-to-text app and other similar apps from your device. Your device would no longer have any of those services.

rohit9625 commented 2 months ago

I got it, thanks :)

I guess these two ways can be helpful:-

  1. Change visibility to none after checking if services are available or not.
  2. When tapped on the icon and service is unavailable, then we can ask user to enable or install speech to text services.
kanahia1 commented 2 months ago

@rohit9625 How about changing the color of the icon (may be to a Gray) if service is not available, unclicking the icon we can show the Toast to indicate the status of service.

rohit9625 commented 2 months ago

@rohit9625 How about changing the color of the icon (may be to a Gray) if service is not available, unclicking the icon we can show the Toast to indicate the status of service.

That's a great idea :)

Let's see @sivaraam's thoughts also.

nicolas-raoul commented 2 months ago

For now the important thing is probably: How to find out in advance whether service is available or not.

kanahia1 commented 2 months ago

Hey @nicolas-raoul, I ran this code (https://stackoverflow.com/a/32596376) I was able to get the engines available

Here are the results

WhatsApp Image 2024-04-21 at 14 17 05_3c703a78

These are the same I got on going to settings of my phone

WhatsApp Image 2024-04-21 at 14 17 05_c76f056b

sivaraam commented 2 months ago

@rohit9625 How about changing the color of the icon (may be to a Gray) if service is not available, unclicking the icon we can show the Toast to indicate the status of service.

I think it might be ideal to just hide the icon altogether when no speech-to-text services are available. I don't see any point with bothering the user about it when their device doesn't have speech-to-text services. If I'm right, the Wikipedia app does the same.

I ran this code (https://stackoverflow.com/a/32596376) I was able to get the engines available

This is good. If it's helpful, this seems like the snippet that the Wikipedia app uses in order to recognize if speech-to-text services are available. We could consider using the same too. if it seems better 🙂