capacitor-pica-network-logger 0.2.1 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CapacitorPicaNetworkLogger.podspec +1 -1
- package/android/build.gradle +1 -9
- package/android/src/main/java/com/linakis/capacitorpicanetworklogger/InspectorNotifications.kt +2 -0
- package/android/src/main/java/com/linakis/capacitorpicanetworklogger/LoggerConfigProvider.kt +3 -3
- package/android/src/main/java/com/linakis/capacitorpicanetworklogger/PicaNetworkLoggerPlugin.kt +2 -2
- package/ios/Plugin/InspectorNotifications.swift +9 -2
- package/package.json +1 -1
package/android/build.gradle
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
plugins {
|
|
2
2
|
id 'com.android.library'
|
|
3
3
|
id 'org.jetbrains.kotlin.android'
|
|
4
|
+
id 'org.jetbrains.kotlin.plugin.compose'
|
|
4
5
|
}
|
|
5
6
|
|
|
6
7
|
android {
|
|
@@ -10,15 +11,6 @@ android {
|
|
|
10
11
|
defaultConfig {
|
|
11
12
|
minSdk 23
|
|
12
13
|
}
|
|
13
|
-
|
|
14
|
-
buildFeatures {
|
|
15
|
-
buildConfig true
|
|
16
|
-
compose true
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
composeOptions {
|
|
20
|
-
kotlinCompilerExtensionVersion '1.5.10'
|
|
21
|
-
}
|
|
22
14
|
}
|
|
23
15
|
|
|
24
16
|
dependencies {
|
package/android/src/main/java/com/linakis/capacitorpicanetworklogger/InspectorNotifications.kt
CHANGED
|
@@ -16,6 +16,8 @@ object InspectorNotifications {
|
|
|
16
16
|
val manager = context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
|
|
17
17
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
|
18
18
|
val channel = NotificationChannel(channelId, channelName, NotificationManager.IMPORTANCE_LOW)
|
|
19
|
+
channel.setSound(null, null)
|
|
20
|
+
channel.enableVibration(false)
|
|
19
21
|
manager.createNotificationChannel(channel)
|
|
20
22
|
}
|
|
21
23
|
|
package/android/src/main/java/com/linakis/capacitorpicanetworklogger/LoggerConfigProvider.kt
CHANGED
|
@@ -5,11 +5,11 @@ import com.getcapacitor.Plugin
|
|
|
5
5
|
|
|
6
6
|
class LoggerConfigProvider {
|
|
7
7
|
fun getConfig(plugin: Plugin): JSObject {
|
|
8
|
-
val config = plugin.config.
|
|
8
|
+
val config = plugin.bridge.config.getPluginConfiguration("PicaNetworkLogger")
|
|
9
9
|
val output = JSObject()
|
|
10
10
|
output.put("maxBodySize", config.getInt("maxBodySize", 131072))
|
|
11
|
-
output.put("redactHeaders", config.
|
|
12
|
-
output.put("redactJsonFields", config.
|
|
11
|
+
output.put("redactHeaders", config.getArray("redactHeaders"))
|
|
12
|
+
output.put("redactJsonFields", config.getArray("redactJsonFields"))
|
|
13
13
|
output.put("notify", config.getBoolean("notify", true))
|
|
14
14
|
return output
|
|
15
15
|
}
|
package/android/src/main/java/com/linakis/capacitorpicanetworklogger/PicaNetworkLoggerPlugin.kt
CHANGED
|
@@ -32,8 +32,8 @@ class PicaNetworkLoggerPlugin : Plugin() {
|
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
LogRepositoryStore.updateRedaction(redactHeaders, redactJsonFields)
|
|
35
|
-
LogRepositoryStore.updateNotify(config.
|
|
36
|
-
requestNotificationPermissionIfNeeded(config.
|
|
35
|
+
LogRepositoryStore.updateNotify(config.optBoolean("notify", true))
|
|
36
|
+
requestNotificationPermissionIfNeeded(config.optBoolean("notify", true))
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
private fun requestNotificationPermissionIfNeeded(notifyEnabled: Boolean) {
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import Foundation
|
|
2
2
|
import UserNotifications
|
|
3
3
|
|
|
4
|
-
class InspectorNotifications: NSObject {
|
|
4
|
+
class InspectorNotifications: NSObject, UNUserNotificationCenterDelegate {
|
|
5
5
|
static let shared = InspectorNotifications()
|
|
6
6
|
|
|
7
7
|
static func show(method: String, url: String, status: Int?) {
|
|
8
|
+
let center = UNUserNotificationCenter.current()
|
|
9
|
+
center.delegate = shared
|
|
8
10
|
let content = UNMutableNotificationContent()
|
|
9
11
|
if let status = status {
|
|
10
12
|
content.title = "\(method) \(status)"
|
|
@@ -12,7 +14,12 @@ class InspectorNotifications: NSObject {
|
|
|
12
14
|
content.title = method
|
|
13
15
|
}
|
|
14
16
|
content.body = url
|
|
17
|
+
content.sound = nil
|
|
15
18
|
let request = UNNotificationRequest(identifier: UUID().uuidString, content: content, trigger: nil)
|
|
16
|
-
|
|
19
|
+
center.add(request, withCompletionHandler: nil)
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {
|
|
23
|
+
completionHandler([])
|
|
17
24
|
}
|
|
18
25
|
}
|