internal static uint AddMessageCallback(IMessageHandlerScheduler scheduler, Action <string> messageCallback)
        {
            if (!_initialized)
            {
                PInvoke.AppleAuth_IOS_SetupNativeMessageHandlerCallback(NativeMessageHandlerCallback);
                _initialized = true;
            }

            if (messageCallback == null)
            {
                throw new Exception("Can't add a null Message Callback.");
            }

            var usedCallbackId = _callbackId;

            _callbackId += 1;
            if (CallbackDictionary.ContainsKey(usedCallbackId))
            {
                throw new Exception("A Message Callback with the same ID " + usedCallbackId + " already exists.");
            }

            var callbackEntry = new MessageCallbackEntry(messageCallback, scheduler);

            CallbackDictionary.Add(usedCallbackId, callbackEntry);
            return(usedCallbackId);
        }
        public AppleAuthManager(IPayloadDeserializer payloadDeserializer, IMessageHandlerScheduler scheduler)
        {
#if UNITY_IOS && !UNITY_EDITOR
            this._payloadDeserializer = payloadDeserializer;
            this._scheduler           = scheduler;
#endif
        }
Exemplo n.º 3
0
        internal static uint AddMessageCallback(IMessageHandlerScheduler scheduler, bool isSingleUse, Action <string> messageCallback)
        {
            if (!_initialized)
            {
                PInvoke.AppleAuth_IOS_SetupNativeMessageHandlerCallback(NativeMessageHandlerCallback);
                _initialized = true;
            }

            if (messageCallback == null)
            {
                throw new Exception("Can't add a null Message Callback.");
            }

            var usedCallbackId = _callbackId;

            _callbackId += 1;
            if (_callbackId >= MaxCallbackId)
            {
                _callbackId = InitialCallbackId;
            }

            var callbackEntry = new MessageCallbackEntry(messageCallback, scheduler, isSingleUse);

            CallbackDictionary.Add(usedCallbackId, callbackEntry);
            return(usedCallbackId);
        }
 public MessageCallbackEntry(Action <string> messageCallback, IMessageHandlerScheduler scheduler)
 {
     this.MessageCallback = messageCallback;
     this.Scheduler       = scheduler;
 }
Exemplo n.º 5
0
 public MessageCallbackEntry(Action <string> messageCallback, IMessageHandlerScheduler scheduler, bool isSingleUseCallback)
 {
     this.MessageCallback     = messageCallback;
     this.Scheduler           = scheduler;
     this.IsSingleUseCallback = isSingleUseCallback;
 }