Skip to content

Disable notification permission request when showNotification is false #1165

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

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ import com.chuckerteam.chucker.internal.ui.MainActivity
public object Chucker {
private const val SHORTCUT_ID = "chuckerShortcutId"

internal var showNotifications: Boolean = true

/**
* Check if this instance is the operation one or no-op.
* @return `true` if this is the operation instance.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public class ChuckerCollector

init {
RepositoryProvider.initialize(context)
Chucker.showNotifications = showNotification
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import androidx.core.view.isVisible
import androidx.lifecycle.lifecycleScope
import androidx.recyclerview.widget.DividerItemDecoration
import com.chuckerteam.chucker.R
import com.chuckerteam.chucker.api.Chucker
import com.chuckerteam.chucker.databinding.ChuckerActivityMainBinding
import com.chuckerteam.chucker.internal.data.entity.HttpTransaction
import com.chuckerteam.chucker.internal.data.model.DialogData
Expand Down Expand Up @@ -96,7 +97,7 @@ internal class MainActivity :
mainBinding.tutorialGroup.isVisible = transactionTuples.isEmpty()
}

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
if (Chucker.showNotifications && Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
handleNotificationsPermission()
}
}
Expand Down