Пример #1
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.ValidateAppRequestArgs(
                message,
                actionType,
                objectId,
                to,
                filters,
                excludeIds,
                maxRecipients,
                data,
                title,
                callback);

            MethodArguments args = new MethodArguments();

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

            call.Callback = callback;
            call.Call(args);
        }
Пример #2
0
        public void Init(
            string appId,
            bool cookie,
            bool logging,
            bool status,
            bool xfbml,
            string channelUrl,
            string authResponse,
            bool frictionlessRequests,
            string javascriptSDKLocale,
            bool loadDebugJSSDK,
            HideUnityDelegate hideUnityDelegate,
            InitDelegate onInitComplete)
        {
            base.Init(onInitComplete);

            this.canvasJSWrapper.InitScreenPosition();
            this.appId = appId;
            this.onHideUnityDelegate = hideUnityDelegate;

            MethodArguments parameters = new MethodArguments();

            parameters.AddString("appId", appId);
            parameters.AddPrimative("cookie", cookie);
            parameters.AddPrimative("logging", logging);
            parameters.AddPrimative("status", status);
            parameters.AddPrimative("xfbml", xfbml);
            parameters.AddString("channelUrl", channelUrl);
            parameters.AddString("authResponse", authResponse);
            parameters.AddPrimative("frictionlessRequests", frictionlessRequests);
            parameters.AddString("version", FB.GraphApiVersion);

            // use 1/0 for booleans, otherwise you'll get strings "True"/"False"
            this.canvasJSWrapper.Init(
                FacebookConnectURL,
                javascriptSDKLocale,
                loadDebugJSSDK ? 1 : 0,
                parameters.ToJsonString(),
                status ? 1 : 0);
        }
        public override void CreateTournament(
            int initialScore,
            string title,
            string imageBase64DataUrl,
            Dictionary <string, string> data,
            FacebookDelegate <ITournamentResult> callback)
        {
            MethodArguments args = new MethodArguments();

            args.AddString("initialScore", initialScore.ToString());
            args.AddString("title", title);
            args.AddString("imageBase64DataUrl", imageBase64DataUrl);
            args.AddDictionary("data", data.ToDictionary(pair => pair.Key, pair => (object)pair.Value));
            var createTournament = new JavaMethodCall <ITournamentResult>(
                this,
                "CreateTournament")
            {
                Callback = callback
            };

            createTournament.Call(args);
        }
Пример #4
0
        public override void AppEventsLogPurchase(
            float logPurchase,
            string currency,
            Dictionary <string, object> parameters)
        {
            MethodArguments args = new MethodArguments();

            args.AddPrimative("logPurchase", logPurchase);
            args.AddString("currency", currency);
            args.AddDictionary("parameters", parameters);
            var logPurchaseCall = new JavaMethodCall <IResult>(this, "LogAppEvent");

            logPurchaseCall.Call(args);
        }
Пример #5
0
        public override void AppEventsLogEvent(
            string logEvent,
            float?valueToSum,
            Dictionary <string, object> parameters)
        {
            MethodArguments args = new MethodArguments();

            args.AddString("logEvent", logEvent);
            args.AddNullablePrimitive("valueToSum", valueToSum);
            args.AddDictionary("parameters", parameters);
            var appEventcall = new JavaMethodCall <IResult>(this, "LogAppEvent");

            appEventcall.Call(args);
        }
Пример #6
0
        public override void PostSessionScore(int score, FacebookDelegate <ISessionScoreResult> callback)
        {
            MethodArguments args = new MethodArguments();

            args.AddString("score", score.ToString());
            var postSessionScore = new JavaMethodCall <ISessionScoreResult>(
                this,
                "PostSessionScore")
            {
                Callback = callback
            };

            postSessionScore.Call(args);
        }
Пример #7
0
        public override void FeedShare(
            string toId,
            Uri link,
            string linkName,
            string linkCaption,
            string linkDescription,
            Uri picture,
            string mediaSource,
            FacebookDelegate <IShareResult> callback)
        {
            MethodArguments args = new MethodArguments();

            args.AddString("toId", toId);
            args.AddUri("link", link);
            args.AddString("linkName", linkName);
            args.AddString("linkCaption", linkCaption);
            args.AddString("linkDescription", linkDescription);
            args.AddUri("picture", picture);
            args.AddString("mediaSource", mediaSource);
            var call = new JavaMethodCall <IShareResult>(this, "FeedShare");

            call.Callback = callback;
            call.Call(args);
        }
Пример #8
0
        public override void FeedShare(
            string toId,
            Uri link,
            string linkName,
            string linkCaption,
            string linkDescription,
            Uri picture,
            string mediaSource,
            FacebookDelegate <IShareResult> callback)
        {
            MethodArguments args = new MethodArguments();

            args.AddString("to", toId);
            args.AddUri("link", link);
            args.AddString("name", linkName);
            args.AddString("caption", linkCaption);
            args.AddString("description", linkDescription);
            args.AddUri("picture", picture);
            args.AddString("source", mediaSource);
            var call = new CanvasUIMethodCall <IShareResult>(this, MethodFeed, Constants.OnShareCompleteMethodName);

            call.Callback = callback;
            call.Call(args);
        }
Пример #9
0
        public override void ScheduleAppToUserNotification(
            string title,
            string body,
            Uri media,
            int timeInterval,
            string payload,
            FacebookDelegate <IScheduleAppToUserNotificationResult> callback)
        {
            MethodArguments args = new MethodArguments();

            args.AddString("title", title);
            args.AddString("body", body);
            args.AddUri("media", media);
            args.AddPrimative("timeInterval", timeInterval);
            args.AddString("payload", payload);
            var scheduleAppToUserNotification = new JavaMethodCall <IScheduleAppToUserNotificationResult>(
                this,
                "ScheduleAppToUserNotification")
            {
                Callback = callback
            };

            scheduleAppToUserNotification.Call(args);
        }
        public override void ShareLink(
            Uri contentURL,
            string contentTitle,
            string contentDescription,
            Uri photoURL,
            string hashtag,
            FacebookDelegate <IShareResult> callback)
        {
            if (hashtag != null)
            {
                throw new NotImplementedException("ShareLink with hashtag is only implemented for iOS and Android for now. Set it to null.");
            }

            MethodArguments args = new MethodArguments();

            args.AddUri("link", contentURL);
            args.AddString("name", contentTitle);
            args.AddString("description", contentDescription);
            args.AddUri("picture", photoURL);
            var call = new CanvasUIMethodCall <IShareResult>(this, MethodFeed, Constants.OnShareCompleteMethodName);

            call.Callback = callback;
            call.Call(args);
        }
Пример #11
0
        public override void ShowRewardedVideo(
            string placementID,
            FacebookDelegate <IRewardedVideoResult> callback)
        {
            MethodArguments args = new MethodArguments();

            args.AddString("placementID", placementID);
            var showRewardedVideo = new JavaMethodCall <IRewardedVideoResult>(
                this,
                "ShowRewardedVideo")
            {
                Callback = callback
            };

            showRewardedVideo.Call(args);
        }
Пример #12
0
        public override void ShowInterstitialAd(
            string placementID,
            FacebookDelegate <IInterstitialAdResult> callback)
        {
            MethodArguments args = new MethodArguments();

            args.AddString("placementID", placementID);
            var showInterstitialAd = new JavaMethodCall <IInterstitialAdResult>(
                this,
                "ShowInterstitialAd")
            {
                Callback = callback
            };

            showInterstitialAd.Call(args);
        }
Пример #13
0
        public override void ConsumePurchase(
            string purchaseToken,
            FacebookDelegate <IConsumePurchaseResult> callback)
        {
            MethodArguments args = new MethodArguments();

            args.AddString("purchaseToken", purchaseToken);
            var consumePurchase = new JavaMethodCall <IConsumePurchaseResult>(
                this,
                "ConsumePurchase")
            {
                Callback = callback
            };

            consumePurchase.Call(args);
        }
        public override void UploadVideoToMediaLibrary(
            string caption,
            Uri videoUri,
            FacebookDelegate <IMediaUploadResult> callback)
        {
            MethodArguments args = new MethodArguments();

            args.AddString("caption", caption);
            args.AddUri("videoUri", videoUri);
            var uploadImageToMediaLibrary = new JavaMethodCall <IMediaUploadResult>(
                this,
                "UploadVideoToMediaLibrary")
            {
                Callback = callback
            };

            uploadImageToMediaLibrary.Call(args);
        }
Пример #15
0
        public void Init(
            string appId,
            HideUnityDelegate hideUnityDelegate,
            InitDelegate onInitComplete)
        {
            // Set the user agent suffix for graph requests
            // This should be set before a call to init to ensure that
            // requests made during init include this suffix.
            this.CallFB(
                "SetUserAgentSuffix",
                string.Format(Constants.UnitySDKUserAgentSuffixLegacy));

            base.Init(onInitComplete);

            var args = new MethodArguments();

            args.AddString("appId", appId);
            var initCall = new JavaMethodCall <IResult>(this, "Init");

            initCall.Call(args);
        }