Skip to content

Commit 4423cc4

Browse files
authored
[tizen_app_manager] Remove Ecore API (#1037)
1 parent 5412074 commit 4423cc4

4 files changed

Lines changed: 24 additions & 13 deletions

File tree

packages/tizen_app_manager/CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
## NEXT
1+
## 0.2.4
22

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

78
## 0.2.3
89

packages/tizen_app_manager/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ To use this package, add `tizen_app_manager` as a dependency in your `pubspec.ya
1010

1111
```yaml
1212
dependencies:
13-
tizen_app_manager: ^0.2.3
13+
tizen_app_manager: ^0.2.4
1414
```
1515
1616
### Retrieving current app info

packages/tizen_app_manager/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: tizen_app_manager
22
description: Tizen application manager APIs. Used to get app info and app running context on a Tizen device.
33
homepage: https://github.com/flutter-tizen/plugins
44
repository: https://github.com/flutter-tizen/plugins/tree/master/packages/tizen_app_manager
5-
version: 0.2.3
5+
version: 0.2.4
66

77
environment:
88
sdk: ">=3.1.0 <4.0.0"

packages/tizen_app_manager/tizen/src/tizen_app_manager_plugin.cc

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44

55
#include "tizen_app_manager_plugin.h"
66

7-
#include <Ecore.h>
87
#include <app.h>
98
#include <flutter/event_channel.h>
109
#include <flutter/event_sink.h>
1110
#include <flutter/event_stream_handler.h>
1211
#include <flutter/method_channel.h>
1312
#include <flutter/plugin_registrar.h>
1413
#include <flutter/standard_method_codec.h>
14+
#include <glib.h>
1515

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

263265
flutter::EncodableList list;
@@ -278,14 +280,22 @@ class TizenAppManagerPlugin : public flutter::Plugin {
278280
}
279281
result->Success(flutter::EncodableValue(list));
280282
delete result;
283+
return nullptr;
281284
},
282-
nullptr,
283-
[](void *data, Ecore_Thread *thread) {
284-
auto *result = static_cast<FlMethodResult *>(data);
285-
result->Error("Operation failed", "Failed to start a thread.");
286-
delete result;
287-
},
288-
result.release());
285+
result.get(), &error);
286+
287+
if (thread == nullptr) {
288+
LOG_ERROR("Failed to create a thread: %s",
289+
error ? error->message : "unknown error");
290+
if (error) {
291+
g_error_free(error);
292+
}
293+
result->Error("Operation failed", "Failed to start a thread.");
294+
return;
295+
}
296+
297+
result.release();
298+
g_thread_unref(thread);
289299
}
290300

291301
void IsAppRunning(const flutter::EncodableMap *arguments,

0 commit comments

Comments
 (0)