All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.mobgen.halo.android.plugin.sdk.HaloExtension.groovy Maven / Gradle / Ivy

There is a newer version: 2.9.3
Show newest version
package com.mobgen.halo.android.plugin.sdk

import com.mobgen.halo.android.plugin.sdk.modules.CoreModule
import com.mobgen.halo.android.plugin.sdk.modules.PushModule
import org.gradle.api.Project

/**
 * The halo extension to configure the plugin.
 */
public class HaloExtension extends ProjectExtension {
    /**
     * The list of modules.
     */
    private List modules

    /**
     * The client id
     */
    public String clientId

    /**
     * The client secret
     */
    public String clientSecret

    /**
     * The client id used for debug builds.
     */
    public String clientIdDebug

    /**
     * The client secret used for debug builds.
     */
    public String clientSecretDebug

    /**
     * The push notifications module.
     */
    private PushModule pushModule

    /**
     * Halo extension constructor.
     */
    public HaloExtension(Project project){
        super(project)
    }

    /**
     * Closure API for the convention object.
     * @param pushClosure push closure.
     */
    def push(Closure pushClosure) {
        pushModule = new PushModule()
        project.configure(pushModule, pushClosure)
    }

    /**
     * Stores the api key for halo.
     * @param clientId The api key
     */
    def clientId(String clientId){
        this.clientId = clientId
    }

    /**
     * The client id that will be used for debug builds.
     * @param clientId The client id that will be used for debug builds.
     */
    def clientIdDebug(String clientId){
        this.clientIdDebug = clientId
    }

    /**
     * The client secret.
     * @param clientSecret The client secret.
     */
    def clientSecret(String clientSecret){
        this.clientSecret = clientSecret
    }

    /**
     * The client secret used for debug builds.
     * @param clientSecretDebug The client secret.
     */
    def clientSecretDebug(String clientSecredDebug){
        this.clientSecretDebug = clientSecredDebug;
    }

    /**
     * Builds all the modules configuring them based on the properties.
     */
    public void buildHalo(){
        modules = CoreModule.CoreBuilder.create()
                .project(project)
                .extension(this)
                .build(pushModule)
    }

    /**
     * Provides the modules.
     * @return The modules.
     */
    public List getModules(){
        return modules
    }

    /**
     * Provides the push module.
     * @return The push module.
     */
    public PushModule pushModule(){
        return pushModule
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy