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

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

There is a newer version: 2.9.3
Show newest version
package com.mobgen.halo.android.plugin.sdk.modules
import com.mobgen.halo.android.plugin.sdk.HaloModule
import groovy.json.JsonBuilder
/**
 * Module for the push notifications DSL.
 */
public class PushModule extends HaloModule {

    /**
     * Push notifications module name.
     */
    private static final String NAME = "halo-user"

    /**
     * Adds the gcm sender id.
     */
    private String gcmSenderId

    /**
     * The sender id used for debugging applications
     */
    private String gcmDebugSenderId

    @Override
    def String moduleName() {
        return NAME
    }

    /**
     * Adds the tag gcm to the halo configuration file.
     * @param senderId The sender id.
     */
    def gcm(String senderId){
        gcmSenderId = senderId
    }

    def gcmDebug(String gcmDebug){
        gcmDebugSenderId = gcmDebug
    }

    /**
     * This module is enabled when the gcm is available.
     * @return True if enabled, false otherwise.
     */
    public boolean isEnabled(){
        return gcmSenderId != null || gcmDebugSenderId != null
    }

    @Override
    JsonBuilder buildConfig(JsonBuilder builder) {
        builder {
            gcmSender gcmSenderId
            gcmSenderDebug gcmDebugSenderId
        }
        return builder
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy