Fix upload

This commit is contained in:
Thomas 2020-09-29 17:48:12 +02:00
parent 70903578d1
commit b6769ca25f
1 changed files with 9 additions and 9 deletions

View File

@ -54,7 +54,7 @@ import java.util.Map;
import java.util.UUID;
import app.fedilab.fedilabtube.client.APIResponse;
import app.fedilab.fedilabtube.client.data.AccountData.Account;
import app.fedilab.fedilabtube.client.data.ChannelData;
import app.fedilab.fedilabtube.helper.Helper;
import app.fedilab.fedilabtube.viewmodel.ChannelsVM;
import es.dmoral.toasty.Toasty;
@ -155,7 +155,7 @@ public class PeertubeUploadActivity extends AppCompatActivity {
}
public void manageVIewChannels(APIResponse apiResponse) {
if (apiResponse.getError() != null || apiResponse.getAccounts() == null || apiResponse.getAccounts().size() == 0) {
if (apiResponse.getError() != null || apiResponse.getChannels() == null || apiResponse.getChannels().size() == 0) {
if (apiResponse.getError() != null && apiResponse.getError().getError() != null)
Toasty.error(PeertubeUploadActivity.this, apiResponse.getError().getError(), Toast.LENGTH_LONG).show();
else
@ -164,14 +164,14 @@ public class PeertubeUploadActivity extends AppCompatActivity {
}
//Populate channels
List<Account> accounts = apiResponse.getAccounts();
String[] channelName = new String[accounts.size()];
String[] channelId = new String[accounts.size()];
List<ChannelData.Channel> channelsForUser = apiResponse.getChannels();
String[] channelName = new String[channelsForUser.size()];
String[] channelId = new String[channelsForUser.size()];
int i = 0;
for (Account account : accounts) {
channels.put(account.getUsername(), account.getId());
channelName[i] = account.getUsername();
channelId[i] = account.getId();
for (ChannelData.Channel channel : channelsForUser) {
channels.put(channel.getName(), channel.getId());
channelName[i] = channel.getName();
channelId[i] = channel.getId();
i++;
}