mueller-ma / PrepaidBalance

App to check your prepaid balance
Apache License 2.0
35 stars 12 forks source link

Regex parsing / Display only account balance #160

Closed bielej closed 1 year ago

bielej commented 1 year ago

Is your feature request related to a problem? Please describe. My Provider adds many useless characters to the USSD response, which makes it cluttered.

Describe the solution you'd like I would like to be able to configure a regular expression to parse the USSD answer with.

Describe alternatives you've considered Automatically (probably using a regular expression) parse the repose to find the exact account balance - display only digits.

mueller-ma commented 1 year ago

Automatically (probably using a regular expression) parse the repose to find the exact account balance - display only digits.

Isn't this an exact description of the current behavior of the app? Several regex patterns are included in the app: https://github.com/mueller-ma/PrepaidBalance/blob/main/app/src/main/java/com/github/muellerma/prepaidbalance/utils/ResponseParser.kt#L10-L34

bielej commented 1 year ago

You're right - but still, it's hardcoded. I would be nice if the user could configure the pattern.

mueller-ma commented 1 year ago

Can you post a USSD response here? Then I can add a parser for that.

Adding a preference to enter a custom regex seems more work to me and hard to debug for the user.

bielej commented 1 year ago
Twoja oferta to nju na karte.
1.Stan konta glownego: 11.00 zl. Srodki wazne bezterminowo.

Thanks :)