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