Skip to content

Conversation

@jibraniqbal666
Copy link

@jibraniqbal666 jibraniqbal666 commented Nov 21, 2025

screen-20251125-021818-1764019066497.mp4

@changeset-bot
Copy link

changeset-bot bot commented Nov 21, 2025

⚠️ No Changeset found

Latest commit: 66af4d2

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@jibraniqbal666 jibraniqbal666 marked this pull request as ready for review November 24, 2025 18:15
@jibraniqbal666 jibraniqbal666 requested a review from a team as a code owner November 24, 2025 18:15
Copilot AI review requested due to automatic review settings November 24, 2025 18:15
Copilot finished reviewing on behalf of jibraniqbal666 November 24, 2025 18:17
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds document viewing features to the mobile app, focusing on authentication persistence, document interaction, and file sharing capabilities.

Key Changes

  • Added authentication session persistence to keep users logged in
  • Implemented document action sheet for user interaction (tap on document to view actions)
  • Added document download and share functionality using expo-sharing

Reviewed changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated 11 comments.

Show a summary per file
File Description
pnpm-lock.yaml Updated dependencies including expo-sharing and @react-native-community/cli
apps/mobile/package.json Added expo-sharing dependency and React Native CLI dev dependency
apps/mobile/tsconfig.json Added JSX configuration for React Native
apps/mobile/app/index.tsx Changed default redirect to documents list (potential authentication issue)
apps/mobile/src/modules/api/api.models.ts Exported CoerceDate type for use in other modules
apps/mobile/src/modules/organizations/organizations.provider.tsx Added authentication check to keep users logged in
apps/mobile/src/modules/documents/screens/documents-list.screen.tsx Added tap interaction to show document action sheet
apps/mobile/src/modules/documents/documents.services.ts Implemented file download function with authentication
apps/mobile/src/modules/documents-actions/components/document-action-sheet.tsx New modal component for document actions (view/share)
Comments suppressed due to low confidence (1)

apps/mobile/src/modules/documents-actions/components/document-action-sheet.tsx:38

  • Unused variable apiClient.
  const apiClient = useApiClient();

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


// Load current organization ID from storage on mount
useEffect(() => {

Copy link

Copilot AI Nov 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Remove the blank line for better code consistency.

Suggested change

Copilot uses AI. Check for mistakes.
Copy link
Member

@CorentinTh CorentinTh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thanks! 🙏
Made some comments, let me know

  • Regarding the ui, love the drawer, maybe it'll be more scaleable to have a vertical list of action instead of a horizontal button stacks
  • A pnpm lint:fix may also be needed

},
"devDependencies": {
"@antfu/eslint-config": "catalog:",
"@react-native-community/cli": "latest",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[question]
What is it used for?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was trying to fix development build, i had some error, let me check.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed.

Comment on lines 62 to 65
if(!authClient.getCookie()) {
router.replace('/auth/login');
return;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure that's the responsibility of the organization provider to manage authentication redirection 🤔

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed

Comment on lines 74 to 92
try {
const fileUri = await fetchDocumentFile({
document: document,
organizationId: document.organizationId,
baseUrl,
authClient,
});

const canShare = await Sharing.isAvailableAsync();
if (canShare) {
await Sharing.shareAsync(fileUri);
} else {
showAlert({
title: 'Sharing Failed',
message: 'Sharing is not available on this device. Please share the document manually.',
});
}

} catch (error) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check for the availability of the sharing api before fetching the file to avoid unnecessary transfer

'Content-Type': 'application/json',
};
// Use documentDirectory for better app compatibility
const fileUri = `${FileSystem.documentDirectory}${document.name}`;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[question]
It looks like there will be collisions as the file isn't cleaned-up?

Copy link
Author

@jibraniqbal666 jibraniqbal666 Nov 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no it basically overrides it everytime. but let's change file system to cacheDirectory

}

return <Redirect href="/auth/login" />;
return <Redirect href="/(app)/(with-organizations)/(tabs)/list" />;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not really sure about the change of the redirection here, I'd prefer to have all authentication/state redirection at the same place

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you run the master app, you will see that on app killed and reload even the app is logged in, it's still goes to login page, even though it should go to document.

so i implemented to check

  • we go directly to home
  • user not logged in
  • go to login
  • other wise be at home page.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rewrote logic again.

@jibraniqbal666
Copy link
Author

Looks great, thanks! 🙏

Made some comments, let me know

  • Regarding the ui, love the drawer, maybe it'll be more scaleable to have a vertical list of action instead of a horizontal button stacks

  • A pnpm lint:fix may also be needed

We will make it list when it exhausted. :), my idea is no future proofing, should be easy to fix later as well.

Copy link
Member

@CorentinTh CorentinTh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the update 🙏

Have you re-run ppnm install after removing the community cli package ? Lot of noise in the pnpm lock


Note: do not hesitate to use the re-request review cog to ping for change, it queues in my notifications

Image

Comment on lines +95 to +96
// Use documentDirectory for better app compatibility
const fileUri = `${FileSystem.cacheDirectory}${document.name}`;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, seems better with cache directory

[Nit] Comment

Suggested change
// Use documentDirectory for better app compatibility
const fileUri = `${FileSystem.cacheDirectory}${document.name}`;
// Use cacheDirectory for better app compatibility
const fileUri = `${FileSystem.cacheDirectory}${document.name}`;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants