예제 #1
0
 public static void AppRequest(
     string message,
     OGActionType actionType,
     string objectId,
     string[] to,
     string data  = "",
     string title = "",
     FacebookDelegate callback = null)
 {
     FacebookImpl.AppRequest(message, actionType, objectId, to, null, null, null, data, title, callback);
 }
예제 #2
0
 public static void AppRequest(
     string message,
     OGActionType actionType,
     string objectId,
     List <object> filters     = null,
     string[] excludeIds       = null,
     int?maxRecipients         = null,
     string data               = "",
     string title              = "",
     FacebookDelegate callback = null)
 {
     FacebookImpl.AppRequest(message, actionType, objectId, null, filters, excludeIds, maxRecipients, data, title, callback);
 }
예제 #3
0
 public override void AppRequest(
     string message,
     OGActionType actionType,
     string objectId,
     string[] to,
     List <object> filters,
     string[] excludeIds,
     int?maxRecipients,
     string data,
     string title,
     FacebookDelegate <IAppRequestResult> callback)
 {
     FacebookLogger.Info("App Request dialog is not implemented in the Unity editor.");
 }
 public override void AppRequest(
     string message,
     OGActionType actionType,
     string objectId,
     string[] to ,
     List<object> filters,
     string[] excludeIds,
     int? maxRecipients ,
     string data,
     string title,
     FacebookDelegate<IAppRequestResult> callback)
 {
     FacebookLogger.Info("App Request dialog is not implemented in the Unity editor.");
 }
예제 #5
0
 public override void AppRequest(
     string message,
     OGActionType actionType,
     string objectId,
     string[] to               = null,
     string filters            = "",
     string[] excludeIds       = null,
     int?maxRecipients         = null,
     string data               = "",
     string title              = "",
     FacebookDelegate callback = null)
 {
     fb.AppRequest(message, actionType, objectId, to, filters, excludeIds, maxRecipients, data, title, callback);
 }
예제 #6
0
 public override void AppRequest(
     string message,
     OGActionType actionType,
     string objectId,
     string[] to               = null,
     List <object> filters     = null,
     string[] excludeIds       = null,
     int?maxRecipients         = null,
     string data               = "",
     string title              = "",
     FacebookDelegate callback = null)
 {
     throw new UnityException("There is no Facebook AppRequest on Windows Phone 8");
 }
예제 #7
0
        public override void AppRequest(
            string message,
            OGActionType actionType,
            string objectId,
            string[] to               = null,
            List <object> filters     = null,
            string[] excludeIds       = null,
            int?maxRecipients         = null,
            string data               = "",
            string title              = "",
            FacebookDelegate callback = null)
        {
            if (string.IsNullOrEmpty(message))
            {
                throw new ArgumentNullException("message", "message cannot be null or empty!");
            }

            if (actionType != null && string.IsNullOrEmpty(objectId))
            {
                throw new ArgumentNullException("objectId", "You cannot provide an actionType without an objectId");
            }

            if (actionType == null && !string.IsNullOrEmpty(objectId))
            {
                throw new ArgumentNullException("actionType", "You cannot provide an objectId without an actionType");
            }

            string mobileFilter = null;

            if (filters != null && filters.Count > 0)
            {
                mobileFilter = filters[0] as string;
            }

            iosAppRequest(
                Convert.ToInt32(AddFacebookDelegate(callback)),
                message,
                (actionType != null) ? actionType.ToString() : null,
                objectId,
                to,
                to != null ? to.Length : 0,
                mobileFilter != null ? mobileFilter : "",
                excludeIds,
                excludeIds != null ? excludeIds.Length : 0,
                maxRecipients.HasValue,
                maxRecipients.HasValue ? maxRecipients.Value : 0,
                data,
                title);
        }
예제 #8
0
        public override void AppRequest(
            string message,
            OGActionType actionType,
            string objectId,
            string[] to,
            List <object> filters,
            string[] excludeIds,
            int?maxRecipients,
            string data,
            string title,
            FacebookDelegate <IAppRequestResult> callback)
        {
            ValidateAppRequestArgs(
                message,
                actionType,
                objectId,
                to,
                filters,
                excludeIds,
                maxRecipients,
                data,
                title,
                callback
                );

            MethodArguments args = new MethodArguments();

            args.addNonNullOrEmptyParameter("message", message);
            args.addNonNullOrEmptyParameter("action_type", actionType != null ? actionType.ToString() : null);
            args.addNonNullOrEmptyParameter("object_id", objectId);
            args.addCommaSeperateListNonNull("to", to);
            if (filters != null && filters.Count > 0)
            {
                string mobileFilter = filters[0] as string;
                if (mobileFilter != null)
                {
                    args.addNonNullOrEmptyParameter("filters", mobileFilter);
                }
            }
            args.addNonNullOrEmptyParameter("max_recipients", maxRecipients);
            args.addNonNullOrEmptyParameter("data", data);
            args.addNonNullOrEmptyParameter("title", title);
            var appRequestCall = new JavaMethodCall <IAppRequestResult>(this, "AppRequest");

            appRequestCall.Callback = callback;
            appRequestCall.call(args);
        }
예제 #9
0
        public override void AppRequest(
            string message,
            OGActionType actionType,
            string objectId,
            string[] to,
            List <object> filters,
            string[] excludeIds,
            int?maxRecipients,
            string data,
            string title,
            FacebookDelegate <IAppRequestResult> callback)
        {
            ValidateAppRequestArgs(
                message,
                actionType,
                objectId,
                to,
                filters,
                excludeIds,
                maxRecipients,
                data,
                title,
                callback
                );

            string mobileFilter = null;

            if (filters != null && filters.Count > 0)
            {
                mobileFilter = filters[0] as string;
            }

            iosAppRequest(
                this.AddCallback(callback),
                message,
                (actionType != null) ? actionType.ToString() : "",
                objectId != null ? objectId : "",
                to,
                to != null ? to.Length : 0,
                mobileFilter != null ? mobileFilter : "",
                excludeIds,
                excludeIds != null ? excludeIds.Length : 0,
                maxRecipients.HasValue,
                maxRecipients.HasValue ? maxRecipients.Value : 0,
                data,
                title);
        }
예제 #10
0
        public override void AppRequest(
            string message,
            OGActionType actionType,
            string objectId,
            string[] to,
            List <object> filters,
            string[] excludeIds,
            int?maxRecipients,
            string data,
            string title,
            FacebookDelegate <IAppRequestResult> callback)
        {
            ValidateAppRequestArgs(
                message,
                actionType,
                objectId,
                to,
                filters,
                excludeIds,
                maxRecipients,
                data,
                title,
                callback
                );

            MethodArguments args = new MethodArguments();

            args.addNonNullOrEmptyParameter("message", message);
            args.addCommaSeperateListNonNull("to", to);
            args.addNonNullOrEmptyParameter("action_type", actionType != null ? actionType.ToString() : null);
            args.addNonNullOrEmptyParameter("object_id", objectId);
            args.addNonNullParameter("filters", filters);
            args.addNonNullParameter("exclude_ids", excludeIds);
            args.addNonNullOrEmptyParameter("max_recipients", maxRecipients);
            args.addNonNullOrEmptyParameter("data", data);
            args.addNonNullOrEmptyParameter("title", title);
            var call = new CanvasUIMethodCall <IResult>(this, MethodAppRequests, Constants.OnAppRequestsCompleteMethodName);

            call.call(args);
        }
예제 #11
0
    public void AppRequest(

        string message,
        OGActionType actionType,
        string objectId,
        string[] to,
        string data  = "",
        string title = "")
    {
        if (!IsLoggedIn)
        {
            Debug.LogWarning("Auth user before AppRequest, fail event generated");
            FBResult res = new FBResult("", "User isn't authed");

            FBAppRequestResult r = new FBAppRequestResult();
            r.Result = res;
            OnAppRequestCompleteAction(r);
            return;
        }

        FB.AppRequest(message, actionType, objectId, to, data, title, AppRequestCallBack);
    }
예제 #12
0
        private OGActionType?GetSelectedOGActionType()
        {
            string       str  = this.actionTypeStrings[this.selectedAction];
            OGActionType sEND = OGActionType.SEND;

            if (str == sEND.ToString())
            {
                return(0);
            }
            OGActionType aSKFOR = OGActionType.ASKFOR;

            if (str == aSKFOR.ToString())
            {
                return(1);
            }
            OGActionType tURN = OGActionType.TURN;

            if (str == tURN.ToString())
            {
                return(2);
            }
            return(null);
        }
예제 #13
0
        public override void AppRequest(
            string message,
            OGActionType actionType,
            string objectId,
            string[] to               = null,
            string filters            = "",
            string[] excludeIds       = null,
            int?maxRecipients         = null,
            string data               = "",
            string title              = "",
            FacebookDelegate callback = null)
        {
            if (string.IsNullOrEmpty(message))
            {
                throw new ArgumentNullException("message", "message cannot be null or empty!");
            }

            if (actionType != null && string.IsNullOrEmpty(objectId))
            {
                throw new ArgumentNullException("objectId", "You cannot provide an actionType without an objectId");
            }

            if (actionType == null && !string.IsNullOrEmpty(objectId))
            {
                throw new ArgumentNullException("actionType", "You cannot provide an objectId without an actionType");
            }

            var paramsDict = new Dictionary <string, object>();

            // Marshal all the above into the thing

            paramsDict["message"] = message;

            if (callback != null)
            {
                paramsDict["callback_id"] = AddFacebookDelegate(callback);
            }

            if (actionType != null && !string.IsNullOrEmpty(objectId))
            {
                paramsDict["action_type"] = actionType.ToString();
                paramsDict["object_id"]   = objectId;
            }

            if (to != null)
            {
                paramsDict["to"] = string.Join(",", to);
            }

            if (!string.IsNullOrEmpty(filters))
            {
                paramsDict["filters"] = filters;
            }

            if (maxRecipients != null)
            {
                paramsDict["max_recipients"] = maxRecipients.Value;
            }

            if (!string.IsNullOrEmpty(data))
            {
                paramsDict["data"] = data;
            }

            if (!string.IsNullOrEmpty(title))
            {
                paramsDict["title"] = title;
            }

            CallFB("AppRequest", MiniJSON.Json.Serialize(paramsDict));
        }
예제 #14
0
 public static void AppRequest(
     string message,
     OGActionType actionType,
     string objectId,
     List<object> filters = null,
     string[] excludeIds = null,
     int? maxRecipients = null,
     string data = "",
     string title = "",
     FacebookDelegate<IAppRequestResult> callback = null)
 {
     FacebookImpl.AppRequest(message, actionType, objectId, null, filters, excludeIds, maxRecipients, data, title, callback);
 }
예제 #15
0
 public static void AppRequest(
     string message,
     OGActionType actionType,
     string objectId,
     string[] to,
     string data = "",
     string title = "",
     FacebookDelegate<IAppRequestResult> callback = null)
 {
     FacebookImpl.AppRequest(message, actionType, objectId, to, null, null, null, data, title, callback);
 }
예제 #16
0
 public override void AppRequest(
     string message,
     OGActionType? actionType,
     string objectId,
     IEnumerable<string> to,
     IEnumerable<object> filters,
     IEnumerable<string> excludeIds,
     int? maxRecipients,
     string data,
     string title,
     FacebookDelegate<IAppRequestResult> callback)
 {
     this.editorWrapper.ShowAppRequestMockDialog(
         this.OnAppRequestsComplete,
         this.CallbackManager.AddFacebookDelegate(callback));
 }
예제 #17
0
    // Request object
    // Return callback(error)
    static void RequestObject(OGActionType actionType, string objectId, string name, string title, string message, Action <string> callback, params string[] recipients)
    {
#if UNITY_EDITOR
        if (callback != null)
        {
            callback("Not supported!");
        }
#else
        if (string.IsNullOrEmpty(objectId))
        {
            CreateObject(name, name, (id, error) => {
                if (!string.IsNullOrEmpty(error))
                {
                    if (callback != null)
                    {
                        callback(error);
                    }
                }
                else
                {
                    RequestObject(actionType, id, name, title, message, callback, recipients);
                }
            });

            return;
        }

        if (recipients == null)
        {
            FB.AppRequest(
                message,
                actionType,
                objectId,
                new List <object>()
            {
                "app_users"
            },
                null,
                null,
                name,
                title,
                (result) =>
            {
                if (callback != null)
                {
                    callback(result.Error);
                }
                else
                {
                    if (!string.IsNullOrEmpty(result.Error))
                    {
                        //Log.Debug(result.Error);
                    }
                    else
                    {
                        //Log.Debug(result.RawResult);
                    }
                }
            }
                );
        }
        else
        {
            FB.AppRequest(
                message,
                actionType,
                objectId,
                recipients,
                name,
                title,
                (result) => {
                if (callback != null)
                {
                    callback(result.Error);
                }
                else
                {
                    if (!string.IsNullOrEmpty(result.Error))
                    {
                        //Log.Debug(result.Error);
                    }
                    else
                    {
                        //Log.Debug(result.RawResult);
                    }
                }
            }
                );
        }
#endif
    }
        public override void AppRequest(
            string message,
            OGActionType? actionType,
            string objectId,
            IEnumerable<string> to,
            IEnumerable<object> filters,
            IEnumerable<string> excludeIds,
            int? maxRecipients,
            string data,
            string title,
            FacebookDelegate<IAppRequestResult> callback)
        {
            string filterString = null;
            if (filters != null)
            {
                using (var enumerator = filters.GetEnumerator())
                {
                    if (enumerator.MoveNext())
                    {
                        filterString = enumerator.Current as string;
                    }
                }
            }

            this.arcadeWrapper.DoAppRequestRequest(
              this.appId,
              message,
              actionType != null ? actionType.ToString() : null,
              objectId,
              to.ToCommaSeparateList(),
              filterString,
              excludeIds.ToCommaSeparateList(),
              maxRecipients.HasValue ? maxRecipients.Value.ToString() : null,
              data,
              title,
              this.CallbackManager.AddFacebookDelegate(callback),
              this.OnAppRequestsComplete);
        }