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

Replace deprecated ImagePicker #159

Closed
garethbowen opened this issue Feb 2, 2021 · 6 comments
Closed

Replace deprecated ImagePicker #159

garethbowen opened this issue Feb 2, 2021 · 6 comments
Assignees
Labels
Priority: 3 - Low Can be bumped from the release Type: Technical issue Improve something that users won't notice
Milestone

Comments

@garethbowen
Copy link
Contributor

The ImagePicker library we use is deprecated, and the most recent version crashes the app, so we should migrate to another solution.

@garethbowen garethbowen added the Type: Technical issue Improve something that users won't notice label Feb 2, 2021
@garethbowen
Copy link
Contributor Author

garethbowen commented Feb 2, 2021

Scheduling for 4.0.0 because some of the solutions will not work on Android 4.4. Does not block the release.

@latin-panda
Copy link
Contributor

latin-panda commented Feb 15, 2022

Adding a bit more of context:

Currently the users on cht-android app can't upload image, audio, video and file when entering information into Enketo forms. This work will fix these type of questions and increase the compatibility with the ODK standard.

@latin-panda
Copy link
Contributor

latin-panda commented Feb 21, 2022

To add more info when testing this ticket:

  • Webapp's Enketo has a max limit of 32KB for each uploaded file. There's another ticket to increase this limit here.
  • Webapp isn't handling empty files, there's a bug reported here.
  • Webapp only fully support images, other media type (video, audio, pdf, etc) will need some work, like add previews, etc. There's a ticket for that here. ODK standard for these inputs here.
  • If the form contains fields to upload any media that is not images, the edit will fail. It'll be addressed on the third bullet's ticket.

@latin-panda
Copy link
Contributor

Ready for AT in this PR

Please see the current limitations in the previous comment, and send me any question you might have 🙂

This is one form we've been using to test, please include more cases as needed for testing.

xml form

<h:html xmlns="http://www.w3.org/2002/xforms" xmlns:h="http://www.w3.org/1999/xhtml">
	<h:head>
		<h:title>Photos on Android - Demo Form</h:title>

		<model>
			<instance>
				<photos-on-android id="photos-on-android">
					<my_photo/>
					<my_video/>
					<my_sound/>
					<my-any-file/>
					<meta>
						<instanceID/>
					</meta>
				</photos-on-android>
			</instance>

			<bind nodeset="/photos-on-android/my_photo" type="binary"/>
			<bind nodeset="/photos-on-android/my_video" type="binary"/>
			<bind nodeset="/photos-on-android/my_sound" type="binary"/>
			<bind nodeset="/photos-on-android/my-any-file" type="binary"/>
		</model>
	</h:head>

	<h:body>
		<upload ref="/photos-on-android/my_photo" mediatype="image/*">
			<hint>Select a picture or take a photo</hint>
			<label>Image widget</label>
		</upload>
		<upload ref="/photos-on-android/my_video" mediatype="video/*">
			<hint>Select a video</hint>
			<label>Video widget</label>
		</upload>
		<upload ref="/photos-on-android/my_sound" mediatype="audio/*">
			<hint>Select a sound?</hint>
			<label>Sound widget</label>
		</upload>
		<upload ref="/photos-on-android/my-any-file" mediatype="">
			<hint>Select a whatever?</hint>
			<label>File widget</label>
		</upload>
	</h:body>
</h:html>

@tatilepizs tatilepizs self-assigned this Mar 11, 2022
@tatilepizs
Copy link

tatilepizs commented Mar 15, 2022

User: CHW
Config: Default
Environment: gamma
cht-core version: master
Platform: Mobile App. APK generated with branch 159-file-picker

Tested in different Android version, all the images were uploaded successfully.

Samsung Galaxy S7 Edge, Android 7.0 (emulator - Kobiton) image image image image
LG V20, Android 8.0 (emulator - Kobiton) image image image image image image
Huawei P20 lite, Android 9 (real phone) image image image image image image
Samsung Galaxy A50, Android 10 (emulator - Kobiton) image image image image image image image
Samsung Galaxy S21, Android 11.0 (emulator - BrowserStack) image image image image image image

latin-panda added a commit that referenced this issue Mar 16, 2022
Ticket: #159

This commit:
- Removes the old image picker library and implementation because it's deprecated.
- Removes support for the deprecated library android.support.* (android.enableJetifier=true) and fixes style of buttons that were depending on Widget.AppCompat.
- Adds new support for Webview's file picker.
- Adds support for recording if selected instead of picking from the phone's file system
@latin-panda
Copy link
Contributor

Thanks @tatilepizs for the detailed comment and great work testing in different Android versions!

This work is merged into the main branch.

melema120 pushed a commit to livinggoods/medic-android that referenced this issue Apr 27, 2022
Ticket: medic#159

This commit:
- Removes the old image picker library and implementation because it's deprecated.
- Removes support for the deprecated library android.support.* (android.enableJetifier=true) and fixes style of buttons that were depending on Widget.AppCompat.
- Adds new support for Webview's file picker.
- Adds support for recording if selected instead of picking from the phone's file system
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority: 3 - Low Can be bumped from the release Type: Technical issue Improve something that users won't notice
Projects
None yet
Development

No branches or pull requests

5 participants