getDefaultLocalUrl method
String?
getDefaultLocalUrl(
{ - bool isSnapshot = false,
})
Implementation
String? getDefaultLocalUrl({bool isSnapshot = false}) {
var cacheDir = CommonUtils.appFileDir;
String filePath = isSnapshot ? snapshotUUID ?? '' : UUID ?? '';
if (Platform.isAndroid) {
filePath = isSnapshot ? 'video_$snapshotUUID' : 'video_$UUID';
} else if (Platform.isIOS) {
String filePathPrefix = '${CommonUtils.getSDKAppID()}/${CommonUtils.getLoginUser()}';
filePath = '$filePathPrefix/video_${isSnapshot ? snapshotUUID : UUID}';
} else if (Platform.isMacOS) {
String filePathPrefix = '${CommonUtils.getSDKAppID()}/${CommonUtils.getLoginUser()}';
filePath = '$filePathPrefix/video_${isSnapshot ? snapshotUUID : UUID}';
} else if (Platform.isWindows) {
String filePathPrefix = 'TencentCloudChat/DownLoad/${CommonUtils.getSDKAppID()}/${CommonUtils.getLoginUser()}';
filePath = '$filePathPrefix/video_${isSnapshot ? snapshotUUID : UUID}';
} else if (Platform.operatingSystem == 'ohos') {
filePath = isSnapshot ? 'video_$snapshotUUID' : 'video_$UUID';
}
var defaultLocalUrl = '${cacheDir.path}/$filePath';
if (File(defaultLocalUrl).existsSync()) {
return defaultLocalUrl;
}
if (Platform.isAndroid && CommonUtils.externalCacheDir != null) {
defaultLocalUrl = '${CommonUtils.externalCacheDir!.parent.path}/cache/$filePath';
if (File(defaultLocalUrl).existsSync()) {
return defaultLocalUrl;
}
}
return null;
}