@kesha-antonov/react-native-background-downloader 4.5.2 → 4.5.4
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/CHANGELOG.md +294 -0
- package/README.md +116 -10
- package/android/build.gradle +4 -2
- package/android/src/main/java/com/eko/Downloader.kt +10 -0
- package/android/src/main/java/com/eko/RNBackgroundDownloaderModuleImpl.kt +55 -9
- package/android/src/main/java/com/eko/UIDTDownloadJobService.kt +130 -30
- package/android/src/main/java/com/eko/uidt/UIDTJobManager.kt +17 -3
- package/android/src/main/java/com/eko/uidt/UIDTJobState.kt +164 -1
- package/android/src/main/java/com/eko/uidt/UIDTNotificationManager.kt +213 -4
- package/example/android/app/debug.keystore +0 -0
- package/ios/.DS_Store +0 -0
- package/ios/RNBackgroundDownloader.mm +53 -9
- package/package.json +1 -1
- package/plugin/build/index.d.ts +2 -2
- package/plugin/build/index.js +1 -1
- package/src/NativeRNBackgroundDownloader.ts +1 -1
- package/src/config.ts +3 -2
- package/src/index.ts +3 -1
- package/src/types.ts +9 -0
- package/plugin/package.json +0 -6
package/plugin/build/index.js
CHANGED
|
@@ -37,7 +37,7 @@ const config_plugins_1 = require("@expo/config-plugins");
|
|
|
37
37
|
const fs = __importStar(require("fs"));
|
|
38
38
|
const path = __importStar(require("path"));
|
|
39
39
|
const withRNBackgroundDownloader = (config, options) => {
|
|
40
|
-
const { mmkvVersion = '
|
|
40
|
+
const { mmkvVersion = '1.3.16', skipMmkvDependency = false } = options || {};
|
|
41
41
|
// Auto-detect react-native-mmkv in dependencies
|
|
42
42
|
const hasReactNativeMmkv = checkForReactNativeMmkv(config);
|
|
43
43
|
const shouldSkipMmkv = skipMmkvDependency || hasReactNativeMmkv;
|
|
@@ -90,7 +90,7 @@ export interface Spec extends TurboModule {
|
|
|
90
90
|
setLogsEnabled(enabled: boolean): void
|
|
91
91
|
setMaxParallelDownloads(max: number): void
|
|
92
92
|
setAllowsCellularAccess(allows: boolean): void
|
|
93
|
-
setNotificationGroupingConfig?(config: { enabled: boolean, showNotificationsEnabled: boolean, texts: UnsafeObject }): void
|
|
93
|
+
setNotificationGroupingConfig?(config: { enabled: boolean, showNotificationsEnabled: boolean, mode: string, texts: UnsafeObject }): void
|
|
94
94
|
|
|
95
95
|
getExistingDownloadTasks(): Promise<Array<{
|
|
96
96
|
id: string
|
package/src/config.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Headers, NotificationsGroupingConfig, NotificationTexts } from './types'
|
|
1
|
+
import { Headers, NotificationGroupingMode, NotificationsGroupingConfig, NotificationTexts } from './types'
|
|
2
2
|
|
|
3
3
|
export const DEFAULT_PROGRESS_INTERVAL = 1000
|
|
4
4
|
export const DEFAULT_PROGRESS_MIN_BYTES = 1024 * 1024 // 1MB
|
|
@@ -28,7 +28,7 @@ interface ConfigState {
|
|
|
28
28
|
maxParallelDownloads: number
|
|
29
29
|
allowsCellularAccess: boolean
|
|
30
30
|
showNotificationsEnabled: boolean
|
|
31
|
-
notificationsGrouping: NotificationsGroupingConfig
|
|
31
|
+
notificationsGrouping: NotificationsGroupingConfig & { mode: NotificationGroupingMode }
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
export const config: ConfigState = {
|
|
@@ -42,6 +42,7 @@ export const config: ConfigState = {
|
|
|
42
42
|
showNotificationsEnabled: false,
|
|
43
43
|
notificationsGrouping: {
|
|
44
44
|
enabled: false,
|
|
45
|
+
mode: 'individual',
|
|
45
46
|
texts: DEFAULT_NOTIFICATION_TEXTS,
|
|
46
47
|
},
|
|
47
48
|
}
|
package/src/index.ts
CHANGED
|
@@ -402,6 +402,7 @@ export function setConfig ({
|
|
|
402
402
|
if (notificationsGrouping !== undefined)
|
|
403
403
|
config.notificationsGrouping = {
|
|
404
404
|
enabled: notificationsGrouping.enabled ?? false,
|
|
405
|
+
mode: notificationsGrouping.mode ?? 'individual',
|
|
405
406
|
texts: {
|
|
406
407
|
...DEFAULT_NOTIFICATION_TEXTS,
|
|
407
408
|
...notificationsGrouping.texts,
|
|
@@ -417,7 +418,7 @@ export function setConfig ({
|
|
|
417
418
|
setLogsEnabled?: (enabled: boolean) => void
|
|
418
419
|
setMaxParallelDownloads?: (max: number) => void
|
|
419
420
|
setAllowsCellularAccess?: (allows: boolean) => void
|
|
420
|
-
setNotificationGroupingConfig?: (config: { enabled: boolean, showNotificationsEnabled: boolean, texts: Record<string, string> }) => void
|
|
421
|
+
setNotificationGroupingConfig?: (config: { enabled: boolean, showNotificationsEnabled: boolean, mode: string, texts: Record<string, string> }) => void
|
|
421
422
|
}
|
|
422
423
|
if (nativeModule.setLogsEnabled)
|
|
423
424
|
nativeModule.setLogsEnabled(isLogsEnabled)
|
|
@@ -431,6 +432,7 @@ export function setConfig ({
|
|
|
431
432
|
nativeModule.setNotificationGroupingConfig({
|
|
432
433
|
enabled: config.notificationsGrouping.enabled,
|
|
433
434
|
showNotificationsEnabled: config.showNotificationsEnabled ?? false,
|
|
435
|
+
mode: config.notificationsGrouping.mode,
|
|
434
436
|
texts: getNotificationTextsForNative(),
|
|
435
437
|
})
|
|
436
438
|
} catch {
|
package/src/types.ts
CHANGED
|
@@ -28,12 +28,21 @@ export interface NotificationTexts {
|
|
|
28
28
|
groupText?: string | ((count: number) => string)
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
+
/**
|
|
32
|
+
* Mode for notification display when grouping is enabled.
|
|
33
|
+
* - 'individual': Show all notifications (default, current behavior)
|
|
34
|
+
* - 'summaryOnly': Show only summary notification, minimize individual ones
|
|
35
|
+
*/
|
|
36
|
+
export type NotificationGroupingMode = 'individual' | 'summaryOnly'
|
|
37
|
+
|
|
31
38
|
/**
|
|
32
39
|
* Configuration for notifications grouping.
|
|
33
40
|
*/
|
|
34
41
|
export interface NotificationsGroupingConfig {
|
|
35
42
|
/** Enable notification grouping (default: false) */
|
|
36
43
|
enabled: boolean
|
|
44
|
+
/** Mode for notification display (default: 'individual') */
|
|
45
|
+
mode?: NotificationGroupingMode
|
|
37
46
|
/** Custom notification texts with optional pluralization */
|
|
38
47
|
texts?: NotificationTexts
|
|
39
48
|
}
|