|
...
|
...
|
@@ -242,6 +242,7 @@ class HealthKitRawMotionDataPoint { |
|
|
|
class HealthKitRawActivityDataPoint {
|
|
|
|
HealthKitRawActivityDataPoint({
|
|
|
|
required this.endTime,
|
|
|
|
this.activityMoveMode,
|
|
|
|
this.activeEnergyBurned,
|
|
|
|
this.activeEnergyBurnedGoal,
|
|
|
|
this.appleMoveTime,
|
|
...
|
...
|
@@ -254,6 +255,8 @@ class HealthKitRawActivityDataPoint { |
|
|
|
|
|
|
|
int endTime;
|
|
|
|
|
|
|
|
int? activityMoveMode;
|
|
|
|
|
|
|
|
double? activeEnergyBurned;
|
|
|
|
|
|
|
|
double? activeEnergyBurnedGoal;
|
|
...
|
...
|
@@ -273,6 +276,7 @@ class HealthKitRawActivityDataPoint { |
|
|
|
List<Object?> _toList() {
|
|
|
|
return <Object?>[
|
|
|
|
endTime,
|
|
|
|
activityMoveMode,
|
|
|
|
activeEnergyBurned,
|
|
|
|
activeEnergyBurnedGoal,
|
|
|
|
appleMoveTime,
|
|
...
|
...
|
@@ -291,14 +295,15 @@ class HealthKitRawActivityDataPoint { |
|
|
|
result as List<Object?>;
|
|
|
|
return HealthKitRawActivityDataPoint(
|
|
|
|
endTime: result[0]! as int,
|
|
|
|
activeEnergyBurned: result[1] as double?,
|
|
|
|
activeEnergyBurnedGoal: result[2] as double?,
|
|
|
|
appleMoveTime: result[3] as double?,
|
|
|
|
appleMoveTimeGoal: result[4] as double?,
|
|
|
|
appleExerciseTime: result[5] as double?,
|
|
|
|
exerciseTimeGoal: result[6] as double?,
|
|
|
|
appleStandHours: result[7] as double?,
|
|
|
|
standHoursGoal: result[8] as double?,
|
|
|
|
activityMoveMode: result[1] as int?,
|
|
|
|
activeEnergyBurned: result[2] as double?,
|
|
|
|
activeEnergyBurnedGoal: result[3] as double?,
|
|
|
|
appleMoveTime: result[4] as double?,
|
|
|
|
appleMoveTimeGoal: result[5] as double?,
|
|
|
|
appleExerciseTime: result[6] as double?,
|
|
|
|
exerciseTimeGoal: result[7] as double?,
|
|
|
|
appleStandHours: result[8] as double?,
|
|
|
|
standHoursGoal: result[9] as double?,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
...
|
...
|
@@ -698,4 +703,122 @@ class HealthKitRawDataHostApi { |
|
|
|
return (pigeonVar_replyList[0] as List<Object?>?)!.cast<HealthKitRawWorkoutDataPoint>();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/// 原生是否通知了flutter ,apple health数据变化,让native 记录这次调用记录
|
|
|
|
/// 需要保存引起此次计算的数据变化类型列表、当前时间
|
|
|
|
Future<bool> saveNativeCallFlutterChange({List<int> relativeDataTypes}) async {
|
|
|
|
final String pigeonVar_channelName = 'dev.flutter.pigeon.doublefeel_flutter.HealthKitRawDataHostApi.saveNativeCallFlutterChange$pigeonVar_messageChannelSuffix';
|
|
|
|
final BasicMessageChannel<Object?> pigeonVar_channel = BasicMessageChannel<Object?>(
|
|
|
|
pigeonVar_channelName,
|
|
|
|
pigeonChannelCodec,
|
|
|
|
binaryMessenger: pigeonVar_binaryMessenger,
|
|
|
|
);
|
|
|
|
final Future<Object?> pigeonVar_sendFuture = pigeonVar_channel.send(<Object?>[relativeDataTypes]);
|
|
|
|
final List<Object?>? pigeonVar_replyList =
|
|
|
|
await pigeonVar_sendFuture as List<Object?>?;
|
|
|
|
if (pigeonVar_replyList == null) {
|
|
|
|
throw _createConnectionError(pigeonVar_channelName);
|
|
|
|
} else if (pigeonVar_replyList.length > 1) {
|
|
|
|
throw PlatformException(
|
|
|
|
code: pigeonVar_replyList[0]! as String,
|
|
|
|
message: pigeonVar_replyList[1] as String?,
|
|
|
|
details: pigeonVar_replyList[2],
|
|
|
|
);
|
|
|
|
} else if (pigeonVar_replyList[0] == null) {
|
|
|
|
throw PlatformException(
|
|
|
|
code: 'null-error',
|
|
|
|
message: 'Host platform returned null value for non-null return value.',
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
return (pigeonVar_replyList[0] as bool?)!;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/// caculate 一旦完成,让native 存储这次的计算记录
|
|
|
|
/// 需要保存引起此次计算的数据变化类型列表、当前时间
|
|
|
|
Future<bool> saveFlutterCaculateFinished({List<int> relativeDataTypes}) async {
|
|
|
|
final String pigeonVar_channelName = 'dev.flutter.pigeon.doublefeel_flutter.HealthKitRawDataHostApi.saveFlutterCaculateFinished$pigeonVar_messageChannelSuffix';
|
|
|
|
final BasicMessageChannel<Object?> pigeonVar_channel = BasicMessageChannel<Object?>(
|
|
|
|
pigeonVar_channelName,
|
|
|
|
pigeonChannelCodec,
|
|
|
|
binaryMessenger: pigeonVar_binaryMessenger,
|
|
|
|
);
|
|
|
|
final Future<Object?> pigeonVar_sendFuture = pigeonVar_channel.send(<Object?>[relativeDataTypes]);
|
|
|
|
final List<Object?>? pigeonVar_replyList =
|
|
|
|
await pigeonVar_sendFuture as List<Object?>?;
|
|
|
|
if (pigeonVar_replyList == null) {
|
|
|
|
throw _createConnectionError(pigeonVar_channelName);
|
|
|
|
} else if (pigeonVar_replyList.length > 1) {
|
|
|
|
throw PlatformException(
|
|
|
|
code: pigeonVar_replyList[0]! as String,
|
|
|
|
message: pigeonVar_replyList[1] as String?,
|
|
|
|
details: pigeonVar_replyList[2],
|
|
|
|
);
|
|
|
|
} else if (pigeonVar_replyList[0] == null) {
|
|
|
|
throw PlatformException(
|
|
|
|
code: 'null-error',
|
|
|
|
message: 'Host platform returned null value for non-null return value.',
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
return (pigeonVar_replyList[0] as bool?)!;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/// 让原生分享出来本地的记录文件
|
|
|
|
Future<bool> shareNativeAppleHealthObserverRecord() async {
|
|
|
|
final String pigeonVar_channelName = 'dev.flutter.pigeon.doublefeel_flutter.HealthKitRawDataHostApi.shareNativeAppleHealthObserverRecord$pigeonVar_messageChannelSuffix';
|
|
|
|
final BasicMessageChannel<Object?> pigeonVar_channel = BasicMessageChannel<Object?>(
|
|
|
|
pigeonVar_channelName,
|
|
|
|
pigeonChannelCodec,
|
|
|
|
binaryMessenger: pigeonVar_binaryMessenger,
|
|
|
|
);
|
|
|
|
final Future<Object?> pigeonVar_sendFuture = pigeonVar_channel.send(null);
|
|
|
|
final List<Object?>? pigeonVar_replyList =
|
|
|
|
await pigeonVar_sendFuture as List<Object?>?;
|
|
|
|
if (pigeonVar_replyList == null) {
|
|
|
|
throw _createConnectionError(pigeonVar_channelName);
|
|
|
|
} else if (pigeonVar_replyList.length > 1) {
|
|
|
|
throw PlatformException(
|
|
|
|
code: pigeonVar_replyList[0]! as String,
|
|
|
|
message: pigeonVar_replyList[1] as String?,
|
|
|
|
details: pigeonVar_replyList[2],
|
|
|
|
);
|
|
|
|
} else if (pigeonVar_replyList[0] == null) {
|
|
|
|
throw PlatformException(
|
|
|
|
code: 'null-error',
|
|
|
|
message: 'Host platform returned null value for non-null return value.',
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
return (pigeonVar_replyList[0] as bool?)!;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/// 让原生分享出来flutter的记录文件
|
|
|
|
Future<bool> shareFlutterObserverRecord() async {
|
|
|
|
final String pigeonVar_channelName = 'dev.flutter.pigeon.doublefeel_flutter.HealthKitRawDataHostApi.shareFlutterObserverRecord$pigeonVar_messageChannelSuffix';
|
|
|
|
final BasicMessageChannel<Object?> pigeonVar_channel = BasicMessageChannel<Object?>(
|
|
|
|
pigeonVar_channelName,
|
|
|
|
pigeonChannelCodec,
|
|
|
|
binaryMessenger: pigeonVar_binaryMessenger,
|
|
|
|
);
|
|
|
|
final Future<Object?> pigeonVar_sendFuture = pigeonVar_channel.send(null);
|
|
|
|
final List<Object?>? pigeonVar_replyList =
|
|
|
|
await pigeonVar_sendFuture as List<Object?>?;
|
|
|
|
if (pigeonVar_replyList == null) {
|
|
|
|
throw _createConnectionError(pigeonVar_channelName);
|
|
|
|
} else if (pigeonVar_replyList.length > 1) {
|
|
|
|
throw PlatformException(
|
|
|
|
code: pigeonVar_replyList[0]! as String,
|
|
|
|
message: pigeonVar_replyList[1] as String?,
|
|
|
|
details: pigeonVar_replyList[2],
|
|
|
|
);
|
|
|
|
} else if (pigeonVar_replyList[0] == null) {
|
|
|
|
throw PlatformException(
|
|
|
|
code: 'null-error',
|
|
|
|
message: 'Host platform returned null value for non-null return value.',
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
return (pigeonVar_replyList[0] as bool?)!;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|