mirror of
https://codeberg.org/tom79/Fedilab.git
synced 2024-12-22 16:50:04 +02:00
Fix an issue with Pleroma & date parsing
This commit is contained in:
parent
6a692cd1cc
commit
951fceaa4d
11 changed files with 37 additions and 13 deletions
|
@ -31,6 +31,9 @@ import androidx.core.app.NotificationCompat;
|
|||
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
||||
import androidx.preference.PreferenceManager;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
@ -87,9 +90,10 @@ public class PostMessageService extends IntentService {
|
|||
}
|
||||
|
||||
private static MastodonStatusesService init(Context context, @NonNull String instance) {
|
||||
Gson gson = new GsonBuilder().setDateFormat("yyyy-MM-dd'T'HH:mm:ss").create();
|
||||
Retrofit retrofit = new Retrofit.Builder()
|
||||
.baseUrl("https://" + instance + "/api/v1/")
|
||||
.addConverterFactory(GsonConverterFactory.create())
|
||||
.addConverterFactory(GsonConverterFactory.create(gson))
|
||||
.client(getOkHttpClient(context))
|
||||
.build();
|
||||
return retrofit.create(MastodonStatusesService.class);
|
||||
|
|
|
@ -95,7 +95,7 @@ public class AccountsVM extends AndroidViewModel {
|
|||
}
|
||||
|
||||
private MastodonAccountsService init(String instance) {
|
||||
Gson gson = new GsonBuilder().setDateFormat("MMM dd, yyyy HH:mm:ss").create();
|
||||
Gson gson = new GsonBuilder().setDateFormat("yyyy-MM-dd'T'HH:mm:ss").create();
|
||||
Retrofit retrofit = new Retrofit.Builder()
|
||||
.baseUrl("https://" + instance + "/api/v1/")
|
||||
.addConverterFactory(GsonConverterFactory.create(gson))
|
||||
|
|
|
@ -23,6 +23,9 @@ import androidx.lifecycle.AndroidViewModel;
|
|||
import androidx.lifecycle.LiveData;
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
|
@ -57,9 +60,10 @@ public class AdminVM extends AndroidViewModel {
|
|||
}
|
||||
|
||||
private MastodonAdminService init(@NonNull String instance) {
|
||||
Gson gson = new GsonBuilder().setDateFormat("yyyy-MM-dd'T'HH:mm:ss").create();
|
||||
Retrofit retrofit = new Retrofit.Builder()
|
||||
.baseUrl("https://" + instance + "/api/v1/")
|
||||
.addConverterFactory(GsonConverterFactory.create())
|
||||
.addConverterFactory(GsonConverterFactory.create(gson))
|
||||
.client(okHttpClient)
|
||||
.build();
|
||||
return retrofit.create(MastodonAdminService.class);
|
||||
|
|
|
@ -23,6 +23,9 @@ import androidx.lifecycle.AndroidViewModel;
|
|||
import androidx.lifecycle.LiveData;
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
|
@ -52,9 +55,10 @@ public class AnnouncementsVM extends AndroidViewModel {
|
|||
}
|
||||
|
||||
private MastodonAnnouncementsService init(@NonNull String instance) {
|
||||
Gson gson = new GsonBuilder().setDateFormat("yyyy-MM-dd'T'HH:mm:ss").create();
|
||||
Retrofit retrofit = new Retrofit.Builder()
|
||||
.baseUrl("https://" + instance + "/api/v1/")
|
||||
.addConverterFactory(GsonConverterFactory.create())
|
||||
.addConverterFactory(GsonConverterFactory.create(gson))
|
||||
.client(okHttpClient)
|
||||
.build();
|
||||
return retrofit.create(MastodonAnnouncementsService.class);
|
||||
|
|
|
@ -23,6 +23,9 @@ import androidx.lifecycle.AndroidViewModel;
|
|||
import androidx.lifecycle.LiveData;
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import app.fedilab.android.client.endpoints.MastodonAppsService;
|
||||
|
@ -55,9 +58,10 @@ public class AppsVM extends AndroidViewModel {
|
|||
}
|
||||
|
||||
private MastodonAppsService init(String instance) {
|
||||
Gson gson = new GsonBuilder().setDateFormat("yyyy-MM-dd'T'HH:mm:ss").create();
|
||||
Retrofit retrofit = new Retrofit.Builder()
|
||||
.baseUrl("https://" + instance + "/api/v1/")
|
||||
.addConverterFactory(GsonConverterFactory.create())
|
||||
.addConverterFactory(GsonConverterFactory.create(gson))
|
||||
.client(okHttpClient)
|
||||
.build();
|
||||
return retrofit.create(MastodonAppsService.class);
|
||||
|
|
|
@ -23,6 +23,9 @@ import androidx.lifecycle.AndroidViewModel;
|
|||
import androidx.lifecycle.LiveData;
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
@ -58,9 +61,10 @@ public class InstancesVM extends AndroidViewModel {
|
|||
}
|
||||
|
||||
private MastodonInstanceService init(@NonNull String instance) {
|
||||
Gson gson = new GsonBuilder().setDateFormat("yyyy-MM-dd'T'HH:mm:ss").create();
|
||||
Retrofit retrofit = new Retrofit.Builder()
|
||||
.baseUrl("https://" + instance + "/api/v1/")
|
||||
.addConverterFactory(GsonConverterFactory.create())
|
||||
.addConverterFactory(GsonConverterFactory.create(gson))
|
||||
.client(okHttpClient)
|
||||
.build();
|
||||
return retrofit.create(MastodonInstanceService.class);
|
||||
|
|
|
@ -63,7 +63,7 @@ public class NotificationsVM extends AndroidViewModel {
|
|||
}
|
||||
|
||||
private MastodonNotificationsService init(@NonNull String instance) {
|
||||
Gson gson = new GsonBuilder().setDateFormat("MMM dd, yyyy HH:mm:ss").create();
|
||||
Gson gson = new GsonBuilder().setDateFormat("yyyy-MM-dd'T'HH:mm:ss").create();
|
||||
Retrofit retrofit = new Retrofit.Builder()
|
||||
.baseUrl("https://" + instance + "/api/v1/")
|
||||
.addConverterFactory(GsonConverterFactory.create(gson))
|
||||
|
|
|
@ -23,6 +23,9 @@ import androidx.lifecycle.AndroidViewModel;
|
|||
import androidx.lifecycle.LiveData;
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import app.fedilab.android.client.endpoints.MastodonAppsService;
|
||||
|
@ -56,9 +59,10 @@ public class OauthVM extends AndroidViewModel {
|
|||
}
|
||||
|
||||
private MastodonAppsService init(@NonNull String instance) {
|
||||
Gson gson = new GsonBuilder().setDateFormat("yyyy-MM-dd'T'HH:mm:ss").create();
|
||||
Retrofit retrofit = new Retrofit.Builder()
|
||||
.baseUrl("https://" + instance + "/")
|
||||
.addConverterFactory(GsonConverterFactory.create())
|
||||
.addConverterFactory(GsonConverterFactory.create(gson))
|
||||
.client(okHttpClient)
|
||||
.build();
|
||||
return retrofit.create(MastodonAppsService.class);
|
||||
|
|
|
@ -58,7 +58,7 @@ public class SearchVM extends AndroidViewModel {
|
|||
}
|
||||
|
||||
private MastodonSearchService init(@NonNull String instance) {
|
||||
Gson gson = new GsonBuilder().setDateFormat("MMM dd, yyyy HH:mm:ss").create();
|
||||
Gson gson = new GsonBuilder().setDateFormat("yyyy-MM-dd'T'HH:mm:ss").create();
|
||||
Retrofit retrofit = new Retrofit.Builder()
|
||||
.baseUrl("https://" + instance + "/api/v2/")
|
||||
.addConverterFactory(GsonConverterFactory.create(gson))
|
||||
|
|
|
@ -90,7 +90,7 @@ public class StatusesVM extends AndroidViewModel {
|
|||
}
|
||||
|
||||
private MastodonStatusesService init(@NonNull String instance) {
|
||||
Gson gson = new GsonBuilder().setDateFormat("MMM dd, yyyy HH:mm:ss").create();
|
||||
Gson gson = new GsonBuilder().setDateFormat("yyyy-MM-dd'T'HH:mm:ss").create();
|
||||
Retrofit retrofit = new Retrofit.Builder()
|
||||
.baseUrl("https://" + instance + "/api/v1/")
|
||||
.addConverterFactory(GsonConverterFactory.create(gson))
|
||||
|
|
|
@ -84,10 +84,10 @@ public class TimelinesVM extends AndroidViewModel {
|
|||
}
|
||||
|
||||
private MastodonTimelinesService initInstanceOnly(String instance) {
|
||||
Gson gson = new GsonBuilder().setDateFormat("MMM dd, yyyy HH:mm:ss").create();
|
||||
Gson gson = new GsonBuilder().setDateFormat("yyyy-MM-dd'T'HH:mm:ss").create();
|
||||
Retrofit retrofit = new Retrofit.Builder()
|
||||
.baseUrl("https://" + instance)
|
||||
.addConverterFactory(GsonConverterFactory.create(gson))
|
||||
// .addConverterFactory(GsonConverterFactory.create(gson))
|
||||
.client(okHttpClient)
|
||||
.build();
|
||||
return retrofit.create(MastodonTimelinesService.class);
|
||||
|
@ -103,7 +103,7 @@ public class TimelinesVM extends AndroidViewModel {
|
|||
}
|
||||
|
||||
private MastodonTimelinesService init(String instance) {
|
||||
Gson gson = new GsonBuilder().setDateFormat("MMM dd, yyyy HH:mm:ss").create();
|
||||
Gson gson = new GsonBuilder().setDateFormat("yyyy-MM-dd'T'HH:mm:ss").create();
|
||||
Retrofit retrofit = new Retrofit.Builder()
|
||||
.baseUrl("https://" + instance + "/api/v1/")
|
||||
.addConverterFactory(GsonConverterFactory.create(gson))
|
||||
|
|
Loading…
Reference in a new issue