-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Share extension Android and iOS implementation #54354
base: main
Are you sure you want to change the base?
Share extension Android and iOS implementation #54354
Conversation
…-fork into Guccio163/shareExtension
…-fork into Guccio163/shareExtension
Hmm IOS failed- I'm retrying now. Could you take a look? |
🧪🧪 Use the links below to test this adhoc build on Android, iOS, Desktop, and Web. Happy testing! 🧪🧪
|
android/app/build.gradle
Outdated
@@ -246,6 +246,8 @@ dependencies { | |||
implementation "com.squareup.okhttp3:okhttp-urlconnection:4.+" | |||
|
|||
implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.0") | |||
|
|||
implementation("com.google.code.gson:gson:2.8.8") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for SNYK to pass we need to use com.google.code.gson:[email protected]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Hi @grgia, I'm returning from OOO tomorrow and already started to check your and Błażej's comments - I'll address all of them in the nearest days! |
@Guccio163 beautiful, keep me updated! |
…are-mansion-labs/expensify-app-fork into brtqkr/wire-up-share-extension-ios
Hi @grgia ! |
@filip-solecki Slack DMd you |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Android looks good! I'll continue with iOS after lunch 😄
private fun getInternalStorageDirectory(context: Context): File { | ||
val internalStorageDirectory = File(context.filesDir.absolutePath, directoryName) | ||
if (!internalStorageDirectory.exists()) { | ||
internalStorageDirectory.mkdir() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's slightly safer to use mkdirs()
here, because in case the parent directory doesn't exist, the command won't fail
* @param context | ||
* @return The absolute path of the image | ||
*/ | ||
fun copyUriToStorage(uri: Uri?, context: Context): String? { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the Uri
doesn't have to be optional here, because in handleSingleFileIntent
the lambda won't run unless fileUri
exists. The same applies to other methods with Uri?
like createTemporaryFile
and saveFileFromProviderUri
- I believe it will make the code much simpler, because we won't have to handle the null
scenario in any of them 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
iOS looking good! Noticed just two minor things!
} | ||
|
||
private func handleImageData(_ image: UIImage, folder: URL, completion: @escaping (FileSaveError?) -> Void) { | ||
let filename = "shared_image.png" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed that SubmitDetailsPage.tsx
we use shared_image.jpg
not shared_image.png
- not sure if these are related or not, but worth mentioning 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great catch, thanks!
|
||
private func handleStringData(_ dataString: String, folder: URL, completion: @escaping (FileSaveError?) -> Void) { | ||
if !dataString.hasPrefix("file://") { | ||
let filename = "text_to_read.txt" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The text_to_read.txt
appears three times, maybe we can extract it to a variable for maintanance. It's a minor one, though 😄
Details
This PR introduces the implementation of Share Extension for mobile apps both for Android and iOS.
Fixed Issues
$#48788
$#48789
PROPOSAL:
Tests
Share test:
Submit test:
Offline tests
N/A
QA Steps
N/A
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label and/or tagged@Expensify/design
so the design team can review the changes.ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
MacOS: Desktop