Skip to content

Commit 492e58d

Browse files
committed
Revert "Remove engine dependency of LifecycleChannel"
This reverts commit a45473d.
1 parent 4424ad4 commit 492e58d

File tree

5 files changed

+23
-24
lines changed

5 files changed

+23
-24
lines changed

shell/platform/tizen/channels/key_event_channel.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
#include <map>
88

9-
#include "flutter/shell/platform/common/json_message_codec.h"
109
#include "flutter/shell/platform/tizen/tizen_log.h"
1110

1211
namespace flutter {

shell/platform/tizen/channels/key_event_channel.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
#include "flutter/shell/platform/common/client_wrapper/include/flutter/basic_message_channel.h"
1313
#include "flutter/shell/platform/common/client_wrapper/include/flutter/binary_messenger.h"
14+
#include "flutter/shell/platform/common/json_message_codec.h"
1415
#include "rapidjson/document.h"
1516

1617
namespace flutter {

shell/platform/tizen/channels/lifecycle_channel.cc

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
#include "lifecycle_channel.h"
66

7-
#include "flutter/shell/platform/common/client_wrapper/include/flutter/standard_message_codec.h"
87
#include "flutter/shell/platform/tizen/flutter_tizen_engine.h"
98
#include "flutter/shell/platform/tizen/tizen_log.h"
109

@@ -21,32 +20,35 @@ constexpr char kDetached[] = "AppLifecycleState.detached";
2120

2221
} // namespace
2322

24-
LifecycleChannel::LifecycleChannel(BinaryMessenger* messenger)
25-
: channel_(std::make_unique<BasicMessageChannel<EncodableValue>>(
26-
messenger,
27-
kChannelName,
28-
&StandardMessageCodec::GetInstance())) {}
23+
LifecycleChannel::LifecycleChannel(FlutterTizenEngine* engine)
24+
: engine_(engine) {}
2925

3026
LifecycleChannel::~LifecycleChannel() {}
3127

28+
void LifecycleChannel::SendLifecycleMessage(const char message[]) {
29+
engine_->SendPlatformMessage(kChannelName,
30+
reinterpret_cast<const uint8_t*>(message),
31+
strlen(message), nullptr, nullptr);
32+
}
33+
3234
void LifecycleChannel::AppIsInactive() {
33-
FT_LOGI("Sending %s message.", kInactive);
34-
channel_->Send(EncodableValue(kInactive));
35+
FT_LOGI("send app lifecycle state inactive.");
36+
SendLifecycleMessage(kInactive);
3537
}
3638

3739
void LifecycleChannel::AppIsResumed() {
38-
FT_LOGI("Sending %s message.", kResumed);
39-
channel_->Send(EncodableValue(kResumed));
40+
FT_LOGI("send app lifecycle state resumed.");
41+
SendLifecycleMessage(kResumed);
4042
}
4143

4244
void LifecycleChannel::AppIsPaused() {
43-
FT_LOGI("Sending %s message.", kPaused);
44-
channel_->Send(EncodableValue(kPaused));
45+
FT_LOGI("send app lifecycle state paused.");
46+
SendLifecycleMessage(kPaused);
4547
}
4648

4749
void LifecycleChannel::AppIsDetached() {
48-
FT_LOGI("Sending %s message.", kDetached);
49-
channel_->Send(EncodableValue(kDetached));
50+
FT_LOGI("send app lifecycle state detached.");
51+
SendLifecycleMessage(kDetached);
5052
}
5153

5254
} // namespace flutter

shell/platform/tizen/channels/lifecycle_channel.h

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,23 @@
55
#ifndef EMBEDDER_LIFECYCLE_CHANNEL_H_
66
#define EMBEDDER_LIFECYCLE_CHANNEL_H_
77

8-
#include <memory>
9-
10-
#include "flutter/shell/platform/common/client_wrapper/include/flutter/basic_message_channel.h"
11-
#include "flutter/shell/platform/common/client_wrapper/include/flutter/binary_messenger.h"
12-
138
namespace flutter {
149

10+
class FlutterTizenEngine;
11+
1512
class LifecycleChannel {
1613
public:
17-
explicit LifecycleChannel(BinaryMessenger* messenger);
14+
explicit LifecycleChannel(FlutterTizenEngine* engine);
1815
virtual ~LifecycleChannel();
1916

2017
void AppIsInactive();
2118
void AppIsResumed();
2219
void AppIsPaused();
2320
void AppIsDetached();
21+
void SendLifecycleMessage(const char message[]);
2422

2523
private:
26-
std::unique_ptr<BasicMessageChannel<EncodableValue>> channel_;
24+
FlutterTizenEngine* engine_{nullptr};
2725
};
2826

2927
} // namespace flutter

shell/platform/tizen/flutter_tizen_engine.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,8 +236,7 @@ bool FlutterTizenEngine::RunEngine(
236236
internal_plugin_registrar_->messenger());
237237
localization_channel = std::make_unique<LocalizationChannel>(this);
238238
localization_channel->SendLocales();
239-
lifecycle_channel = std::make_unique<LifecycleChannel>(
240-
internal_plugin_registrar_->messenger());
239+
lifecycle_channel = std::make_unique<LifecycleChannel>(this);
241240

242241
if (IsHeaded()) {
243242
texture_registrar_ = std::make_unique<FlutterTizenTextureRegistrar>(this);

0 commit comments

Comments
 (0)