Vinetos / Tranquille

📲🚫 Block unwanted calls effortlessly. Supports regex. wildcard and open-source bans-lists. Fork of YetAnotherCallBlocker.
GNU Affero General Public License v3.0
24 stars 2 forks source link

Linting results and deprecations #10

Open Penaz91 opened 2 months ago

Penaz91 commented 2 months ago

During building and testing with Android Studio, I noticed a warning saying that something in the App uses or overrides a deprecated API.

I decided to run the code checking tool and export the result (minus the "typos", which I think are useless at the moment) as an HTML page.

linting_result.zip

This seems like a good starting point for future modernization of the app.

Vinetos commented 2 months ago

Absolutely. There are bunch of use of deprecated APIs because the app was initially created to target very old Android versions.

A way to automate a linter to at least warn on merge requests can enter in the scope of this issue (probably with a Github Actions but I may deploy jenkins or whatever)

Penaz91 commented 2 months ago

Hope you don't mind but I thought it would be a good idea to track some changes here, as a way to jump-start newcomers who would want to contribute to the project.

So here are some deprecation warnings that have been popping up from what I've seen.

androidx.paging.PositionalDataSource androidx.paging.LivePagedListBuilder androidx.paging.PagedListAdapter androidx.paging.PagedList possibly others Replaced by PagingSource in Paging v3: https://developer.android.com/reference/androidx/paging/PositionalDataSource https://developer.android.com/topic/libraries/architecture/paging/v3-overview https://developer.android.com/topic/libraries/architecture/paging/v3-migration https://developer.android.com/topic/libraries/architecture/paging/v3-paged-data

android.os.AsyncTask Seemingly deprecated with no replacement. Google suggests using either java.util.concurrent.Executors or Kotlin's coroutines

fragment.requestPermissions Deprecated in favour of the activity result API https://developer.android.com/reference/androidx/fragment/app/Fragment.html?hl=en#requestPermissions(java.lang.String%5B%5D,int)

android.app.IntentService Deprecated in API v30 (Android 11) in favour of WorkManager https://developer.android.com/reference/android/app/IntentService https://developer.android.com/reference/androidx/work/WorkManager.html

android.telephony.PhoneStateListener Deprecated in API v31 (Android 12) in favour of TelephonyCallback https://developer.android.com/reference/android/telephony/PhoneStateListener https://developer.android.com/reference/android/telephony/TelephonyCallback

fragment.startActivityForResult Seemingly deprecated in favour of registerForActivityResult. https://developer.android.com/training/basics/intents/result