fixed media loading
This commit is contained in:
parent
52bc41027b
commit
0960f81b98
|
@ -28,6 +28,7 @@ import org.mariotaku.twidere.api.twitter.auth.OAuthEndpoint;
|
||||||
import org.mariotaku.twidere.model.CacheMetadata;
|
import org.mariotaku.twidere.model.CacheMetadata;
|
||||||
import org.mariotaku.twidere.model.ParcelableCredentials;
|
import org.mariotaku.twidere.model.ParcelableCredentials;
|
||||||
import org.mariotaku.twidere.model.ParcelableMedia;
|
import org.mariotaku.twidere.model.ParcelableMedia;
|
||||||
|
import org.mariotaku.twidere.model.UserKey;
|
||||||
import org.mariotaku.twidere.model.util.ParcelableCredentialsUtils;
|
import org.mariotaku.twidere.model.util.ParcelableCredentialsUtils;
|
||||||
import org.mariotaku.twidere.util.JsonSerializer;
|
import org.mariotaku.twidere.util.JsonSerializer;
|
||||||
import org.mariotaku.twidere.util.SharedPreferencesWrapper;
|
import org.mariotaku.twidere.util.SharedPreferencesWrapper;
|
||||||
|
@ -113,17 +114,16 @@ public class TwidereMediaDownloader implements MediaDownloader, Constants {
|
||||||
protected CacheDownloadLoader.DownloadResult getInternal(@NonNull String url,
|
protected CacheDownloadLoader.DownloadResult getInternal(@NonNull String url,
|
||||||
@Nullable Object extra) throws IOException {
|
@Nullable Object extra) throws IOException {
|
||||||
final Uri uri = Uri.parse(url);
|
final Uri uri = Uri.parse(url);
|
||||||
final Authorization auth;
|
Authorization auth = null;
|
||||||
final ParcelableCredentials account;
|
ParcelableCredentials account = null;
|
||||||
final boolean useThumbor;
|
boolean useThumbor = true;
|
||||||
if (extra instanceof MediaExtra) {
|
if (extra instanceof MediaExtra) {
|
||||||
useThumbor = ((MediaExtra) extra).isUseThumbor();
|
useThumbor = ((MediaExtra) extra).isUseThumbor();
|
||||||
account = ParcelableCredentialsUtils.getCredentials(mContext, ((MediaExtra) extra).getAccountKey());
|
UserKey accountKey = ((MediaExtra) extra).getAccountKey();
|
||||||
auth = TwitterAPIFactory.getAuthorization(account);
|
if (accountKey != null) {
|
||||||
} else {
|
account = ParcelableCredentialsUtils.getCredentials(mContext, accountKey);
|
||||||
useThumbor = true;
|
auth = TwitterAPIFactory.getAuthorization(account);
|
||||||
account = null;
|
}
|
||||||
auth = null;
|
|
||||||
}
|
}
|
||||||
final Uri modifiedUri = getReplacedUri(uri, account != null ? account.api_url_format : null);
|
final Uri modifiedUri = getReplacedUri(uri, account != null ? account.api_url_format : null);
|
||||||
final MultiValueMap<String> additionalHeaders = new MultiValueMap<>();
|
final MultiValueMap<String> additionalHeaders = new MultiValueMap<>();
|
||||||
|
|
Loading…
Reference in New Issue