mirror of
https://github.com/TwidereProject/Twidere-Android
synced 2025-02-17 04:00:48 +01:00
fixed #328
This commit is contained in:
parent
a3aed721c6
commit
fa45dcc977
@ -57,10 +57,6 @@ public abstract class BugReporter {
|
||||
error(null, throwable);
|
||||
}
|
||||
|
||||
public static void logIfFalse(boolean expression, String message) {
|
||||
if (!expression) error(message);
|
||||
}
|
||||
|
||||
protected abstract void logImpl(@Nullable String message, @Nullable Throwable throwable);
|
||||
|
||||
protected abstract void errorImpl(@Nullable String message, @Nullable Throwable throwable);
|
||||
|
@ -117,7 +117,8 @@ public class UploadLogsTask implements Runnable {
|
||||
}
|
||||
}
|
||||
if (succeeded) {
|
||||
BugReporter.logIfFalse(dayLogsDir.delete(), "Unable to delete log dir");
|
||||
//noinspection ResultOfMethodCallIgnored
|
||||
dayLogsDir.delete();
|
||||
}
|
||||
}
|
||||
return hasErrors;
|
||||
|
@ -366,11 +366,13 @@ public class DirectMessagesFragment extends AbsContentListRecyclerViewFragment<M
|
||||
|
||||
@Override
|
||||
protected long[][] doInBackground(final Object... params) {
|
||||
final FragmentActivity activity = getActivity();
|
||||
if (activity == null) return null;
|
||||
final long[][] result = new long[3][];
|
||||
result[0] = getAccountIds();
|
||||
result[1] = DataStoreUtils.getOldestMessageIds(getActivity(),
|
||||
result[1] = DataStoreUtils.getOldestMessageIds(activity,
|
||||
DirectMessages.Inbox.CONTENT_URI, result[0]);
|
||||
result[2] = DataStoreUtils.getOldestMessageIds(getActivity(),
|
||||
result[2] = DataStoreUtils.getOldestMessageIds(activity,
|
||||
DirectMessages.Outbox.CONTENT_URI, result[0]);
|
||||
return result;
|
||||
}
|
||||
@ -378,7 +380,7 @@ public class DirectMessagesFragment extends AbsContentListRecyclerViewFragment<M
|
||||
@Override
|
||||
protected void onPostExecute(final long[][] result) {
|
||||
final AsyncTwitterWrapper twitter = mTwitterWrapper;
|
||||
if (twitter == null) return;
|
||||
if (twitter == null || result == null) return;
|
||||
twitter.getReceivedDirectMessagesAsync(result[0], result[1], null);
|
||||
twitter.getSentDirectMessagesAsync(result[0], result[2], null);
|
||||
}
|
||||
|
@ -43,7 +43,6 @@ import java.util.List;
|
||||
* Created by mariotaku on 15/8/6.
|
||||
*/
|
||||
public class JsonSerializer {
|
||||
public static final String JSON_CACHE_DIR = "json_cache";
|
||||
|
||||
@Nullable
|
||||
public static <T> String serialize(@Nullable final List<T> list, final Class<T> cls) {
|
||||
@ -146,13 +145,4 @@ public class JsonSerializer {
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
public static File getSerializationFile(final Context context, final Object... args) throws IOException {
|
||||
if (context == null || args == null || args.length == 0) return null;
|
||||
final File cacheDir = Utils.getBestCacheDir(context, JSON_CACHE_DIR);
|
||||
if (!cacheDir.exists()) {
|
||||
BugReporter.logIfFalse(cacheDir.mkdirs(), "Unable to create cache dir " + cacheDir);
|
||||
}
|
||||
final String filename = Utils.encodeQueryParams(TwidereArrayUtils.toString(args, '.', false));
|
||||
return new File(cacheDir, filename + ".json");
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user