Skip to content

Commit

Permalink
- Bugfix for LoadImageAtPathAsync and GetVideoThumbnailAsync
Browse files Browse the repository at this point in the history
- Closed #274
  • Loading branch information
yasirkula committed Mar 24, 2023
1 parent 46eb0de commit 8ccd3b6
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public void run()
if( resultOperation.finished )
{
resultOperation.sendResultToUnity();
dismiss();
dismissAllowingStateLoss();
}
else
{
Expand Down Expand Up @@ -132,7 +132,7 @@ public void onClick( DialogInterface dialog, int which )
resultOperation.cancel();
resultOperation.sendResultToUnity();

dismiss();
dismissAllowingStateLoss();
}
} )
.setCancelable( false )
Expand Down
Binary file modified Plugins/NativeGallery/Android/NativeGallery.aar
Binary file not shown.
12 changes: 8 additions & 4 deletions Plugins/NativeGallery/NativeGallery.cs
Original file line number Diff line number Diff line change
Expand Up @@ -806,9 +806,11 @@ public static async Task<Texture2D> LoadImageAtPathAsync( string imagePath, int
maxSize = SystemInfo.maxTextureSize;

#if !UNITY_EDITOR && UNITY_ANDROID
string loadPath = await TryCallNativeAndroidFunctionOnSeparateThread( () => AJC.CallStatic<string>( "LoadImageAtPath", Context, imagePath, TemporaryImagePath, maxSize ) );
string temporaryImagePath = TemporaryImagePath; // Must be accessed from main thread
string loadPath = await TryCallNativeAndroidFunctionOnSeparateThread( () => AJC.CallStatic<string>( "LoadImageAtPath", Context, imagePath, temporaryImagePath, maxSize ) );
#elif !UNITY_EDITOR && UNITY_IOS
string loadPath = await Task.Run( () => _NativeGallery_LoadImageAtPath( imagePath, TemporaryImagePath, maxSize ) );
string temporaryImagePath = TemporaryImagePath; // Must be accessed from main thread
string loadPath = await Task.Run( () => _NativeGallery_LoadImageAtPath( imagePath, temporaryImagePath, maxSize ) );
#else
string loadPath = imagePath;
#endif
Expand Down Expand Up @@ -941,9 +943,11 @@ public static async Task<Texture2D> GetVideoThumbnailAsync( string videoPath, in
maxSize = SystemInfo.maxTextureSize;

#if !UNITY_EDITOR && UNITY_ANDROID
string thumbnailPath = await TryCallNativeAndroidFunctionOnSeparateThread( () => AJC.CallStatic<string>( "GetVideoThumbnail", Context, videoPath, TemporaryImagePath + ".png", false, maxSize, captureTimeInSeconds ) );
string temporaryImagePath = TemporaryImagePath; // Must be accessed from main thread
string thumbnailPath = await TryCallNativeAndroidFunctionOnSeparateThread( () => AJC.CallStatic<string>( "GetVideoThumbnail", Context, videoPath, temporaryImagePath + ".png", false, maxSize, captureTimeInSeconds ) );
#elif !UNITY_EDITOR && UNITY_IOS
string thumbnailPath = await Task.Run( () => _NativeGallery_GetVideoThumbnail( videoPath, TemporaryImagePath + ".png", maxSize, captureTimeInSeconds ) );
string temporaryImagePath = TemporaryImagePath; // Must be accessed from main thread
string thumbnailPath = await Task.Run( () => _NativeGallery_GetVideoThumbnail( videoPath, temporaryImagePath + ".png", maxSize, captureTimeInSeconds ) );
#else
string thumbnailPath = null;
#endif
Expand Down
2 changes: 1 addition & 1 deletion Plugins/NativeGallery/README.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
= Native Gallery for Android & iOS (v1.7.1) =
= Native Gallery for Android & iOS (v1.7.2) =

Online documentation & example code available at: https://github.com/yasirkula/UnityNativeGallery
E-mail: [email protected]
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "com.yasirkula.nativegallery",
"displayName": "Native Gallery",
"version": "1.7.1",
"version": "1.7.2",
"documentationUrl": "https://github.com/yasirkula/UnityNativeGallery",
"changelogUrl": "https://github.com/yasirkula/UnityNativeGallery/releases",
"licensesUrl": "https://github.com/yasirkula/UnityNativeGallery/blob/master/LICENSE.txt",
Expand Down

0 comments on commit 8ccd3b6

Please sign in to comment.