Improves services

This commit is contained in:
stom79 2018-09-07 18:51:47 +02:00
parent 0d8071331c
commit 5714d39433
5 changed files with 17 additions and 5 deletions

View File

@ -527,6 +527,10 @@ public class Status implements Parcelable{
return;
if( status.getAccount() == null)
return;
if( status.getReblog() != null && status.getReblog().getEmojis() == null)
return;
if( status.getReblog() == null && status.getEmojis() == null)
return;
final List<Emojis> emojis = status.getReblog() != null ? status.getReblog().getEmojis() : status.getEmojis();
final List<Emojis> emojisAccounts = status.getAccount().getEmojis();

View File

@ -27,6 +27,7 @@ import android.support.v4.content.ContextCompat;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@ -407,7 +408,7 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
}
} else if (type == RetrieveFeedsAsyncTask.Type.PUBLIC || type == RetrieveFeedsAsyncTask.Type.REMOTE_INSTANCE) {
} else if (type == RetrieveFeedsAsyncTask.Type.PUBLIC || type == RetrieveFeedsAsyncTask.Type.LOCAL) {
status.setReplies(new ArrayList<Status>());
status.setNew(false);
@ -442,6 +443,7 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
editor.putBoolean(Helper.SHOULD_CONTINUE_STREAMING_FEDERATED + userId + instance, true);
editor.apply();
if(liveNotifications) {
Log.v(Helper.TAG,"streamingFederatedIntent: " + streamingFederatedIntent);
streamingFederatedIntent = new Intent(context, StreamingFederatedTimelineService.class);
try {
context.startService(streamingFederatedIntent);
@ -524,6 +526,7 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
}
}
}else if (type == RetrieveFeedsAsyncTask.Type.LOCAL){
Log.v(Helper.TAG,"visible: " + visible);
if (visible) {
SharedPreferences.Editor editor = sharedpreferences.edit();
editor.putBoolean(Helper.SHOULD_CONTINUE_STREAMING_LOCAL + userId + instance, true);

View File

@ -113,6 +113,7 @@ public class LiveNotificationService extends Service {
proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(host, port));
else
proxy = new Proxy(Proxy.Type.SOCKS, new InetSocketAddress(host, port));
final String login = sharedpreferences.getString(Helper.SET_PROXY_LOGIN, null);
final String pwd = sharedpreferences.getString(Helper.SET_PROXY_PASSWORD, null);
if( login != null) {
@ -148,7 +149,8 @@ public class LiveNotificationService extends Service {
Thread thread = new Thread() {
@Override
public void run() {
taks(accountStream);
if(Helper.isConnectedToInternet(LiveNotificationService.this, accountStream.getInstance()))
taks(accountStream);
}
};
thread.start();
@ -162,7 +164,8 @@ public class LiveNotificationService extends Service {
Thread thread = new Thread() {
@Override
public void run() {
taks(accountStream);
if(Helper.isConnectedToInternet(LiveNotificationService.this, accountStream.getInstance()))
taks(accountStream);
}
};
thread.start();

View File

@ -100,7 +100,8 @@ public class StreamingFederatedTimelineService extends IntentService {
}
if( accountStream != null){
try {
if(!Helper.isConnectedToInternet(StreamingFederatedTimelineService.this, accountStream.getInstance()))
return;
URL url = new URL("https://" + accountStream.getInstance() + "/api/v1/streaming/public");
httpsURLConnection = (HttpsURLConnection) url.openConnection();
httpsURLConnection.setRequestProperty("Content-Type", "application/json");

View File

@ -99,7 +99,8 @@ public class StreamingLocalTimelineService extends IntentService {
}
if( accountStream != null){
try {
if(!Helper.isConnectedToInternet(StreamingLocalTimelineService.this, accountStream.getInstance()))
return;
URL url = new URL("https://" + accountStream.getInstance() + "/api/v1/streaming/public/local");
httpsURLConnection = (HttpsURLConnection) url.openConnection();
httpsURLConnection.setRequestProperty("Content-Type", "application/json");