Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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
Loading
Loading
Loading
Loading
Loading
+33 −18
Original line number Diff line number Diff line
@@ -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"
+21 −0
Original line number Diff line number Diff line
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
+5 −0
Original line number Diff line number Diff line
@@ -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)
+1 −0
Original line number Diff line number Diff line
@@ -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>
+14 −0
Original line number Diff line number Diff line
<!--
  ~ 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" />