-
-
Notifications
You must be signed in to change notification settings - Fork 327
/
Chucker.kt
38 lines (33 loc) 路 1.18 KB
/
Chucker.kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package com.chuckerteam.chucker.api
import android.content.Context
import android.content.Intent
import com.chuckerteam.chucker.internal.support.NotificationHelper
import com.chuckerteam.chucker.internal.ui.MainActivity
/**
* Chucker methods and utilities to interact with the library.
*/
public object Chucker {
/**
* Check if this instance is the operation one or no-op.
* @return `true` if this is the operation instance.
*/
@Suppress("MayBeConst ") // https://github.com/ChuckerTeam/chucker/pull/169#discussion_r362341353
public val isOp: Boolean = true
/**
* Get an Intent to launch the Chucker UI directly.
* @param context An Android [Context].
* @return An Intent for the main Chucker Activity that can be started with [Context.startActivity].
*/
@JvmStatic
public fun getLaunchIntent(context: Context): Intent {
return Intent(context, MainActivity::class.java)
.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
}
/**
* Dismisses all previous Chucker notifications.
*/
@JvmStatic
public fun dismissNotifications(context: Context) {
NotificationHelper(context).dismissNotifications()
}
}