NGMediaSaveCallbackiOS.cs
1022 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#if UNITY_EDITOR || UNITY_IOS
using UnityEngine;
namespace NativeGalleryNamespace
{
public class NGMediaSaveCallbackiOS : MonoBehaviour
{
private static NGMediaSaveCallbackiOS instance;
private NativeGallery.MediaSaveCallback callback;
public static void Initialize( NativeGallery.MediaSaveCallback callback )
{
if( instance == null )
{
instance = new GameObject( "NGMediaSaveCallbackiOS" ).AddComponent<NGMediaSaveCallbackiOS>();
DontDestroyOnLoad( instance.gameObject );
}
else if( instance.callback != null )
instance.callback( false, null );
instance.callback = callback;
}
public void OnMediaSaveCompleted( string message )
{
NativeGallery.MediaSaveCallback _callback = callback;
callback = null;
if( _callback != null )
_callback( true, null );
}
public void OnMediaSaveFailed( string error )
{
NativeGallery.MediaSaveCallback _callback = callback;
callback = null;
if( _callback != null )
_callback( false, null );
}
}
}
#endif