Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Amit #39

Merged
merged 7 commits into from
Oct 25, 2023
Merged

Amit #39

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
2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ android {
namespace 'com.BugBazaar'
compileSdk 32


sourceSets {
main {
jniLibs.srcDirs = ['src/main/jniLibs']
}
}

defaultConfig {
applicationId "com.BugBazaar"
Expand Down Expand Up @@ -68,5 +72,6 @@ dependencies {
implementation group: 'com.cloudinary', name: 'cloudinary-android', version: '1.24.0'
implementation 'com.google.android.material:material:1.4.0' // Use the latest version
implementation 'com.razorpay:checkout:1.6.33'
implementation 'com.scottyab:rootbeer-lib:0.1.0'

}
27 changes: 27 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
android:allowTaskReparenting="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:debuggable="true"
android:extractNativeLibs="true"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
Expand All @@ -38,6 +39,17 @@
tools:ignore="CustomPermissionTypo"
tools:replace="android:fullBackupContent"
tools:targetApi="31">
<service android:name="com.darvin.security.IsolatedService" android:enabled="true" android:process=":tmpService" android:isolatedProcess="true"/>

<activity
android:name=".ui.SplashActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".ui.RASPSettings"
android:exported="false" />
Expand Down Expand Up @@ -99,6 +111,16 @@
<activity
android:name=".ui.NavigationDrawer_Dashboard"
android:exported="true">
<<<<<<< HEAD

<!-- <intent-filter> -->
<!-- <action android:name="android.intent.action.MAIN" /> -->


<!-- <category android:name="android.intent.category.LAUNCHER" /> -->
<!-- </intent-filter> -->
=======
>>>>>>> 0e7df25cb0b07fcb1d45350389331aa368e1e1a3
</activity>
<activity
android:name=".ui.MyProfile"
Expand All @@ -118,6 +140,10 @@
<activity
android:name=".ui.Signin"
android:clearTaskOnLaunch="true"
<<<<<<< HEAD
android:exported="true"
android:launchMode="singleTop" />
=======
android:exported="true" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
Expand All @@ -126,6 +152,7 @@
</activity>


>>>>>>> 0e7df25cb0b07fcb1d45350389331aa368e1e1a3
<activity
android:name=".ui.Deeplink"
android:exported="true">
Expand Down
Binary file added app/src/main/JniLibs/arm64-v8a/libnative-lib.so
Binary file not shown.
Binary file added app/src/main/JniLibs/armeabi-v7a/libnative-lib.so
Binary file not shown.
Binary file added app/src/main/JniLibs/x86/libnative-lib.so
Binary file not shown.
Binary file added app/src/main/JniLibs/x86_64/libnative-lib.so
Binary file not shown.
43 changes: 43 additions & 0 deletions app/src/main/java/com/BugBazaar/controller/checkAuth.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package com.BugBazaar.controller;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.widget.Toast;

import com.BugBazaar.ui.CreatePasscode;
import com.BugBazaar.ui.PasscodeActivity;
import com.BugBazaar.ui.Signin;

public class checkAuth extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

// Check if the user is logged in
UserAuthSave userAuthSave = new UserAuthSave(getApplicationContext());

if (UserAuthSave.isLoggedIn()) {

Toast.makeText(this, "Welcome back !!", Toast.LENGTH_SHORT).show();

Log.d("passcodemait", String.valueOf(UserAuthSave.getpasscode_flag()));

if (UserAuthSave.getpasscode_flag()) {

startActivity(new Intent(this, PasscodeActivity.class));
} else {
startActivity(new Intent(this, CreatePasscode.class));


}




}
}
}

4 changes: 1 addition & 3 deletions app/src/main/java/com/BugBazaar/ui/MyProfile.java
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,5 @@ public void onSaveProfileClick(View view) {
editProfileBtn.setVisibility(View.VISIBLE);
}
//Code to handle backbutton
public void onBackButtonClick(View view) {
onBackPressed(); // Navigate back to the previous activity
}

}
25 changes: 20 additions & 5 deletions app/src/main/java/com/BugBazaar/ui/RASPSettings.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.BugBazaar.ui;

import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.View;
Expand Down Expand Up @@ -46,11 +47,13 @@ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putBoolean("switch1_state", isChecked);
editor.apply();
restartApplication();

// If switch1 is turned on, turn off other switches
if (isChecked) {
switch2.setChecked(false);
switch3.setChecked(false);

}
}
});
Expand All @@ -61,7 +64,7 @@ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putBoolean("switch2_state", isChecked);
editor.apply();

restartApplication();
// If switch1 is turned on, turn off other switches
if (isChecked) {
switch1.setChecked(false);
Expand All @@ -76,7 +79,7 @@ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putBoolean("switch3_state", isChecked);
editor.apply();

restartApplication();
// If switch1 is turned on, turn off other switches
if (isChecked) {
switch1.setChecked(false);
Expand All @@ -99,25 +102,37 @@ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (switchView == switch1) {
switch2.setChecked(false);
switch3.setChecked(false);
showToast("Switch 1 is turned on!");
showToast("EASY PROTECTION IS ON!!!");


} else if (switchView == switch2) {
switch1.setChecked(false);
switch3.setChecked(false);
showToast("Switch 2 is turned on!");
showToast("Medium PROTECTION IS ON!!!");
} else if (switchView == switch3) {
switch1.setChecked(false);
switch2.setChecked(false);
showToast("Switch 3 is turned on!");
showToast("Advanced PROTECTION IS ON!!!");
}
}
}
}

private void restartApplication() {
Intent intent = new Intent(this, SplashActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
finish();
}

private void showToast(String message) {
Toast.makeText(this, message, Toast.LENGTH_SHORT).show();
}

//Code to handle backbutton
public void onBackButtonClick(View view) {
onBackPressed(); // Navigate back to the previous activity
}


}
13 changes: 7 additions & 6 deletions app/src/main/java/com/BugBazaar/ui/Signin.java
Original file line number Diff line number Diff line change
Expand Up @@ -129,14 +129,15 @@ public void onPermissionDenied() {

}

public void onBackPressed() {
// Create an Intent to start the desired activity
Intent intentw = new Intent(this, NavigationDrawer_Dashboard.class);

// Start the desired activity
startActivity(intentw);

// Finish the current activity
@Override
public void onBackPressed() {
startActivity(new Intent(this,NavigationDrawer_Dashboard.class));
finish();


}


}
138 changes: 138 additions & 0 deletions app/src/main/java/com/BugBazaar/ui/SplashActivity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
package com.BugBazaar.ui;


import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.os.Handler;
import android.os.RemoteException;
import android.util.Log;
import android.view.View;
import android.widget.Toast;

import androidx.appcompat.app.AppCompatActivity;

import com.BugBazaar.R;
import com.BugBazaar.ui.detectAppInt.checkroot;
import com.BugBazaar.utils.AlertDialogManager;
import com.darvin.security.DetectMagisk;
import com.darvin.security.Native;
import com.google.android.material.snackbar.Snackbar;

public class SplashActivity extends AppCompatActivity implements DetectMagisk.DetectionListener {

private static final int SPLASH_TIMEOUT = 2000; // 2 seconds
AlertDialogManager alertDialogManager = new AlertDialogManager();


@Override
protected void onCreate(Bundle bundle) {
super.onCreate(bundle);

setContentView(R.layout.activity_splash);


new Handler().postDelayed(new Runnable() {
@Override
public void run() {
// Fetch the switch states
boolean[] switchStates = Checklevel();
boolean switch1State = switchStates[0];
boolean switch2State = switchStates[1];
boolean switch3State = switchStates[2];

// Perform an operation on switch1State
if (switch1State) {
showToast("Easy Protection");

// Create an instance of the checkroot class and pass the current context
checkroot rootChecker = new checkroot(SplashActivity.this);

// Call the checkRootBeer method
rootChecker.checkRootBeer();


} else if (switch2State) {

boolean z = Native.isMagiskPresentNative();


DetectMagisk detectMagisk = new DetectMagisk(getApplicationContext());
detectMagisk.setDetectionListener(SplashActivity.this);
// Start Magisk detection
detectMagisk.startMagiskDetection();



// try {
// Log.d("helloamit", String.valueOf(detectMagisk.serviceBinder.isMagiskPresent()));
// } catch (RemoteException e) {
// throw new RuntimeException(e);
// }
// if (z) {
//
// Log.d("coolamit", String.valueOf(z));
// }
// Intent mainIntent = new Intent(SplashActivity.this, NavigationDrawer_Dashboard.class);
// startActivity(mainIntent);
// finish();

}




else if (switch3State) {

// switch1 is in the "OFF" state, perform a different operation if needed
}

else {

Intent mainIntent = new Intent(SplashActivity.this, NavigationDrawer_Dashboard.class);
startActivity(mainIntent);
finish();
}


}
}, SPLASH_TIMEOUT);
}

// Fetch and return the switch states
public boolean[] Checklevel() {
// Fetch the values from SharedPreferences
SharedPreferences sharedPreferences = getSharedPreferences("SwitchStatePrefs", Context.MODE_PRIVATE);

boolean switch1State = sharedPreferences.getBoolean("switch1_state", false);
boolean switch2State = sharedPreferences.getBoolean("switch2_state", false);
boolean switch3State = sharedPreferences.getBoolean("switch3_state", false);

// Return the switch states as an array
return new boolean[]{switch1State, switch2State, switch3State};
}

private void showToast(String message) {
Toast.makeText(this, message, Toast.LENGTH_SHORT).show();
}


@Override
public void onMagiskDetected() {

runOnUiThread(new Runnable() {
@Override
public void run() {
alertDialogManager.showRootedDeviceAlert(SplashActivity.this,"Magisk ");

}
});

}

@Override
public void onMagiskNotDetected() {

}
}
Loading
Loading