-
-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added async variants of RequestPermission function that don't freeze …
…the app unnecessarily
- Loading branch information
Showing
10 changed files
with
157 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#if UNITY_EDITOR || UNITY_IOS | ||
using UnityEngine; | ||
|
||
namespace NativeCameraNamespace | ||
{ | ||
public class NCPermissionCallbackiOS : MonoBehaviour | ||
{ | ||
private static NCPermissionCallbackiOS instance; | ||
private NativeCamera.PermissionCallback callback; | ||
|
||
public static void Initialize( NativeCamera.PermissionCallback callback ) | ||
{ | ||
if( instance == null ) | ||
{ | ||
instance = new GameObject( "NCPermissionCallbackiOS" ).AddComponent<NCPermissionCallbackiOS>(); | ||
DontDestroyOnLoad( instance.gameObject ); | ||
} | ||
else if( instance.callback != null ) | ||
instance.callback( NativeCamera.Permission.ShouldAsk ); | ||
|
||
instance.callback = callback; | ||
} | ||
|
||
public void OnPermissionRequested( string message ) | ||
{ | ||
NativeCamera.PermissionCallback _callback = callback; | ||
callback = null; | ||
|
||
if( _callback != null ) | ||
_callback( (NativeCamera.Permission) int.Parse( message ) ); | ||
} | ||
} | ||
} | ||
#endif |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters