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

Commit ab61cf10 authored by Mathew Smith's avatar Mathew Smith
Browse files

Merge branch 'e-5.734-add-ci' into 'e-5.734'

Add GitLab CI config

See merge request e/apps/mail!24
parents 8373c4cd 3324b7c4
Loading
Loading
Loading
Loading
Loading

.gitlab-ci.yml

0 → 100644
+21 −0
Original line number Diff line number Diff line
image: "registry.gitlab.e.foundation:5000/e/apps/docker-android-apps-cicd:latest"

stages:
- build

before_script:
- export GRADLE_USER_HOME=$(pwd)/.gradle
- chmod +x ./gradlew

cache:
  key: ${CI_PROJECT_ID}
  paths:
  - .gradle/

build:
  stage: build
  script:
  - ./gradlew build -x test
  artifacts:
    paths:
    - app/k9mail/build/outputs/apk/
+3 −3
Original line number Diff line number Diff line
@@ -8,10 +8,10 @@ import com.fsck.k9.autodiscovery.api.DiscoveryResults
import com.fsck.k9.autodiscovery.api.DiscoveryTarget
import com.fsck.k9.helper.EmailHelper
import com.fsck.k9.mail.AuthType
import com.fsck.k9.mail.oauth.OAuth2Provider
import java.net.URI
import com.fsck.k9.mail.ConnectionSecurity
import com.fsck.k9.mail.oauth.OAuth2Provider
import com.fsck.k9.preferences.Protocols
import java.net.URI
import org.xmlpull.v1.XmlPullParser
import timber.log.Timber

+1 −0
Original line number Diff line number Diff line
package com.fsck.k9.mail.oauth;


public class AuthorizationException extends Exception {
    public AuthorizationException(String detailMessage, Throwable throwable) {
        super(detailMessage, throwable);
+19 −11
Original line number Diff line number Diff line
@@ -13,17 +13,25 @@ enum class OAuth2Provider(
    val isInDomain: (String) -> Boolean,
    val webViewClient: (String, OAuth2CodeGrantFlowManager) -> OAuth2WebViewClient
) {
    GMAIL(GmailAuthorizationServer(), {
    GMAIL(
        GmailAuthorizationServer(),
        {
            it in listOf("gmail.com", "android.com", "google.com", "googlemail.com")
    }, { email: String, codeGrantFlowManager: OAuth2CodeGrantFlowManager ->
        },
        { email: String, codeGrantFlowManager: OAuth2CodeGrantFlowManager ->
            GmailWebViewClient(email, codeGrantFlowManager)
    }),
    OUTLOOK(OutlookAuthorizationServer(), {
        }
    ),
    OUTLOOK(
        OutlookAuthorizationServer(),
        {
            val domainWoExt = it.split('.')[0]
            domainWoExt in listOf("hotmail", "live", "msn", "outlook")
    }, { email: String, codeGrantFlowManager: OAuth2CodeGrantFlowManager ->
        },
        { email: String, codeGrantFlowManager: OAuth2CodeGrantFlowManager ->
            OutlookWebViewClient(email, codeGrantFlowManager)
    });
        }
    );

    companion object {
        private fun getTypeFromDomain(domain: String): OAuth2Provider? {
+6 −3
Original line number Diff line number Diff line
package com.fsck.k9.mail.oauth;


import com.fsck.k9.mail.AuthenticationFailedException;
import com.fsck.k9.mail.oauth.authorizationserver.codegrantflow.OAuth2NeedUserPromptException;


public interface OAuth2TokenProvider {
    /**
     * A default timeout value to use when fetching tokens.
@@ -12,14 +14,15 @@ public interface OAuth2TokenProvider {
    /**
     * Fetch a token. No guarantees are provided for validity.
     */
    String getToken(String email, long timeoutMillis) throws AuthenticationFailedException, OAuth2NeedUserPromptException;
    String getToken(String email, long timeoutMillis)
            throws AuthenticationFailedException, OAuth2NeedUserPromptException;

    /**
     * Invalidate the token for this email.
     *
     * <p>
     * Note that the token should always be invalidated on credential failure. However invalidating a token every
     * single time is not recommended.
     * Note that the token should always be invalidated on credential failure. However invalidating a token every single
     * time is not recommended.
     * <p>
     * Invalidating a token and then failure with a new token should be treated as a permanent failure.
     */
Loading