com.mobgen.halo.android.plugin.sdk.modules.PushModule.groovy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of halo-plugin Show documentation
Show all versions of halo-plugin Show documentation
This plugin helps on the configuration of the SDK.
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
}
}