Remove direct timeline for GNU, it doesn't seem to work.
This commit is contained in:
parent
bac1d1a342
commit
51a7cee34c
|
@ -431,6 +431,8 @@ public abstract class BaseMainActivity extends BaseActivity
|
||||||
else
|
else
|
||||||
typePosition.put(0, RetrieveFeedsAsyncTask.Type.GNU_NOTIFICATION);
|
typePosition.put(0, RetrieveFeedsAsyncTask.Type.GNU_NOTIFICATION);
|
||||||
int i = 2;
|
int i = 2;
|
||||||
|
if( social == UpdateAccountInfoAsyncTask.SOCIAL.GNU )
|
||||||
|
display_direct = false;
|
||||||
if( display_direct) {
|
if( display_direct) {
|
||||||
tabLayout.addTab(tabDirect);
|
tabLayout.addTab(tabDirect);
|
||||||
tabPosition.put("direct",i);
|
tabPosition.put("direct",i);
|
||||||
|
@ -474,13 +476,12 @@ public abstract class BaseMainActivity extends BaseActivity
|
||||||
typePosition.put(i, RetrieveFeedsAsyncTask.Type.GNU_WHOLE);
|
typePosition.put(i, RetrieveFeedsAsyncTask.Type.GNU_WHOLE);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
if( display_art) {
|
if( social == UpdateAccountInfoAsyncTask.SOCIAL.GNU )
|
||||||
|
display_art = false;
|
||||||
|
if( display_art ) {
|
||||||
tabLayout.addTab(tabArt);
|
tabLayout.addTab(tabArt);
|
||||||
tabPosition.put("art", i);
|
tabPosition.put("art", i);
|
||||||
if( social != UpdateAccountInfoAsyncTask.SOCIAL.GNU )
|
typePosition.put(i, RetrieveFeedsAsyncTask.Type.ART);
|
||||||
typePosition.put(i, RetrieveFeedsAsyncTask.Type.ART);
|
|
||||||
else
|
|
||||||
typePosition.put(i, RetrieveFeedsAsyncTask.Type.GNU_ART);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if( (getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_LARGE)
|
if( (getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_LARGE)
|
||||||
|
|
|
@ -351,6 +351,7 @@ public class RetrieveFeedsAsyncTask extends AsyncTask<Void, Void, Void> {
|
||||||
break;
|
break;
|
||||||
case GNU_DM:
|
case GNU_DM:
|
||||||
gnuAPI = new GNUAPI(this.contextReference.get());
|
gnuAPI = new GNUAPI(this.contextReference.get());
|
||||||
|
gnuAPI.getDirectTimeline(max_id);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if( MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON || MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA) {
|
if( MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON || MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA) {
|
||||||
|
|
|
@ -20,6 +20,7 @@ import android.content.SharedPreferences;
|
||||||
import android.database.sqlite.SQLiteDatabase;
|
import android.database.sqlite.SQLiteDatabase;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v4.content.LocalBroadcastManager;
|
import android.support.v4.content.LocalBroadcastManager;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
import org.json.JSONArray;
|
import org.json.JSONArray;
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
|
@ -622,16 +623,19 @@ public class GNUAPI {
|
||||||
params.put("since_id", since_id);
|
params.put("since_id", since_id);
|
||||||
if (0 > limit || limit > 80)
|
if (0 > limit || limit > 80)
|
||||||
limit = 80;
|
limit = 80;
|
||||||
params.put("limit",String.valueOf(limit));
|
params.put("count",String.valueOf(limit));
|
||||||
statuses = new ArrayList<>();
|
statuses = new ArrayList<>();
|
||||||
|
Log.v(Helper.TAG,getAbsoluteUrl("/direct_messages.json"));
|
||||||
try {
|
try {
|
||||||
HttpsConnection httpsConnection = new HttpsConnection(context);
|
HttpsConnection httpsConnection = new HttpsConnection(context);
|
||||||
String response = httpsConnection.get(getAbsoluteUrl("/timelines/direct"), 60, params, prefKeyOauthTokenT);
|
String response = httpsConnection.get(getAbsoluteUrl("/direct_messages.json"), 60, params, prefKeyOauthTokenT);
|
||||||
|
Log.v(Helper.TAG,response);
|
||||||
apiResponse.setSince_id(httpsConnection.getSince_id());
|
apiResponse.setSince_id(httpsConnection.getSince_id());
|
||||||
apiResponse.setMax_id(httpsConnection.getMax_id());
|
apiResponse.setMax_id(httpsConnection.getMax_id());
|
||||||
statuses = parseStatuses(context, new JSONArray(response));
|
statuses = parseStatuses(context, new JSONArray(response));
|
||||||
} catch (HttpsConnection.HttpsConnectionException e) {
|
} catch (HttpsConnection.HttpsConnectionException e) {
|
||||||
setError(e.getStatusCode(), e);
|
setError(e.getStatusCode(), e);
|
||||||
|
e.printStackTrace();
|
||||||
} catch (NoSuchAlgorithmException e) {
|
} catch (NoSuchAlgorithmException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
@ -774,7 +778,7 @@ public class GNUAPI {
|
||||||
if( local)
|
if( local)
|
||||||
params.put("local", Boolean.toString(true));
|
params.put("local", Boolean.toString(true));
|
||||||
if( max_id != null )
|
if( max_id != null )
|
||||||
params.put("_", max_id);
|
params.put("max_id", max_id);
|
||||||
if( since_id != null )
|
if( since_id != null )
|
||||||
params.put("since_id", since_id);
|
params.put("since_id", since_id);
|
||||||
if( 0 > limit || limit > 40)
|
if( 0 > limit || limit > 40)
|
||||||
|
@ -1497,7 +1501,7 @@ public class GNUAPI {
|
||||||
HashMap<String, String> params = new HashMap<>();
|
HashMap<String, String> params = new HashMap<>();
|
||||||
String stringType = null;
|
String stringType = null;
|
||||||
if( max_id != null )
|
if( max_id != null )
|
||||||
params.put("_", max_id);
|
params.put("max_id", max_id);
|
||||||
if( since_id != null )
|
if( since_id != null )
|
||||||
params.put("since_id", since_id);
|
params.put("since_id", since_id);
|
||||||
if( 0 > limit || limit > 30)
|
if( 0 > limit || limit > 30)
|
||||||
|
@ -1533,9 +1537,8 @@ public class GNUAPI {
|
||||||
String response = httpsConnection.get(url, 60, params, prefKeyOauthTokenT);
|
String response = httpsConnection.get(url, 60, params, prefKeyOauthTokenT);
|
||||||
apiResponse.setSince_id(httpsConnection.getSince_id());
|
apiResponse.setSince_id(httpsConnection.getSince_id());
|
||||||
apiResponse.setMax_id(httpsConnection.getMax_id());
|
apiResponse.setMax_id(httpsConnection.getMax_id());
|
||||||
List<Status> statuses = parseStatuses(context, new JSONArray(response));
|
|
||||||
List<Account> accounts = parseAccountResponse(new JSONArray(response));
|
|
||||||
if(type == DisplayNotificationsFragment.Type.FOLLOW){
|
if(type == DisplayNotificationsFragment.Type.FOLLOW){
|
||||||
|
List<Account> accounts = parseAccountResponse(new JSONArray(response));
|
||||||
if( accounts != null)
|
if( accounts != null)
|
||||||
for(Account st: accounts ){
|
for(Account st: accounts ){
|
||||||
Notification notification = new Notification();
|
Notification notification = new Notification();
|
||||||
|
@ -1546,6 +1549,7 @@ public class GNUAPI {
|
||||||
notifications.add(notification);
|
notifications.add(notification);
|
||||||
}
|
}
|
||||||
}else {
|
}else {
|
||||||
|
List<Status> statuses = parseStatuses(context, new JSONArray(response));
|
||||||
if( statuses != null)
|
if( statuses != null)
|
||||||
for(Status st: statuses ){
|
for(Status st: statuses ){
|
||||||
Notification notification = new Notification();
|
Notification notification = new Notification();
|
||||||
|
@ -1857,8 +1861,9 @@ public class GNUAPI {
|
||||||
try{
|
try{
|
||||||
status.setReblog(parseStatuses(context, resobj.getJSONObject("retweeted_status")));
|
status.setReblog(parseStatuses(context, resobj.getJSONObject("retweeted_status")));
|
||||||
}catch (Exception ignored){ status.setReblog(null);}
|
}catch (Exception ignored){ status.setReblog(null);}
|
||||||
} catch (JSONException ignored) {ignored.printStackTrace();} catch (ParseException e) {
|
} catch (JSONException ignored) {ignored.printStackTrace(); Log.v(Helper.TAG,"resobj: " + resobj);} catch (ParseException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
||||||
}
|
}
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue