Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ android {
applicationId "ps.reso.instaeclipse"
minSdkVersion 28
targetSdk 36
versionCode 11
versionName '0.4.4'
versionCode 12
versionName '0.4.5'

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,10 @@ protected void beforeHookedMethod(MethodHookParam param) {
return;
}
shouldDrop |= (uri.getPath().startsWith("/api/v1/clips/") && uri.getQuery() != null
&& (uri.getQuery().contains("next_media_ids=")
|| uri.getQuery().contains("max_id=")))
|| uri.getPath().contains("/clips/discover/")
|| uri.getPath().contains("/mixed_media/discover/stream/");
&& (uri.getQuery().contains("next_media_ids=")
|| uri.getQuery().contains("max_id=")))
|| uri.getPath().contains("/clips/discover/")
|| uri.getPath().contains("/mixed_media/discover/stream/");
}
if (FeatureFlags.disableExplore) {
shouldDrop |= uri.getPath().contains("/discover/topical_explore")
Expand All @@ -130,6 +130,11 @@ protected void beforeHookedMethod(MethodHookParam param) {
|| uri.getPath().contains("/logging_client_events");
}

// Misc
if (FeatureFlags.disableRepost) {
shouldDrop |= uri.getPath().contains("/media/create_note/");
}

if (shouldDrop) {
// XposedBridge.log("the URI was blocked: " + uri.getPath());
// Modify the URI to divert the request to a harmless endpoint
Expand All @@ -146,7 +151,7 @@ protected void beforeHookedMethod(MethodHookParam param) {
else {
XposedBridge.log("Logging: " + uri.getHost() + uri.getPath());
}
*/
*/

if (FeatureFlags.showFollowerToast) {
if (uri.getPath() != null && uri.getPath().startsWith("/api/v1/friendships/show/")) {
Expand Down
52 changes: 47 additions & 5 deletions app/src/main/java/ps/reso/instaeclipse/mods/ui/UIHookManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,31 @@ private static boolean isAnyGhostOptionEnabled() {

public static void setupHooks(Activity activity) {
// Hook Search Tab (open InstaEclipse Settings)
hookLongPress(activity, "search_tab", v -> {
DialogUtils.showEclipseOptionsDialog(activity);
VibrationUtil.vibrate(activity);
return true;
});
String[] possibleSearch = {"search_tab", "action_bar_end_action_buttons"};

for (String id : possibleSearch) {
@SuppressLint("DiscouragedApi")
int viewId = activity.getResources().getIdentifier(id, "id", activity.getPackageName());
View view = activity.findViewById(viewId);

if (view != null) {
processSearchView(activity, view, id);
} else {
// VIEW NOT FOUND YET: Wait for the layout to change and try again
final View decorView = activity.getWindow().getDecorView();
decorView.getViewTreeObserver().addOnGlobalLayoutListener(new android.view.ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
View lateView = activity.findViewById(viewId);
if (lateView != null) {
processSearchView(activity, lateView, id);
// Remove listener so we don't keep calling this unnecessarily
decorView.getViewTreeObserver().removeOnGlobalLayoutListener(this);
}
}
});
}
}

// Hook Inbox Button (toggle Ghost Quick Options)
String[] possibleIds = {"action_bar_inbox_button", "direct_tab"};
Expand Down Expand Up @@ -194,4 +214,26 @@ protected void afterHookedMethod(MethodHookParam param) {
});
}

private static void applySearchHook(Activity activity, View v) {
v.setOnLongClickListener(view -> {
DialogUtils.showEclipseOptionsDialog(activity);
VibrationUtil.vibrate(activity);
return true;
});
}

private static void processSearchView(Activity activity, View view, String id) {
if (id.equals("action_bar_end_action_buttons") && view instanceof ViewGroup container) {
for (int i = 0; i < container.getChildCount(); i++) {
View child = container.getChildAt(i);
CharSequence description = child.getContentDescription();
if (description != null && description.toString().toLowerCase().contains("search")) {
applySearchHook(activity, child);
}
}
} else {
applySearchHook(activity, view);
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ public static void saveAllFlags() {
editor.putBoolean("isMiscEnabled", FeatureFlags.isMiscEnabled);
editor.putBoolean("disableStoryFlipping", FeatureFlags.disableStoryFlipping);
editor.putBoolean("disableVideoAutoPlay", FeatureFlags.disableVideoAutoPlay);
editor.putBoolean("disableRepost", FeatureFlags.disableRepost);
editor.putBoolean("showFollowerToast", FeatureFlags.showFollowerToast);
editor.putBoolean("showFeatureToasts", FeatureFlags.showFeatureToasts);

Expand Down Expand Up @@ -108,6 +109,7 @@ public static void loadAllFlags(Context context) {
FeatureFlags.isMiscEnabled = prefs.getBoolean("isMiscEnabled", false);
FeatureFlags.disableStoryFlipping = prefs.getBoolean("disableStoryFlipping", false);
FeatureFlags.disableVideoAutoPlay = prefs.getBoolean("disableVideoAutoPlay", false);
FeatureFlags.disableRepost = prefs.getBoolean("disableRepost", false);
FeatureFlags.showFollowerToast = prefs.getBoolean("showFollowerToast", false);
FeatureFlags.showFeatureToasts = prefs.getBoolean("showFeatureToasts", false);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,13 @@ private static void showMiscOptions(Context context) {
LinearLayout layout = createSwitchLayout(context);

// Create all child switches
Switch[] switches = new Switch[]{createSwitch(context, "Disable Story Auto-Swipe", FeatureFlags.disableStoryFlipping), createSwitch(context, "Disable Video Autoplay", FeatureFlags.disableVideoAutoPlay), createSwitch(context, "Show Follower Toast", FeatureFlags.showFollowerToast), createSwitch(context, "Show Feature Toasts", FeatureFlags.showFeatureToasts)};
Switch[] switches = new Switch[]{
createSwitch(context, "Disable Story Auto-Swipe", FeatureFlags.disableStoryFlipping),
createSwitch(context, "Disable Video Autoplay", FeatureFlags.disableVideoAutoPlay),
createSwitch(context, "Disable Repost", FeatureFlags.disableRepost),
createSwitch(context, "Show Follower Toast", FeatureFlags.showFollowerToast),
createSwitch(context, "Show Feature Toasts", FeatureFlags.showFeatureToasts)
};

// Create Enable/Disable All switch
@SuppressLint("UseSwitchCompatOrMaterialCode") Switch enableAllSwitch = createSwitch(context, "Enable/Disable All", areAllEnabled(switches));
Expand Down Expand Up @@ -693,9 +699,12 @@ private static void showMiscOptions(Context context) {
FeatureFlags.disableVideoAutoPlay = isChecked;
break;
case 2:
FeatureFlags.showFollowerToast = isChecked;
FeatureFlags.disableRepost = isChecked;
break;
case 3:
FeatureFlags.showFollowerToast = isChecked;
break;
case 4:
FeatureFlags.showFeatureToasts = isChecked;
break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public class FeatureFlags {
public static boolean disableVideoAutoPlay = false;
public static boolean showFollowerToast = false;
public static boolean showFeatureToasts = false;
public static boolean disableRepost = false;


}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

public class VersionCheckUtility {

private static final String CURRENT_VERSION = "0.4.4"; // Current version
private static final String CURRENT_VERSION = "0.4.5"; // Current version
private static final String VERSION_CHECK_URL = "https://raw.githubusercontent.com/ReSo7200/InstaEclipse/refs/heads/main/version.json"; // JSON URL

public static void checkForUpdates(Context context) {
Expand Down
80 changes: 41 additions & 39 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
android:id="@+id/main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:background="@color/black">
android:background="@color/black"
android:fitsSystemWindows="true">

<!-- App Bar -->
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/app_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/black">
Expand All @@ -20,7 +20,6 @@
android:layout_height="48dp"
android:background="@color/black">

<!-- App Logo -->
<ImageView
android:id="@+id/toolbar_title_image"
android:layout_width="42dp"
Expand All @@ -31,66 +30,69 @@
android:paddingEnd="7dp"
android:adjustViewBounds="true"
android:scaleType="fitCenter"
app:tint="@color/white" />
app:tint="@color/white"
tools:ignore="HardcodedText,RtlSymmetry" />

<!-- App Name -->
<TextView
android:id="@+id/toolbar_title_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="start|center_vertical"
android:text="@string/app_name"
android:textSize="18sp"
android:textStyle="bold"
android:contentDescription="App Name"
android:maxWidth="160dp"
android:adjustViewBounds="true"
android:scaleType="fitCenter"
android:textSize="18sp"
android:textStyle="bold"
android:textColor="@color/white" />

<!-- App Version -->
<TextView
android:id="@+id/toolbar_version"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end|center_vertical"
android:layout_marginEnd="4dp"
android:layout_marginEnd="4dp"
android:text="@string/version"
android:textColor="@color/white"
android:textSize="15sp"
android:textStyle="bold"
android:textStyle="bold"
android:paddingEnd="16dp"
tools:ignore="RtlSymmetry" />
</com.google.android.material.appbar.MaterialToolbar>
</com.google.android.material.appbar.AppBarLayout>

<!-- Scrollable Container for Fragment -->
<androidx.core.widget.NestedScrollView
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
android:clipToPadding="false"
android:paddingBottom="82dp">
app:layout_behavior="@string/appbar_scrolling_view_behavior">

<!-- Fragment Container -->
<FrameLayout
android:id="@+id/fragment_container"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<androidx.core.widget.NestedScrollView
android:id="@+id/main_scroll_view"
android:layout_width="0dp"
android:layout_height="0dp"
android:fillViewport="true"
app:layout_constraintBottom_toTopOf="@id/bottom_navigation"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">

</androidx.core.widget.NestedScrollView>
<FrameLayout
android:id="@+id/fragment_container"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</androidx.core.widget.NestedScrollView>

<!-- Bottom Navigation -->
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="@+id/bottom_navigation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
app:menu="@menu/bottom_navigation_menu"
app:itemTextColor="@color/white"
app:itemIconTint="@drawable/nav_selector"
app:itemActiveIndicatorStyle="@null"
app:itemRippleColor="@android:color/transparent"
android:background="@color/black" />
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="@+id/bottom_navigation"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="@color/black"
app:itemActiveIndicatorStyle="@null"
app:itemIconTint="@drawable/nav_selector"
app:itemRippleColor="@android:color/transparent"
app:itemTextColor="@color/white"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:menu="@menu/bottom_navigation_menu" />

</androidx.constraintlayout.widget.ConstraintLayout>

</androidx.coordinatorlayout.widget.CoordinatorLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
Loading