Skip to content
Open
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
4 changes: 4 additions & 0 deletions packages/quick_actions/quick_actions_android/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 1.0.29

* Simplifies thread handling in message responses.

## 1.0.28

* Updates build files from Groovy to Kotlin.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
import android.content.Intent;
import android.content.res.Resources;
import android.os.Build;
import android.os.Handler;
import android.os.Looper;
import androidx.annotation.ChecksSdkIntAtLeast;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
Expand All @@ -24,7 +22,6 @@
import io.flutter.plugins.quickactions.Messages.ShortcutItemMessage;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Executor;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
Expand Down Expand Up @@ -62,7 +59,6 @@ public void setShortcutItems(
return;
}
List<ShortcutInfoCompat> shortcuts = shortcutItemMessageToShortcutInfo(itemsList);
Executor uiThreadExecutor = new UiThreadExecutor();
ThreadPoolExecutor executor =
new ThreadPoolExecutor(0, 1, 1, TimeUnit.SECONDS, new LinkedBlockingQueue<>());

Expand All @@ -76,21 +72,15 @@ public void setShortcutItems(
// Leave dynamicShortcutsSet as false
}

final boolean didSucceed = dynamicShortcutsSet;

// TODO(camsim99): Investigate removing all of the executor logic in favor of background channels.
uiThreadExecutor.execute(
() -> {
if (didSucceed) {
result.success();
} else {
result.error(
new FlutterError(
"quick_action_setshortcutitems_failure",
"Exception thrown when setting dynamic shortcuts",
null));
}
});
if (dynamicShortcutsSet) {
result.success();
} else {
result.error(
new FlutterError(
"quick_action_setshortcutitems_failure",
"Exception thrown when setting dynamic shortcuts",
null));
}
});
}

Expand Down Expand Up @@ -177,13 +167,4 @@ private Intent getIntentToOpenMainActivity(String type) {
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
}

static class UiThreadExecutor implements Executor {
private final Handler handler = new Handler(Looper.getMainLooper());

@Override
public void execute(Runnable command) {
handler.post(command);
}
}
}
2 changes: 1 addition & 1 deletion packages/quick_actions/quick_actions_android/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: quick_actions_android
description: An implementation for the Android platform of the Flutter `quick_actions` plugin.
repository: https://github.com/flutter/packages/tree/main/packages/quick_actions/quick_actions_android
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+in_app_purchase%22
version: 1.0.28
version: 1.0.29

environment:
sdk: ^3.9.0
Expand Down
Loading