Skip to content

Commit

Permalink
Replace download service with activity (getodk#2463)
Browse files Browse the repository at this point in the history
Some devices do not support service intents.

This also makes InstanceUploaderActivity accessible through action instead of component name to allow for future refactors.

- Remove service since startService might not work from Android 8.0 as https://developer.android.com/about/versions/oreo/android-8.0-changes\#atap . Change the FormDownloadJob to start in background thread
- Add optional url, username & password to DownloadFormListUtils.downloadFormList enabling the download of a form using alternate server configurations

* Add response when request is received by FormDownloadRequestReceiver

* Enable foreground form download through the FormDownloadList activity

- Enable optional username, password, url credentials for form downloads
- Enable extra for FORM_IDS
- Exit FormDownloadList activity with result when download forms list is cancelled/fails & when download forms is cancelled/fails/succeeds
- Use custom url, username && password in Auth Dialog when invalid authentication details are passed from an external app. Do not persist the correct details entered by the user
- Clear host credentials and cookies after using custom credentials from external app

* Add optional credentials for background form downloader and clean up optional credentials

* Exit activity if no internet connection is available & in download mode only

* Add customUrl for use in the authentication dialog

* Remove background form download requests

* Make username & password optional to correspond with anonymous logins

* Fix foreground form download request with custom credentials

- Use the credentials entered after authentication error while trying to download form/form list
- Fix anonymouse form download not working due to combo(url + username + password) check

* Remove FormDownloadService declaration from Manifest

* Use default /formList download path for external app form download requests

* Make InstanceUploaderActivity accessible through action instead of component name
  • Loading branch information
ekigamba authored and lognaturel committed Sep 14, 2018
1 parent 90bd6ae commit b6799e9
Show file tree
Hide file tree
Showing 12 changed files with 314 additions and 222 deletions.
23 changes: 15 additions & 8 deletions collect_app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,13 @@ the specific language governing permissions and limitations under the License.
<data android:mimeType="vnd.android.cursor.dir/vnd.odk.form" />
</intent-filter>
</activity>
<activity android:name=".activities.FormDownloadList" />
<activity android:name=".activities.FormDownloadList">
<intent-filter>
<action android:name="org.odk.collect.android.FORM_DOWNLOAD" />
<category android:name="android.intent.category.DEFAULT"/>
<data android:mimeType="vnd.android.cursor.dir/vnd.odk.form" />
</intent-filter>
</activity>
<activity
android:name=".activities.FileManagerTabs"
android:configChanges="orientation|screenSize" />
Expand All @@ -179,8 +185,13 @@ the specific language governing permissions and limitations under the License.
</intent-filter>
</activity>
<activity
android:exported="true"
android:name=".activities.InstanceUploaderActivity" />
android:name=".activities.InstanceUploaderActivity">
<intent-filter>
<action android:name="org.odk.collect.android.INSTANCE_UPLOAD" />
<category android:name="android.intent.category.DEFAULT"/>
<data android:mimeType="vnd.android.cursor.dir/vnd.odk.instance" />
</intent-filter>
</activity>
<activity android:name=".activities.AboutActivity" />
<activity android:name=".preferences.PreferencesActivity" />
<activity android:name=".preferences.AdminPreferencesActivity" />
Expand Down Expand Up @@ -282,11 +293,6 @@ the specific language governing permissions and limitations under the License.
<activity android:name=".activities.CaptureSelfieVideoActivity" />
<activity android:name=".activities.CaptureSelfieVideoActivityNewApi" />

<!-- External apps can request form downloads -->
<service
android:name=".services.FormDownloadService"
android:exported="true" />

<receiver
android:name=".tasks.sms.SmsSentBroadcastReceiver"
android:enabled="true"
Expand All @@ -304,4 +310,5 @@ the specific language governing permissions and limitations under the License.
</intent-filter>
</receiver>
</application>

</manifest>
Loading

0 comments on commit b6799e9

Please sign in to comment.