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.
@@ -1,6 +1,6 @@
1
1
  Pod::Spec.new do |s|
2
2
  s.name = 'CapacitorPicaNetworkLogger'
3
- s.version = '0.1.6'
3
+ s.version = '0.2.2'
4
4
  s.summary = 'Capacitor HTTP inspector'
5
5
  s.license = 'MIT'
6
6
  s.author = { 'Nikos Linakis' => 'nikos@linakis.net' }
@@ -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 {
@@ -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
 
@@ -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.getObject("PicaNetworkLogger", JSObject())
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.optJSONArray("redactHeaders"))
12
- output.put("redactJsonFields", config.optJSONArray("redactJsonFields"))
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
  }
@@ -32,8 +32,8 @@ class PicaNetworkLoggerPlugin : Plugin() {
32
32
  }
33
33
  }
34
34
  LogRepositoryStore.updateRedaction(redactHeaders, redactJsonFields)
35
- LogRepositoryStore.updateNotify(config.getBoolean("notify", true))
36
- requestNotificationPermissionIfNeeded(config.getBoolean("notify", true))
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
- UNUserNotificationCenter.current().add(request, withCompletionHandler: nil)
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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "capacitor-pica-network-logger",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "Capacitor HTTP network logger with debug-only native capture",
5
5
  "license": "MIT",
6
6
  "repository": {