Skip to content

Commit

Permalink
1. Modified TermsAndConditionsActivity activity to fix some WebView bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
banditVedant committed Dec 7, 2023
1 parent c0b32c8 commit f975b08
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 29 deletions.
8 changes: 2 additions & 6 deletions .idea/deploymentTargetDropDown.xml

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

2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@
android:exported="false" />
<activity
android:name=".ui.MyProfile"
android:exported="false" />
android:exported="true" />
<activity
android:name=".ui.TermsAndConditionsActivity"
android:exported="true" />
Expand Down
25 changes: 9 additions & 16 deletions app/src/main/java/com/BugBazaar/ui/MyProfile.java
Original file line number Diff line number Diff line change
Expand Up @@ -215,14 +215,18 @@ private void uploadImageToFirebaseStorage(Uri imageUri) {
// Upload the image
storageRef.putFile(imageUri)
.addOnSuccessListener(taskSnapshot -> {
Log.d("helloamit", String.valueOf(imageUri));
//Log.d("imageuri", String.valueOf(imageUri));

Log.d("hello", "success");
//Log.d("success", "success");
// Image upload successful, show a Toast notification
Toast.makeText(MyProfile.this, "Profile picture uploaded successfully.", Toast.LENGTH_SHORT).show();
// Image upload successful, do something if needed
})
.addOnFailureListener(exception -> {
Log.d("hello", "fail");
//Log.d("fail", "fail");
// Handle unsuccessful uploads, do something if needed
// Handle unsuccessful uploads, show a Toast notification
Toast.makeText(MyProfile.this, "Image upload failed.", Toast.LENGTH_SHORT).show();
});
}

Expand Down Expand Up @@ -303,7 +307,7 @@ private void saveDataToLocalVariable() {

if (!savedSuccessfully) {

Toast.makeText(this, "somwthing wrong happened", Toast.LENGTH_SHORT).show();
Toast.makeText(this, "Something went wrong!", Toast.LENGTH_SHORT).show();
return;
}

Expand All @@ -321,12 +325,10 @@ private void saveDataToLocalVariable() {
// editor.apply();

uploaddatatofirebase(nameData, emailData, mobileData, addressData);

//


// Display a toast message to indicate that the data is saved
Toast.makeText(this, "Profile has been updated", Toast.LENGTH_SHORT).show();
Toast.makeText(this, "Profile has been updated successfully.", Toast.LENGTH_SHORT).show();
revertToTextViews();
}

Expand All @@ -352,21 +354,12 @@ private void uploaddatatofirebase(String nameData, String emailData, String mobi
});










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


//After clicking on "Save Profile" revert all EditTextViews into TextViews. Also Hide "Save Profile" button and "Edit Profile" button is visible.
private void revertToTextViews() {
// Show the "Edit Profile" button
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,21 +70,16 @@ private void startWebView(String webViewUrl) {
else if (webViewUrl.endsWith(".bugbazaar.com")){
CookieManager cookieManager = CookieManager.getInstance();
cookieManager.setCookie(webViewUrl, getsessionid());

// Log.d("hello","cookieset");
Log.d("hello","cookieset");
}

webView.loadUrl(webViewUrl);


}

private String getsessionid() {
return String.valueOf(UUID.randomUUID());
}



private class JavaScriptInterface {
@android.webkit.JavascriptInterface

Expand Down

0 comments on commit f975b08

Please sign in to comment.