Skip to content

Commit

Permalink
Merge branch 'develop' into 9.4.0-Dev
Browse files Browse the repository at this point in the history
  • Loading branch information
joshtynjala committed May 6, 2024
2 parents fc8a0b7 + f8ee4f3 commit 77088f4
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 16 deletions.
27 changes: 14 additions & 13 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
unit-test-neko-haxe3:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true

Expand Down Expand Up @@ -45,7 +45,7 @@ jobs:
haxe-version: [4.0.5, 4.1.5, 4.2.5, 4.3.1]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true

Expand Down Expand Up @@ -83,9 +83,10 @@ jobs:
matrix:
haxe-version: [4.0.5, 4.1.5, 4.2.5, 4.3.1]
# AL init fails on both windows and ubuntu
runs-on: macos-latest
# macos-14 is arm64, which setup-haxe doesn't support yet
runs-on: macos-13
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true

Expand Down Expand Up @@ -125,7 +126,7 @@ jobs:
haxe-version: [4.0.5, 4.1.5, 4.2.5, 4.3.1]
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true

Expand Down Expand Up @@ -168,7 +169,7 @@ jobs:
runs-on: ubuntu-latest
steps:

- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true

Expand All @@ -189,7 +190,7 @@ jobs:
run: |
haxe run.hxml
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: openfl-haxelib
path: |
Expand All @@ -204,7 +205,7 @@ jobs:
runs-on: ubuntu-latest
steps:

- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true

Expand All @@ -230,7 +231,7 @@ jobs:
run: |
haxe docs.hxml
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: openfl-docs
path: docs
Expand Down Expand Up @@ -258,7 +259,7 @@ jobs:
haxelib install actuate --quiet
haxelib git openfl-samples https://github.com/openfl/openfl-samples --quiet
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
name: openfl-haxelib
path: openfl-haxelib
Expand Down Expand Up @@ -305,7 +306,7 @@ jobs:
haxelib install genes --quiet
haxelib git openfl-samples https://github.com/openfl/openfl-samples --quiet
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
name: openfl-haxelib
path: openfl-haxelib
Expand Down Expand Up @@ -359,7 +360,7 @@ jobs:
haxelib install actuate --quiet
haxelib git openfl-samples https://github.com/openfl/openfl-samples --quiet
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
name: openfl-haxelib
path: openfl-haxelib
Expand Down Expand Up @@ -405,7 +406,7 @@ jobs:
haxelib install actuate --quiet
haxelib git openfl-samples https://github.com/openfl/openfl-samples --quiet
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
name: openfl-haxelib
path: openfl-haxelib
Expand Down
30 changes: 28 additions & 2 deletions src/openfl/net/FileReference.hx
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,8 @@ class FileReference extends EventDispatcher
@:noCompletion private var __urlLoader:URLLoader;
#if (js && html5)
@:noCompletion private var __inputControl:InputElement;
@:noCompletion private var __pendingDownload:Bool = false;
@:noCompletion private var __pendingDefaultFileName:Null<String>;
#end

/**
Expand Down Expand Up @@ -859,6 +861,11 @@ class FileReference extends EventDispatcher
saveFileDialog.onSelect.add(saveFileDialog_onSelect);
saveFileDialog.browse(SAVE, defaultFileName != null ? Path.extension(defaultFileName) : null, defaultFileName);
#end

#if(js && html5)
__pendingDownload = true;
__pendingDefaultFileName = defaultFileName;
#end
}

/**
Expand Down Expand Up @@ -1501,7 +1508,6 @@ class FileReference extends EventDispatcher

@:noCompletion private function urlLoader_download_onComplete(event:Event):Void
{
#if (desktop && sys)
if ((__urlLoader.data is ByteArrayData))
{
__data = __urlLoader.data;
Expand All @@ -1511,7 +1517,8 @@ class FileReference extends EventDispatcher
__data = new ByteArray();
__data.writeUTFBytes(Std.string(__urlLoader.data));
}


#if (desktop && sys)
if (__path != null)
{
File.saveBytes(__path, __data);
Expand All @@ -1521,6 +1528,18 @@ class FileReference extends EventDispatcher
}
#end

#if(js && html5)
#if(lime && !macro)
if(__pendingDownload){
//Maybe just use an achor element and save the data as a blob with js instead of invoking lime?
var saveFileDialog = new FileDialog();
saveFileDialog.save(__data, __pendingDefaultFileName != null ? Path.extension(__pendingDefaultFileName) : null, __pendingDefaultFileName);
__pendingDownload = false;
__pendingDefaultFileName = null;
}
#end
#end

dispatchEvent(event);
}

Expand Down Expand Up @@ -1552,6 +1571,13 @@ class FileReference extends EventDispatcher

@:noCompletion private function urlLoader_onIOError(event:IOErrorEvent):Void
{
#if(js && html5)
if(__pendingDownload){
__pendingDownload = false;
__pendingDefaultFileName = null;
}
#end

dispatchEvent(event);
}

Expand Down
3 changes: 2 additions & 1 deletion src/openfl/net/Socket.hx
Original file line number Diff line number Diff line change
Expand Up @@ -1180,7 +1180,8 @@ class Socket extends EventDispatcher implements IDataInput implements IDataOutpu
}
catch (e:Eof)
{
// ignore
//We used to ignore this, but I'm not sure why. There may be an edge case where this causes the socket to prematurely close or become unusable.
doClose = true;
}
catch (e:Error)
{
Expand Down

0 comments on commit 77088f4

Please sign in to comment.