diff --git a/Changelog.md b/Changelog.md
index c3c3942..012d0c3 100644
--- a/Changelog.md
+++ b/Changelog.md
@@ -1,2 +1,10 @@
-- Initial Code Commit For CoManga [2019.03.05]
-- Added download location for UWP [2019.03.11]
+- Initial Code Commit For CoManga. [2019.03.05]
+- Added download location for UWP. [2019.03.11]
+- UWP download location fixed. [2019.03.24]
+- BadgeLogo fixed. [2019.03.24]
+- Added references for Ads in UWP project. (Doesn't work tho). [2019.03.24]
+
+Know Issues :
+Setting up AdControlView in UWP throws `System.InvalidOperationException: 'Cannot assign a native control without an Element; Renderer unbound and/or disposed. Please consult Xamarin.Forms renderers for reference implementation of OnElementChanged.'`.
+
+Need to fix that.
\ No newline at end of file
diff --git a/README.md b/README.md
index ab77e1b..3eba9c8 100644
--- a/README.md
+++ b/README.md
@@ -59,8 +59,7 @@ If you're on iOS, then you're compiling the project and the files will be stored
You should get your downloaded items there.
#### UWP
-Getting the permissions is a little tricky in UWP. I've literally tried a lot of different things and couldn't get it to work. So, you'll have to work hard to get these downloaded files. You can find them in this location :
-`C:\Users\{Your User Name}\AppData\Local\Packages\8c5bdaa1-7509-4aca-bd99-321c57de3c9f_0b312jg1at2fy\LocalState\CoManga`
+You can find your downloaded content in the `"Downloads"` folder undeder the folder named "CoManga".
# Why Is It Not On Application Stores?
diff --git a/docs/changelog.rst b/docs/changelog.rst
index c3c3942..2e32b87 100644
--- a/docs/changelog.rst
+++ b/docs/changelog.rst
@@ -1,2 +1,12 @@
- Initial Code Commit For CoManga [2019.03.05]
- Added download location for UWP [2019.03.11]
+- Initial Code Commit For CoManga. [2019.03.05]
+- Added download location for UWP. [2019.03.11]
+- UWP download location fixed. [2019.03.24]
+- BadgeLogo fixed. [2019.03.24]
+- Added references for Ads in UWP project. (Doesn't work tho). [2019.03.24]
+
+Know Issues :
+Setting up AdControlView in UWP throws `System.InvalidOperationException: 'Cannot assign a native control without an Element; Renderer unbound and/or disposed. Please consult Xamarin.Forms renderers for reference implementation of OnElementChanged.'`.
+
+Need to fix that.
\ No newline at end of file
diff --git a/docs/index.rst b/docs/index.rst
index 8832112..35977d9 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -94,10 +94,7 @@ You should get your downloaded items there.
UWP
^^^
-Getting the permissions is a little tricky in UWP. I've literally tried
-a lot of different things and couldn't get it to work. So, you'll have
-to work hard to get these downloaded files. You can find them in this
-location : ``C:\Users\{Your User Name}\AppData\Local\Packages\8c5bdaa1-7509-4aca-bd99-321c57de3c9f_0b312jg1at2fy\LocalState\CoManga``
+You can find your downloaded content in the `"Downloads"` folder undeder the folder named "CoManga".
Why Is It Not On Application Stores?
====================================
diff --git a/src/comic_dl/comic_dl.Android/comic_dl.Android.csproj b/src/comic_dl/comic_dl.Android/comic_dl.Android.csproj
index f1ccc4f..ff7b51e 100644
--- a/src/comic_dl/comic_dl.Android/comic_dl.Android.csproj
+++ b/src/comic_dl/comic_dl.Android/comic_dl.Android.csproj
@@ -65,6 +65,9 @@
1.9.1
+
+ 10.1705.16001
+
12.0.1
diff --git a/src/comic_dl/comic_dl.Android/comic_dl.Android.csproj.user b/src/comic_dl/comic_dl.Android/comic_dl.Android.csproj.user
index e1e5b56..b3df81b 100644
--- a/src/comic_dl/comic_dl.Android/comic_dl.Android.csproj.user
+++ b/src/comic_dl/comic_dl.Android/comic_dl.Android.csproj.user
@@ -1,7 +1,7 @@
- Xiaomi Mi A1
+ Android_Accelerated_x86_Oreo
Android_Accelerated_x86_Oreo
Theme.DeviceDefault.NoActionBar.Fullscreen
diff --git a/src/comic_dl/comic_dl.Android/dependencyServices/DirectoryHelper.cs b/src/comic_dl/comic_dl.Android/dependencyServices/DirectoryHelper.cs
index 071e74f..177a308 100644
--- a/src/comic_dl/comic_dl.Android/dependencyServices/DirectoryHelper.cs
+++ b/src/comic_dl/comic_dl.Android/dependencyServices/DirectoryHelper.cs
@@ -3,7 +3,7 @@
using System.IO;
using System.Linq;
using System.Text;
-
+using System.Threading.Tasks;
using Android.App;
using Android.Content;
using Android.OS;
@@ -53,7 +53,7 @@ public bool CheckExisingFile(string fileAddress)
return false;
}
- public bool CreateFile(string directoryName, byte[] contentToWrite)
+ public Task CreateFile(string directoryName, byte[] contentToWrite)
{
var filePath = Path.Combine(documentBasePath, directoryName);
if (!File.Exists(filePath))
@@ -61,14 +61,14 @@ public bool CreateFile(string directoryName, byte[] contentToWrite)
try
{
File.WriteAllBytes(directoryName, contentToWrite);
- return true;
+ return Task.FromResult(true);
}
catch (Exception)
{
- return false;
+ return Task.FromResult(false);
}
}
- return false;
+ return Task.FromResult(false);
}
}
}
\ No newline at end of file
diff --git a/src/comic_dl/comic_dl.UWP/Assets/BadgeLogo.scale-100.png b/src/comic_dl/comic_dl.UWP/Assets/BadgeLogo.scale-100.png
index d4364e4..210ad39 100644
Binary files a/src/comic_dl/comic_dl.UWP/Assets/BadgeLogo.scale-100.png and b/src/comic_dl/comic_dl.UWP/Assets/BadgeLogo.scale-100.png differ
diff --git a/src/comic_dl/comic_dl.UWP/Assets/BadgeLogo.scale-125.png b/src/comic_dl/comic_dl.UWP/Assets/BadgeLogo.scale-125.png
index 3146a25..a8b4e15 100644
Binary files a/src/comic_dl/comic_dl.UWP/Assets/BadgeLogo.scale-125.png and b/src/comic_dl/comic_dl.UWP/Assets/BadgeLogo.scale-125.png differ
diff --git a/src/comic_dl/comic_dl.UWP/Assets/BadgeLogo.scale-150.png b/src/comic_dl/comic_dl.UWP/Assets/BadgeLogo.scale-150.png
index 173bbd9..565b8c3 100644
Binary files a/src/comic_dl/comic_dl.UWP/Assets/BadgeLogo.scale-150.png and b/src/comic_dl/comic_dl.UWP/Assets/BadgeLogo.scale-150.png differ
diff --git a/src/comic_dl/comic_dl.UWP/Assets/BadgeLogo.scale-200.png b/src/comic_dl/comic_dl.UWP/Assets/BadgeLogo.scale-200.png
index 18e3523..42bdfa1 100644
Binary files a/src/comic_dl/comic_dl.UWP/Assets/BadgeLogo.scale-200.png and b/src/comic_dl/comic_dl.UWP/Assets/BadgeLogo.scale-200.png differ
diff --git a/src/comic_dl/comic_dl.UWP/Assets/BadgeLogo.scale-400.png b/src/comic_dl/comic_dl.UWP/Assets/BadgeLogo.scale-400.png
index 3442339..3d27605 100644
Binary files a/src/comic_dl/comic_dl.UWP/Assets/BadgeLogo.scale-400.png and b/src/comic_dl/comic_dl.UWP/Assets/BadgeLogo.scale-400.png differ
diff --git a/src/comic_dl/comic_dl.UWP/comic_dl.UWP.csproj b/src/comic_dl/comic_dl.UWP/comic_dl.UWP.csproj
index de0d02c..1b89617 100644
--- a/src/comic_dl/comic_dl.UWP/comic_dl.UWP.csproj
+++ b/src/comic_dl/comic_dl.UWP/comic_dl.UWP.csproj
@@ -99,6 +99,7 @@
App.xaml
+
@@ -189,6 +190,9 @@
1.9.1
+
+ 10.1705.16001
+
12.0.1
@@ -207,8 +211,14 @@
comic_dl
+
-
+
+ Microsoft Advertising SDK for XAML
+
+
+ Visual C++ 2015 Runtime for Universal Windows Platform Apps
+
14.0
diff --git a/src/comic_dl/comic_dl.UWP/customRenderer/AdViewRenderer.cs b/src/comic_dl/comic_dl.UWP/customRenderer/AdViewRenderer.cs
new file mode 100644
index 0000000..033e074
--- /dev/null
+++ b/src/comic_dl/comic_dl.UWP/customRenderer/AdViewRenderer.cs
@@ -0,0 +1,55 @@
+using System;
+using Xamarin.Forms;
+using Xamarin.Forms.Platform.UWP;
+using System.Linq;
+using System.Threading.Tasks;
+using Microsoft.Advertising.Ads;
+using Microsoft.Advertising.WinRT.UI;
+using Windows.System.Profile;
+
+[assembly: ExportRenderer(typeof(comic_dl.Controls.AdControlView), typeof(comic_dl.UWP.customRenderer.AdViewRenderer))]
+namespace comic_dl.UWP.customRenderer
+{
+#pragma warning disable CS0618 // Type or member is obsolete
+ public class AdViewRenderer : ViewRenderer
+ {
+ string bannerId = "1100041955";
+ AdControl adView;
+ string applicationID = "9n81f8b5ww93";
+ void CreateNativeAdControl()
+ {
+ if (adView != null)
+ return;
+
+ var width = 300;
+ var height = 50;
+ if (AnalyticsInfo.VersionInfo.DeviceFamily == "Windows.Desktop")
+ {
+ width = 728;
+ height = 90;
+ }
+ // Setup your BannerView, review AdSizeCons class for more Ad sizes.
+ adView = new AdControl
+ {
+ ApplicationId = applicationID,
+ AdUnitId = bannerId,
+ HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Center,
+ VerticalAlignment = Windows.UI.Xaml.VerticalAlignment.Bottom,
+ Height = height,
+ Width = width
+ };
+
+ }
+
+ protected override void OnElementChanged(ElementChangedEventArgs e)
+ {
+ base.OnElementChanged(e);
+ if (Control == null)
+ {
+ CreateNativeAdControl();
+ //SetNativeControl(adView);
+ }
+ }
+ }
+#pragma warning restore CS0618 // Type or member is obsolete
+}
diff --git a/src/comic_dl/comic_dl.UWP/dependencyServices/DirectoryHelper.cs b/src/comic_dl/comic_dl.UWP/dependencyServices/DirectoryHelper.cs
index a9681f3..a4ccbf3 100644
--- a/src/comic_dl/comic_dl.UWP/dependencyServices/DirectoryHelper.cs
+++ b/src/comic_dl/comic_dl.UWP/dependencyServices/DirectoryHelper.cs
@@ -6,6 +6,7 @@
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using Windows.Storage;
using Xamarin.Forms;
[assembly: Dependency(typeof(DirectoryHelper))]
@@ -48,23 +49,39 @@ public bool CheckExisingFile(string fileAddress)
return false;
}
- public bool CreateFile(string directoryName, byte[] contentToWrite)
+ public async Task CreateFile(string directoryName, byte[] contentToWrite)
{
- //var filePath = Path.Combine(documentBasePath, directoryName);
- var filePath = Windows.Storage.DownloadsFolder.CreateFileAsync(directoryName);
- if (!File.Exists(Convert.ToString(filePath)))
+ List fileNames = directoryName.Split('/').ToList();
+ string downloadType = fileNames[1];
+ string comicName = fileNames[2];
+ string comicChapter = fileNames[3];
+ string comicFileName = fileNames[4];
+ StorageFile destinationFile;
+ StorageFolder downloadsFolder;
+ try
{
- try
+ downloadsFolder = await DownloadsFolder.CreateFolderAsync(downloadType + @"\" + comicName + @"\" + comicChapter + @"\");
+ string folderToken = Windows.Storage.AccessCache.StorageApplicationPermissions.FutureAccessList.Add(downloadsFolder);
+ ApplicationData.Current.LocalSettings.Values["folderToken"] = folderToken;
+ destinationFile = await downloadsFolder.CreateFileAsync(comicFileName, CreationCollisionOption.ReplaceExisting);
+
+ await Windows.Storage.FileIO.WriteBytesAsync(destinationFile, contentToWrite);
+ return true;
+ // File.WriteAllBytes(destinationFile.Path, contentToWrite);
+ }
+ catch (Exception ex)
+ {
+ if (ApplicationData.Current.LocalSettings.Values["folderToken"] != null)
{
- File.WriteAllBytes(directoryName, contentToWrite);
+ string token = ApplicationData.Current.LocalSettings.Values["folderToken"].ToString();
+ downloadsFolder = await Windows.Storage.AccessCache.StorageApplicationPermissions.FutureAccessList.GetFolderAsync(token);
+ destinationFile = await downloadsFolder.CreateFileAsync(comicFileName, CreationCollisionOption.ReplaceExisting);
+ //File.WriteAllBytes(destinationFile.Path, contentToWrite);
+ await Windows.Storage.FileIO.WriteBytesAsync(destinationFile, contentToWrite);
return true;
}
- catch (Exception)
- {
- return false;
- }
+ return false;
}
- return false;
}
}
}
diff --git a/src/comic_dl/comic_dl.iOS/comic_dl.iOS.csproj b/src/comic_dl/comic_dl.iOS/comic_dl.iOS.csproj
index e15e30f..946b27a 100644
--- a/src/comic_dl/comic_dl.iOS/comic_dl.iOS.csproj
+++ b/src/comic_dl/comic_dl.iOS/comic_dl.iOS.csproj
@@ -621,6 +621,9 @@
1.9.1
+
+ 10.1705.16001
+
12.0.1
@@ -643,16 +646,15 @@
-
-
-
-
-
-
+
+
+
+
+
diff --git a/src/comic_dl/comic_dl.iOS/dependencyServices/DirectoryHelper.cs b/src/comic_dl/comic_dl.iOS/dependencyServices/DirectoryHelper.cs
index db66637..bc6a955 100644
--- a/src/comic_dl/comic_dl.iOS/dependencyServices/DirectoryHelper.cs
+++ b/src/comic_dl/comic_dl.iOS/dependencyServices/DirectoryHelper.cs
@@ -8,6 +8,7 @@
using UIKit;
using Xamarin.Forms;
using comic_dl.interace;
+using System.Threading.Tasks;
[assembly: Dependency(typeof(DirectoryHelper))]
namespace comic_dl.iOS
@@ -47,7 +48,7 @@ public bool CheckExisingFile(string fileAddress)
return false;
}
- public bool CreateFile(string directoryName, byte[] contentToWrite)
+ public Task CreateFile(string directoryName, byte[] contentToWrite)
{
var filePath = documentBasePath + directoryName;
if (!File.Exists(filePath))
@@ -55,14 +56,14 @@ public bool CreateFile(string directoryName, byte[] contentToWrite)
try
{
File.WriteAllBytes(directoryName, contentToWrite);
- return true;
+ return Task.FromResult(true);
}
catch (Exception)
{
- return false;
+ return Task.FromResult(false);
}
}
- return false;
+ return Task.FromResult(false);
}
}
}
\ No newline at end of file
diff --git a/src/comic_dl/comic_dl/_comic/downloader/ComicDownloader.cs b/src/comic_dl/comic_dl/_comic/downloader/ComicDownloader.cs
index 1d1fcd0..c17b5f1 100644
--- a/src/comic_dl/comic_dl/_comic/downloader/ComicDownloader.cs
+++ b/src/comic_dl/comic_dl/_comic/downloader/ComicDownloader.cs
@@ -55,7 +55,7 @@ public async Task FilesDownloader(List listOfUrl, string comicName
if (contents == null) // If there's nothing, just move onto the next loop.
continue;
- bool isFileDownloaded = DependencyService.Get().CreateFile(filePath, contents);
+ bool isFileDownloaded = await DependencyService.Get().CreateFile(filePath, contents);
if (!isFileDownloaded)
diff --git a/src/comic_dl/comic_dl/_manga/downloader/Downloader.cs b/src/comic_dl/comic_dl/_manga/downloader/Downloader.cs
index 5d1d501..274ad5c 100644
--- a/src/comic_dl/comic_dl/_manga/downloader/Downloader.cs
+++ b/src/comic_dl/comic_dl/_manga/downloader/Downloader.cs
@@ -53,7 +53,7 @@ public async Task FilesDownloader(List listOfUrl, string mangaName
if (contents == null) // If there's nothing, just move onto the next loop.
continue;
- bool isFileDownloaded = DependencyService.Get().CreateFile(filePath, contents);
+ bool isFileDownloaded = await DependencyService.Get().CreateFile(filePath, contents);
if (!isFileDownloaded)
diff --git a/src/comic_dl/comic_dl/comic_dl.csproj b/src/comic_dl/comic_dl/comic_dl.csproj
index 6e12c8b..f111093 100644
--- a/src/comic_dl/comic_dl/comic_dl.csproj
+++ b/src/comic_dl/comic_dl/comic_dl.csproj
@@ -10,6 +10,7 @@
+
diff --git a/src/comic_dl/comic_dl/interace/IDirectory.cs b/src/comic_dl/comic_dl/interace/IDirectory.cs
index 7e4778b..70d4708 100644
--- a/src/comic_dl/comic_dl/interace/IDirectory.cs
+++ b/src/comic_dl/comic_dl/interace/IDirectory.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Text;
+using System.Threading.Tasks;
namespace comic_dl.interace
{
@@ -9,6 +10,6 @@ public interface IDirectory
string GetBasePath();
string CreateDirectory(string directoryName);
bool CheckExisingFile(string filePath);
- bool CreateFile(string directoryName, byte[] contentToWrite);
+ Task CreateFile(string directoryName, byte[] contentToWrite);
}
}