package org.wikimedia.commons.campaigns;

import android.net.Uri;
import org.wikimedia.commons.contributions.Contribution;

import java.util.ArrayList;
import java.util.Date;

public class CampaignContribution extends Contribution {
    private Campaign campaign;

    private ArrayList<String> fieldValues;


    public CampaignContribution(Uri localUri, String remoteUri, String filename, String description, long dataLength, Date dateCreated, Date dateUploaded, String creator, String editSummary, Campaign campaign) {
        super(localUri, remoteUri, filename, description, dataLength, dateCreated, dateUploaded, creator, editSummary);
        this.campaign = campaign;
    }

    public Campaign getCampaign() {
        return campaign;
    }

    public void setCampaign(Campaign campaign) {
        this.campaign = campaign;
    }

    @Override
    public String getTrackingTemplates() {
        StringBuffer buffer = new StringBuffer();
        if(campaign.getAutoAddWikitext() != null) {
            buffer.append(campaign.getAutoAddWikitext()).append("\n");
        }
        if(campaign.getAutoAddCategories() != null && campaign.getAutoAddCategories().size() != 0) {
            for(String cat : campaign.getAutoAddCategories()) {
                buffer.append("[[Category:").append(cat).append("]]").append("\n");
            }
        } else {
            buffer.append("{{subst:unc}}\n");
        }
        return buffer.toString();
    }

    @Override
    public String getDescription() {
        return super.getDescription();
    }
}

@@ -1402,32 +1402,122 @@
 %5Cn%22);%0A        %7D%0A
+        buffer.append(%22%5B%5BCategory:%22).append(campaign.getTrackingCategory()).append(%22%5Cn%22);%0A
         return b

Add tracking category when uploading with a Campaign