public String getFileUrl(long id, long accessHash) {
        CachedFileUrl cachedFileUrl = keyValueStorage.getValue(id);
        if (cachedFileUrl != null) {
            long urlTime = cachedFileUrl.getTimeout();
            long currentTime = im.actor.runtime.Runtime.getCurrentSyncedTime();
            if (urlTime <= currentTime) {
                Log.w("JsFilesModule", "URL #" + id + " timeout (urlTime: " + urlTime + ", current:" + currentTime + ")");
                keyValueStorage.removeItem(id);
            } else {
                return cachedFileUrl.getUrl();
            }
        }

        if (!requestedFiles.contains(id)) {
            requestedFiles.add(id);
            urlLoader.send(new FileRequest(id, accessHash));
        }

        return null;
    }
public String getFileUrl ( long id , long accessHash ) { CachedFileUrl cachedFileUrl = keyValueStorage . getValue ( id ) ; if ( cachedFileUrl != null ) { long urlTime = cachedFileUrl . getTimeout ( ) ; long currentTime = im . actor . runtime . Runtime . getCurrentSyncedTime ( ) ; if ( urlTime <= currentTime ) { Log . w ( "JsFilesModule" , "URL #" + id + " timeout (urlTime: " + urlTime + ", current:" + currentTime + ")" ) ; keyValueStorage . removeItem ( id ) ; } else { return cachedFileUrl . getUrl ( ) ; } } if ( ! requestedFiles . contains ( id ) ) { requestedFiles . add ( id ) ; urlLoader . send ( new FileRequest ( id , accessHash ) ) ; } return null ; }
Getting URL for file if available

@param id         file's id
@param accessHash file's accessHash
@return url for a file or null if not yet available