Skip to content

Commit

Permalink
Potential fix for IllegalStateException on Android
Browse files Browse the repository at this point in the history
  • Loading branch information
yasirkula committed Nov 14, 2023
1 parent 5b0c08e commit c84d108
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ public static void RequestPermission( Context context, final FileBrowserPermissi
}

final Fragment request = new FileBrowserPermissionFragment( permissionReceiver );
( (Activity) context ).getFragmentManager().beginTransaction().add( 0, request ).commit();
( (Activity) context ).getFragmentManager().beginTransaction().add( 0, request ).commitAllowingStateLoss();
}

// Returns whether or not Storage Access Framework (SAF) should be used
Expand All @@ -199,7 +199,7 @@ public static boolean CheckSAF()
public static void PickSAFFolder( Context context, final FileBrowserDirectoryReceiver directoryReceiver )
{
final Fragment request = new FileBrowserDirectoryPickerFragment( directoryReceiver );
( (Activity) context ).getFragmentManager().beginTransaction().add( 0, request ).commit();
( (Activity) context ).getFragmentManager().beginTransaction().add( 0, request ).commitAllowingStateLoss();
}

// Retrieves the previously picked Storage Access Framework (SAF) folder uris
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,6 @@ public void onActivityResult( int requestCode, int resultCode, Intent data )
if( directoryReceiver != null )
directoryReceiver.OnDirectoryPicked( rawUri, name );

getFragmentManager().beginTransaction().remove( this ).commit();
getFragmentManager().beginTransaction().remove( this ).commitAllowingStateLoss();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public void onRequestPermissionsResult( int requestCode, String[] permissions, i
{
Log.e( "Unity", "Fragment data got reset while asking permissions!" );

getFragmentManager().beginTransaction().remove( this ).commit();
getFragmentManager().beginTransaction().remove( this ).commitAllowingStateLoss();
return;
}

Expand Down Expand Up @@ -102,7 +102,7 @@ public void onRequestPermissionsResult( int requestCode, String[] permissions, i
}

permissionReceiver.OnPermissionResult( result );
getFragmentManager().beginTransaction().remove( this ).commit();
getFragmentManager().beginTransaction().remove( this ).commitAllowingStateLoss();

// Resolves a bug in Unity 2019 where the calling activity
// doesn't resume automatically after the fragment finishes
Expand Down
Binary file modified Plugins/SimpleFileBrowser/Android/SimpleFileBrowser.aar
Binary file not shown.
2 changes: 1 addition & 1 deletion Plugins/SimpleFileBrowser/README.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
= Simple File Browser (v1.6.3) =
= Simple File Browser (v1.6.4) =

Documentation: https://github.com/yasirkula/UnitySimpleFileBrowser
FAQ: https://github.com/yasirkula/UnitySimpleFileBrowser#faq
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.simplefilebrowser",
"displayName": "Simple File Browser",
"version": "1.6.3",
"version": "1.6.4",
"documentationUrl": "https://github.com/yasirkula/UnitySimpleFileBrowser",
"changelogUrl": "https://github.com/yasirkula/UnitySimpleFileBrowser/releases",
"licensesUrl": "https://github.com/yasirkula/UnitySimpleFileBrowser/blob/master/LICENSE.txt",
Expand Down

0 comments on commit c84d108

Please sign in to comment.