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
4 changes: 4 additions & 0 deletions packages/battery_plus/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 1.1.1

* Hold memory of StreamHandlerError's member to prevent crash.

## 1.1.0

* Update battery_plus to 2.1.3.
Expand Down
2 changes: 1 addition & 1 deletion packages/battery_plus/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ This package is not an _endorsed_ implementation of `battery_plus`. Therefore, y
```yaml
dependencies:
battery_plus: ^2.1.3
battery_plus_tizen: ^1.1.0
battery_plus_tizen: ^1.1.1
```

Then you can import `battery_plus` in your Dart code:
Expand Down
2 changes: 1 addition & 1 deletion packages/battery_plus/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: battery_plus_tizen
description: Tizen implementation of the battery_plus plugin
homepage: https://github.com/flutter-tizen/plugins
repository: https://github.com/flutter-tizen/plugins/tree/master/packages/battery_plus
version: 1.1.0
version: 1.1.1

flutter:
plugin:
Expand Down
16 changes: 15 additions & 1 deletion packages/battery_plus/tizen/src/battery_plus_tizen_plugin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,20 @@ std::string BatteryStatusToString(BatteryStatus status) {
}
}

class BatteryStatusStreamHandlerError : public FlStreamHandlerError {
public:
BatteryStatusStreamHandlerError(const std::string &error_code,
const std::string &error_message,
const flutter::EncodableValue *error_details)
: error_code_(error_code),
error_message_(error_message),
FlStreamHandlerError(error_code_, error_message_, error_details) {}

private:
std::string error_code_;
std::string error_message_;
};

class BatteryStatusStreamHandler : public FlStreamHandler {
protected:
std::unique_ptr<FlStreamHandlerError> OnListenInternal(
Expand All @@ -58,7 +72,7 @@ class BatteryStatusStreamHandler : public FlStreamHandler {
}
};
if (!battery_.StartListen(callback)) {
return std::make_unique<FlStreamHandlerError>(
return std::make_unique<BatteryStatusStreamHandlerError>(
std::to_string(battery_.GetLastError()),
battery_.GetLastErrorString(), nullptr);
}
Expand Down
4 changes: 4 additions & 0 deletions packages/connectivity_plus/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 1.1.2

* Hold memory of StreamHandlerError's member to prevent crash.

## 1.1.1

* Update connectivity_plus to 2.3.0.
Expand Down
2 changes: 1 addition & 1 deletion packages/connectivity_plus/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ This package is not an _endorsed_ implementation of `connectivity_plus`. Therefo
```yaml
dependencies:
connectivity_plus: ^2.3.0
connectivity_plus_tizen: ^1.1.1
connectivity_plus_tizen: ^1.1.2
```

Then you can import `connectivity_plus` in your Dart code:
Expand Down
2 changes: 1 addition & 1 deletion packages/connectivity_plus/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: connectivity_plus_tizen
description: Tizen implementation of the connectivity_plus plugin.
homepage: https://github.com/flutter-tizen/plugins
repository: https://github.com/flutter-tizen/plugins/tree/master/packages/connectivity_plus
version: 1.1.1
version: 1.1.2

flutter:
plugin:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,20 @@ std::string ConnectionTypeToString(ConnectionType type) {
}
}

class ConnectivityStreamHandlerError : public FlStreamHandlerError {
public:
ConnectivityStreamHandlerError(const std::string &error_code,
const std::string &error_message,
const flutter::EncodableValue *error_details)
: error_code_(error_code),
error_message_(error_message),
FlStreamHandlerError(error_code_, error_message_, error_details) {}

private:
std::string error_code_;
std::string error_message_;
};

class ConnectivityStreamHandler : public FlStreamHandler {
protected:
std::unique_ptr<FlStreamHandlerError> OnListenInternal(
Expand All @@ -59,7 +73,7 @@ class ConnectivityStreamHandler : public FlStreamHandler {
}
};
if (!connection_.StartListen(callback)) {
return std::make_unique<FlStreamHandlerError>(
return std::make_unique<ConnectivityStreamHandlerError>(
std::to_string(connection_.GetLastError()),
connection_.GetLastErrorString(), nullptr);
}
Expand Down
4 changes: 4 additions & 0 deletions packages/geolocator/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 1.0.5

* Hold memory of StreamHandlerError's member to prevent crash

## 1.0.4

* Resolve linter warnings.
Expand Down
2 changes: 1 addition & 1 deletion packages/geolocator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ The Tizen implementation of [`geolocator`](https://github.com/Baseflow/flutter-g
```yaml
dependencies:
geolocator: ^8.0.0
geolocator_tizen: ^1.0.4
geolocator_tizen: ^1.0.5
```

Then you can import `geolocator` in your Dart code:
Expand Down
2 changes: 1 addition & 1 deletion packages/geolocator/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: geolocator_tizen
description: Geolocation plugin for Flutter. This plugin provides the Tizen implementation for the geolocator.
homepage: https://github.com/flutter-tizen/plugins
repository: https://github.com/flutter-tizen/plugins/tree/master/packages/geolocator
version: 1.0.4
version: 1.0.5

flutter:
plugin:
Expand Down
50 changes: 26 additions & 24 deletions packages/geolocator/tizen/src/geolocator_tizen_plugin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,20 @@ typedef flutter::StreamHandlerError<flutter::EncodableValue>

constexpr char kPrivilegeLocation[] = "http://tizen.org/privilege/location";

class LocationStreamHandlerError : public FlStreamHandlerError {
public:
LocationStreamHandlerError(const std::string &error_code,
const std::string &error_message,
const flutter::EncodableValue *error_details)
: error_code_(error_code),
error_message_(error_message),
FlStreamHandlerError(error_code_, error_message_, error_details) {}

private:
std::string error_code_;
std::string error_message_;
};

class LocationStreamHandler : public FlStreamHandler {
protected:
std::unique_ptr<FlStreamHandlerError> OnListenInternal(
Expand All @@ -43,11 +57,9 @@ class LocationStreamHandler : public FlStreamHandler {
try {
location_manager_.StartListenLocationUpdate(callback);
} catch (const LocationManagerError &error) {
// Issue: https://github.com/flutter/flutter/issues/101682
error_code_ = std::to_string(error.GetErrorCode());
error_message_ = error.GetErrorString();
return std::make_unique<FlStreamHandlerError>(error_code_, error_message_,
nullptr);
return std::make_unique<LocationStreamHandlerError>(
std::to_string(error.GetErrorCode()), error.GetErrorString(),
nullptr);
}
return nullptr;
}
Expand All @@ -57,10 +69,9 @@ class LocationStreamHandler : public FlStreamHandler {
try {
location_manager_.StopListenLocationUpdate();
} catch (const LocationManagerError &error) {
error_code_ = std::to_string(error.GetErrorCode());
error_message_ = error.GetErrorString();
return std::make_unique<FlStreamHandlerError>(error_code_, error_message_,
nullptr);
return std::make_unique<LocationStreamHandlerError>(
std::to_string(error.GetErrorCode()), error.GetErrorString(),
nullptr);
}
events_.reset();
return nullptr;
Expand All @@ -69,9 +80,6 @@ class LocationStreamHandler : public FlStreamHandler {
private:
LocationManager location_manager_;
std::unique_ptr<FlEventSink> events_;

std::string error_code_;
std::string error_message_;
};

class ServiceStatusStreamHandler : public FlStreamHandler {
Expand All @@ -86,11 +94,9 @@ class ServiceStatusStreamHandler : public FlStreamHandler {
try {
location_manager_.StartListenServiceStatusUpdate(callback);
} catch (const LocationManagerError &error) {
// Issue: https://github.com/flutter/flutter/issues/101682
error_code_ = std::to_string(error.GetErrorCode());
error_message_ = error.GetErrorString();
return std::make_unique<FlStreamHandlerError>(error_code_, error_message_,
nullptr);
return std::make_unique<LocationStreamHandlerError>(
std::to_string(error.GetErrorCode()), error.GetErrorString(),
nullptr);
}
return nullptr;
}
Expand All @@ -100,10 +106,9 @@ class ServiceStatusStreamHandler : public FlStreamHandler {
try {
location_manager_.StopListenServiceStatusUpdate();
} catch (const LocationManagerError &error) {
error_code_ = std::to_string(error.GetErrorCode());
error_message_ = error.GetErrorString();
return std::make_unique<FlStreamHandlerError>(error_code_, error_message_,
nullptr);
return std::make_unique<LocationStreamHandlerError>(
std::to_string(error.GetErrorCode()), error.GetErrorString(),
nullptr);
}
events_.reset();
return nullptr;
Expand All @@ -112,9 +117,6 @@ class ServiceStatusStreamHandler : public FlStreamHandler {
private:
LocationManager location_manager_;
std::unique_ptr<FlEventSink> events_;

std::string error_code_;
std::string error_message_;
};

class GeolocatorTizenPlugin : public flutter::Plugin {
Expand Down
4 changes: 4 additions & 0 deletions packages/sensors_plus/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 1.1.1

* Hold memory of StreamHandlerError's member to prevent crash.

## 1.1.0

* Update sensors_plus to 1.2.1.
Expand Down
2 changes: 1 addition & 1 deletion packages/sensors_plus/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ This package is not an _endorsed_ implementation of 'sensors_plus'. Therefore, y
```yaml
dependencies:
sensors_plus: ^1.2.1
sensors_plus_tizen: ^1.1.0
sensors_plus_tizen: ^1.1.1
```

Then you can import `sensors_plus` in your Dart code:
Expand Down
2 changes: 1 addition & 1 deletion packages/sensors_plus/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: sensors_plus_tizen
description: Tizen implementation of the sensors plugin
homepage: https://github.com/flutter-tizen/plugins
repository: https://github.com/flutter-tizen/plugins/tree/master/packages/sensors_plus
version: 1.1.0
version: 1.1.1

flutter:
plugin:
Expand Down
16 changes: 15 additions & 1 deletion packages/sensors_plus/tizen/src/sensors_plus_plugin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,20 @@ typedef flutter::StreamHandler<flutter::EncodableValue> FlStreamHandler;
typedef flutter::StreamHandlerError<flutter::EncodableValue>
FlStreamHandlerError;

class DeviceSensorStreamHandlerError : public FlStreamHandlerError {
public:
DeviceSensorStreamHandlerError(const std::string &error_code,
const std::string &error_message,
const flutter::EncodableValue *error_details)
: error_code_(error_code),
error_message_(error_message),
FlStreamHandlerError(error_code_, error_message_, error_details) {}

private:
std::string error_code_;
std::string error_message_;
};

class DeviceSensorStreamHandler : public FlStreamHandler {
public:
DeviceSensorStreamHandler(SensorType type) : sensor_(type) {}
Expand All @@ -32,7 +46,7 @@ class DeviceSensorStreamHandler : public FlStreamHandler {
events_->Success(flutter::EncodableValue(sensor_event));
};
if (!sensor_.StartListen(callback)) {
return std::make_unique<FlStreamHandlerError>(
return std::make_unique<DeviceSensorStreamHandlerError>(
std::to_string(sensor_.GetLastError()), sensor_.GetLastErrorString(),
nullptr);
}
Expand Down