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

[$500] Android - Log-Unable to share log as tapping on conversation does not trigger any action #38209

Closed
1 of 6 tasks
izarutskaya opened this issue Mar 13, 2024 · 13 comments
Closed
1 of 6 tasks
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor

Comments

@izarutskaya
Copy link

izarutskaya commented Mar 13, 2024

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Version Number: 1.4.51
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught during regression testing, add the test name, ID and link from TestRail: https://expensify.testrail.io/index.php?/tests/view/4422072
Logs: https://stackoverflow.com/c/expensify/questions/4856
Issue reported by: Applause-Internal team

Action Performed:

  1. Launch app
  2. Login with a new account
  3. Tap profile --- about --- troubleshoot
  4. Enable client side logging
  5. Tap view debug console
  6. Note logs are displayed in real-time
  7. Enter 5+5
  8. Tap execute
  9. Tap save log
  10. Close the successfully downloaded modal
  11. Tap " Share log"
  12. In search page, tap on a conversation

Expected Result:

In search page, tapping on a conversation user must be directed to conversation page and logs must be sent as an attachment.

Actual Result:

In search page, tapping on a conversation does not trigger any action. User is not navigated to conversation page showing logs sent as an attachment.

Workaround:

Unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Bug6411980_1710314637190.ah.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01c66f93b0f705d0fa
  • Upwork Job ID: 1768329032101048320
  • Last Price Increase: 2024-03-14
@izarutskaya izarutskaya added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Mar 13, 2024
Copy link

melvin-bot bot commented Mar 13, 2024

Triggered auto assignment to @stephanieelliott (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

@izarutskaya
Copy link
Author

@stephanieelliott I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors.

@shahinyan11
Copy link

shahinyan11 commented Mar 13, 2024

Proposal

Please re-state the problem that we are trying to solve in this issue.

Log-Unable to share log as tapping on conversation does not trigger any action

What is the root cause of that problem?

Here we return early if reportID is not exist. And this can happen if users have not had conversation before

What changes do you think we should make in order to solve the problem?

Create new report if there is not exist old one. To do that we can do below steps

  1. Add return report.reportID at the end of the navigateToAndOpenReport function.
  2. Update the attachLogToReport function like below
    const attachLogToReport = (option: Report) => {
        let reportId = option.reportID
        if (!reportId) {
            reportId = navigateToAndOpenReport([option.login])
        }
        
        const filename = FileUtils.appendTimeToFileName('logs.txt');

        onAttachLogToReport(reportId, filename);
    };

What alternative solutions did you explore? (Optional)

  1. Remove this code .
  2. Add new optional callback param for navigateToAndOpenReport function. And add following code callback?.(report.reportID) after this line
  3. Update this function with below
    const onAttachLogToReport = (option: OptionData, filename: string) => {
        function sendAttachment (reportID: string){
            FileUtils.readFileAsync(
                logSource,
                filename,
                (file) => {
                    Report.addAttachment(reportID, file);

                    const routeToNavigate = ROUTES.REPORT_WITH_ID.getRoute(reportID);
                    Navigation.navigate(routeToNavigate);
                },
                () => {},
            );
        }


        if (!option.reportID) {
            Report.navigateToAndOpenReport([option.login], false, sendAttachment );
            return
        }

        sendAttachment(option.reportID)
    };

@stephanieelliott stephanieelliott added the External Added to denote the issue can be worked on by a contributor label Mar 14, 2024
@melvin-bot melvin-bot bot changed the title Android - Log-Unable to share log as tapping on conversation does not trigger any action [$500] Android - Log-Unable to share log as tapping on conversation does not trigger any action Mar 14, 2024
Copy link

melvin-bot bot commented Mar 14, 2024

Job added to Upwork: https://www.upwork.com/jobs/~01c66f93b0f705d0fa

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Mar 14, 2024
Copy link

melvin-bot bot commented Mar 14, 2024

Triggered auto assignment to Contributor-plus team member for initial proposal review - @situchan (External)

@stephanieelliott stephanieelliott removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Mar 14, 2024
@stephanieelliott
Copy link
Contributor

stephanieelliott commented Mar 14, 2024

Yea I think this may be a BE issue -- @situchan can you help me confirm?

@situchan
Copy link
Contributor

This is frontend issue

@situchan
Copy link
Contributor

@shahinyan11 does this happen only on android or all platforms?

@shahinyan11
Copy link

@shahinyan11 does this happen only on android or all platforms?

On all platforms

@Eros472
Copy link

Eros472 commented Mar 15, 2024

// Assuming this is within an Adapter for a RecyclerView
@Override
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
    Conversation conversation = conversations.get(position);

    holder.itemView.setOnClickListener(v -> {
        Intent intent = new Intent(context, ConversationActivity.class);
        intent.putExtra("logData", logData); // Assume logData is a String or serializable object
        context.startActivity(intent);
    });
}

In your ConversationActivity, you would then retrieve the log data:

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_conversation);

    // Retrieve the log data
    String logData = getIntent().getStringExtra("logData");
    // Now you can use logData, e.g., display it or attach it to a message
}

Copy link

melvin-bot bot commented Mar 15, 2024

📣 @Eros472! 📣
Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
Please follow these steps:

  1. Make sure you've read and understood the contributing guidelines.
  2. Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
  3. Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
  4. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
    Screen Shot 2022-11-16 at 4 42 54 PM
    Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>

@ShridharGoel
Copy link
Contributor

ShridharGoel commented Mar 16, 2024

Proposal

Please re-state the problem that we are trying to solve in this issue.

Unable to share log as tapping on conversation does not trigger any action.

What is the root cause of that problem?

When selecting a user with no existing report, the report ID in the option is null which leads to no navigation based on the existing logic.

const attachLogToReport = (option: Report) => {
if (!option.reportID) {
return;
}
const filename = FileUtils.appendTimeToFileName('logs.txt');
onAttachLogToReport(option.reportID, filename);
};

const onAttachLogToReport = (reportID: string, filename: string) => {
if (!reportID || !logSource) {
return;
}
const src = `file://${logSource}`;
Report.addAttachment(reportID, {name: filename, source: src, uri: src, type: 'text/plain'} as File);
const routeToNavigate = ROUTES.REPORT_WITH_ID.getRoute(reportID);
Navigation.navigate(routeToNavigate);
};

What changes do you think we should make in order to solve the problem?

The report ID check can be removed.

const attachLogToReport = (option: Report) => {
        const filename = FileUtils.appendTimeToFileName('logs.txt');

        onAttachLogToReport(option, filename);
    };

Instead of having reportID in onAttachLogToReport, we will have option and then call navigateToAndOpenReport with the file.

-     const onAttachLogToReport = (reportID: string, filename: string) => {
+ const onAttachLogToReport = (option: OptionData, filename: string) => {
        FileUtils.readFileAsync(
            logSource,
            filename,
            (file) => {
- Report.addAttachment(reportID, file);

-              const routeToNavigate = ROUTES.REPORT_WITH_ID.getRoute(reportID);
-              Navigation.navigate(routeToNavigate);

+              if (!option.login) {
+                 return;
+              }
+               Report.navigateToAndOpenReport([option.login], true, file)
            },
            () => {},
        );
    };

In navigateToAndOpenReport, we'll pass an option parameter file and then have the below logic after openReport call to add attachment before navigating.

-function navigateToAndOpenReport(userLogins: string[], shouldDismissModal = true) {
+function navigateToAndOpenReport(userLogins: string[], shouldDismissModal = true, file: File = undefined) {
    let newChat: ReportUtils.OptimisticChatReport | EmptyObject = {};

    const participantAccountIDs = PersonalDetailsUtils.getAccountIDsByLogins(userLogins);
    const chat = ReportUtils.getChatByParticipants(participantAccountIDs);

    if (!chat) {
        newChat = ReportUtils.buildOptimisticChatReport(participantAccountIDs);
    }
    const report = chat ?? newChat;

    // We want to pass newChat here because if anything is passed in that param (even an existing chat), we will try to create a chat on the server
    openReport(report.reportID, userLogins, newChat);

+  if (file && report.reportID) {
+      addAttachment(report.reportID, file, '');
+  }
    if (shouldDismissModal) {
        Navigation.dismissModalWithReport(report);
    } else {
        Navigation.navigateWithSwitchPolicyID({route: ROUTES.HOME});
        Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(report.reportID));
    }
}

The above was for the web code.
Similar thing can be done for the native code as well.

function ShareLogList({logSource}: ShareLogListProps) {
    const onAttachLogToReport = (option: OptionData, filename: string) => {
        if (!logSource) {
            return;
        }
        const src = `file://${logSource}`;
        if (!option.login) {
            return;
        }
        Report.navigateToAndOpenReport([option.login], true, {name: filename, source: src, uri: src, type: 'text/plain'} as File)
    };

    return <BaseShareLogList onAttachLogToReport={onAttachLogToReport} />;
}

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Mar 18, 2024
@stephanieelliott
Copy link
Contributor

Closing this based on the updated guidance, I think this is somewhat low ROI and can be fixed later when we move to the polish phase.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor
Projects
None yet
Development

No branches or pull requests

6 participants