Example #1
0
    /// <summary>
    /// The external storage permission is one way - we cannot remove it, since
    /// it might be there legitimately.
    /// </summary>
    public XDocument merge(XDocument manifest, BillingPlatform platform, bool sandbox)
    {
        switch (platform)
        {
        case BillingPlatform.GooglePlay:
            addElements(manifest, GOOGLE_PLAY_ELEMENTS);
            addElements(manifest, COMMON_ELEMENTS);
            // Old billing service v2 elements.
            removeElements(manifest, ELEMENT_GOOGLEPLAY_BILLING_RECEIVER);
            removeElements(manifest, ELEMENT_GOOGLEPLAY_BILLING_SERVICE);
            removeElements(manifest, AMAZON_ELEMENTS);
            removeElements(manifest, SAMSUNG_APPS_ELEMENTS);
            break;

        case BillingPlatform.AmazonAppstore:
            addElements(manifest, AMAZON_ELEMENTS);
            addElements(manifest, COMMON_ELEMENTS);
            if (sandbox)
            {
                addElements(manifest, ELEMENT_WRITE_EXTERNAL);
            }
            removeElements(manifest, GOOGLE_PLAY_ELEMENTS);
            removeElements(manifest, SAMSUNG_APPS_ELEMENTS);
            break;

        case BillingPlatform.SamsungApps:
            addElements(manifest, SAMSUNG_APPS_ELEMENTS);
            removeElements(manifest, GOOGLE_PLAY_ELEMENTS);
            removeElements(manifest, AMAZON_ELEMENTS);
            break;
        }
        return(manifest);
    }
 /// <summary>
 /// The external storage permission is one way - we cannot remove it, since
 /// it might be there legitimately.
 /// </summary>
 public XDocument merge(XDocument manifest, BillingPlatform platform, bool sandbox)
 {
     switch (platform) {
     case BillingPlatform.GooglePlay:
         addElements (manifest, GOOGLE_PLAY_ELEMENTS);
         addElements (manifest, COMMON_ELEMENTS);
         // Old billing service v2 elements.
         removeElements (manifest, ELEMENT_GOOGLEPLAY_BILLING_RECEIVER);
         removeElements (manifest, ELEMENT_GOOGLEPLAY_BILLING_SERVICE);
         removeElements (manifest, AMAZON_ELEMENTS);
         removeElements (manifest, SAMSUNG_APPS_ELEMENTS);
         break;
     case BillingPlatform.AmazonAppstore:
         addElements (manifest, AMAZON_ELEMENTS);
         addElements (manifest, COMMON_ELEMENTS);
         if (sandbox) {
             addElements (manifest, ELEMENT_WRITE_EXTERNAL);
         }
         removeElements (manifest, GOOGLE_PLAY_ELEMENTS);
         removeElements (manifest, SAMSUNG_APPS_ELEMENTS);
         break;
     case BillingPlatform.SamsungApps:
         addElements (manifest, SAMSUNG_APPS_ELEMENTS);
         removeElements (manifest, GOOGLE_PLAY_ELEMENTS);
         removeElements (manifest, AMAZON_ELEMENTS);
         break;
     }
     return manifest;
 }
Example #3
0
        public string serialisePurchasable(PurchasableItem item, BillingPlatform platform)
        {
            string screenshotPath = item.platformBundles[BillingPlatform.AppleAppStore].get <string>("screenshotPath");

            if (!string.IsNullOrEmpty(screenshotPath))
            {
                string assetPath = util.guidToAssetPath((string)screenshotPath);
                if (!string.IsNullOrEmpty(assetPath))
                {
                    screenshotPath = new FileInfo(assetPath).FullName;
                }
            }
            var records = new string[] {
                platform == BillingPlatform.AppleAppStore ? config.iOSSKU : config.macAppStoreSKU,
                item.LocalIds[platform],
                item.name, // This is the 'reference' field that is used to refer to the product within iTunes connect.
                item.PurchaseType == PurchaseType.Consumable ? "Consumable" : "Non-Consumable",
                "yes",
                item.platformBundles[BillingPlatform.AppleAppStore].getString("appleAppStorePriceTier"),
                item.name,
                item.description,
                screenshotPath,
            };

            return(string.Join("\t", records));
        }
Example #4
0
 public DefaultPlatformEditor(PurchasableItem item, BillingPlatform platform)
 {
     this.platform = platform;
     this.item     = item;
     this.localId  = item.LocalIds[platform];
     overridden    = localId != item.Id;
 }
 public void initialiseForPlatform(BillingPlatform platform)
 {
     genericToPlatformSpecificIds = new Dictionary<string, string>();
     platformSpecificToGenericIds = new Dictionary<string, string>();
     foreach (PurchasableItem item in db.inventory) {
         genericToPlatformSpecificIds.Add(item.Id, item.LocalId);
         platformSpecificToGenericIds.Add(item.LocalId, item.Id);
     }
 }
Example #6
0
 public void initialiseForPlatform(BillingPlatform platform)
 {
     genericToPlatformSpecificIds = new Dictionary <string, string>();
     platformSpecificToGenericIds = new Dictionary <string, string>();
     foreach (PurchasableItem item in db.inventory)
     {
         genericToPlatformSpecificIds[item.Id]      = item.LocalId;
         platformSpecificToGenericIds[item.LocalId] = item.Id;
     }
 }
 public DownloadManager(IReceiptStore receiptStore, IUtil util, IStorage storage, IURLFetcher fetcher, ILogger logger, BillingPlatform platform, string appSecret)
 {
     this.receiptStore = receiptStore;
     this.util = util;
     this.storage = storage;
     this.fetcher = fetcher;
     this.logger = logger;
     this.platform = platform;
     this.appSecret = appSecret;
     this.scheduledDownloads = deserialiseDownloads ();
     this.workQueue = new List<string> (scheduledDownloads);
     this.persistentDataPath = util.persistentDataPath;
 }
Example #8
0
        public void initialiseForPlatform (BillingPlatform platform) {
            genericToPlatformSpecificIds = new Dictionary<string, string>();
            platformSpecificToGenericIds = new Dictionary<string, string>();
            string lookingFor = string.Format("{0}.Id", platform);
            foreach (var item in parser.Parse("unibillInventory", "item")) {
                string id = item.attributes["id"];
                string mapsTo = id;
                if (item.kvps.ContainsKey(lookingFor)) {
                    mapsTo = item.kvps[lookingFor];
                }
                genericToPlatformSpecificIds[id] = mapsTo;
                platformSpecificToGenericIds[mapsTo] = id;

            }
        }
 public void writeFile(BillingPlatform platform)
 {
     string directory = Path.Combine (util.getAssetsDirectoryPath (), "Plugins/unibill/generated/storekit");
     if (!Directory.Exists (directory)) {
         Directory.CreateDirectory(directory);
     }
     string path = Path.Combine (directory, string.Format("{0}.MassImportTemplate.txt", platform));
     using (StreamWriter writer = new StreamWriter(path, false)) {
         writer.WriteLine (getHeaderLine ());
         foreach (PurchasableItem item in config.AllPurchasableItems) {
             if (PurchaseType.Subscription != item.PurchaseType) {
                 writer.WriteLine(serialisePurchasable(item, platform));
             }
         }
     }
 }
Example #10
0
        public DownloadManager(IReceiptStore receiptStore, IUtil util, IStorage storage, IURLFetcher fetcher, ILogger logger, BillingPlatform platform, string appSecret)
        {
            this.receiptStore       = receiptStore;
            this.util               = util;
            this.storage            = storage;
            this.fetcher            = fetcher;
            this.logger             = logger;
            this.platform           = platform;
            this.appSecret          = appSecret;
            this.scheduledDownloads = deserialiseDownloads();
            this.persistentDataPath = util.persistentDataPath;
            Thread t = new Thread(DownloadFlusher);

            t.IsBackground = true;
            t.Start();
        }
Example #11
0
        public void writeFile(BillingPlatform platform)
        {
            string directory = Path.Combine(util.getAssetsDirectoryPath(), "Plugins/unibill/generated/storekit");

            if (!Directory.Exists(directory))
            {
                Directory.CreateDirectory(directory);
            }
            string path = Path.Combine(directory, string.Format("{0}.MassImportTemplate.txt", platform));

            using (StreamWriter writer = new StreamWriter(path, false)) {
                writer.WriteLine(getHeaderLine());
                foreach (PurchasableItem item in config.AllPurchasableItems)
                {
                    if (PurchaseType.Subscription != item.PurchaseType)
                    {
                        writer.WriteLine(serialisePurchasable(item, platform));
                    }
                }
            }
        }
        public string serialisePurchasable(PurchasableItem item, BillingPlatform platform)
        {
            string screenshotPath = item.platformBundles[BillingPlatform.AppleAppStore].get<string>("screenshotPath");
            if (!string.IsNullOrEmpty (screenshotPath)) {
                string assetPath = util.guidToAssetPath((string)screenshotPath);
                if (!string.IsNullOrEmpty(assetPath)) {
                    screenshotPath = new FileInfo(assetPath).FullName;
                }
            }
            var records = new string[] {
                platform == BillingPlatform.AppleAppStore ? config.iOSSKU : config.macAppStoreSKU,
                item.LocalIds[platform],
                item.LocalIds[platform], // This is the 'reference' field that is used to refer to the product within iTunes connect.
                item.PurchaseType == PurchaseType.Consumable ? "Consumable" : "Non-Consumable",
                "yes",
                item.platformBundles[BillingPlatform.AppleAppStore].getString("appleAppStorePriceTier"),
                item.name,
                item.description,
                screenshotPath,
            };

            return string.Join("\t", records);
        }
Example #13
0
 /// <summary>
 /// The external storage permission is one way - we cannot remove it, since
 /// it might be there legitimately.
 /// </summary>
 public XDocument merge (XDocument manifest, BillingPlatform platform, bool sandbox) {
     if (platform == BillingPlatform.GooglePlay) {
         addElements(manifest, ELEMENT_GOOGLEPLAY_BILLING);
         addElements(manifest, COMMON_ELEMENTS);
         addElements(manifest, ELEMENT_GOOGLEPLAY_CUSTOM_ACTIVITY);
         removeElements(manifest, ELEMENT_GOOGLEPLAY_BILLING_RECEIVER);
         removeElements(manifest, ELEMENT_GOOGLEPLAY_BILLING_SERVICE);
         removeElements(manifest, AMAZON_ELEMENTS);
     } else if (platform == BillingPlatform.AmazonAppstore) {
         addElements(manifest, AMAZON_ELEMENTS);
         addElements(manifest, COMMON_ELEMENTS);
         removeElements(manifest, ELEMENT_GOOGLEPLAY_BILLING_RECEIVER);
         removeElements(manifest, ELEMENT_GOOGLEPLAY_BILLING_SERVICE);
         removeElements(manifest, ELEMENT_GOOGLEPLAY_BILLING);
         removeElements(manifest, ELEMENT_GOOGLEPLAY_CUSTOM_ACTIVITY);
         if (sandbox) {
             addElements(manifest, ELEMENT_WRITE_EXTERNAL);
         } else {
             removeElements(manifest, ELEMENT_WRITE_EXTERNAL);
         }
     }
     return manifest;
 }
Example #14
0
		public DefaultPlatformEditor(XElement rootItem, BillingPlatform platform) {
			this.platform = platform;
            XElement element = rootItem.XPathSelectElement(string.Format ("platforms/{0}/{0}.Id", platform));
			if (null != element) {
				overridden = true;
				id = (string) element;
			} else {
				id = (string) rootItem.Attribute("id");
			}
		}
 public AnalyticsReporter(BillingPlatform platform, IUnityAnalytics analytics)
 {
     this.platform  = platform;
     this.analytics = analytics;
 }
Example #16
0
 public PurchasableItem(string id, Dictionary <string, object> hash, BillingPlatform platform)
 {
     this.Id       = id;
     this.platform = platform;
     Deserialize(hash);
 }
Example #17
0
 public DefaultPlatformEditor(PurchasableItem item, BillingPlatform platform) {
     this.platform = platform;
     this.item = item;
     this.localId = item.LocalIds[platform];
     overridden = localId != item.Id;
 }