Skip to content

Commit

Permalink
Renamed tizen plugin to match android
Browse files Browse the repository at this point in the history
  • Loading branch information
Rexios80 committed Feb 15, 2022
1 parent b0d7c8b commit 03c8cc4
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 22 deletions.
3 changes: 1 addition & 2 deletions lib/src/workout_base.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import 'dart:async';
import 'dart:io';
import 'package:device_info_plus/device_info_plus.dart';
import 'package:flutter/services.dart';
import 'package:permission_handler/permission_handler.dart';

Expand Down Expand Up @@ -54,7 +53,7 @@ class Workout {
_currentFeatures.contains(WorkoutFeature.steps) ||
_currentFeatures.contains(WorkoutFeature.distance) ||
_currentFeatures.contains(WorkoutFeature.speed)) {
sensors.add('pedometer'); // Why? Ask Tizen.
sensors.add('pedometer');
}
}
return sensors;
Expand Down
5 changes: 2 additions & 3 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ dependencies:

permission_handler: ^8.1.2
permission_handler_tizen: ^1.0.0
device_info_plus: ^3.2.1

dev_dependencies:
rexios_lints: ^1.0.0
Expand All @@ -25,5 +24,5 @@ flutter:
package: dev.rexios.workout
pluginClass: WorkoutPlugin
tizen:
pluginClass: HealthTizenPlugin
fileName: health_tizen_plugin.h
pluginClass: WorkoutPlugin
fileName: workout_plugin.h
4 changes: 2 additions & 2 deletions tizen/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ include_directories(../../../tizen-studio/platforms/tizen-4.0/wearable/rootstrap
include_directories(../../../tizen-studio/platforms/tizen-4.0/wearable/rootstraps/wearable-4.0-device.core/usr/include/dlog)

add_executable(tizen
inc/health_tizen_plugin.h
src/health_tizen_plugin.cc
inc/workout_plugin.h
src/workout_plugin.cc
src/log.h)
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef FLUTTER_PLUGIN_HEALTH_TIZEN_PLUGIN_H_
#define FLUTTER_PLUGIN_HEALTH_TIZEN_PLUGIN_H_
#ifndef FLUTTER_PLUGIN_WORKOUT_PLUGIN_H_
#define FLUTTER_PLUGIN_WORKOUT_PLUGIN_H_

#include <flutter_plugin_registrar.h>

Expand All @@ -13,11 +13,11 @@
extern "C" {
#endif

FLUTTER_PLUGIN_EXPORT void HealthTizenPluginRegisterWithRegistrar(
FLUTTER_PLUGIN_EXPORT void WorkoutPluginRegisterWithRegistrar(
FlutterDesktopPluginRegistrarRef registrar);

#if defined(__cplusplus)
} // extern "C"
#endif

#endif // FLUTTER_PLUGIN_HEALTH_TIZEN_PLUGIN_H_
#endif // FLUTTER_PLUGIN_WORKOUT_PLUGIN_H_
4 changes: 2 additions & 2 deletions tizen/project_def.prop
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# See https://docs.tizen.org/application/tizen-studio/native-tools/project-conversion
# for details.

APPNAME = health_tizen_plugin
APPNAME = workout_plugin
type = staticLib
profile = common-4.0

# Source files
USER_SRCS += src/health_tizen_plugin.cc
USER_SRCS += src/workout_plugin.cc

# User defines
USER_DEFS =
Expand Down
2 changes: 1 addition & 1 deletion tizen/src/log.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#ifdef LOG_TAG
#undef LOG_TAG
#endif
#define LOG_TAG "HealthTizenPlugin"
#define LOG_TAG "WorkoutPlugin"

#define LOG(prio, fmt, arg...) \
dlog_print(prio, LOG_TAG, "%s: %s(%d) > " fmt, __FILE__, __func__, __LINE__, \
Expand Down
16 changes: 8 additions & 8 deletions tizen/src/health_tizen_plugin.cc → tizen/src/workout_plugin.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "health_tizen_plugin.h"
#include "workout_plugin.h"

#include <flutter/method_channel.h>
#include <flutter/plugin_registrar.h>
Expand All @@ -17,14 +17,14 @@
using namespace std;
using namespace flutter;

class HealthTizenPlugin : public Plugin {
class WorkoutPlugin : public Plugin {
public:
static void RegisterWithRegistrar(PluginRegistrar *registrar) {
auto plugin = make_unique<HealthTizenPlugin>(registrar);
auto plugin = make_unique<WorkoutPlugin>(registrar);
registrar->AddPlugin(move(plugin));
}

explicit HealthTizenPlugin(PluginRegistrar *registrar) {
explicit WorkoutPlugin(PluginRegistrar *registrar) {
auto channel =
make_unique<MethodChannel<EncodableValue> >(
registrar->messenger(), "workout",
Expand All @@ -38,7 +38,7 @@ class HealthTizenPlugin : public Plugin {
channel_ = std::move(channel);
}

~HealthTizenPlugin() override = default;
~WorkoutPlugin() override = default;

private:
void HandleMethodCall(
Expand Down Expand Up @@ -201,11 +201,11 @@ class HealthTizenPlugin : public Plugin {
static unique_ptr<MethodChannel<EncodableValue>> channel_;
};

unique_ptr<MethodChannel<EncodableValue>> HealthTizenPlugin::channel_;
unique_ptr<MethodChannel<EncodableValue>> WorkoutPlugin::channel_;

void HealthTizenPluginRegisterWithRegistrar(
void WorkoutPluginRegisterWithRegistrar(
FlutterDesktopPluginRegistrarRef registrar) {
HealthTizenPlugin::RegisterWithRegistrar(
WorkoutPlugin::RegisterWithRegistrar(
PluginRegistrarManager::GetInstance()
->GetRegistrar<PluginRegistrar>(registrar));
}

0 comments on commit 03c8cc4

Please sign in to comment.