Skip to content

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

Closed

Description

@izarutskaya

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

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Mar 13, 2024
  2. melvin-bot commented on Mar 13, 2024

    @melvin-bot

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

  3. izarutskaya commented on Mar 13, 2024

    @izarutskaya
    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.

  4. shahinyan11 commented on Mar 13, 2024

    @shahinyan11

    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)
        };
    
  5. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Mar 14, 2024
  6. 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[/+] on Mar 14, 2024
  7. melvin-bot commented on Mar 14, 2024

    @melvin-bot
  8. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Mar 14, 2024
  9. melvin-bot commented on Mar 14, 2024

    @melvin-bot

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

  10. removed
    Help WantedApply this label when an issue is open to proposals by contributors
    on Mar 14, 2024
  11. stephanieelliott commented on Mar 14, 2024

    @stephanieelliott
    Contributor

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

  12. situchan commented on Mar 14, 2024

    @situchan
    Contributor

    This is frontend issue

  13. situchan commented on Mar 14, 2024

    @situchan
    Contributor

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

  14. shahinyan11 commented on Mar 14, 2024

    @shahinyan11

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

    On all platforms

  15. Erick4725 commented on Mar 15, 2024

    @Erick4725
    // 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
    }
    
  16. melvin-bot commented on Mar 15, 2024

    @melvin-bot

    📣 @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>
    
  17. ShridharGoel commented on Mar 16, 2024

    @ShridharGoel
    Contributor

    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} />;
    }
    
  18. stephanieelliott commented on Mar 19, 2024

    @stephanieelliott
    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

Metadata

Metadata

Labels

BugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions