Skip to content
This repository has been archived by the owner on Apr 29, 2024. It is now read-only.

Commit

Permalink
[background] update delegate implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
conceptdev committed Jan 2, 2020
1 parent 150f0e6 commit e4158ec
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,16 @@ public UIImageView ImageView {
}
}

public class UrlSessionDelegate : NSUrlSessionDownloadDelegate
{
public class UrlSessionDelegate : NSObject, INSUrlSessionDownloadDelegate
{
public SimpleBackgroundTransferViewController controller;

public UrlSessionDelegate (SimpleBackgroundTransferViewController controller)
{
this.controller = controller;
}

public override void DidWriteData (NSUrlSession session, NSUrlSessionDownloadTask downloadTask, long bytesWritten, long totalBytesWritten, long totalBytesExpectedToWrite)
public void DidWriteData (NSUrlSession session, NSUrlSessionDownloadTask downloadTask, long bytesWritten, long totalBytesWritten, long totalBytesExpectedToWrite)
{
Console.WriteLine ("Set Progress");
if (downloadTask == controller.downloadTask) {
Expand All @@ -91,7 +91,7 @@ public override void DidWriteData (NSUrlSession session, NSUrlSessionDownloadTas
}
}

public override void DidFinishDownloading (NSUrlSession session, NSUrlSessionDownloadTask downloadTask, NSUrl location)
public void DidFinishDownloading (NSUrlSession session, NSUrlSessionDownloadTask downloadTask, NSUrl location)
{
Console.WriteLine ("Finished");
Console.WriteLine ("File downloaded in : {0}", location);
Expand Down Expand Up @@ -121,7 +121,7 @@ public override void DidFinishDownloading (NSUrlSession session, NSUrlSessionDow
}
}

public override void DidCompleteWithError (NSUrlSession session, NSUrlSessionTask task, NSError error)
public void DidCompleteWithError (NSUrlSession session, NSUrlSessionTask task, NSError error)
{
Console.WriteLine ("DidComplete");
if (error == null)
Expand All @@ -137,12 +137,12 @@ public override void DidCompleteWithError (NSUrlSession session, NSUrlSessionTas
controller.downloadTask = null;
}

public override void DidResume (NSUrlSession session, NSUrlSessionDownloadTask downloadTask, long resumeFileOffset, long expectedTotalBytes)
public void DidResume (NSUrlSession session, NSUrlSessionDownloadTask downloadTask, long resumeFileOffset, long expectedTotalBytes)
{
Console.WriteLine ("DidResume");
}

public override void DidFinishEventsForBackgroundSession (NSUrlSession session)
public void DidFinishEventsForBackgroundSession (NSUrlSession session)
{
using (AppDelegate appDelegate = UIApplication.SharedApplication.Delegate as AppDelegate) {
var handler = appDelegate.BackgroundSessionCompletionHandler;
Expand Down

0 comments on commit e4158ec

Please sign in to comment.