Skip to content

Commit

Permalink
Make Contacts app recognize tuta account
Browse files Browse the repository at this point in the history
Close #7692
Close #6568

Co-authored-by: bir <[email protected]>
Co-authored-by: hrb-hub <[email protected]>
  • Loading branch information
3 people committed Nov 11, 2024
1 parent 6156123 commit ea8bc90
Show file tree
Hide file tree
Showing 11 changed files with 601 additions and 152 deletions.
3 changes: 3 additions & 0 deletions app-android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -46,20 +46,23 @@ android {
buildTypes {
debug {
resValue("string", "package_name", "de.tutao.tutanota.debug")
resValue("string", "account_type", "de.tutao.tutanota.debug")
manifestPlaceholders = [contentProviderAuthority: 'de.tutao.fileprovider.debug']
applicationIdSuffix ".debug"
jniDebuggable true
}
release {
minifyEnabled true
resValue("string", "package_name", "de.tutao.tutanota")
resValue("string", "account_type", "de.tutao.tutanota")
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
manifestPlaceholders = [contentProviderAuthority: 'de.tutao.fileprovider']
}
releaseTest {
initWith release
minifyEnabled true
resValue("string", "package_name", "de.tutao.tutanota.test")
resValue("string", "account_type", "de.tutao.tutanota.test")
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
manifestPlaceholders = [contentProviderAuthority: 'de.tutao.fileprovider.test']
applicationIdSuffix ".test"
Expand Down
3 changes: 0 additions & 3 deletions app-android/app/src/debugDist/res/values/strings.xml

This file was deleted.

11 changes: 7 additions & 4 deletions app-android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -161,29 +161,32 @@


<service
android:name="de.tutao.tutashared.credentials.AccountManagerAuthenticatorService"
android:name="de.tutao.tutashared.credentials.AccountAuthenticatorService"
android:exported="false">
<intent-filter>
<action android:name="android.accounts.AccountAuthenticator"/>
</intent-filter>

<meta-data
android:name="android.accounts.AccountAuthenticator"
android:resource="@xml/authenticator"/>
android:resource="@xml/account_authenticator"/>
</service>

<service
android:name=".StubSyncService"
android:exported="false"
android:exported="true"
android:process=":sync">
<intent-filter>
<action android:name="android.content.SyncAdapter"/>
</intent-filter>
<meta-data
android:name="android.content.SyncAdapter"
android:resource="@xml/syncadapter"/>
<meta-data
android:name="android.provider.CONTACTS_STRUCTURE"
android:resource="@xml/contacts"/>
</service>


<receiver
android:name=".push.BootBroadcastReceiver"
android:exported="false">
Expand Down

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions app-android/app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<resources>
<string name="app_name" translatable="false">Tuta</string>
<string name="reminder_label">Reminder</string>
<string name="pushNewMail_msg">New email received.</string>
<string name="notificationSync_msg">Synchronizing notifications</string>
<string name="scheduleAlarmError_msg">Could not set up an alarm. Please update the application.</string>
<string name="wantToSendReport_msg">Something unexpected went wrong. Do you want to send an error report? You can add a message to help us fix this error.</string>
<string name="downloadCompleted_msg">Download completed</string>
<string name="unlockCredentials_action">Unlock credentials</string>
<string name="delete_action">Delete</string>
<string name="markRead_action">Mark read</string>
<string name="app_name" translatable="false">Tuta</string>
<string name="reminder_label">Reminder</string>
<string name="pushNewMail_msg">New email received.</string>
<string name="notificationSync_msg">Synchronizing notifications</string>
<string name="scheduleAlarmError_msg">Could not set up an alarm. Please update the application.</string>
<string name="wantToSendReport_msg">Something unexpected went wrong. Do you want to send an error report? You can add a message to help us fix this error.</string>
<string name="downloadCompleted_msg">Download completed</string>
<string name="unlockCredentials_action">Unlock credentials</string>
<string name="delete_action">Delete</string>
<string name="markRead_action">Mark read</string>
</resources>
5 changes: 5 additions & 0 deletions app-android/app/src/main/res/xml/account_authenticator.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<account-authenticator xmlns:android="http://schemas.android.com/apk/res/android"
android:accountType="@string/account_type"
android:icon="@mipmap/ic_logo_round"
android:label="@string/app_name"
android:smallIcon="@mipmap/ic_logo_round"/>
7 changes: 0 additions & 7 deletions app-android/app/src/main/res/xml/authenticator.xml

This file was deleted.

61 changes: 61 additions & 0 deletions app-android/app/src/main/res/xml/contacts.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- The base valid EditSchema must contain "name" and "photo" DataKinds -->
<!-- An invalid EditSchema will result in Tuta not being detected as a contact provider -->
<ContactsAccountType>
<EditSchema>
<DataKind kind="photo" maxOccurs="1"/>
<DataKind kind="name"
maxOccurs="1"
supportsDisplayName="false"
supportsPrefix="true"
supportsMiddleName="true"
supportsSuffix="true"
supportsPhoneticGivenName="true"
supportsPhoneticMiddleName="true"
supportsPhoneticFamilyName="true"
/>
<DataKind kind="phone">
<Type type="home"/>
<Type type="work"/>
<Type type="mobile"/>
<Type type="other_fax"/>
<Type type="other"/>
<Type type="custom"/>
</DataKind>
<DataKind kind="email">
<Type type="home"/>
<Type type="work"/>
<Type type="other"/>
<Type type="custom"/>
</DataKind>
<DataKind kind="nickname" maxOccurs="1"/>
<DataKind kind="im">
<Type type="custom"/>
</DataKind>
<DataKind kind="postal" needsStructured="false">
<Type type="home"/>
<Type type="work"/>
<Type type="other"/>
<Type type="custom"/>
</DataKind>
<DataKind kind="organization" maxOccurs="1"/>
<DataKind kind="website"/>
<DataKind kind="note" maxOccurs="1"/>
<DataKind kind="event" dateWithTime="false">
<Type type="birthday" maxOccurs="1" yearOptional="true"/>
</DataKind>
<DataKind kind="relationship">
<Type type="parent"/>
<Type type="brother"/>
<Type type="sister"/>
<Type type="child"/>
<Type type="friend"/>
<Type type="relative"/>
<Type type="spouse"/>
<Type type="partner"/>
<Type type="assistant"/>
<Type type="manager"/>
<Type type="custom"/>
</DataKind>
</EditSchema>
</ContactsAccountType>
8 changes: 4 additions & 4 deletions app-android/app/src/main/res/xml/syncadapter.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
<sync-adapter
xmlns:android="http://schemas.android.com/apk/res/android"
android:contentAuthority="com.android.contacts"
android:accountType="@string/package_name"
android:userVisible="false"
android:supportsUploading="false"
android:accountType="@string/account_type"
android:userVisible="true"
android:supportsUploading="true"
android:allowParallelSyncs="false"
android:isAlwaysSyncable="true"
/>
/>
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@ package de.tutao.tutashared.credentials

import android.app.Service
import android.content.Intent

import android.os.IBinder


class AccountManagerAuthenticatorService : Service() {
class AccountAuthenticatorService : Service() {
private var authenticator: AccountManagerAuthenticator? = null

override fun onCreate() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package de.tutao.tutashared.credentials
import android.accounts.*
import android.content.Context
import android.os.Bundle
import android.util.Log

class AccountManagerAuthenticator(context: Context) : AbstractAccountAuthenticator(context) {
private val context: Context
Expand All @@ -16,6 +17,7 @@ class AccountManagerAuthenticator(context: Context) : AbstractAccountAuthenticat
authTokenType: String,
requiredFeatures: Array<String>,
options: Bundle): Bundle? {
Log.d("Sync", "AccountManagerAuthenticator addAccount")
return null
}

Expand Down

0 comments on commit ea8bc90

Please sign in to comment.