mirror of
				https://github.com/fabianonline/telegram_backup.git
				synced 2025-11-04 01:27:47 +00:00 
			
		
		
		
	Some more improvements, while I'm learning more and more about Kotlin. ;-)
This commit is contained in:
		@@ -48,23 +48,30 @@ abstract class AbstractMediaFileManager(protected var message: TLMessage, protec
 | 
			
		||||
    abstract val size: Int
 | 
			
		||||
    abstract val extension: String
 | 
			
		||||
 | 
			
		||||
    fun isDownloaded() { return File(targetPathAndFilename).isFile() }
 | 
			
		||||
    fun isDownloading() {return File(targetPathAndFilename + ".downloading").isFile() }
 | 
			
		||||
    fun getTargetPath() {
 | 
			
		||||
    val downloaded: Boolean
 | 
			
		||||
    	get() = File(targetPathAndFilename).isFile()
 | 
			
		||||
    
 | 
			
		||||
    val downloading: Boolean
 | 
			
		||||
    	get() = File("${targetPathAndFilename}.downloading").isFile()
 | 
			
		||||
    
 | 
			
		||||
	val targetPath: String
 | 
			
		||||
		get() {
 | 
			
		||||
	        val path = user.getFileBase() + Config.FILE_FILES_BASE + File.separatorChar
 | 
			
		||||
    	    File(path).mkdirs()
 | 
			
		||||
    	    return path
 | 
			
		||||
		}
 | 
			
		||||
    fun getTargetFilename() {
 | 
			
		||||
    
 | 
			
		||||
    val targetFilename: String
 | 
			
		||||
    	get() {
 | 
			
		||||
			val message_id = message.getId()
 | 
			
		||||
			if (message.getToId() is TLPeerChannel) {
 | 
			
		||||
				val channel_id = message.getToId().getChannelId()
 | 
			
		||||
				return "channel_${channel_id}_${message_id}.$extension"
 | 
			
		||||
			} else return "${message_id}.$extension"
 | 
			
		||||
		}
 | 
			
		||||
    val getTargetPathAndFilename() {
 | 
			
		||||
        return getTargetPath() + getTargetFilename()
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
    val targetPathAndFilenam: String
 | 
			
		||||
    	get() = targetPath + targetFilename
 | 
			
		||||
 | 
			
		||||
    abstract val letter: String
 | 
			
		||||
    abstract val name: String
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user