Commit 232a1266 authored by Vincent Bourgmayer's avatar Vincent Bourgmayer 🎼
Browse files

Merge branch '123-allowMeteredConnection-eDrive' into 'master'

Let user enable or disable edrive synchronization on metered network

See merge request !32
parents f8cb13bd 0d57747a
Pipeline #178243 passed with stage
in 2 minutes and 2 seconds
......@@ -203,7 +203,7 @@
<meta-data
android:name="android.provider.CONTACTS_STRUCTURE"
android:resource="@xml/contacts"/>
</service>
</service>
<!-- account type "Eelo" -->
<service
......@@ -217,8 +217,8 @@
android:name="android.accounts.AccountAuthenticator"
android:resource="@xml/eelo_account_authenticator" />
</service>
<service
<service
android:name=".syncadapter.EeloCalendarsSyncAdapterService"
android:exported="true"
android:process=":sync"
......@@ -232,7 +232,7 @@
android:resource="@xml/eelo_sync_calendars" />
</service>
<service
<service
android:name=".syncadapter.EeloTasksSyncAdapterService"
android:exported="true"
android:process=":sync"
......@@ -244,9 +244,9 @@
<meta-data
android:name="android.content.SyncAdapter"
android:resource="@xml/eelo_sync_tasks" />
</service>
<service
</service>
<service
android:name=".syncadapter.EeloNotesSyncAdapterService"
android:exported="true"
android:process=":sync"
......@@ -260,7 +260,7 @@
android:resource="@xml/eelo_sync_notes" />
</service>
<service
<service
android:name=".syncadapter.EeloEmailSyncAdapterService"
android:exported="true"
android:process=":sync"
......@@ -274,7 +274,7 @@
android:resource="@xml/eelo_sync_email" />
</service>
<service
<service
android:name=".syncadapter.EeloMediaSyncAdapterService"
android:exported="true"
android:process=":sync"
......@@ -286,7 +286,7 @@
<meta-data
android:name="android.content.SyncAdapter"
android:resource="@xml/eelo_sync_media" />
</service>
</service>
<service
android:name=".syncadapter.EeloAppDataSyncAdapterService"
......@@ -302,6 +302,21 @@
android:resource="@xml/eelo_sync_app_data" />
</service>
<service
android:name=".syncadapter.EeloMeteredEdriveSyncAdapterService"
android:exported="true"
android:process=":sync"
tools:ignore="ExportedService">
<intent-filter>
<action android:name="android.content.SyncAdapter" />
</intent-filter>
<meta-data
android:name="android.content.SyncAdapter"
android:resource="@xml/eelo_sync_metered_edrive" />
</service>
<!-- account type "eelo Address book" -->
<service
android:name=".syncadapter.EeloNullAuthenticatorService"
......@@ -327,7 +342,7 @@
<meta-data
android:name="android.content.SyncAdapter"
android:resource="@xml/eelo_sync_address_books" />
</service>
</service>
<service
android:name=".syncadapter.EeloContactsSyncAdapterService"
......@@ -359,7 +374,7 @@
android:resource="@xml/google_account_authenticator" />
</service>
<service
<service
android:name=".syncadapter.GoogleCalendarsSyncAdapterService"
android:exported="true"
android:process=":sync"
......@@ -371,7 +386,7 @@
<meta-data
android:name="android.content.SyncAdapter"
android:resource="@xml/google_sync_calendars" />
</service>
</service>
<service
android:name=".syncadapter.GoogleTasksSyncAdapterService"
......@@ -385,8 +400,8 @@
<meta-data
android:name="android.content.SyncAdapter"
android:resource="@xml/google_sync_tasks" />
</service>
</service>
<!-- account type "Google Address book" -->
<service
android:name=".syncadapter.GoogleNullAuthenticatorService"
......@@ -412,7 +427,7 @@
<meta-data
android:name="android.content.SyncAdapter"
android:resource="@xml/google_sync_address_books" />
</service>
</service>
<service
android:name=".syncadapter.GoogleContactsSyncAdapterService"
......@@ -430,8 +445,8 @@
android:name="android.provider.CONTACTS_STRUCTURE"
android:resource="@xml/contacts" />
</service>
<service
<service
android:name=".syncadapter.GoogleEmailSyncAdapterService"
android:exported="true"
android:process=":sync"
......
package foundation.e.accountmanager.syncadapter
import android.accounts.Account
import android.content.ContentProviderClient
import android.content.Context
import android.content.SyncResult
import android.os.Bundle
class EeloMeteredEdriveSyncAdapterService : SyncAdapterService() {
override fun syncAdapter() = CalendarsSyncAdapter(this)
class CalendarsSyncAdapter(
context: Context
): SyncAdapter(context) {
override fun sync(account: Account, extras: Bundle, authority: String, provider: ContentProviderClient, syncResult: SyncResult) {
// Unused
}
}
}
\ No newline at end of file
......@@ -296,6 +296,11 @@ class AccountDetailsFragment : Fragment() {
context.getString(R.string.app_data_authority),
true
)
ContentResolver.setSyncAutomatically(
account,
context.getString(R.string.metered_edrive_authority),
true
)
// add entries for account to service DB
Logger.log.log(Level.INFO, "Writing account configuration to database", config)
......
......@@ -28,6 +28,7 @@
<string name="email_authority">foundation.e.mail.provider.AppContentProvider</string>
<string name="media_authority">foundation.e.drive.providers.MediasSyncProvider</string>
<string name="app_data_authority">foundation.e.drive.providers.SettingsSyncProvider</string>
<string name="metered_edrive_authority" translatable="false">foundation.e.drive.providers.MeteredConnectionAllowedProvider</string>
<string name="e_drive_package_name">foundation.e.drive</string>
<string name="manage_accounts" translatable="false">Account extra settings</string>
<string name="manage_account_description">Credentials, sync frequency, etc.</string>
......
<!--
~ Copyright (c) 2013 – 2015 Ricki Hirner (bitfire web engineering).
~ All rights reserved. This program and the accompanying materials
~ are made available under the terms of the GNU Public License v3.0
~ which accompanies this distribution, and is available at
~ http://www.gnu.org/licenses/gpl.html
-->
<sync-adapter xmlns:android="http://schemas.android.com/apk/res/android"
android:accountType="@string/eelo_account_type"
android:contentAuthority="@string/metered_edrive_authority"
android:isAlwaysSyncable="true"
android:userVisible="true" />
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment