Skip to content

Commit

Permalink
Enabled the DownloadManager's notification.
Browse files Browse the repository at this point in the history
* Removed the foreground service from application since now download manager handles the notification so we don't need the foreground service.
* Removed the all code related to notification management.
  • Loading branch information
MohitMaliDeveloper committed Dec 16, 2024
1 parent b83ecde commit 352606c
Show file tree
Hide file tree
Showing 9 changed files with 482 additions and 1,164 deletions.
3 changes: 3 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
android:name="android.permission.NEARBY_WIFI_DEVICES"
android:usesPermissionFlags="neverForLocation"
tools:targetApi="s" />
<!-- Device with versions >= Pie need this permission -->
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC" />

<application
android:name=".KiwixApp"
Expand Down
17 changes: 5 additions & 12 deletions core/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,8 @@
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />

<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<uses-permission
android:name="android.permission.DOWNLOAD_WITHOUT_NOTIFICATION" />
<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT"/>
<!-- Device with versions >= Pie need this permission -->
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC" />
<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" />

<queries>
<intent>
<action android:name="android.intent.action.TTS_SERVICE" />
Expand Down Expand Up @@ -52,8 +48,8 @@

<application
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:dataExtractionRules = "@xml/data_extraction_rules"
android:hardwareAccelerated="true"
android:largeHeap="true"
android:requestLegacyExternalStorage="true"
Expand All @@ -80,9 +76,9 @@
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.fileprovider"
android:exported="false"
android:grantUriPermissions="true"
tools:node="merge"
tools:overrideLibrary="com.squareup.picasso.picasso"
android:grantUriPermissions="true">
tools:overrideLibrary="com.squareup.picasso.picasso">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths" />
Expand All @@ -92,8 +88,5 @@
android:name=".error.DiagnosticReportActivity"
android:exported="false" />
<service android:name=".read_aloud.ReadAloudService" />
<service
android:name=".downloader.downloadManager.DownloadMonitorService"
android:foregroundServiceType="dataSync" />
</application>
</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,12 @@ import dagger.BindsInstance
import dagger.Subcomponent
import org.kiwix.kiwixmobile.core.di.CoreServiceScope
import org.kiwix.kiwixmobile.core.di.modules.CoreServiceModule
import org.kiwix.kiwixmobile.core.downloader.downloadManager.DownloadMonitorService
import org.kiwix.kiwixmobile.core.read_aloud.ReadAloudService

@Subcomponent(modules = [CoreServiceModule::class])
@CoreServiceScope
interface CoreServiceComponent {
fun inject(readAloudService: ReadAloudService)
fun inject(downloadMonitorService: DownloadMonitorService)

@Subcomponent.Builder
interface Builder {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
package org.kiwix.kiwixmobile.core.di.modules

import android.app.DownloadManager
import android.app.NotificationManager
import android.content.Context
import dagger.Module
import dagger.Provides
import org.kiwix.kiwixmobile.core.dao.DownloadRoomDao
Expand All @@ -30,7 +28,6 @@ import org.kiwix.kiwixmobile.core.downloader.DownloaderImpl
import org.kiwix.kiwixmobile.core.downloader.downloadManager.DownloadManagerBroadcastReceiver
import org.kiwix.kiwixmobile.core.downloader.downloadManager.DownloadManagerMonitor
import org.kiwix.kiwixmobile.core.downloader.downloadManager.DownloadManagerRequester
import org.kiwix.kiwixmobile.core.downloader.downloadManager.DownloadNotificationManager
import org.kiwix.kiwixmobile.core.utils.SharedPreferenceUtil
import javax.inject.Singleton

Expand Down Expand Up @@ -69,11 +66,4 @@ object DownloaderModule {
fun providesDownloadManagerBroadcastReceiver(
callback: DownloadManagerBroadcastReceiver.Callback
): DownloadManagerBroadcastReceiver = DownloadManagerBroadcastReceiver(callback)

@Provides
@Singleton
fun providesDownloadNotificationManager(
context: Context,
notificationManager: NotificationManager
): DownloadNotificationManager = DownloadNotificationManager(context, notificationManager)
}
Loading

0 comments on commit 352606c

Please sign in to comment.