Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes lint rule and suppress non di usages #2902

Merged
merged 3 commits into from
Mar 10, 2023

Conversation

cmonfortep
Copy link
Contributor

@cmonfortep cmonfortep commented Mar 1, 2023

Task/Issue URL: https://app.asana.com/0/1202552961248957/1204091058652565/f

Description

Fixes lint rule.

Steps to test this PR

Feature 1

  • remove suppress from one of the current usages
  • execute lint
  • ensure lint fails

UI changes

Before After
!(Upload before screenshot) (Upload after screenshot)

@cmonfortep
Copy link
Contributor Author

Current dependencies on/for this PR:

This comment was auto-generated by Graphite.

@@ -40,6 +41,7 @@ import kotlinx.coroutines.ensureActive
import kotlinx.coroutines.flow.*
import kotlinx.coroutines.launch

@SuppressLint("NoLifecycleObserver") // we don't use DI here
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unsure if we prefer suppress or replace DefaultLifecycleObserver by MainProcessLifecycleObserver... I think better to suppress since we are not observing app lifecycle.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suppress yup

@@ -30,6 +31,7 @@ import androidx.lifecycle.DefaultLifecycleObserver
import androidx.lifecycle.LifecycleOwner
import com.duckduckgo.mobile.android.ui.view.setAllParentsClip

@SuppressLint("NoLifecycleObserver") // we don't use DI here
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment is kinda wrong, the justification is not that we don't use DI. Is that we're not observing the app lifecycle.
Same for other comments

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

true. I was thinking about that when writing my previous comment 👍

@@ -66,6 +67,7 @@ import kotlinx.coroutines.isActive
import kotlinx.coroutines.launch
import timber.log.Timber

@SuppressLint("NoLifecycleObserver") // we don't use DI here
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see where the SettingsViewModel observers the activity lifecycle. Maybe we need to fix that?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mmm...you are right...not sure what's this doing here. I see onStop cancels deviceShieldStatePollingJob, which is always null. Gonna remove it, but please review it because probably related to AppTp old feature?

Copy link
Collaborator

@aitorvs aitorvs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left some comments but haven't tested yet. Will test tomorrow

Copy link
Collaborator

@aitorvs aitorvs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thanks for taking care of this

@cmonfortep cmonfortep merged commit afbec29 into develop Mar 10, 2023
@cmonfortep cmonfortep deleted the feature/cristian/fix_LifecycleObserver_lint branch March 10, 2023 09:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants