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
3 changes: 2 additions & 1 deletion packages/tizen_app_manager/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
## NEXT
## 0.2.4

* Update code format.
* Remove a testcase for `AppRunningContext.appState` API because the tizen
test farm does not support the 'foreground' state.
* Remove Ecore API.

## 0.2.3

Expand Down
2 changes: 1 addition & 1 deletion packages/tizen_app_manager/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ To use this package, add `tizen_app_manager` as a dependency in your `pubspec.ya

```yaml
dependencies:
tizen_app_manager: ^0.2.3
tizen_app_manager: ^0.2.4
```

### Retrieving current app info
Expand Down
2 changes: 1 addition & 1 deletion packages/tizen_app_manager/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: tizen_app_manager
description: Tizen application manager APIs. Used to get app info and app running context on a Tizen device.
homepage: https://github.com/flutter-tizen/plugins
repository: https://github.com/flutter-tizen/plugins/tree/master/packages/tizen_app_manager
version: 0.2.3
version: 0.2.4

environment:
sdk: ">=3.1.0 <4.0.0"
Expand Down
30 changes: 20 additions & 10 deletions packages/tizen_app_manager/tizen/src/tizen_app_manager_plugin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@

#include "tizen_app_manager_plugin.h"

#include <Ecore.h>
#include <app.h>
#include <flutter/event_channel.h>
#include <flutter/event_sink.h>
#include <flutter/event_stream_handler.h>
#include <flutter/method_channel.h>
#include <flutter/plugin_registrar.h>
#include <flutter/standard_method_codec.h>
#include <glib.h>

#include <memory>
#include <optional>
Expand Down Expand Up @@ -256,8 +256,10 @@ class TizenAppManagerPlugin : public flutter::Plugin {
void GetInstalledApps(std::unique_ptr<FlMethodResult> result) {
// TizenAppManager::GetAllAppsInfo() is an expensive operation and might
// cause unresponsiveness on low-end devices if run on the platform thread.
ecore_thread_run(
[](void *data, Ecore_Thread *thread) {
GError *error = nullptr;
GThread *thread = g_thread_try_new(
"flutter_tizen_plugins_tizen_app_manager_installed_appss",
[](gpointer data) -> gpointer {
auto *result = static_cast<FlMethodResult *>(data);

flutter::EncodableList list;
Expand All @@ -278,14 +280,22 @@ class TizenAppManagerPlugin : public flutter::Plugin {
}
result->Success(flutter::EncodableValue(list));
delete result;
return nullptr;
},
nullptr,
[](void *data, Ecore_Thread *thread) {
auto *result = static_cast<FlMethodResult *>(data);
result->Error("Operation failed", "Failed to start a thread.");
delete result;
},
result.release());
result.get(), &error);

if (thread == nullptr) {
LOG_ERROR("Failed to create a thread: %s",
error ? error->message : "unknown error");
if (error) {
g_error_free(error);
}
result->Error("Operation failed", "Failed to start a thread.");
return;
}

result.release();
g_thread_unref(thread);
}

void IsAppRunning(const flutter::EncodableMap *arguments,
Expand Down
Loading