native-update 1.1.0 → 1.1.1

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.
@@ -71,6 +71,8 @@ dependencies {
71
71
 
72
72
  // Kotlin
73
73
  implementation 'org.jetbrains.kotlin:kotlin-stdlib:1.9.22'
74
+ implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3'
75
+ implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-play-services:1.7.3'
74
76
 
75
77
  // AndroidX
76
78
  implementation "androidx.appcompat:appcompat:${androidxAppCompatVersion}"
@@ -90,6 +92,9 @@ dependencies {
90
92
  // Security
91
93
  implementation 'androidx.security:security-crypto:1.1.0-alpha06'
92
94
 
95
+ // JSON parsing
96
+ implementation 'com.google.code.gson:gson:2.10.1'
97
+
93
98
  // Testing
94
99
  testImplementation 'junit:junit:4.13.2'
95
100
  androidTestImplementation 'androidx.test.ext:junit:1.1.5'
@@ -17,6 +17,7 @@ import com.google.android.play.core.install.model.InstallStatus
17
17
  import com.google.android.play.core.install.model.UpdateAvailability
18
18
  import com.google.android.play.core.ktx.isFlexibleUpdateAllowed
19
19
  import com.google.android.play.core.ktx.isImmediateUpdateAllowed
20
+ import com.google.android.gms.tasks.Tasks
20
21
  import kotlinx.coroutines.tasks.await
21
22
 
22
23
  class AppUpdatePlugin(
@@ -25,6 +25,14 @@ class BackgroundNotificationManager(
25
25
  private const val ACTION_UPDATE_NOW = "com.aoneahsan.nativeupdate.UPDATE_NOW"
26
26
  private const val ACTION_UPDATE_LATER = "com.aoneahsan.nativeupdate.UPDATE_LATER"
27
27
  private const val ACTION_DISMISS = "com.aoneahsan.nativeupdate.DISMISS"
28
+
29
+ /**
30
+ * Static method to cancel notification from BroadcastReceiver
31
+ */
32
+ fun cancelNotificationStatic(context: Context) {
33
+ val notificationManager = NotificationManagerCompat.from(context)
34
+ notificationManager.cancel(NOTIFICATION_ID)
35
+ }
28
36
  }
29
37
 
30
38
  private var preferences: NotificationPreferences = NotificationPreferences.default()
@@ -133,6 +141,10 @@ class BackgroundNotificationManager(
133
141
  notificationManager.cancel(NOTIFICATION_ID)
134
142
  }
135
143
 
144
+ fun cancelUpdateNotification() {
145
+ cancelNotification()
146
+ }
147
+
136
148
  private fun createNotificationBuilder(
137
149
  appUpdate: AppUpdateInfo?,
138
150
  liveUpdate: LatestVersion?
@@ -38,8 +38,7 @@ class NotificationActionReceiver : BroadcastReceiver() {
38
38
  }
39
39
 
40
40
  // Cancel the notification
41
- val notificationManager = BackgroundNotificationManager(context)
42
- notificationManager.cancelUpdateNotification()
41
+ BackgroundNotificationManager.cancelNotificationStatic(context)
43
42
  }
44
43
 
45
44
  private fun handleInstallNow(context: Context, intent: Intent) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "native-update",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "Foundation package for building a comprehensive update system for Capacitor apps. Provides architecture and interfaces but requires backend implementation.",
5
5
  "type": "module",
6
6
  "main": "dist/plugin.cjs.js",