Skip to content

Commit

Permalink
Merge pull request #71 from ku-ring/task/kuring-76
Browse files Browse the repository at this point in the history
kuring-76 Android 기본 WorkerFactory 대신 커스텀 팩토리를 사용하도록 수정
  • Loading branch information
mwy3055 authored Sep 11, 2023
2 parents 16b0bec + d75a3a5 commit 12035d9
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 21 deletions.
1 change: 1 addition & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ dependencies {
def work_version = '2.7.1'
implementation "androidx.work:work-runtime-ktx:$work_version"
androidTestImplementation "androidx.work:work-testing:$work_version"
implementation "androidx.hilt:hilt-work:1.0.0"

// Shimmer effect
implementation 'com.facebook.shimmer:shimmer:0.5.0'
Expand Down
32 changes: 18 additions & 14 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<uses-permission android:name="com.google.android.gms.permission.AD_ID" />
<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
android:maxSdkVersion="28" />

<application
tools:replace="icon, label"
android:name="com.ku_stacks.ku_ring.KuRingApplication"
android:allowBackup="false"
android:icon="${appIcon}"
android:label="${appName}"
android:roundIcon="@drawable/ic_ku_ring_launcher_round"
android:usesCleartextTraffic="true"
android:supportsRtl="true"
android:theme="@style/Theme.KURing">
android:theme="@style/Theme.KURing"
android:usesCleartextTraffic="true"
tools:replace="icon, label">

<activity
android:name=".ui.splash.SplashActivity"
Expand All @@ -45,7 +45,8 @@
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustResize" />

<activity android:name=".ui.my_notification.NotificationActivity"
<activity
android:name=".ui.my_notification.NotificationActivity"
android:exported="true"
android:launchMode="singleTask" />
<activity
Expand All @@ -60,20 +61,20 @@
<activity
android:name="com.google.android.gms.oss.licenses.OssLicensesActivity"
android:exported="true"
android:theme="@style/OpenSourceItemTheme"/>
android:theme="@style/OpenSourceItemTheme" />

<activity
android:name=".ui.notice_webview.NoticeWebActivity"
android:exported="true"
/>
android:exported="true" />

<activity
android:name=".ui.edit_subscription.EditSubscriptionActivity"
android:exported="true"
android:screenOrientation="portrait"
android:theme="@style/EditSubscriptionTheme"/>
android:theme="@style/EditSubscriptionTheme" />

<activity android:name=".ui.notion.NotionViewActivity"
<activity
android:name=".ui.notion.NotionViewActivity"
android:exported="true" />

<activity
Expand All @@ -100,15 +101,19 @@
<meta-data
android:name="com.ku_stacks.ku_ring.initializer.SendbirdInitializer"
android:value="androidx.startup" />
<meta-data
android:name="androidx.work.WorkManagerInitializer"
android:value="androidx.startup"
tools:node="remove" />
</provider>

<service android:name="com.ku_stacks.ku_ring.MyFireBaseMessagingService"
android:enabled="true"
android:exported="false"
android:stopWithTask="false">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT"/>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT"/>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
<action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
</intent-filter>
</service>

Expand All @@ -118,8 +123,7 @@

<meta-data
android:name="com.google.firebase.messaging.default_notification_icon"
android:resource="@drawable/ic_status_bar"
/>
android:resource="@drawable/ic_status_bar" />

</application>

Expand Down
15 changes: 14 additions & 1 deletion app/src/main/java/com/ku_stacks/ku_ring/KuRingApplication.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,20 @@
package com.ku_stacks.ku_ring

import android.app.Application
import android.util.Log
import androidx.hilt.work.HiltWorkerFactory
import androidx.work.Configuration
import dagger.hilt.android.HiltAndroidApp
import javax.inject.Inject

@HiltAndroidApp
class KuRingApplication : Application()
class KuRingApplication : Application(), Configuration.Provider {

@Inject
lateinit var workerFactory: HiltWorkerFactory

override fun getWorkManagerConfiguration() = Configuration.Builder()
.setMinimumLoggingLevel(Log.INFO)
.setWorkerFactory(workerFactory)
.build()
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,21 @@ import android.content.Context
import android.graphics.BitmapFactory
import android.media.RingtoneManager
import androidx.core.app.NotificationCompat
import androidx.hilt.work.HiltWorker
import androidx.work.Worker
import androidx.work.WorkerParameters
import com.ku_stacks.ku_ring.MyFireBaseMessagingService
import com.ku_stacks.ku_ring.R
import com.ku_stacks.ku_ring.navigator.KuringNavigator
import javax.inject.Inject
import dagger.assisted.Assisted
import dagger.assisted.AssistedInject

class ReEngagementNotificationWork(appContext: Context, workerParams: WorkerParameters) :
Worker(appContext, workerParams) {

@Inject
lateinit var navigator: KuringNavigator
@HiltWorker
class ReEngagementNotificationWork @AssistedInject constructor(
@Assisted appContext: Context,
@Assisted workerParams: WorkerParameters,
private val navigator: KuringNavigator
) : Worker(appContext, workerParams) {

override fun doWork(): Result {
val notification = createNotification(applicationContext)
Expand Down

0 comments on commit 12035d9

Please sign in to comment.