Integration: remove legacy WidgetTaskActionReceiver (replaced by CompleteTaskAction — P3 Stream M follow-up)
Stream M replaced the widget's task-complete path with CompleteTaskAction + WidgetActionProcessor. Grepping confirmed the only references to WidgetTaskActionReceiver were its own class file and the manifest entry. Remove both. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -121,15 +121,6 @@
|
|||||||
</intent-filter>
|
</intent-filter>
|
||||||
</receiver>
|
</receiver>
|
||||||
|
|
||||||
<!-- Widget Task Complete Receiver -->
|
|
||||||
<receiver
|
|
||||||
android:name=".widget.WidgetTaskActionReceiver"
|
|
||||||
android:exported="false">
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="com.tt.honeyDue.COMPLETE_TASK" />
|
|
||||||
</intent-filter>
|
|
||||||
</receiver>
|
|
||||||
|
|
||||||
<!-- Small Widget Receiver (2x1) -->
|
<!-- Small Widget Receiver (2x1) -->
|
||||||
<receiver
|
<receiver
|
||||||
android:name=".widget.HoneyDueSmallWidgetReceiver"
|
android:name=".widget.HoneyDueSmallWidgetReceiver"
|
||||||
|
|||||||
@@ -1,56 +0,0 @@
|
|||||||
package com.tt.honeyDue.widget
|
|
||||||
|
|
||||||
import android.content.BroadcastReceiver
|
|
||||||
import android.content.Context
|
|
||||||
import android.content.Intent
|
|
||||||
import com.tt.honeyDue.data.DataManager
|
|
||||||
import com.tt.honeyDue.models.TaskCompletionCreateRequest
|
|
||||||
import com.tt.honeyDue.network.APILayer
|
|
||||||
import kotlinx.coroutines.CoroutineScope
|
|
||||||
import kotlinx.coroutines.Dispatchers
|
|
||||||
import kotlinx.coroutines.launch
|
|
||||||
|
|
||||||
/**
|
|
||||||
* BroadcastReceiver for handling task actions from widgets
|
|
||||||
*/
|
|
||||||
class WidgetTaskActionReceiver : BroadcastReceiver() {
|
|
||||||
|
|
||||||
override fun onReceive(context: Context, intent: Intent) {
|
|
||||||
when (intent.action) {
|
|
||||||
"com.tt.honeyDue.COMPLETE_TASK" -> {
|
|
||||||
val taskId = intent.getIntExtra("task_id", -1)
|
|
||||||
if (taskId != -1) {
|
|
||||||
completeTask(context, taskId)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun completeTask(context: Context, taskId: Int) {
|
|
||||||
CoroutineScope(Dispatchers.IO).launch {
|
|
||||||
try {
|
|
||||||
// Check if user is authenticated
|
|
||||||
val token = DataManager.authToken.value
|
|
||||||
if (token.isNullOrEmpty()) {
|
|
||||||
return@launch
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create completion request
|
|
||||||
val request = TaskCompletionCreateRequest(
|
|
||||||
taskId = taskId,
|
|
||||||
notes = "Completed from widget"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Complete the task via API
|
|
||||||
val result = APILayer.createTaskCompletion(request)
|
|
||||||
|
|
||||||
// Update widgets after completion
|
|
||||||
if (result is com.tt.honeyDue.network.ApiResult.Success) {
|
|
||||||
WidgetUpdateManager.forceRefresh(context)
|
|
||||||
}
|
|
||||||
} catch (e: Exception) {
|
|
||||||
e.printStackTrace()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user