Merge branch 'develop' of https://gitlab.com/tom79/mastalab into develop
This commit is contained in:
commit
4d61600ed2
|
@ -93,7 +93,7 @@ dependencies {
|
||||||
implementation 'org.apache.poi:poi:3.16'
|
implementation 'org.apache.poi:poi:3.16'
|
||||||
implementation 'com.github.mabbas007:TagsEditText:1.0.5'
|
implementation 'com.github.mabbas007:TagsEditText:1.0.5'
|
||||||
implementation 'com.jaredrummler:material-spinner:1.3.1'
|
implementation 'com.jaredrummler:material-spinner:1.3.1'
|
||||||
implementation 'com.github.stom79:SQLite2XL:1.0.5'
|
implementation 'com.github.stom79:SQLite2XL:1.2'
|
||||||
implementation "com.tonyodev.fetch2:fetch2:2.3.6"
|
implementation "com.tonyodev.fetch2:fetch2:2.3.6"
|
||||||
playstoreImplementation "io.github.kobakei:ratethisapp:$ratethisappLibraryVersion"
|
playstoreImplementation "io.github.kobakei:ratethisapp:$ratethisappLibraryVersion"
|
||||||
}
|
}
|
||||||
|
|
|
@ -1437,6 +1437,9 @@ public abstract class BaseMainActivity extends BaseActivity
|
||||||
SQLiteToExcel sqliteToExcel = new SQLiteToExcel(BaseMainActivity.this, DB_NAME);
|
SQLiteToExcel sqliteToExcel = new SQLiteToExcel(BaseMainActivity.this, DB_NAME);
|
||||||
String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss", Locale.getDefault()).format(new Date());
|
String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss", Locale.getDefault()).format(new Date());
|
||||||
final String fileName = "Mastalab_export_"+timeStamp+".xls";
|
final String fileName = "Mastalab_export_"+timeStamp+".xls";
|
||||||
|
List<String> excludedValues = new ArrayList<>();
|
||||||
|
excludedValues.add(Sqlite.TABLE_TRACKING_BLOCK);
|
||||||
|
sqliteToExcel.setExcludeValuesFromTables(excludedValues);
|
||||||
sqliteToExcel.exportAllTables(fileName, new SQLiteToExcel.ExportListener() {
|
sqliteToExcel.exportAllTables(fileName, new SQLiteToExcel.ExportListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onStart() {
|
public void onStart() {
|
||||||
|
@ -1453,10 +1456,11 @@ public abstract class BaseMainActivity extends BaseActivity
|
||||||
intent.setDataAndType(uri, "application/vnd.ms-excel");
|
intent.setDataAndType(uri, "application/vnd.ms-excel");
|
||||||
Helper.notify_user(getApplicationContext(), intent, notificationIdTmp, BitmapFactory.decodeResource(getResources(),
|
Helper.notify_user(getApplicationContext(), intent, notificationIdTmp, BitmapFactory.decodeResource(getResources(),
|
||||||
R.mipmap.ic_launcher), Helper.NotifType.STORE, getString(R.string.save_over), getString(R.string.download_from, fileName));
|
R.mipmap.ic_launcher), Helper.NotifType.STORE, getString(R.string.save_over), getString(R.string.download_from, fileName));
|
||||||
Toasty.success(getApplicationContext(), getString(R.string.toast_saved),Toast.LENGTH_LONG).show();
|
Toasty.success(getApplicationContext(), getString(R.string.data_base_exported),Toast.LENGTH_LONG).show();
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public void onError(Exception e) {
|
public void onError(Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
Toasty.error(getApplicationContext(), getString(R.string.data_export_error_simple),Toast.LENGTH_LONG).show();
|
Toasty.error(getApplicationContext(), getString(R.string.data_export_error_simple),Toast.LENGTH_LONG).show();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -2347,10 +2351,7 @@ public abstract class BaseMainActivity extends BaseActivity
|
||||||
@Override
|
@Override
|
||||||
public void onCompleted(String dbName) {
|
public void onCompleted(String dbName) {
|
||||||
Toasty.success(getApplicationContext(),getString(R.string.data_import_success_simple),Toast.LENGTH_LONG).show();
|
Toasty.success(getApplicationContext(),getString(R.string.data_import_success_simple),Toast.LENGTH_LONG).show();
|
||||||
Intent changeAccount = new Intent(activity, MainActivity.class);
|
Helper.logoutCurrentUser(BaseMainActivity.this);
|
||||||
changeAccount.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
|
||||||
activity.finish();
|
|
||||||
activity.startActivity(changeAccount);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -14,17 +14,22 @@
|
||||||
* see <http://www.gnu.org/licenses>. */
|
* see <http://www.gnu.org/licenses>. */
|
||||||
package fr.gouv.etalab.mastodon.activities;
|
package fr.gouv.etalab.mastodon.activities;
|
||||||
|
|
||||||
|
import android.Manifest;
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
|
import android.content.pm.PackageManager;
|
||||||
import android.database.sqlite.SQLiteDatabase;
|
import android.database.sqlite.SQLiteDatabase;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.design.widget.TextInputLayout;
|
import android.support.design.widget.TextInputLayout;
|
||||||
|
import android.support.v4.app.ActivityCompat;
|
||||||
import android.support.v4.content.ContextCompat;
|
import android.support.v4.content.ContextCompat;
|
||||||
import android.support.v7.app.ActionBar;
|
import android.support.v7.app.ActionBar;
|
||||||
import android.support.v7.app.AlertDialog;
|
import android.support.v7.app.AlertDialog;
|
||||||
|
@ -50,6 +55,7 @@ import android.widget.LinearLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import com.ajts.androidmads.library.ExcelToSQLite;
|
||||||
import com.elconfidencial.bubbleshowcase.BubbleShowCase;
|
import com.elconfidencial.bubbleshowcase.BubbleShowCase;
|
||||||
import com.elconfidencial.bubbleshowcase.BubbleShowCaseBuilder;
|
import com.elconfidencial.bubbleshowcase.BubbleShowCaseBuilder;
|
||||||
import com.elconfidencial.bubbleshowcase.BubbleShowCaseListener;
|
import com.elconfidencial.bubbleshowcase.BubbleShowCaseListener;
|
||||||
|
@ -73,6 +79,7 @@ import fr.gouv.etalab.mastodon.client.Entities.Account;
|
||||||
import fr.gouv.etalab.mastodon.client.Entities.InstanceNodeInfo;
|
import fr.gouv.etalab.mastodon.client.Entities.InstanceNodeInfo;
|
||||||
import fr.gouv.etalab.mastodon.client.GNUAPI;
|
import fr.gouv.etalab.mastodon.client.GNUAPI;
|
||||||
import fr.gouv.etalab.mastodon.client.HttpsConnection;
|
import fr.gouv.etalab.mastodon.client.HttpsConnection;
|
||||||
|
import fr.gouv.etalab.mastodon.fragments.SettingsFragment;
|
||||||
import fr.gouv.etalab.mastodon.helper.Helper;
|
import fr.gouv.etalab.mastodon.helper.Helper;
|
||||||
import fr.gouv.etalab.mastodon.sqlite.AccountDAO;
|
import fr.gouv.etalab.mastodon.sqlite.AccountDAO;
|
||||||
import fr.gouv.etalab.mastodon.sqlite.Sqlite;
|
import fr.gouv.etalab.mastodon.sqlite.Sqlite;
|
||||||
|
@ -81,6 +88,7 @@ import static fr.gouv.etalab.mastodon.helper.Helper.THEME_LIGHT;
|
||||||
import static fr.gouv.etalab.mastodon.helper.Helper.changeDrawableColor;
|
import static fr.gouv.etalab.mastodon.helper.Helper.changeDrawableColor;
|
||||||
import static fr.gouv.etalab.mastodon.helper.Helper.changeMaterialSpinnerColor;
|
import static fr.gouv.etalab.mastodon.helper.Helper.changeMaterialSpinnerColor;
|
||||||
import static fr.gouv.etalab.mastodon.helper.Helper.convertDpToPixel;
|
import static fr.gouv.etalab.mastodon.helper.Helper.convertDpToPixel;
|
||||||
|
import static fr.gouv.etalab.mastodon.sqlite.Sqlite.DB_NAME;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -109,6 +117,7 @@ public class LoginActivity extends BaseActivity {
|
||||||
private LinearLayout step_login_credential, step_instance;
|
private LinearLayout step_login_credential, step_instance;
|
||||||
private TextView instance_chosen;
|
private TextView instance_chosen;
|
||||||
private ImageView info_instance;
|
private ImageView info_instance;
|
||||||
|
private final int PICK_IMPORT = 5557;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
@ -774,11 +783,68 @@ public class LoginActivity extends BaseActivity {
|
||||||
editor.putBoolean(Helper.SET_SECURITY_PROVIDER, item.isChecked());
|
editor.putBoolean(Helper.SET_SECURITY_PROVIDER, item.isChecked());
|
||||||
editor.apply();
|
editor.apply();
|
||||||
return false;
|
return false;
|
||||||
|
}else if(id == R.id.action_import_data){
|
||||||
|
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
|
||||||
|
if (ContextCompat.checkSelfPermission(LoginActivity.this, Manifest.permission.READ_EXTERNAL_STORAGE) !=
|
||||||
|
PackageManager.PERMISSION_GRANTED) {
|
||||||
|
ActivityCompat.requestPermissions(LoginActivity.this,
|
||||||
|
new String[]{Manifest.permission.READ_EXTERNAL_STORAGE},
|
||||||
|
TootActivity.MY_PERMISSIONS_REQUEST_READ_EXTERNAL_STORAGE);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
|
||||||
|
intent.addCategory(Intent.CATEGORY_OPENABLE);
|
||||||
|
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT) {
|
||||||
|
intent.setType("application/vnd.ms-excel");
|
||||||
|
String[] mimetypes = {"application/vnd.ms-excel"};
|
||||||
|
intent.putExtra(Intent.EXTRA_MIME_TYPES, mimetypes);
|
||||||
|
startActivityForResult(intent, PICK_IMPORT);
|
||||||
|
}else {
|
||||||
|
intent.setType("application/vnd.ms-excel");
|
||||||
|
Intent pickIntent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
|
||||||
|
Intent chooserIntent = Intent.createChooser(intent, getString(R.string.toot_select_import));
|
||||||
|
chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, new Intent[] {pickIntent});
|
||||||
|
startActivityForResult(chooserIntent, PICK_IMPORT);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onActivityResult(int requestCode, int resultCode,
|
||||||
|
Intent data) {
|
||||||
|
super.onActivityResult(requestCode, resultCode, data);
|
||||||
|
if (requestCode == PICK_IMPORT && resultCode == Activity.RESULT_OK) {
|
||||||
|
if (data == null || data.getData() == null) {
|
||||||
|
Toasty.error(getApplicationContext(),getString(R.string.toot_select_file_error),Toast.LENGTH_LONG).show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ExcelToSQLite excelToSQLite = new ExcelToSQLite(getApplicationContext(), DB_NAME, true);
|
||||||
|
String filename = SettingsFragment.getPath(getApplicationContext(), data.getData());
|
||||||
|
assert filename != null;
|
||||||
|
excelToSQLite.importFromFile(filename, new ExcelToSQLite.ImportListener() {
|
||||||
|
@Override
|
||||||
|
public void onStart() {
|
||||||
|
Toasty.success(getApplicationContext(),getString(R.string.data_import_start),Toast.LENGTH_LONG).show();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCompleted(String dbName) {
|
||||||
|
Toasty.success(getApplicationContext(),getString(R.string.data_import_success_simple),Toast.LENGTH_LONG).show();
|
||||||
|
Helper.logoutCurrentUser(LoginActivity.this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(Exception e) {
|
||||||
|
Toasty.error(getApplicationContext(),getString(R.string.data_import_error_simple),Toast.LENGTH_LONG).show();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public static String redirectUserToAuthorizeAndLogin(String clientId, String instance) {
|
public static String redirectUserToAuthorizeAndLogin(String clientId, String instance) {
|
||||||
String queryString = Helper.CLIENT_ID + "="+ clientId;
|
String queryString = Helper.CLIENT_ID + "="+ clientId;
|
||||||
queryString += "&" + Helper.REDIRECT_URI + "="+ Uri.encode(Helper.REDIRECT_CONTENT_WEB);
|
queryString += "&" + Helper.REDIRECT_URI + "="+ Uri.encode(Helper.REDIRECT_CONTENT_WEB);
|
||||||
|
|
|
@ -1593,6 +1593,11 @@ public class TootActivity extends BaseActivity implements OnPostActionInterface,
|
||||||
if( itemStore != null)
|
if( itemStore != null)
|
||||||
itemStore.setVisible(false);
|
itemStore.setVisible(false);
|
||||||
}
|
}
|
||||||
|
if( MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.GNU || MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.FRIENDICA){
|
||||||
|
MenuItem itemContacts = menu.findItem(R.id.action_contacts);
|
||||||
|
if( itemContacts != null)
|
||||||
|
itemContacts.setVisible(false);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,7 @@ import fr.gouv.etalab.mastodon.client.APIResponse;
|
||||||
import fr.gouv.etalab.mastodon.client.Entities.Account;
|
import fr.gouv.etalab.mastodon.client.Entities.Account;
|
||||||
import fr.gouv.etalab.mastodon.client.Entities.Conversation;
|
import fr.gouv.etalab.mastodon.client.Entities.Conversation;
|
||||||
import fr.gouv.etalab.mastodon.client.Entities.TagTimeline;
|
import fr.gouv.etalab.mastodon.client.Entities.TagTimeline;
|
||||||
|
import fr.gouv.etalab.mastodon.client.GNUAPI;
|
||||||
import fr.gouv.etalab.mastodon.interfaces.OnRetrieveMissingFeedsInterface;
|
import fr.gouv.etalab.mastodon.interfaces.OnRetrieveMissingFeedsInterface;
|
||||||
import fr.gouv.etalab.mastodon.sqlite.SearchDAO;
|
import fr.gouv.etalab.mastodon.sqlite.SearchDAO;
|
||||||
import fr.gouv.etalab.mastodon.sqlite.Sqlite;
|
import fr.gouv.etalab.mastodon.sqlite.Sqlite;
|
||||||
|
@ -67,60 +68,108 @@ public class RetrieveMissingFeedsAsyncTask extends AsyncTask<Void, Void, Void> {
|
||||||
protected Void doInBackground(Void... params) {
|
protected Void doInBackground(Void... params) {
|
||||||
if( this.contextReference.get() == null)
|
if( this.contextReference.get() == null)
|
||||||
return null;
|
return null;
|
||||||
API api = new API(this.contextReference.get());
|
if(MainActivity.social != UpdateAccountInfoAsyncTask.SOCIAL.GNU && MainActivity.social != UpdateAccountInfoAsyncTask.SOCIAL.FRIENDICA) {
|
||||||
List<fr.gouv.etalab.mastodon.client.Entities.Status> tempStatus = null;
|
API api = new API(this.contextReference.get());
|
||||||
APIResponse apiResponse = null;
|
List<fr.gouv.etalab.mastodon.client.Entities.Status> tempStatus = null;
|
||||||
if( type == RetrieveFeedsAsyncTask.Type.HOME) {
|
APIResponse apiResponse = null;
|
||||||
apiResponse = api.getHomeTimelineSinceId(since_id);
|
if (type == RetrieveFeedsAsyncTask.Type.HOME) {
|
||||||
}else if( type == RetrieveFeedsAsyncTask.Type.DIRECT)
|
apiResponse = api.getHomeTimelineSinceId(since_id);
|
||||||
apiResponse = api.getDirectTimelineSinceId(since_id);
|
} else if (type == RetrieveFeedsAsyncTask.Type.DIRECT)
|
||||||
else if( type == RetrieveFeedsAsyncTask.Type.CONVERSATION)
|
apiResponse = api.getDirectTimelineSinceId(since_id);
|
||||||
apiResponse = api.getConversationTimelineSinceId(since_id);
|
else if (type == RetrieveFeedsAsyncTask.Type.CONVERSATION)
|
||||||
else if( type == RetrieveFeedsAsyncTask.Type.LOCAL)
|
apiResponse = api.getConversationTimelineSinceId(since_id);
|
||||||
apiResponse = api.getPublicTimelineSinceId(true, since_id);
|
else if (type == RetrieveFeedsAsyncTask.Type.LOCAL)
|
||||||
else if( type == RetrieveFeedsAsyncTask.Type.PUBLIC)
|
apiResponse = api.getPublicTimelineSinceId(true, since_id);
|
||||||
apiResponse = api.getPublicTimelineSinceId(false, since_id);
|
else if (type == RetrieveFeedsAsyncTask.Type.PUBLIC)
|
||||||
else if (type == RetrieveFeedsAsyncTask.Type.REMOTE_INSTANCE)
|
apiResponse = api.getPublicTimelineSinceId(false, since_id);
|
||||||
apiResponse = api.getInstanceTimelineSinceId(remoteInstance, since_id);
|
else if (type == RetrieveFeedsAsyncTask.Type.REMOTE_INSTANCE)
|
||||||
else if (type == RetrieveFeedsAsyncTask.Type.TAG) {
|
apiResponse = api.getInstanceTimelineSinceId(remoteInstance, since_id);
|
||||||
SQLiteDatabase db = Sqlite.getInstance(contextReference.get(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
else if (type == RetrieveFeedsAsyncTask.Type.TAG) {
|
||||||
List<TagTimeline> tagTimelines = new SearchDAO(contextReference.get(), db).getTimelineInfo(remoteInstance);
|
SQLiteDatabase db = Sqlite.getInstance(contextReference.get(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
if( tagTimelines != null && tagTimelines.size() > 0){
|
List<TagTimeline> tagTimelines = new SearchDAO(contextReference.get(), db).getTimelineInfo(remoteInstance);
|
||||||
TagTimeline tagTimeline = tagTimelines.get(0);
|
if (tagTimelines != null && tagTimelines.size() > 0) {
|
||||||
boolean isArt = tagTimeline.isART();
|
TagTimeline tagTimeline = tagTimelines.get(0);
|
||||||
if( isArt)
|
boolean isArt = tagTimeline.isART();
|
||||||
apiResponse = api.getCustomArtTimelineSinceId(false, remoteInstance, since_id, tagTimelines.get(0).getAny(), tagTimelines.get(0).getAll(), tagTimelines.get(0).getNone());
|
if (isArt)
|
||||||
else
|
apiResponse = api.getCustomArtTimelineSinceId(false, remoteInstance, since_id, tagTimelines.get(0).getAny(), tagTimelines.get(0).getAll(), tagTimelines.get(0).getNone());
|
||||||
apiResponse = api.getPublicTimelineTagSinceId(remoteInstance, false, since_id, tagTimelines.get(0).getAny(), tagTimelines.get(0).getAll(), tagTimelines.get(0).getNone());
|
else
|
||||||
}else{
|
apiResponse = api.getPublicTimelineTagSinceId(remoteInstance, false, since_id, tagTimelines.get(0).getAny(), tagTimelines.get(0).getAll(), tagTimelines.get(0).getNone());
|
||||||
apiResponse = api.getPublicTimelineTag(remoteInstance, false, since_id, tagTimelines.get(0).getAny(), tagTimelines.get(0).getAll(), tagTimelines.get(0).getNone());
|
} else {
|
||||||
}
|
apiResponse = api.getPublicTimelineTag(remoteInstance, false, since_id, tagTimelines.get(0).getAny(), tagTimelines.get(0).getAll(), tagTimelines.get(0).getNone());
|
||||||
}else if (type == RetrieveFeedsAsyncTask.Type.ART)
|
}
|
||||||
apiResponse = api.getArtTimelineSinceId( false, since_id, null, null, null);
|
} else if (type == RetrieveFeedsAsyncTask.Type.ART)
|
||||||
if (apiResponse != null) {
|
apiResponse = api.getArtTimelineSinceId(false, since_id, null, null, null);
|
||||||
if( type != RetrieveFeedsAsyncTask.Type.CONVERSATION)
|
if (apiResponse != null) {
|
||||||
tempStatus = apiResponse.getStatuses();
|
if (type != RetrieveFeedsAsyncTask.Type.CONVERSATION)
|
||||||
else{
|
tempStatus = apiResponse.getStatuses();
|
||||||
List<Conversation> conversations = apiResponse.getConversations();
|
else {
|
||||||
tempStatus = new ArrayList<>();
|
List<Conversation> conversations = apiResponse.getConversations();
|
||||||
if( conversations != null && conversations.size() > 0){
|
tempStatus = new ArrayList<>();
|
||||||
for(Conversation conversation: conversations){
|
if (conversations != null && conversations.size() > 0) {
|
||||||
fr.gouv.etalab.mastodon.client.Entities.Status status = conversation.getLast_status();
|
for (Conversation conversation : conversations) {
|
||||||
List<String> ppConversation = new ArrayList<>();
|
fr.gouv.etalab.mastodon.client.Entities.Status status = conversation.getLast_status();
|
||||||
for (Account account : conversation.getAccounts())
|
List<String> ppConversation = new ArrayList<>();
|
||||||
ppConversation.add(account.getAvatar());
|
for (Account account : conversation.getAccounts())
|
||||||
status.setConversationProfilePicture(ppConversation);
|
ppConversation.add(account.getAvatar());
|
||||||
status.setConversationId(conversation.getId());
|
status.setConversationProfilePicture(ppConversation);
|
||||||
tempStatus.add(status);
|
status.setConversationId(conversation.getId());
|
||||||
|
tempStatus.add(status);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if( tempStatus != null)
|
if (tempStatus != null)
|
||||||
statuses.addAll(0, tempStatus);
|
statuses.addAll(0, tempStatus);
|
||||||
}
|
}
|
||||||
if (type == RetrieveFeedsAsyncTask.Type.HOME && statuses.size() > 0) {
|
if (type == RetrieveFeedsAsyncTask.Type.HOME && statuses.size() > 0) {
|
||||||
MainActivity.lastHomeId = statuses.get(0).getId();
|
MainActivity.lastHomeId = statuses.get(0).getId();
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
GNUAPI gnuapi = new GNUAPI(this.contextReference.get());
|
||||||
|
List<fr.gouv.etalab.mastodon.client.Entities.Status> tempStatus = null;
|
||||||
|
APIResponse apiResponse = null;
|
||||||
|
if (type == RetrieveFeedsAsyncTask.Type.GNU_HOME) {
|
||||||
|
apiResponse = gnuapi.getHomeTimelineSinceId(since_id);
|
||||||
|
}else if (type == RetrieveFeedsAsyncTask.Type.GNU_LOCAL)
|
||||||
|
apiResponse = gnuapi.getPublicTimelineSinceId(true, since_id);
|
||||||
|
else if (type == RetrieveFeedsAsyncTask.Type.GNU_WHOLE)
|
||||||
|
apiResponse = gnuapi.getPublicTimelineSinceId(false, since_id);
|
||||||
|
else if (type == RetrieveFeedsAsyncTask.Type.GNU_TAG) {
|
||||||
|
SQLiteDatabase db = Sqlite.getInstance(contextReference.get(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
|
List<TagTimeline> tagTimelines = new SearchDAO(contextReference.get(), db).getTimelineInfo(remoteInstance);
|
||||||
|
if (tagTimelines != null && tagTimelines.size() > 0) {
|
||||||
|
TagTimeline tagTimeline = tagTimelines.get(0);
|
||||||
|
boolean isArt = tagTimeline.isART();
|
||||||
|
if (isArt)
|
||||||
|
apiResponse = gnuapi.getCustomArtTimelineSinceId(false, remoteInstance, since_id, tagTimelines.get(0).getAny(), tagTimelines.get(0).getAll(), tagTimelines.get(0).getNone());
|
||||||
|
else
|
||||||
|
apiResponse = gnuapi.getPublicTimelineTagSinceId(remoteInstance, false, since_id, tagTimelines.get(0).getAny(), tagTimelines.get(0).getAll(), tagTimelines.get(0).getNone());
|
||||||
|
} else {
|
||||||
|
apiResponse = gnuapi.getPublicTimelineTag(remoteInstance, false, since_id, tagTimelines.get(0).getAny(), tagTimelines.get(0).getAll(), tagTimelines.get(0).getNone());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (apiResponse != null) {
|
||||||
|
if (type != RetrieveFeedsAsyncTask.Type.CONVERSATION)
|
||||||
|
tempStatus = apiResponse.getStatuses();
|
||||||
|
else {
|
||||||
|
List<Conversation> conversations = apiResponse.getConversations();
|
||||||
|
tempStatus = new ArrayList<>();
|
||||||
|
if (conversations != null && conversations.size() > 0) {
|
||||||
|
for (Conversation conversation : conversations) {
|
||||||
|
fr.gouv.etalab.mastodon.client.Entities.Status status = conversation.getLast_status();
|
||||||
|
List<String> ppConversation = new ArrayList<>();
|
||||||
|
for (Account account : conversation.getAccounts())
|
||||||
|
ppConversation.add(account.getAvatar());
|
||||||
|
status.setConversationProfilePicture(ppConversation);
|
||||||
|
status.setConversationId(conversation.getId());
|
||||||
|
tempStatus.add(status);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tempStatus != null)
|
||||||
|
statuses.addAll(0, tempStatus);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,7 +65,7 @@ public class Sqlite extends SQLiteOpenHelper {
|
||||||
static final String TABLE_BOOST_SCHEDULE = "BOOST_SCHEDULE";
|
static final String TABLE_BOOST_SCHEDULE = "BOOST_SCHEDULE";
|
||||||
|
|
||||||
//Table for blocking tracking domains
|
//Table for blocking tracking domains
|
||||||
static final String TABLE_TRACKING_BLOCK = "TRACKING_BLOCK";
|
public static final String TABLE_TRACKING_BLOCK = "TRACKING_BLOCK";
|
||||||
|
|
||||||
static final String COL_USER_ID = "USER_ID";
|
static final String COL_USER_ID = "USER_ID";
|
||||||
static final String COL_USERNAME = "USERNAME";
|
static final String COL_USERNAME = "USERNAME";
|
||||||
|
|
|
@ -897,6 +897,7 @@
|
||||||
<string name="calls_blocked">http calls blocked by the application</string>
|
<string name="calls_blocked">http calls blocked by the application</string>
|
||||||
<string name="list_of_blocked_domains">List of blocked calls</string>
|
<string name="list_of_blocked_domains">List of blocked calls</string>
|
||||||
<string name="submit">Submit</string>
|
<string name="submit">Submit</string>
|
||||||
|
<string name="data_base_exported">The data base has been exported!</string>
|
||||||
<!-- end languages -->
|
<!-- end languages -->
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue