diff --git a/app/src/main/java/app/fedilab/android/activities/BaseMainActivity.java b/app/src/main/java/app/fedilab/android/activities/BaseMainActivity.java index eda9c6bc6..55f37e17e 100644 --- a/app/src/main/java/app/fedilab/android/activities/BaseMainActivity.java +++ b/app/src/main/java/app/fedilab/android/activities/BaseMainActivity.java @@ -737,7 +737,7 @@ public abstract class BaseMainActivity extends BaseActivity Bundle bundle = new Bundle(); statusFragment = new DisplayStatusFragment(); bundle.putSerializable("type", RetrieveFeedsAsyncTask.Type.REMOTE_INSTANCE); - String instance = "peertube.social"; + String instance = "peertube.fedilab.app"; if(timelines.get(tabLayout.getSelectedTabPosition()).getRemoteInstance() != null && timelines.get(tabLayout.getSelectedTabPosition()).getRemoteInstance().getType().equals("PEERTUBE")) instance = timelines.get(tabLayout.getSelectedTabPosition()).getRemoteInstance().getHost(); bundle.putString("remote_instance", instance); @@ -2226,7 +2226,7 @@ public abstract class BaseMainActivity extends BaseActivity bundle.putString("instanceType", "ART"); }else if (tl.getType() == ManageTimelines.Type.PEERTUBE) { bundle.putString("instanceType", "PEERTUBE"); - bundle.putString("remote_instance", "peertube.social"); + bundle.putString("remote_instance", "peertube.fedilab.app"); bundle.putSerializable("type", RetrieveFeedsAsyncTask.Type.REMOTE_INSTANCE); }else if( tl.getType() == ManageTimelines.Type.INSTANCE){ if( tl.getRemoteInstance().getFilteredWith() == null){ diff --git a/app/src/main/java/app/fedilab/android/client/API.java b/app/src/main/java/app/fedilab/android/client/API.java index 63139025e..0be30d591 100644 --- a/app/src/main/java/app/fedilab/android/client/API.java +++ b/app/src/main/java/app/fedilab/android/client/API.java @@ -1863,7 +1863,7 @@ public class API { List howToVideos = new ArrayList<>(); try { HttpsConnection httpsConnection = new HttpsConnection(context, this.instance); - String response = httpsConnection.get("https://peertube.social/api/v1/video-channels/mastalab_channel/videos", 60, null, null); + String response = httpsConnection.get("https://peertube.fedilab.app/api/v1/video-channels/fedilab_channel/videos", 60, null, null); JSONArray jsonArray = new JSONObject(response).getJSONArray("data"); howToVideos = parseHowTos(jsonArray); } catch (HttpsConnection.HttpsConnectionException e) { diff --git a/app/src/main/java/app/fedilab/android/drawers/HowToVideosAdapter.java b/app/src/main/java/app/fedilab/android/drawers/HowToVideosAdapter.java index 3948ac1c2..af21453cc 100644 --- a/app/src/main/java/app/fedilab/android/drawers/HowToVideosAdapter.java +++ b/app/src/main/java/app/fedilab/android/drawers/HowToVideosAdapter.java @@ -116,14 +116,14 @@ public class HowToVideosAdapter extends BaseAdapter implements OnListActionInter next.setBounds(0,0,(int) (30 * scale + 0.5f),(int) (30 * scale + 0.5f)); holder.how_to_description.setCompoundDrawables(null, null, next, null); Glide.with(holder.how_to_image.getContext()) - .load("https://peertube.social" + howToVideo.getThumbnailPath()) + .load("https://peertube.fedilab.app" + howToVideo.getThumbnailPath()) .into(holder.how_to_image); holder.how_to_container.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(context, WebviewActivity.class); Bundle b = new Bundle(); - String finalUrl = "https://peertube.social" + howToVideo.getEmbedPath(); + String finalUrl = "https://peertube.fedilab.app" + howToVideo.getEmbedPath(); b.putString("url", finalUrl); b.putBoolean("peertubeLink", true); Pattern link = Pattern.compile("(https?:\\/\\/[\\da-z\\.-]+\\.[a-z\\.]{2,10})\\/videos\\/embed\\/(\\w{8}-\\w{4}-\\w{4}-\\w{4}-\\w{12})$"); diff --git a/app/src/main/java/app/fedilab/android/drawers/StatusListAdapter.java b/app/src/main/java/app/fedilab/android/drawers/StatusListAdapter.java index 4c1e933fd..275f130a5 100644 --- a/app/src/main/java/app/fedilab/android/drawers/StatusListAdapter.java +++ b/app/src/main/java/app/fedilab/android/drawers/StatusListAdapter.java @@ -126,6 +126,7 @@ import app.fedilab.android.client.Entities.Poll; import app.fedilab.android.client.Entities.PollOptions; import app.fedilab.android.client.Entities.Relationship; import app.fedilab.android.client.Entities.Status; +import app.fedilab.android.client.Entities.StoredStatus; import app.fedilab.android.client.Entities.TagTimeline; import app.fedilab.android.helper.CrossActions; import app.fedilab.android.helper.CustomTextView; @@ -213,6 +214,8 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct private int stepSpliToot; private String in_reply_to_status; private TextView warning_message; + private Status tootReply; + private long currentToId = -1; public StatusListAdapter(Context context, RetrieveFeedsAsyncTask.Type type, String targetedId, boolean isOnWifi, List statuses){ super(); @@ -500,6 +503,10 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct return; } + toot_content = null; + toot_cw_content = null; + tootReply = null; + currentToId = -1; if(apiResponse.getError() == null) { boolean display_confirm = sharedpreferences.getBoolean(Helper.SET_DISPLAY_CONFIRM, true); if( display_confirm){ @@ -2510,7 +2517,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct toot_cw_content = content_cw; toot_space_left = holder.toot_space_left; in_reply_to_status = status.getReblog() != null ? status.getReblog().getId():status.getId(); - + tootReply = status; if( theme == Helper.THEME_DARK || theme == Helper.THEME_BLACK) { changeDrawableColor(context, R.drawable.emoji_one_category_smileysandpeople, R.color.dark_text); changeDrawableColor(context, R.drawable.ic_public_toot, R.color.dark_text); @@ -4187,4 +4194,30 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct } + public void storeToot(){ + //Nothing to store here.... + if (tootReply == null || (toot_content.getText().toString().trim().length() == 0 && toot_cw_content.getText().toString().trim().length() == 0)) + return; + Status toot = new Status(); + if( toot_cw_content.getText().toString().trim().length() > 0) + toot.setSpoiler_text(toot_cw_content.getText().toString().trim()); + toot.setVisibility(visibility); + toot.setContent(toot_content.getText().toString().trim()); + + toot.setIn_reply_to_id(tootReply.getId()); + SQLiteDatabase db = Sqlite.getInstance(context, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open(); + try{ + if(currentToId == -1) { + currentToId = new StatusStoredDAO(context, db).insertStatus(toot, tootReply); + }else{ + StoredStatus storedStatus = new StatusStoredDAO(context, db).getStatus(currentToId); + if( storedStatus != null ){ + new StatusStoredDAO(context, db).updateStatus(currentToId, toot); + }else { //Might have been deleted, so it needs insertion + new StatusStoredDAO(context, db).insertStatus(toot, tootReply); + } + } + }catch (Exception ignored){ } + } + } \ No newline at end of file diff --git a/app/src/main/java/app/fedilab/android/fragments/DisplayStatusFragment.java b/app/src/main/java/app/fedilab/android/fragments/DisplayStatusFragment.java index c7ba4a550..00d96c3e8 100644 --- a/app/src/main/java/app/fedilab/android/fragments/DisplayStatusFragment.java +++ b/app/src/main/java/app/fedilab/android/fragments/DisplayStatusFragment.java @@ -794,6 +794,9 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn @Override public void onStop(){ super.onStop(); + if( statusListAdapter != null){ + statusListAdapter.storeToot(); + } if( type == RetrieveFeedsAsyncTask.Type.PUBLIC && streamingFederatedIntent != null){ SharedPreferences.Editor editor = sharedpreferences.edit(); editor.putBoolean(Helper.SHOULD_CONTINUE_STREAMING_FEDERATED + userId + instance, false);