Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 27 additions & 39 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,69 +1,59 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.ccextractor.taskwarriorflutter">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<uses-permission android:name="android.permission.USE_EXACT_ALARM" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<uses-permission android:name="android.permission.USE_EXACT_ALARM" />
<uses-permission android:name="android.permission.VIBRATE" />

<application
android:label="Taskwarrior"
android:name="${applicationName}"
android:icon="@mipmap/launcher_icon"
android:enableOnBackInvokedCallback="true">

<activity
android:name=".MainActivity"
android:exported="true"
android:launchMode="singleTop"
android:launchMode="singleTask"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
<!-- Specifies an Android theme to apply to this Activity as soon as
the Android process has started. This theme is visible to the user
while the Flutter UI initializes. After that, this theme continues
to determine the Window background behind the Flutter UI. -->

<meta-data
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@style/NormalTheme"
/>

<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<intent-filter>
<action android:name="es.antonborri.home_widget.action.LAUNCH" />
</intent-filter>
</activity>

<receiver android:name=".TaskWarriorWidgetProvider"
android:exported="true">

<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
<action android:name="es.antonborri.home_widget.action.LAUNCH" />
</intent-filter>
<meta-data android:name="android.appwidget.provider"
android:resource="@xml/taskwarriorconfig" />
</receiver>

<receiver android:name=".WidgetUpdateReceiver"
android:exported="true">

<intent-filter>
<action android:name="UPDATE_WIDGET" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="taskwarrior" />
</intent-filter>
</receiver>

<receiver android:name=".BurndownChartProvider"
</activity>
<receiver android:name=".TaskWarriorWidgetProvider"
android:exported="true">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<meta-data android:name="android.appwidget.provider"
android:resource="@xml/burndownchartconfig" />
android:resource="@xml/taskwarriorconfig" />
</receiver>

<!-- Used for Background Work -->
<receiver android:name="es.antonborri.home_widget.HomeWidgetBackgroundReceiver"
android:exported="true">
<intent-filter>
Expand All @@ -72,17 +62,15 @@
</receiver>
<service android:name="es.antonborri.home_widget.HomeWidgetBackgroundService"
android:permission="android.permission.BIND_JOB_SERVICE" android:exported="true"/>
<service
<service
android:name=".ListViewRemoteViewsService"
android:permission="android.permission.BIND_REMOTEVIEWS" />
<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->

<meta-data
android:name="flutterEmbedding"
android:value="2" />


<receiver android:exported="false" android:name="com.dexterous.flutterlocalnotifications.ScheduledNotificationReceiver" />

<receiver android:exported="false" android:name="com.dexterous.flutterlocalnotifications.ScheduledNotificationReceiver" />
<receiver android:exported="false" android:name="com.dexterous.flutterlocalnotifications.ScheduledNotificationBootReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
Expand All @@ -92,4 +80,4 @@
</intent-filter>
</receiver>
</application>
</manifest>
</manifest>

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,36 +1,7 @@
package com.ccextractor.taskwarriorflutter

import android.content.Intent
import android.os.Bundle
import io.flutter.embedding.android.FlutterActivity
import io.flutter.embedding.engine.FlutterEngine
import io.flutter.plugin.common.MethodChannel
import android.content.Context
import android.content.IntentFilter
import android.appwidget.AppWidgetManager
import android.content.ComponentName

class MainActivity: FlutterActivity() {
private val channel = "com.example.taskwarrior/widget"

override fun configureFlutterEngine(flutterEngine: FlutterEngine) {
super.configureFlutterEngine(flutterEngine)

MethodChannel(flutterEngine.dartExecutor.binaryMessenger, channel).setMethodCallHandler {
call, result ->
if (call.method == "updateWidget") {
updateWidget()
result.success("Widget updated")
} else {
result.notImplemented()
}
}
}

private fun updateWidget() {
val intent = Intent(this, WidgetUpdateReceiver::class.java).apply {
action = "UPDATE_WIDGET"
}
sendBroadcast(intent)
}
// No custom code needed! The home_widget plugin attaches automatically.
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,33 @@ import android.os.Build
class TaskWarriorWidgetProvider : AppWidgetProvider() {

override fun onReceive(context: Context, intent: Intent) {
// val myaction = intent.action
if (intent.action == "TASK_ACTION") {
val extras = intent.extras
if(extras!=null){
val uuid = extras.getString("uuid")?:""
val add_task = extras.getString("launchedFor")
val host = if(add_task == "ADD_TASK"){context.getString(R.string.app_widget_add_clicked_uri)}else{context.getString(R.string.app_widget_card_clicked_uri)}
val launchIntent = Intent(context, MainActivity::class.java).apply {
action = context.getString(R.string.app_widget_launch_action)
data = Uri.parse("$host?uuid=$uuid")
flags = Intent. FLAG_ACTIVITY_NEW_TASK
context?.startActivity(this)
}
// HomeWidgetLaunchIntent.getActivity(context, MainActivity::class.java, Uri.parse("TaskWarrior://taskView?taskId=$uuid"))
}
}
super.onReceive(context, intent)
}
// Handle the custom action from your Widget buttons/list
if (intent.action == "TASK_ACTION") {
val uuid = intent.getStringExtra("uuid") ?: ""
val launchedFor = intent.getStringExtra("launchedFor")

// 1. Construct the URI exactly as Flutter expects it
// Scheme: taskwarrior://
// Host: cardclicked OR addclicked
val deepLinkUri = if (launchedFor == "ADD_TASK") {
Uri.parse("taskwarrior://addclicked")
} else {
// For list items, we attach the UUID
Uri.parse("taskwarrior://cardclicked?uuid=$uuid")
}

// 2. Create the Intent to open MainActivity
val launchIntent = Intent(context, MainActivity::class.java).apply {
action = Intent.ACTION_VIEW
data = deepLinkUri
// These flags ensure the app opens correctly whether running or not
flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_SINGLE_TOP
}

context.startActivity(launchIntent)
}
super.onReceive(context, intent)
}
fun getLayoutId(context: Context) : Int{
val sharedPrefs = HomeWidgetPlugin.getData(context)
val theme = sharedPrefs.getString("themeMode", "")
Expand Down

This file was deleted.

10 changes: 0 additions & 10 deletions android/app/src/main/res/xml/burndownchartconfig.xml

This file was deleted.

Loading