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

Commit 0d57747a authored by Vincent Bourgmayer's avatar Vincent Bourgmayer
Browse files

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

# Conflicts:
#   app/src/main/AndroidManifest.xml
parents ee040bdd f8cb13bd
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -5,6 +5,7 @@ stages:

before_script:
- git submodule update --init --recursive
- echo email.key $EMAIL_KEY >> local.properties
- export GRADLE_USER_HOME=$(pwd)/.gradle
- chmod +x ./gradlew

+11 −0
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@ android {
        multiDexEnabled true    // >64k methods for Android 4.4

        buildConfigField "String", "userAgent", "\"DAVx5\""
        buildConfigField "String", "EMAIL_KEY", "\"${emailKey()}\""

        // when using this, make sure that notification icons are real bitmaps
        vectorDrawables.useSupportLibrary = true
@@ -161,3 +162,13 @@ dependencies {
    testImplementation 'junit:junit:4.12'
    testImplementation "com.squareup.okhttp3:mockwebserver:${versions.okhttp}"
}

def emailKey() {
    Properties properties = new Properties()
    try {
        properties.load(project.rootProject.file('local.properties').newDataInputStream())
    } catch (ignored) {
        // Ignore
    }
    return properties.getProperty("email.key", "invalid")
}
+12 −2
Original line number Diff line number Diff line
@@ -44,6 +44,16 @@
        android:label="@string/app_name"
        android:theme="@style/AppTheme"
        tools:ignore="UnusedAttribute">
        <activity
            android:name=".ui.setup.CreateAccountActivity"
            android:label="@string/create_account"
            android:exported="true"
            android:parentActivityName=".ui.AccountsActivity" >
            <intent-filter>
                <action android:name="${applicationId}.ui.setup.CreateAccountActivity" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>

        <service android:name=".DavService"/>

+26 −0
Original line number Diff line number Diff line
/*
 * Copyright © ECORP SAS 2022.
 * 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
 */

package foundation.e.accountmanager.ui.setup

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import foundation.e.accountmanager.R

class CreateAccountActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_create_account)

        supportFragmentManager.beginTransaction().apply {
            replace(R.id.content, SendInviteFragment())
            commit()
        }
    }
}
 No newline at end of file
+66 −0
Original line number Diff line number Diff line
/*
 * Copyright © ECORP SAS 2022.
 * 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
 */

package foundation.e.accountmanager.ui.setup

import android.accounts.AccountManager
import android.accounts.AccountManagerCallback
import android.app.Activity.RESULT_OK
import android.content.Intent
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Button
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
import androidx.fragment.app.Fragment
import foundation.e.accountmanager.R

class InviteSuccessfulFragment : Fragment() {

    override fun onCreateView(
        inflater: LayoutInflater, container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View? {
        (activity as AppCompatActivity?)?.supportActionBar?.hide()
        return inflater.inflate(R.layout.fragment_invite_successful, container, false)
    }
    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)

        val instructions = view.findViewById<TextView>(R.id.instructions)
        val formattedText = view.context.getText(R.string.instructions)
        instructions.text = formattedText
        view.findViewById<Button>(R.id.sign_in).setOnClickListener {
            try {
                activity?.let {
                    val accountManager = AccountManager.get(it)
                    accountManager.addAccount(
                        "e.foundation.webdav.eelo",
                        null,
                        null,
                        null,
                        it,
                        AccountManagerCallback<Bundle?> {
                            activity?.setResult(RESULT_OK, Intent())
                            activity?.finish()
                        },
                        null
                    )
                }
            } catch (e: Exception) {
            }
        }

        view.findViewById<Button>(R.id.sign_in_later).setOnClickListener {
            activity?.setResult(RESULT_OK, Intent())
            activity?.finish()
        }
    }
}
 No newline at end of file
Loading