Skip to content

OcWeb: Improve OC corresponding JS method #2879

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

Merged
merged 13 commits into from
Jul 17, 2025

Conversation

DaVinci9196
Copy link
Contributor

@DaVinci9196 DaVinci9196 commented Apr 28, 2025

Supplement the JS method corresponding to OcIdWebview.
Also modify the following:

  1. Fixed the problem that the link corresponding to ID:400 request reports 400.
  2. Fixed the problem that the link corresponding to ID:10052 does not match the actual display.
  3. MainActivity adds a toolbar, the title changes with the js method, and a button to close the page.
  4. Modify user avatar to support uploading from local gallery.
  5. Modify user avatar to support taking photos and uploading.

@mar-v-in mar-v-in added this to the 0.3.9 milestone Jun 11, 2025
@mar-v-in
Copy link
Member

mar-v-in commented Jul 15, 2025

I tried uploading a user avatar with this merged and it did not work for me. The button is not responsive and there is no log message.

@DaVinci9196
Copy link
Contributor Author

DaVinci9196 commented Jul 16, 2025

I tried uploading a user avatar with this merged and it did not work for me. The button is not responsive and there is no log message.

I suspect this is a problem with the webview. I tried to implement a method to get local images from the loaded js. I couldn't select the file through the device webview, but it was normal through chrome or computer chrome.

document.getElementById("uploadBtn").addEventListener("click", () => {
const input = document.createElement("input");
input.type = "file";
input.accept = "image/*";
input.multiple = false;
input.style.display = "none";

  input.addEventListener("change", (event) => {
    const file = event.target.files[0];
    if (file) {
      previewImage(file);
      uploadFile(file);
    }
  });

  document.body.appendChild(input);
  input.click();
  document.body.removeChild(input);

});

@mar-v-in
Copy link
Member

I suspect this is a problem with the webview. I tried to implement a method to get local images from the loaded js. I couldn't select the file through the device webview, but it was normal through chrome or computer chrome.

I'm a little surprised because there is specific code for user avatar uploading in this PR, but I can't find how to trigger it.

The only bridge functions that I see being called are:

  • ocConsistency.verifyActualAccountId
  • ocUi.isOpenScreenEnabled
  • ucUi.isOpenHelpEnabled
  • ocAppBar.hide
  • ocPlayProtect.isPlayProtectEnabled (when opening security checkup)
  • ocUdc.getSupportedDeviceSettings
  • ocAppBar.*

Notably, there is no call to any ocFilePicker functions. Can you explain how to reach and test them?

@DaVinci9196
Copy link
Contributor Author

@mar-v-in There are two places to change your avatar.

  1. image
  2. image

The first replacement can execute ocFilePicker normally, but the second one cannot execute normally.

@DaVinci9196 DaVinci9196 force-pushed the fix_webview_js_error branch from 3846947 to 87d233e Compare July 17, 2025 06:25
@mar-v-in mar-v-in merged commit 9551fc6 into microg:master Jul 17, 2025
1 check passed
@DaVinci9196 DaVinci9196 deleted the fix_webview_js_error branch July 18, 2025 01:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants