Skip to content

Storage can't download more than one file at a time #3

@Ryxali

Description

@Ryxali

The event listener is defined as follows:

/* This listener is used in pair with GetSharedFileIDFromUser. 
We ask backends for user data to retrieve sharedFileID */
public class SpecificUserDataListener : GlobalSpecificUserDataListener
{
	public ulong sharedFileID = 0;
	private Storage storage = GalaxyManager.Instance.Storage;

	public override void OnSpecificUserDataUpdated(GalaxyID userID)
	{
		Debug.Log("User " + userID + " data received");
		storage.DownloadSharedFile(sharedFileID);
	}

}

And is used like this

/* Downloads a file share */
public void DownloadSharedFileFromUser(GalaxyID userID, string fileName)
{
	specificUserDataListener.sharedFileID = GetSharedFileIDFromUser(userID, fileName);
	try
	{
		GalaxyInstance.User().RequestUserData(userID);
	}
	catch (GalaxyInstance.Error e)
	{
		Debug.Log("Could not request user data for reason " + e);
	}
}

Given that there is only a single instance of the listener and the sharedFileId it's searching for is set with each new request, this means the listener can only listen for and therefore download a single item at a time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions