mirror of
https://github.com/KokaKiwi/BarInsta
synced 2024-11-22 22:57:29 +00:00
Open post from dm thread and handle ig links properly from within the app
This commit is contained in:
parent
0d7b5199ea
commit
ccfaa1c397
@ -157,6 +157,12 @@ public class MainActivity extends BaseLanguageActivity {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onNewIntent(final Intent intent) {
|
||||||
|
super.onNewIntent(intent);
|
||||||
|
handleIntent(intent);
|
||||||
|
}
|
||||||
|
|
||||||
private void setupSuggestions() {
|
private void setupSuggestions() {
|
||||||
suggestionsFetchHandler = new Handler();
|
suggestionsFetchHandler = new Handler();
|
||||||
suggestionAdapter = new SuggestionsAdapter(this, (type, query) -> {
|
suggestionAdapter = new SuggestionsAdapter(this, (type, query) -> {
|
||||||
|
@ -29,6 +29,7 @@ import androidx.fragment.app.Fragment;
|
|||||||
import androidx.lifecycle.MutableLiveData;
|
import androidx.lifecycle.MutableLiveData;
|
||||||
import androidx.lifecycle.ViewModel;
|
import androidx.lifecycle.ViewModel;
|
||||||
import androidx.lifecycle.ViewModelProvider;
|
import androidx.lifecycle.ViewModelProvider;
|
||||||
|
import androidx.navigation.NavController;
|
||||||
import androidx.navigation.NavDirections;
|
import androidx.navigation.NavDirections;
|
||||||
import androidx.navigation.fragment.NavHostFragment;
|
import androidx.navigation.fragment.NavHostFragment;
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
@ -223,11 +224,18 @@ public class DirectMessageThreadFragment extends Fragment {
|
|||||||
case CLIP:
|
case CLIP:
|
||||||
final long postId = directItemModel.getMediaModel().getPk();
|
final long postId = directItemModel.getMediaModel().getPk();
|
||||||
final boolean isId = true;
|
final boolean isId = true;
|
||||||
// startActivity(new Intent(requireContext(), PostViewer.class)
|
final NavController navController = NavHostFragment.findNavController(this);
|
||||||
// .putExtra(Constants.EXTRAS_POST, new PostModel(postId, false)));
|
final NavDirections action = DirectMessageThreadFragmentDirections
|
||||||
|
.actionGlobalPostViewFragment(
|
||||||
|
0,
|
||||||
|
new String[]{String.valueOf(postId)},
|
||||||
|
isId
|
||||||
|
);
|
||||||
|
navController.navigate(action);
|
||||||
break;
|
break;
|
||||||
case LINK:
|
case LINK:
|
||||||
Intent linkIntent = new Intent(Intent.ACTION_VIEW);
|
Intent linkIntent = new Intent(Intent.ACTION_VIEW);
|
||||||
|
linkIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK|Intent.FLAG_ACTIVITY_SINGLE_TOP);
|
||||||
linkIntent.setData(Uri.parse(directItemModel.getLinkModel().getLinkContext().getLinkUrl()));
|
linkIntent.setData(Uri.parse(directItemModel.getLinkModel().getLinkContext().getLinkUrl()));
|
||||||
startActivity(linkIntent);
|
startActivity(linkIntent);
|
||||||
break;
|
break;
|
||||||
@ -545,8 +553,8 @@ public class DirectMessageThreadFragment extends Fragment {
|
|||||||
wr.close();
|
wr.close();
|
||||||
urlConnection.connect();
|
urlConnection.connect();
|
||||||
if (urlConnection.getResponseCode() == HttpURLConnection.HTTP_OK) {
|
if (urlConnection.getResponseCode() == HttpURLConnection.HTTP_OK) {
|
||||||
if (action == "delete") hasDeletedSomething = true;
|
if (action.equals("delete")) hasDeletedSomething = true;
|
||||||
else if (action == "seen") DirectMessageInboxFragment.refreshPlease = true;
|
else if (action.equals("seen")) DirectMessageInboxFragment.refreshPlease = true;
|
||||||
}
|
}
|
||||||
urlConnection.disconnect();
|
urlConnection.disconnect();
|
||||||
} catch (Throwable ex) {
|
} catch (Throwable ex) {
|
||||||
|
@ -38,6 +38,22 @@
|
|||||||
app:nullable="false" />
|
app:nullable="false" />
|
||||||
</action>
|
</action>
|
||||||
|
|
||||||
|
<include app:graph="@navigation/post_view_nav_graph" />
|
||||||
|
|
||||||
|
<action
|
||||||
|
android:id="@+id/action_global_postViewFragment"
|
||||||
|
app:destination="@id/post_view_nav_graph">
|
||||||
|
<argument
|
||||||
|
android:name="index"
|
||||||
|
app:argType="integer" />
|
||||||
|
<argument
|
||||||
|
android:name="idOrCodeArray"
|
||||||
|
app:argType="string[]" />
|
||||||
|
<argument
|
||||||
|
android:name="isId"
|
||||||
|
app:argType="boolean" />
|
||||||
|
</action>
|
||||||
|
|
||||||
<fragment
|
<fragment
|
||||||
android:id="@+id/directMessagesInboxFragment"
|
android:id="@+id/directMessagesInboxFragment"
|
||||||
android:name="awais.instagrabber.fragments.directmessages.DirectMessageInboxFragment"
|
android:name="awais.instagrabber.fragments.directmessages.DirectMessageInboxFragment"
|
||||||
|
Loading…
Reference in New Issue
Block a user