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

com.upplication.cordova.config.EditConfigConfig Maven / Gradle / Ivy

There is a newer version: 9.0.0
Show newest version
package com.upplication.cordova.config;

import com.upplication.cordova.EditConfig;
import com.upplication.cordova.Platform;
import com.upplication.cordova.Preference;
import com.upplication.cordova.util.IConfigProcessor;

import java.io.IOException;
import java.util.List;

/**
 * cordova.config().editConfig().add(...);
 * Edit config 'internal' XML files
 * https://cordova.apache.org/docs/en/latest/config_ref/index.html#edit-config
 */
public class EditConfigConfig {

    private IConfigProcessor configProcessor;
    private Platform platform;

    public EditConfigConfig(IConfigProcessor configProcessor, Platform platform){
        this.configProcessor = configProcessor;
        this.platform = platform;
    }

    public void add(EditConfig editConfig) throws IOException {
        this.add(getPlatform(), editConfig.getFile(), editConfig.getTarget(), editConfig.getMode(), editConfig.getContent());
    }

    public void add(String platform, String file, String target, String mode, String content) throws IOException {
        configProcessor.addEditConfig(platform, file, target, mode, content);
    }

    public List getAll() throws IOException {
        return configProcessor.getEditConfig(getPlatform());
    }

    private String getPlatform() {
        if (platform != null) {
            return platform.name().toLowerCase();
        } else {
            return null;
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy