Instant Messaging
Dev support
Update time: 2023/02/01 17:17:00
Dev support
Get the size of the cached files
Get the size of the SDK cached files. For example, thumbnails of image messages and recording files of audio messages.* The interface is available only for Android, Windows, and macOS
- API prototype
class SettingsService {
///
/// Get the size of the cached files. For example, thumbnails of image messages and recording files of audio messages. For Android*
///
/// [fileTypes] list of file types (Windows and macOS support the first type in the list. )<br>
/// [startTime] start time in milliseconds. A value of 0 indicates no start time is specified. ( not supported on Windows and macOS) <br>
/// [endTime] end time in milliseconds. A value of 0 indicates no end time is specified.<br>
///
Future<NIMResult<int>> getSizeOfDirCache(
List<NIMDirCacheFileType> fileTypes, int startTime, int endTime);
}
- Example
NimCore.instance.settingsService.getSizeOfDirCache(
[NIMDirCacheFileType.audio, NIMDirCacheFileType.video], 0, 0
).then((size) => print('cache size: $size'));
Delete the cached files
Delete cached files of specified types in the SDK. For example, thumbnails of image messages and recording files of audio messages. The interface is available only for Android.
- API prototype
class SettingsService {
///
/// Delete cache files of specified types. For example, thumbnails of image messages and recording files of voice messages.* For Android*
///
/// [fileTypes] list of file types (Windows and macOS support the first type in the list. )<br>
/// [startTime] start time in milliseconds. A value of 0 indicates no start time is specified. ( not supported on Windows and macOS) <br>
/// [endTime] end time in milliseconds. A value of 0 indicates no end time is specified.<br>
///
Future<NIMResult<void>> clearDirCache(
List<NIMDirCacheFileType> fileTypes, int startTime, int endTime);
}
- Example
NimCore.instance.settingsService.clearDirCache(
[NIMDirCacheFileType.audio, NIMDirCacheFileType.video], 0, 0
).then(() => print('clear dir cache'));
Compress log files
Compress the log files in ZIP format, and return the path of the specified ZIP file. The interface is not supported for Windows and macOS.
- API prototype
class SettingsService {
/// Archive log files and return the file path
Future<NIMResult<String>> archiveLogs();
}
- Example
NimCore.instance.settingsService.archiveLogs()
.then((path) => print('log path: $path'));
Upload log files
- API prototype
class SettingsService {
/// Compress and upload the log file
/// Return the URL of the compressed file. The interface is not supported for Windows and macOS.
///
/// [chatroomId] Chat room ID. The interface is not supported for Windows and macOS.<br>
/// [comment] Log comments. Optional. Up to 4097 characters are allowed.<br>
/// [partial] true: upload part of log files. false: upload all of log files. ** The interface is available only for Android.
///
Future<NIMResult<String>> uploadLogs({
String? chatroomId,
String? comment,
bool partial = true,
});
}
- Parameters
Parameter | Description |
---|---|
chatroomId | The ID of a chat room. If no chat room exists, enter "". |
comment | Log comments. Optional. Up to 4097 characters are allowed |
partial | true: Upload part of log files; false: Upload all log files. The interface is available only for Android. |
- Example
NimCore.instance.settingsService.uploadLogs(
comment: 'comment message'
).then((url) => print('log url: $url'));
Was this page helpful?
Yes
No