Initial project
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
|
||||
class MediaSdkMethodChannel
|
||||
{
|
||||
// Channel Name
|
||||
static const String channelName = 'media_sdk';
|
||||
|
||||
//---------------- Flutter call native ----------------
|
||||
|
||||
static const String requestPermission = 'requestPermission';
|
||||
|
||||
|
||||
//---------------- Flutter call native ----------------
|
||||
|
||||
|
||||
|
||||
//---------------- native call Flutter ----------------
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//---------------- native call Flutter ----------------
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
import '../../../media_sdk_platform_interface.dart';
|
||||
|
||||
class MediaSdkMethodChannelDataSource
|
||||
{
|
||||
|
||||
final MediaSdkPlatform platform;
|
||||
|
||||
MediaSdkMethodChannelDataSource(this.platform);
|
||||
|
||||
|
||||
Future<String?> getPlatformVersion() async {
|
||||
return await getPlatformVersion();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
|
||||
/// Data Transfer Object
|
||||
/// - 只負責資料傳輸 / 解析
|
||||
/// - 結構可變
|
||||
/// - 可以依賴 JSON / platform
|
||||
class MediaSdkPermissionStatusDto {
|
||||
final bool granted;
|
||||
final bool permanentlyDenied;
|
||||
final String? grantedAt; // 通常是 raw string
|
||||
|
||||
MediaSdkPermissionStatusDto({
|
||||
required this.granted,
|
||||
required this.permanentlyDenied,
|
||||
this.grantedAt,
|
||||
});
|
||||
|
||||
factory MediaSdkPermissionStatusDto.fromJson(
|
||||
Map<String, dynamic> json,
|
||||
) {
|
||||
return MediaSdkPermissionStatusDto(
|
||||
granted: json['granted'] as bool,
|
||||
permanentlyDenied: json['permanentlyDenied'] as bool,
|
||||
grantedAt: json['grantedAt'] as String?,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
//Repository Impl
|
||||
|
||||
import '../../domain/repositories/media_sdk_repository.dart';
|
||||
import '../datasources/media_sdk_method_channel_datasource.dart';
|
||||
|
||||
class MediaSdkRepositoryImpl implements MediaSdkRepository
|
||||
{
|
||||
final MediaSdkMethodChannelDataSource _datasource;
|
||||
|
||||
const MediaSdkRepositoryImpl(this._datasource);
|
||||
|
||||
@override
|
||||
Future<String?> platformVersion() {
|
||||
return _datasource.getPlatformVersion();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user