repo_name
stringlengths
1
52
repo_creator
stringclasses
6 values
programming_language
stringclasses
4 values
code
stringlengths
0
9.68M
num_lines
int64
1
234k
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As with any software that integrates with the Facebook platform, your use of * this software is subject to the Facebook Developer Principles and Policies * [http://developers.facebook.com/policy/]. This copyright notice shall be * included in all copies or substantial portions of the software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ namespace Facebook.Unity { using System.Collections.Generic; public interface IFriendFinderInvitationResult : IResult { IList<FriendFinderInviation> Invitations { get; } } }
29
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As with any software that integrates with the Facebook platform, your use of * this software is subject to the Facebook Developer Principles and Policies * [http://developers.facebook.com/policy/]. This copyright notice shall be * included in all copies or substantial portions of the software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ namespace Facebook.Unity { using System.Collections.Generic; public interface IGameLoadCompleteResult : IResult { } }
29
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As with any software that integrates with the Facebook platform, your use of * this software is subject to the Facebook Developer Principles and Policies * [http://developers.facebook.com/policy/]. This copyright notice shall be * included in all copies or substantial portions of the software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ namespace Facebook.Unity { /// <summary> /// The result of a a FriendFinder Dialog. There is no data returned /// to the client. /// </summary> public interface IGamingServicesFriendFinderResult : IResult { } }
31
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As with any software that integrates with the Facebook platform, your use of * this software is subject to the Facebook Developer Principles and Policies * [http://developers.facebook.com/policy/]. This copyright notice shall be * included in all copies or substantial portions of the software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ namespace Facebook.Unity { /// <summary> /// The Get Current Gaming Context API result. /// </summary> public interface IGetCurrentGamingContextResult : IResult { /// <summary> /// Gets Gaming Context ID. /// </summary> /// <value>The ID of current gaming context the game session is in.</value> string ContextId { get; } } }
35
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As with any software that integrates with the Facebook platform, your use of * this software is subject to the Facebook Developer Principles and Policies * [http://developers.facebook.com/policy/]. This copyright notice shall be * included in all copies or substantial portions of the software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ namespace Facebook.Unity { using System.Collections.Generic; /// <summary> /// The result of fetching all tournaments the user is participating in. /// </summary> public interface IGetTournamentsResult : IResult { } }
32
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As with any software that integrates with the Facebook platform, your use of * this software is subject to the Facebook Developer Principles and Policies * [http://developers.facebook.com/policy/]. This copyright notice shall be * included in all copies or substantial portions of the software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ namespace Facebook.Unity { using System.Collections.Generic; using UnityEngine; /// <summary> /// The result of a graph api call. /// </summary> public interface IGraphResult : IResult { /// <summary> /// Gets the result. /// </summary> /// <value>A list parsed from the result.</value> IList<object> ResultList { get; } /// <summary> /// Gets the Texture. /// </summary> /// <value> /// A texture downloaded from the graph endpoint if the graph api redirected to a image, otherwise null. /// </value> /// <remarks> /// The Graph API does not return textures directly, but a few endpoints can /// redirect to images when no 'redirect=false' parameter is specified. Ex: '/me/picture'. /// </remarks> Texture2D Texture { get; } } }
50
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As with any software that integrates with the Facebook platform, your use of * this software is subject to the Facebook Developer Principles and Policies * [http://developers.facebook.com/policy/]. This copyright notice shall be * included in all copies or substantial portions of the software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ namespace Facebook.Unity { /// <summary> /// The result of a group creation. /// </summary> public interface IGroupCreateResult : IResult { /// <summary> /// Gets the group identifier. /// </summary> /// <value>The group id of the group created.</value> string GroupId { get; } } }
35
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As with any software that integrates with the Facebook platform, your use of * this software is subject to the Facebook Developer Principles and Policies * [http://developers.facebook.com/policy/]. This copyright notice shall be * included in all copies or substantial portions of the software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ namespace Facebook.Unity { /// <summary> /// The result of a group join. /// </summary> public interface IGroupJoinResult : IResult { } }
30
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As with any software that integrates with the Facebook platform, your use of * this software is subject to the Facebook Developer Principles and Policies * [http://developers.facebook.com/policy/]. This copyright notice shall be * included in all copies or substantial portions of the software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ namespace Facebook.Unity { /// <summary> /// The license check for premium games result. /// </summary> public interface IHasLicenseResult : IResult { /// <summary> /// Gets if the user has a license to play the game. /// </summary> /// <value>The access token.</value> bool HasLicense { get; } } }
35
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As with any software that integrates with the Facebook platform, your use of * this software is subject to the Facebook Developer Principles and Policies * [http://developers.facebook.com/policy/]. This copyright notice shall be * included in all copies or substantial portions of the software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ namespace Facebook.Unity { using System.Collections.Generic; public interface IIAPReadyResult : IResult { } }
29
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As with any software that integrates with the Facebook platform, your use of * this software is subject to the Facebook Developer Principles and Policies * [http://developers.facebook.com/policy/]. This copyright notice shall be * included in all copies or substantial portions of the software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ namespace Facebook.Unity { using System.Collections.Generic; public interface IInitCloudGameResult : IResult { } }
29
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As with any software that integrates with the Facebook platform, your use of * this software is subject to the Facebook Developer Principles and Policies * [http://developers.facebook.com/policy/]. This copyright notice shall be * included in all copies or substantial portions of the software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ namespace Facebook.Unity { internal interface IInternalResult : IResult { /// <summary> /// Gets the callback identifier. /// </summary> /// <value>A unique ID for this callback. This value should only be used internally.</value> string CallbackId { get; } } }
32
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As with any software that integrates with the Facebook platform, your use of * this software is subject to the Facebook Developer Principles and Policies * [http://developers.facebook.com/policy/]. This copyright notice shall be * included in all copies or substantial portions of the software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ namespace Facebook.Unity { using System.Collections.Generic; public interface IInterstitialAdResult : IResult { } }
29
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As with any software that integrates with the Facebook platform, your use of * this software is subject to the Facebook Developer Principles and Policies * [http://developers.facebook.com/policy/]. This copyright notice shall be * included in all copies or substantial portions of the software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ namespace Facebook.Unity { /// <summary> /// The Locale result /// </summary> public interface ILocaleResult : IResult { /// <summary> /// Gets the Locale. /// </summary> /// <value>The user's locale.</value> string Locale { get; } } }
35
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As with any software that integrates with the Facebook platform, your use of * this software is subject to the Facebook Developer Principles and Policies * [http://developers.facebook.com/policy/]. This copyright notice shall be * included in all copies or substantial portions of the software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ namespace Facebook.Unity { /// <summary> /// The result of a login request. /// </summary> public interface ILoginResult : IResult { /// <summary> /// Gets the access token. /// </summary> /// <value>The access token returned from login if successful else null.</value> AccessToken AccessToken { get; } /// <summary> /// Gets the authentication token. /// </summary> /// <value>The authentication token returned from login if successful else null.</value> AuthenticationToken AuthenticationToken { get; } } }
41
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As with any software that integrates with the Facebook platform, your use of * this software is subject to the Facebook Developer Principles and Policies * [http://developers.facebook.com/policy/]. This copyright notice shall be * included in all copies or substantial portions of the software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ namespace Facebook.Unity { /// <summary> /// The result for getting the Login Status of a user. /// </summary> public interface ILoginStatusResult : ILoginResult { /// <summary> /// Gets a value indicating whether the access token retrieval has failed /// </summary> /// <value><c>true</c> if an access token could not be retrieved; otherwise, /// <c>false</c>.</value>b bool Failed { get; } } }
36
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As with any software that integrates with the Facebook platform, your use of * this software is subject to the Facebook Developer Principles and Policies * [http://developers.facebook.com/policy/]. This copyright notice shall be * included in all copies or substantial portions of the software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ namespace Facebook.Unity { /// <summary> /// The result of a Media Upload /// </summary> public interface IMediaUploadResult : IResult { /// <summary> /// Gets the Media Identifier. /// </summary> /// <value>The media identifier if the upload was successful.</value> string MediaId { get; } } }
35
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As with any software that integrates with the Facebook platform, your use of * this software is subject to the Facebook Developer Principles and Policies * [http://developers.facebook.com/policy/]. This copyright notice shall be * included in all copies or substantial portions of the software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ namespace Facebook.Unity { using System.Collections.Generic; internal class InitCloudGameResult : ResultBase, IInitCloudGameResult { internal InitCloudGameResult(ResultContainer resultContainer) : base(resultContainer) { } } }
32
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As with any software that integrates with the Facebook platform, your use of * this software is subject to the Facebook Developer Principles and Policies * [http://developers.facebook.com/policy/]. This copyright notice shall be * included in all copies or substantial portions of the software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ namespace Facebook.Unity { using System.Collections.Generic; internal class InterstitialAdResult : ResultBase, IInterstitialAdResult { internal InterstitialAdResult(ResultContainer resultContainer) : base(resultContainer) { if (this.ErrorDictionary != null && this.ErrorDictionary["errorType"] == "USER_INPUT") { this.Cancelled = true; } } } }
36
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As with any software that integrates with the Facebook platform, your use of * this software is subject to the Facebook Developer Principles and Policies * [http://developers.facebook.com/policy/]. This copyright notice shall be * included in all copies or substantial portions of the software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ namespace Facebook.Unity { using System.Collections.Generic; public interface IOpenAppStoreResult : IResult { } }
29
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As with any software that integrates with the Facebook platform, your use of * this software is subject to the Facebook Developer Principles and Policies * [http://developers.facebook.com/policy/]. This copyright notice shall be * included in all copies or substantial portions of the software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ namespace Facebook.Unity { using System.Collections.Generic; /// <summary> /// The payload result. /// </summary> public interface IPayloadResult : IResult { /// <summary> /// Gets a dictionary of the payload items. /// </summary> /// <value>The payload.</value> IDictionary<string, string> Payload { get; } } }
37
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As with any software that integrates with the Facebook platform, your use of * this software is subject to the Facebook Developer Principles and Policies * [http://developers.facebook.com/policy/]. This copyright notice shall be * included in all copies or substantial portions of the software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ namespace Facebook.Unity { /// <summary> /// The result of a pay request. /// </summary> public interface IPayResult : IResult { /// <summary> /// Gets the error code. /// </summary> /// <value>The error code.</value> long ErrorCode { get; } } }
35
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As with any software that integrates with the Facebook platform, your use of * this software is subject to the Facebook Developer Principles and Policies * [http://developers.facebook.com/policy/]. This copyright notice shall be * included in all copies or substantial portions of the software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ namespace Facebook.Unity { /// <summary> /// The result of a user profile request. /// </summary> public interface IProfileResult : IResult { /// <summary> /// Gets the current user profile. /// </summary> /// <value>The current profile returned user is logged in else null.</value> Profile CurrentProfile { get; } } }
34
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As with any software that integrates with the Facebook platform, your use of * this software is subject to the Facebook Developer Principles and Policies * [http://developers.facebook.com/policy/]. This copyright notice shall be * included in all copies or substantial portions of the software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ namespace Facebook.Unity { using System.Collections.Generic; /// <summary> /// The purchase result. /// </summary> public interface IPurchaseResult : IResult { /// <summary> /// Gets the purchase information of the item that was purchased. /// </summary> /// <value>The purchase object.</value> Purchase Purchase { get; } } }
37
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As with any software that integrates with the Facebook platform, your use of * this software is subject to the Facebook Developer Principles and Policies * [http://developers.facebook.com/policy/]. This copyright notice shall be * included in all copies or substantial portions of the software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ namespace Facebook.Unity { using System.Collections.Generic; /// <summary> /// The access token refresh result. /// </summary> public interface IPurchasesResult : IResult { /// <summary> /// Gets a list of products available for purchase. /// </summary> /// <value>The list of product objects.</value> IList<Purchase> Purchases { get; } } }
37
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As with any software that integrates with the Facebook platform, your use of * this software is subject to the Facebook Developer Principles and Policies * [http://developers.facebook.com/policy/]. This copyright notice shall be * included in all copies or substantial portions of the software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ namespace Facebook.Unity { /// <summary> /// The result of a Create Referral call /// </summary> public interface IReferralsCreateResult : IResult { /// <summary> /// Gets the Create Referral call result. /// </summary> /// <value>A string that specifies if Create Referral call was successful.</value> string Raw { get; } /// <summary> /// Gets the link generated by Create Referral call result. /// </summary> /// <value>A string that contains the link generated by Create Referral call.</value> string ReferralLink { get; } } }
41
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As with any software that integrates with the Facebook platform, your use of * this software is subject to the Facebook Developer Principles and Policies * [http://developers.facebook.com/policy/]. This copyright notice shall be * included in all copies or substantial portions of the software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ namespace Facebook.Unity { /// <summary> /// The result of a Get Data Referral call /// </summary> public interface IReferralsGetDataResult : IResult { /// <summary> /// Gets the Get Data Referral call result. /// </summary> /// <value>A string that specifies if Create Referral call was successful.</value> string Raw { get; } /// <summary> /// Gets the payload generated by Get Data Referral call result. /// </summary> /// <value>A string that contains the payload generated by Get Data Referral call.</value> string Payload { get; } } }
41
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As with any software that integrates with the Facebook platform, your use of * this software is subject to the Facebook Developer Principles and Policies * [http://developers.facebook.com/policy/]. This copyright notice shall be * included in all copies or substantial portions of the software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ namespace Facebook.Unity { using System.Collections.Generic; /// <summary> /// A class contiaing the result data. /// </summary> public interface IResult { /// <summary> /// Gets the error. /// </summary> /// <value>The error string from the result. If no error occured value is null or empty.</value> string Error { get; } /// <summary> /// Gets the error, as a Dictionary. /// </summary> /// <value> /// The error string from the result, as a Dictionary. /// If no error occured or cannot be parsed as a Dictionary, value is null. /// </value> IDictionary<string, string> ErrorDictionary { get; } /// <summary> /// Gets the result. /// </summary> /// <value>A collection of key values pairs that are parsed from the result.</value> IDictionary<string, object> ResultDictionary { get; } /// <summary> /// Gets the raw result. /// </summary> /// <value>The raw result string.</value> string RawResult { get; } /// <summary> /// Gets a value indicating whether this instance cancelled. /// </summary> /// <value><c>true</c> if this instance cancelled; otherwise, <c>false</c>.</value>b bool Cancelled { get; } } }
64
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As with any software that integrates with the Facebook platform, your use of * this software is subject to the Facebook Developer Principles and Policies * [http://developers.facebook.com/policy/]. This copyright notice shall be * included in all copies or substantial portions of the software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ namespace Facebook.Unity { using System.Collections.Generic; public interface IRewardedVideoResult : IResult { } }
29
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As with any software that integrates with the Facebook platform, your use of * this software is subject to the Facebook Developer Principles and Policies * [http://developers.facebook.com/policy/]. This copyright notice shall be * included in all copies or substantial portions of the software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ namespace Facebook.Unity { using System.Collections.Generic; public interface IScheduleAppToUserNotificationResult : IResult { } }
29
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As with any software that integrates with the Facebook platform, your use of * this software is subject to the Facebook Developer Principles and Policies * [http://developers.facebook.com/policy/]. This copyright notice shall be * included in all copies or substantial portions of the software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ namespace Facebook.Unity { using System.Collections.Generic; /// <summary> /// The post session score result. /// </summary> public interface ISessionScoreResult : IResult { } }
32
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As with any software that integrates with the Facebook platform, your use of * this software is subject to the Facebook Developer Principles and Policies * [http://developers.facebook.com/policy/]. This copyright notice shall be * included in all copies or substantial portions of the software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ namespace Facebook.Unity { /// <summary> /// The result of a share. /// </summary> public interface IShareResult : IResult { /// <summary> /// Gets the post identifier. /// </summary> /// <value>The post identifier if the post was successful and the user is tossed.</value> string PostId { get; } } }
35
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As with any software that integrates with the Facebook platform, your use of * this software is subject to the Facebook Developer Principles and Policies * [http://developers.facebook.com/policy/]. This copyright notice shall be * included in all copies or substantial portions of the software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ namespace Facebook.Unity { /// <summary> /// The result of a soft keyboard open /// </summary> public interface ISoftKeyboardOpenResult : IResult { /// <summary> /// Gets the soft keyboard open result. /// </summary> /// <value>A string that specifies if the soft keyboard has open action was successful.</value> string Success { get; } } }
35
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As with any software that integrates with the Facebook platform, your use of * this software is subject to the Facebook Developer Principles and Policies * [http://developers.facebook.com/policy/]. This copyright notice shall be * included in all copies or substantial portions of the software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ namespace Facebook.Unity { using System.Collections.Generic; /// <summary> /// The catalog result. /// </summary> public interface ISubscribableCatalogResult : IResult { /// <summary> /// Gets a list of subscribable products available for purchase. /// </summary> /// <value>The list of subscribable product objects.</value> IList<SubscribableProduct> SubscribableProducts { get; } } }
37
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As with any software that integrates with the Facebook platform, your use of * this software is subject to the Facebook Developer Principles and Policies * [http://developers.facebook.com/policy/]. This copyright notice shall be * included in all copies or substantial portions of the software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ namespace Facebook.Unity { using System.Collections.Generic; /// <summary> /// The subscription result. /// </summary> public interface ISubscriptionResult : IResult { /// <summary> /// Gets the information about the subscription that was purchased. /// </summary> /// <value>The subscriptions object.</value> Subscription Subscription { get; } } }
37
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As with any software that integrates with the Facebook platform, your use of * this software is subject to the Facebook Developer Principles and Policies * [http://developers.facebook.com/policy/]. This copyright notice shall be * included in all copies or substantial portions of the software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ namespace Facebook.Unity { using System.Collections.Generic; /// <summary> /// The access token refresh result. /// </summary> public interface ISubscriptionsResult : IResult { /// <summary> /// Gets a list of the user's subscriptions. /// </summary> /// <value>The list of subscriptions objects.</value> IList<Subscription> Subscriptions { get; } } }
37
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As with any software that integrates with the Facebook platform, your use of * this software is subject to the Facebook Developer Principles and Policies * [http://developers.facebook.com/policy/]. This copyright notice shall be * included in all copies or substantial portions of the software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ namespace Facebook.Unity { /// <summary> /// The Switch Gaming Context API result. /// </summary> public interface ISwitchGamingContextResult : IResult { } }
29
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As with any software that integrates with the Facebook platform, your use of * this software is subject to the Facebook Developer Principles and Policies * [http://developers.facebook.com/policy/]. This copyright notice shall be * included in all copies or substantial portions of the software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ namespace Facebook.Unity { using System.Collections.Generic; /// <summary> /// The instant tournament result. /// </summary> public interface ITournamentResult : IResult { } }
31
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As with any software that integrates with the Facebook platform, your use of * this software is subject to the Facebook Developer Principles and Policies * [http://developers.facebook.com/policy/]. This copyright notice shall be * included in all copies or substantial portions of the software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ namespace Facebook.Unity { using System.Collections.Generic; /// <summary> /// The instant tournament score result. /// </summary> public interface ITournamentScoreResult : IResult { } }
32
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As with any software that integrates with the Facebook platform, your use of * this software is subject to the Facebook Developer Principles and Policies * [http://developers.facebook.com/policy/]. This copyright notice shall be * included in all copies or substantial portions of the software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ namespace Facebook.Unity { /// <summary> /// The result of a Virtual Gamepad Layout change /// </summary> public interface IVirtualGamepadLayoutResult : IResult { /// <summary> /// Gets the Virtual Gamepad Layout change result. /// </summary> /// <value>A string that specifies if the layout change was successful.</value> string Success { get; } } }
35
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As with any software that integrates with the Facebook platform, your use of * this software is subject to the Facebook Developer Principles and Policies * [http://developers.facebook.com/policy/]. This copyright notice shall be * included in all copies or substantial portions of the software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ namespace Facebook.Unity { using System.Collections.Generic; internal class LocaleResult: ResultBase, ILocaleResult { internal LocaleResult(ResultContainer resultContainer) : base(resultContainer) { if (this.ResultDictionary != null) { string locale; if (this.ResultDictionary.TryGetValue("locale", out locale)) { this.Locale = locale; } } } public string Locale { get; private set; } } }
40
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As with any software that integrates with the Facebook platform, your use of * this software is subject to the Facebook Developer Principles and Policies * [http://developers.facebook.com/policy/]. This copyright notice shall be * included in all copies or substantial portions of the software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ namespace Facebook.Unity { using System.Collections.Generic; internal class LoginResult : ResultBase, ILoginResult { public const string LastRefreshKey = "last_refresh"; public static readonly string UserIdKey = Constants.IsWeb ? "userID" : "user_id"; public static readonly string ExpirationTimestampKey = Constants.IsWeb ? "expiresIn" : "expiration_timestamp"; public static readonly string PermissionsKey = Constants.IsWeb ? "grantedScopes" : "permissions"; public static readonly string AccessTokenKey = Constants.IsWeb ? "accessToken" : Constants.AccessTokenKey; public static readonly string GraphDomain = "graph_domain"; public static readonly string AuthTokenString = "auth_token_string"; public static readonly string AuthNonce = "auth_nonce"; internal LoginResult(ResultContainer resultContainer) : base(resultContainer) { if (this.ResultDictionary != null && this.ResultDictionary.ContainsKey("WindowsCurrentAccessToken")) { //Windows SDK will create and validate the AccessToken this.AccessToken = this.ResultDictionary.GetValueOrDefault<AccessToken>("WindowsCurrentAccessToken"); AccessToken.CurrentAccessToken = this.AccessToken; } else { if (this.ResultDictionary != null && this.ResultDictionary.ContainsKey(LoginResult.AccessTokenKey)) { this.AccessToken = Utilities.ParseAccessTokenFromResult(this.ResultDictionary); } if (this.ResultDictionary != null && this.ResultDictionary.ContainsKey(LoginResult.AuthTokenString) && this.ResultDictionary.ContainsKey(LoginResult.AuthNonce)) { this.AuthenticationToken = Utilities.ParseAuthenticationTokenFromResult(this.ResultDictionary); } if (this.AuthenticationToken != null) { AccessToken.CurrentAccessToken = null; } } } public AccessToken AccessToken { get; private set; } public AuthenticationToken AuthenticationToken { get; private set; } public override string ToString() { return Utilities.FormatToString( base.ToString(), this.GetType().Name, new Dictionary<string, string>() { { "AccessToken", this.AccessToken.ToStringNullOk() }, { "AuthenticationToken", this.AuthenticationToken.ToStringNullOk() }, }); } } }
78
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As with any software that integrates with the Facebook platform, your use of * this software is subject to the Facebook Developer Principles and Policies * [http://developers.facebook.com/policy/]. This copyright notice shall be * included in all copies or substantial portions of the software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ namespace Facebook.Unity { using System.Collections.Generic; internal class LoginStatusResult : LoginResult, ILoginStatusResult { public static readonly string FailedKey = "failed"; internal LoginStatusResult(ResultContainer resultContainer) : base(resultContainer) { if (this.ResultDictionary != null && this.ResultDictionary.ContainsKey(LoginStatusResult.FailedKey)) { this.Failed = this.ResultDictionary.GetValueOrDefault<bool>(LoginStatusResult.FailedKey); } } public bool Failed { get; private set; } public override string ToString() { return Utilities.FormatToString( base.ToString(), this.GetType().Name, new Dictionary<string, string>() { { "Failed", this.Failed.ToString() }, }); } } }
51
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As with any software that integrates with the Facebook platform, your use of * this software is subject to the Facebook Developer Principles and Policies * [http://developers.facebook.com/policy/]. This copyright notice shall be * included in all copies or substantial portions of the software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ namespace Facebook.Unity { using System.Collections.Generic; internal class MediaUploadResult : ResultBase, IMediaUploadResult { internal MediaUploadResult(ResultContainer resultContainer) : base(resultContainer) { if (this.ResultDictionary != null) { string mediaId; if (this.ResultDictionary.TryGetValue("video_id", out mediaId)) { this.MediaId = mediaId; } else if (this.ResultDictionary.TryGetValue("id", out mediaId)) { this.MediaId = mediaId; } } } public string MediaId { get; private set; } public override string ToString() { return Utilities.FormatToString( base.ToString(), this.GetType().Name, new Dictionary<string, string>() { { "MediaId", this.MediaId }, }); } } }
56
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As with any software that integrates with the Facebook platform, your use of * this software is subject to the Facebook Developer Principles and Policies * [http://developers.facebook.com/policy/]. This copyright notice shall be * included in all copies or substantial portions of the software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ namespace Facebook.Unity { using System.Collections.Generic; internal class OpenAppStoreResult : ResultBase, IOpenAppStoreResult { internal OpenAppStoreResult(ResultContainer resultContainer) : base(resultContainer) { } } }
32
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As with any software that integrates with the Facebook platform, your use of * this software is subject to the Facebook Developer Principles and Policies * [http://developers.facebook.com/policy/]. This copyright notice shall be * included in all copies or substantial portions of the software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ namespace Facebook.Unity { using System.Collections.Generic; using System.Text; internal class PayloadResult : ResultBase, IPayloadResult { public PayloadResult(ResultContainer resultContainer) : base(resultContainer) { if (this.ResultDictionary != null && this.ResultDictionary.ContainsKey("success")) { this.Payload = Utilities.ParseInnerStringDictionary(this.ResultDictionary, "success"); } } public IDictionary<string, string> Payload { get; private set; } public override string ToString() { return Utilities.FormatToString( null, this.GetType().Name, this.Payload ); } } }
48
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As with any software that integrates with the Facebook platform, your use of * this software is subject to the Facebook Developer Principles and Policies * [http://developers.facebook.com/policy/]. This copyright notice shall be * included in all copies or substantial portions of the software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ namespace Facebook.Unity { using System.Collections.Generic; internal class PayResult : ResultBase, IPayResult { internal const long CancelPaymentFlowCode = 1383010; internal PayResult(ResultContainer resultContainer) : base(resultContainer) { if (this.CanvasErrorCode != null && this.CanvasErrorCode.Value == PayResult.CancelPaymentFlowCode) { this.Cancelled = true; } } public long ErrorCode { get { return this.CanvasErrorCode.GetValueOrDefault(); } } public override string ToString() { return Utilities.FormatToString( base.ToString(), this.GetType().Name, new Dictionary<string, string>() { { "ErrorCode", this.ErrorCode.ToString() }, }); } } }
57
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As with any software that integrates with the Facebook platform, your use of * this software is subject to the Facebook Developer Principles and Policies * [http://developers.facebook.com/policy/]. This copyright notice shall be * included in all copies or substantial portions of the software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ namespace Facebook.Unity { internal class ProfileResult : ResultBase, IProfileResult { public const string ProfileKey = "profile"; internal ProfileResult(ResultContainer resultContainer) : base(resultContainer) { if (this.ResultDictionary != null) { if (this.ResultDictionary.TryGetValue(ProfileKey, out Profile profileData)) { this.CurrentProfile = profileData; } else { this.CurrentProfile = null; } } } public Profile CurrentProfile { get; private set; } } }
45
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As with any software that integrates with the Facebook platform, your use of * this software is subject to the Facebook Developer Principles and Policies * [http://developers.facebook.com/policy/]. This copyright notice shall be * included in all copies or substantial portions of the software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ namespace Facebook.Unity { using System.Collections.Generic; using System.Text; internal class PurchaseResult : ResultBase, IPurchaseResult { public PurchaseResult(ResultContainer resultContainer) : base(resultContainer) { if (this.ResultDictionary != null && this.ResultDictionary.ContainsKey("success")) { this.Purchase = Utilities.ParsePurchaseFromResult(this.ResultDictionary); } else if (this.ResultDictionary != null && this.ResultDictionary.ContainsKey("purchase")) { this.ResultDictionary.TryGetValue("purchase", out object product); this.Purchase = (Purchase)product; } if (this.ErrorDictionary != null && this.ErrorDictionary["errorType"] == "USER_INPUT") { this.Cancelled = true; } } public Purchase Purchase { get; private set; } public override string ToString() { return Utilities.FormatToString( null, this.GetType().Name, new Dictionary<string, string>() { { "Purchase", Purchase.ToString() }, }); } } }
59
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As with any software that integrates with the Facebook platform, your use of * this software is subject to the Facebook Developer Principles and Policies * [http://developers.facebook.com/policy/]. This copyright notice shall be * included in all copies or substantial portions of the software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ namespace Facebook.Unity { using System.Collections.Generic; using System.Text; internal class PurchasesResult : ResultBase, IPurchasesResult { public PurchasesResult(ResultContainer resultContainer) : base(resultContainer) { if (this.ResultDictionary != null && this.ResultDictionary.ContainsKey("success")) { this.Purchases = Utilities.ParsePurchasesFromResult(this.ResultDictionary); }else if (this.ResultDictionary != null && this.ResultDictionary.ContainsKey("purchases")) { this.ResultDictionary.TryGetValue("purchases", out object productsList); this.Purchases = (IList<Purchase>)productsList; } } public IList<Purchase> Purchases { get; private set; } public override string ToString() { StringBuilder sb = new StringBuilder(); foreach (var purchase in this.Purchases) { sb.AppendLine(purchase.ToString()); } return Utilities.FormatToString( null, this.GetType().Name, new Dictionary<string, string>() { { "Purchases", sb.ToString() }, }); } } }
60
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As with any software that integrates with the Facebook platform, your use of * this software is subject to the Facebook Developer Principles and Policies * [http://developers.facebook.com/policy/]. This copyright notice shall be * included in all copies or substantial portions of the software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ namespace Facebook.Unity { internal class ReferralsCreateResult : ResultBase, IReferralsCreateResult { internal ReferralsCreateResult(ResultContainer resultContainer) : base(resultContainer) { if (this.ResultDictionary != null) { string raw; if (this.ResultDictionary.TryGetValue("raw", out raw)) { this.Raw = raw; } string link; if (this.ResultDictionary.TryGetValue("referral_link", out link)) { this.ReferralLink = link; } } } public string Raw { get; private set; } public string ReferralLink { get; private set; } } }
46
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As with any software that integrates with the Facebook platform, your use of * this software is subject to the Facebook Developer Principles and Policies * [http://developers.facebook.com/policy/]. This copyright notice shall be * included in all copies or substantial portions of the software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ namespace Facebook.Unity { internal class ReferralsGetDataResult : ResultBase, IReferralsGetDataResult { internal ReferralsGetDataResult(ResultContainer resultContainer) : base(resultContainer) { if (this.ResultDictionary != null) { string raw; if (this.ResultDictionary.TryGetValue("raw", out raw)) { this.Raw = raw; } string payload; if (this.ResultDictionary.TryGetValue("payload", out payload)) { this.Payload = payload; } } } public string Raw { get; private set; } public string Payload { get; private set; } } }
46
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As with any software that integrates with the Facebook platform, your use of * this software is subject to the Facebook Developer Principles and Policies * [http://developers.facebook.com/policy/]. This copyright notice shall be * included in all copies or substantial portions of the software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ namespace Facebook.Unity { using System; using System.Collections.Generic; internal abstract class ResultBase : IInternalResult { internal const long CancelDialogCode = 4201; internal const string ErrorCodeKey = "error_code"; internal const string ErrorMessageKey = "error_message"; internal ResultBase(ResultContainer result) { string error = ResultBase.GetErrorValue(result.ResultDictionary); bool cancelled = ResultBase.GetCancelledValue(result.ResultDictionary); string callbackId = ResultBase.GetCallbackId(result.ResultDictionary); this.Init(result, error, cancelled, callbackId); } internal ResultBase(ResultContainer result, string error, bool cancelled) { this.Init(result, error, cancelled, null); } public virtual string Error { get; protected set; } public virtual IDictionary<string, string> ErrorDictionary { get; protected set; } public virtual IDictionary<string, object> ResultDictionary { get; protected set; } public virtual string RawResult { get; protected set; } public virtual bool Cancelled { get; protected set; } public virtual string CallbackId { get; protected set; } protected long? CanvasErrorCode { get; private set; } public override string ToString() { return Utilities.FormatToString( base.ToString(), this.GetType().Name, new Dictionary<string, string>() { { "Error", this.Error }, { "RawResult", this.RawResult }, { "Cancelled", this.Cancelled.ToString() }, }); } protected void Init(ResultContainer result, string error, bool cancelled, string callbackId) { this.RawResult = result.RawResult; this.ResultDictionary = result.ResultDictionary; this.Cancelled = cancelled; this.Error = error; this.CallbackId = callbackId; this.ErrorDictionary = Utilities.ParseStringDictionaryFromString(error); if (this.ResultDictionary != null) { long errorCode; if (this.ResultDictionary.TryGetValue(ResultBase.ErrorCodeKey, out errorCode)) { this.CanvasErrorCode = errorCode; if (errorCode == ResultBase.CancelDialogCode) { this.Cancelled = true; } } string errorMessage; if (this.ResultDictionary.TryGetValue(ResultBase.ErrorMessageKey, out errorMessage)) { this.Error = errorMessage; } } } private static string GetErrorValue(IDictionary<string, object> result) { if (result == null) { return null; } string error; if (result.TryGetValue<string>("error", out error)) { return error; } return null; } private static bool GetCancelledValue(IDictionary<string, object> result) { if (result == null) { return false; } // Check for cancel string object cancelled; if (result.TryGetValue("cancelled", out cancelled)) { bool? cancelBool = cancelled as bool?; if (cancelBool != null) { return cancelBool.HasValue && cancelBool.Value; } string cancelString = cancelled as string; if (cancelString != null) { return Convert.ToBoolean(cancelString); } int? cancelInt = cancelled as int?; if (cancelInt != null) { return cancelInt.HasValue && cancelInt.Value != 0; } } return false; } private static string GetCallbackId(IDictionary<string, object> result) { if (result == null) { return null; } // Check for cancel string string callbackId; if (result.TryGetValue<string>(Constants.CallbackIdKey, out callbackId)) { return callbackId; } return null; } } }
169
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As with any software that integrates with the Facebook platform, your use of * this software is subject to the Facebook Developer Principles and Policies * [http://developers.facebook.com/policy/]. This copyright notice shall be * included in all copies or substantial portions of the software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ namespace Facebook.Unity { using System; using System.Collections.Generic; internal class ResultContainer { private const string CanvasResponseKey = "response"; public ResultContainer(IDictionary<string, object> dictionary) { this.RawResult = dictionary.ToJson(); this.ResultDictionary = dictionary; if (Constants.IsWeb) { this.ResultDictionary = this.GetWebFormattedResponseDictionary(this.ResultDictionary); } } public ResultContainer(string result) { this.RawResult = result; if (string.IsNullOrEmpty(result)) { this.ResultDictionary = new Dictionary<string, object>(); } else { this.ResultDictionary = Facebook.MiniJSON.Json.Deserialize(result) as Dictionary<string, object>; // The result dictionary can be null for graph requests that return lists. For these cases // we won't need to format the results anyways since the results don't contain a callback id. if (Constants.IsWeb && this.ResultDictionary != null) { // Web has a different format from mobile so reformat the result to match our // mobile responses this.ResultDictionary = this.GetWebFormattedResponseDictionary(this.ResultDictionary); } } } public string RawResult { get; private set; } public IDictionary<string, object> ResultDictionary { get; set; } private IDictionary<string, object> GetWebFormattedResponseDictionary(IDictionary<string, object> resultDictionary) { IDictionary<string, object> responseDictionary; if (resultDictionary.TryGetValue(CanvasResponseKey, out responseDictionary)) { object callbackId; if (resultDictionary.TryGetValue(Constants.CallbackIdKey, out callbackId)) { responseDictionary[Constants.CallbackIdKey] = callbackId; } return responseDictionary; } return resultDictionary; } } }
85
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As with any software that integrates with the Facebook platform, your use of * this software is subject to the Facebook Developer Principles and Policies * [http://developers.facebook.com/policy/]. This copyright notice shall be * included in all copies or substantial portions of the software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ namespace Facebook.Unity { using System.Collections.Generic; internal class RewardedVideoResult : ResultBase, IRewardedVideoResult { internal RewardedVideoResult(ResultContainer resultContainer) : base(resultContainer) { if (this.ErrorDictionary != null && this.ErrorDictionary["errorType"] == "USER_INPUT") { this.Cancelled = true; } } } }
36
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As with any software that integrates with the Facebook platform, your use of * this software is subject to the Facebook Developer Principles and Policies * [http://developers.facebook.com/policy/]. This copyright notice shall be * included in all copies or substantial portions of the software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ namespace Facebook.Unity { using System.Collections.Generic; internal class ScheduleAppToUserNotificationResult : ResultBase, IScheduleAppToUserNotificationResult { internal ScheduleAppToUserNotificationResult(ResultContainer resultContainer) : base(resultContainer) { } } }
32
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As with any software that integrates with the Facebook platform, your use of * this software is subject to the Facebook Developer Principles and Policies * [http://developers.facebook.com/policy/]. This copyright notice shall be * included in all copies or substantial portions of the software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ namespace Facebook.Unity { using System.Collections.Generic; internal class SessionScoreResult : ResultBase, ISessionScoreResult { internal SessionScoreResult(ResultContainer resultContainer) : base(resultContainer) { } } }
31
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As with any software that integrates with the Facebook platform, your use of * this software is subject to the Facebook Developer Principles and Policies * [http://developers.facebook.com/policy/]. This copyright notice shall be * included in all copies or substantial portions of the software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ namespace Facebook.Unity { using System.Collections.Generic; internal class ShareResult : ResultBase, IShareResult { internal ShareResult(ResultContainer resultContainer) : base(resultContainer) { if (this.ResultDictionary != null) { string postId; if (this.ResultDictionary.TryGetValue(ShareResult.PostIDKey, out postId)) { this.PostId = postId; } else if (this.ResultDictionary.TryGetValue("postId", out postId)) { this.PostId = postId; } } } public string PostId { get; private set; } internal static string PostIDKey { get { return Constants.IsWeb ? "post_id" : "id"; } } public override string ToString() { return Utilities.FormatToString( base.ToString(), this.GetType().Name, new Dictionary<string, string>() { { "PostId", this.PostId }, }); } } }
65
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As with any software that integrates with the Facebook platform, your use of * this software is subject to the Facebook Developer Principles and Policies * [http://developers.facebook.com/policy/]. This copyright notice shall be * included in all copies or substantial portions of the software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ namespace Facebook.Unity { internal class SoftKeyboardOpenResult : ResultBase, ISoftKeyboardOpenResult { internal SoftKeyboardOpenResult(ResultContainer resultContainer) : base(resultContainer) { if (this.ResultDictionary != null) { string success; if (this.ResultDictionary.TryGetValue("success", out success)) { this.Success = success; } } } public string Success { get; private set; } } }
39
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As with any software that integrates with the Facebook platform, your use of * this software is subject to the Facebook Developer Principles and Policies * [http://developers.facebook.com/policy/]. This copyright notice shall be * included in all copies or substantial portions of the software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ namespace Facebook.Unity { using System.Collections.Generic; using System.Text; internal class SubscribableCatalogResult : ResultBase, ISubscribableCatalogResult { public SubscribableCatalogResult(ResultContainer resultContainer) : base(resultContainer) { if (this.ResultDictionary != null && this.ResultDictionary.ContainsKey("success")) { this.SubscribableProducts = Utilities.ParseSubscribableCatalogFromResult(this.ResultDictionary); } else if (this.ResultDictionary != null && this.ResultDictionary.ContainsKey("subscribable_products")) { this.ResultDictionary.TryGetValue("subscribable_products", out object subscribableProductsList); this.SubscribableProducts = (IList<SubscribableProduct>)subscribableProductsList; } } public IList<SubscribableProduct> SubscribableProducts { get; private set; } public override string ToString() { StringBuilder sb = new StringBuilder(); foreach (var subscribableProduct in this.SubscribableProducts) { sb.AppendLine(subscribableProduct.ToString()); } return Utilities.FormatToString( null, this.GetType().Name, new Dictionary<string, string>() { { "SubscribableProducts", sb.ToString() }, }); } } }
61
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As with any software that integrates with the Facebook platform, your use of * this software is subject to the Facebook Developer Principles and Policies * [http://developers.facebook.com/policy/]. This copyright notice shall be * included in all copies or substantial portions of the software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ namespace Facebook.Unity { using System.Collections.Generic; using System.Text; internal class SubscriptionResult : ResultBase, ISubscriptionResult { public SubscriptionResult(ResultContainer resultContainer) : base(resultContainer) { if (this.ResultDictionary != null && this.ResultDictionary.ContainsKey("success")) { this.Subscription = Utilities.ParseSubscriptionFromResult(this.ResultDictionary); } else if (this.ResultDictionary != null && this.ResultDictionary.ContainsKey("subscription")) { this.ResultDictionary.TryGetValue("subscription", out object subscription); this.Subscription = (Subscription)subscription; } if (this.ErrorDictionary != null && this.ErrorDictionary["errorType"] == "USER_INPUT") { this.Cancelled = true; } } public Subscription Subscription { get; private set; } public override string ToString() { return Utilities.FormatToString( null, this.GetType().Name, new Dictionary<string, string>() { { "Subscription", Subscription.ToString() }, }); } } }
59
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As with any software that integrates with the Facebook platform, your use of * this software is subject to the Facebook Developer Principles and Policies * [http://developers.facebook.com/policy/]. This copyright notice shall be * included in all copies or substantial portions of the software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ namespace Facebook.Unity { using System.Collections.Generic; using System.Text; internal class SubscriptionsResult : ResultBase, ISubscriptionsResult { public SubscriptionsResult(ResultContainer resultContainer) : base(resultContainer) { if (this.Subscriptions != null && this.ResultDictionary.ContainsKey("success")) { this.Subscriptions = Utilities.ParseSubscriptionsFromResult(this.ResultDictionary); } else if (this.ResultDictionary != null && this.ResultDictionary.ContainsKey("subscriptions")) { this.ResultDictionary.TryGetValue("subscriptions", out object productsList); this.Subscriptions = (IList<Subscription>)productsList; } } public IList<Subscription> Subscriptions { get; private set; } public override string ToString() { StringBuilder sb = new StringBuilder(); foreach (var subscription in this.Subscriptions) { sb.AppendLine(subscription.ToString()); } return Utilities.FormatToString( null, this.GetType().Name, new Dictionary<string, string>() { { "Subscriptions", sb.ToString() }, }); } } }
60
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As with any software that integrates with the Facebook platform, your use of * this software is subject to the Facebook Developer Principles and Policies * [http://developers.facebook.com/policy/]. This copyright notice shall be * included in all copies or substantial portions of the software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ namespace Facebook.Unity { using System.Collections.Generic; internal class SwitchGamingContextResult : ResultBase, ISwitchGamingContextResult { internal SwitchGamingContextResult(ResultContainer resultContainer) : base(resultContainer) { if (this.ResultDictionary != null) { string contextId; if (this.ResultDictionary.TryGetValue<string>("contextId", out contextId)) { this.ContextId = contextId; } } } public string ContextId { get; private set; } public override string ToString() { return Utilities.FormatToString( base.ToString(), this.GetType().Name, new Dictionary<string, string>() { { "ContextId", this.ContextId }, }); } } }
55
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As with any software that integrates with the Facebook platform, your use of * this software is subject to the Facebook Developer Principles and Policies * [http://developers.facebook.com/policy/]. This copyright notice shall be * included in all copies or substantial portions of the software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ namespace Facebook.Unity { using System.Collections.Generic; using System.Text; internal class TournamentResult : ResultBase, ITournamentResult, IDialogResult { internal TournamentResult(ResultContainer resultContainer) : base(resultContainer) { if (this.ResultDictionary != null) { string tournamentId; if (this.ResultDictionary.TryGetValue("tournament_id", out tournamentId)) { this.TournamentId = tournamentId; } string contextId; if (this.ResultDictionary.TryGetValue("context_id", out contextId)) { this.ContextId = contextId; } int endTime; if (this.ResultDictionary.TryGetValue("end_time", out endTime)) { this.EndTime = endTime; } string tournamentTitle; if (this.ResultDictionary.TryGetValue("tournament_title", out tournamentTitle)) { this.TournamentTitle = tournamentTitle; } IDictionary<string, string> payload; if (this.ResultDictionary.TryGetValue("payload", out payload)) { this.Payload = payload; } } } public string TournamentId { get; private set; } public string ContextId { get; private set; } public int EndTime { get; private set; } public string TournamentTitle { get; private set; } public IDictionary<string, string> Payload { get; private set; } public override string ToString() { StringBuilder sb = new StringBuilder(); foreach (var kvp in this.Payload) { sb.AppendFormat("\n\t{0}: {1}", kvp.Key, kvp.Value); } return Utilities.FormatToString( base.ToString(), this.GetType().Name, new Dictionary<string, string>() { { "TournamentId", this.TournamentId }, { "ContextId", this.ContextId}, { "EntTime", this.EndTime.ToString() }, { "TournamentTitle", this.TournamentTitle }, { "Payload", sb.ToString()}, }); } } }
98
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As with any software that integrates with the Facebook platform, your use of * this software is subject to the Facebook Developer Principles and Policies * [http://developers.facebook.com/policy/]. This copyright notice shall be * included in all copies or substantial portions of the software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ namespace Facebook.Unity { using System.Collections.Generic; internal class TournamentScoreResult : ResultBase, ITournamentScoreResult { internal TournamentScoreResult(ResultContainer resultContainer) : base(resultContainer) { } } }
31
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As with any software that integrates with the Facebook platform, your use of * this software is subject to the Facebook Developer Principles and Policies * [http://developers.facebook.com/policy/]. This copyright notice shall be * included in all copies or substantial portions of the software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ namespace Facebook.Unity { internal class VirtualGamepadLayoutResult : ResultBase, IVirtualGamepadLayoutResult { internal VirtualGamepadLayoutResult(ResultContainer resultContainer) : base(resultContainer) { if (this.ResultDictionary != null) { string success; if (this.ResultDictionary.TryGetValue("success", out success)) { this.Success = success; } } } public string Success { get; private set; } } }
40
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As with any software that integrates with the Facebook platform, your use of * this software is subject to the Facebook Developer Principles and Policies * [http://developers.facebook.com/policy/]. This copyright notice shall be * included in all copies or substantial portions of the software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #pragma warning disable 618 namespace Facebook.Unity { using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.Networking; /* * A short lived async request that loads a FBResult from a url endpoint */ internal class AsyncRequestString : MonoBehaviour { private Uri url; private HttpMethod method; private IDictionary<string, string> formData; private WWWForm query; private FacebookDelegate<IGraphResult> callback; internal static void Post( Uri url, Dictionary<string, string> formData = null, FacebookDelegate<IGraphResult> callback = null) { Request(url, HttpMethod.POST, formData, callback); } internal static void Get( Uri url, Dictionary<string, string> formData = null, FacebookDelegate<IGraphResult> callback = null) { Request(url, HttpMethod.GET, formData, callback); } internal static void Request( Uri url, HttpMethod method, WWWForm query = null, FacebookDelegate<IGraphResult> callback = null) { ComponentFactory.AddComponent<AsyncRequestString>() .SetUrl(url) .SetMethod(method) .SetQuery(query) .SetCallback(callback); } internal static void Request( Uri url, HttpMethod method, IDictionary<string, string> formData = null, FacebookDelegate<IGraphResult> callback = null) { ComponentFactory.AddComponent<AsyncRequestString>() .SetUrl(url) .SetMethod(method) .SetFormData(formData) .SetCallback(callback); } internal IEnumerator Start() { UnityWebRequestAsyncOperation webRequestOperation; if (this.method == HttpMethod.GET) { string urlParams = this.url.AbsoluteUri.Contains("?") ? "&" : "?"; if (this.formData != null) { foreach (KeyValuePair<string, string> pair in this.formData) { urlParams += string.Format("{0}={1}&", Uri.EscapeDataString(pair.Key), Uri.EscapeDataString(pair.Value)); } } UnityWebRequest webRequest = UnityWebRequest.Get(url + urlParams); if (Constants.CurrentPlatform != FacebookUnityPlatform.WebGL) { webRequest.SetRequestHeader("User-Agent", Constants.GraphApiUserAgent); } webRequestOperation = webRequest.SendWebRequest(); } else { // POST or DELETE if (this.query == null) { this.query = new WWWForm(); } if (this.method == HttpMethod.DELETE) { this.query.AddField("method", "delete"); } if (this.formData != null) { foreach (KeyValuePair<string, string> pair in this.formData) { this.query.AddField(pair.Key, pair.Value); } } if (Constants.CurrentPlatform != FacebookUnityPlatform.WebGL) { this.query.headers["User-Agent"] = Constants.GraphApiUserAgent; } UnityWebRequest webRequest = UnityWebRequest.Post(url.AbsoluteUri, query); webRequestOperation = webRequest.SendWebRequest(); } yield return webRequestOperation; if (this.callback != null) { this.callback(new GraphResult(webRequestOperation)); } // after the callback is called, web request should be able to be disposed webRequestOperation.webRequest.Dispose(); MonoBehaviour.Destroy(this); } internal AsyncRequestString SetUrl(Uri url) { this.url = url; return this; } internal AsyncRequestString SetMethod(HttpMethod method) { this.method = method; return this; } internal AsyncRequestString SetFormData(IDictionary<string, string> formData) { this.formData = formData; return this; } internal AsyncRequestString SetQuery(WWWForm query) { this.query = query; return this; } internal AsyncRequestString SetCallback(FacebookDelegate<IGraphResult> callback) { this.callback = callback; return this; } } } #pragma warning restore 618
179
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As with any software that integrates with the Facebook platform, your use of * this software is subject to the Facebook Developer Principles and Policies * [http://developers.facebook.com/policy/]. This copyright notice shall be * included in all copies or substantial portions of the software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ using System; using System.Collections.Generic; using UnityEngine; namespace Facebook.Unity { internal class AsyncRequestStringHandler : IAsyncRequestStringHandler { public void Request( Uri url, HttpMethod method, WWWForm query = null, FacebookDelegate<IGraphResult> callback = null) { AsyncRequestString.Request(url, method, query, callback); } public void Request( Uri url, HttpMethod method, IDictionary<string, string> formData = null, FacebookDelegate<IGraphResult> callback = null) { AsyncRequestString.Request(url, method, formData, callback); } } }
48
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As with any software that integrates with the Facebook platform, your use of * this software is subject to the Facebook Developer Principles and Policies * [http://developers.facebook.com/policy/]. This copyright notice shall be * included in all copies or substantial portions of the software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ using System; using System.Collections.Generic; using UnityEngine; namespace Facebook.Unity { internal class AsyncRequestStringWrapper : IAsyncRequestStringWrapper { public void Request( Uri url, HttpMethod method, WWWForm query = null, FacebookDelegate<IGraphResult> callback = null) { AsyncRequestString.Request(url, method, query, callback); } public void Request( Uri url, HttpMethod method, IDictionary<string, string> formData = null, FacebookDelegate<IGraphResult> callback = null) { AsyncRequestString.Request(url, method, formData, callback); } } }
48
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As with any software that integrates with the Facebook platform, your use of * this software is subject to the Facebook Developer Principles and Policies * [http://developers.facebook.com/policy/]. This copyright notice shall be * included in all copies or substantial portions of the software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ namespace Facebook.Unity { using System; using System.Reflection; using UnityEngine; using UnityEngine.Events; using System.Collections.Generic; internal class CodelessIAPAutoLog { internal static void handlePurchaseCompleted(System.Object data) { try { if (!FB.Mobile.IsImplicitPurchaseLoggingEnabled()) { return; } object metadata = CodelessIAPAutoLog.GetProperty(data, "metadata"); object productDefinition = CodelessIAPAutoLog.GetProperty(data, "definition"); if (metadata == null || productDefinition == null) { return; } Decimal price = (Decimal)CodelessIAPAutoLog.GetProperty(metadata, "localizedPrice"); String currency = (String)CodelessIAPAutoLog.GetProperty(metadata, "isoCurrencyCode"); String id = (String)CodelessIAPAutoLog.GetProperty(productDefinition, "id"); FB.LogAppEvent( AppEventName.Purchased, (float)price, new Dictionary<string, object>() { { "_implicitlyLogged", "1" }, { AppEventParameterName.Currency, currency }, { AppEventParameterName.ContentID, id } }); } catch (System.Exception e) { FacebookLogger.Log("Failed to automatically handle Purchase Completed: " + e.Message); } } internal static void addListenerToIAPButtons(object listenerObject) { UnityEngine.Object[] iapButtons = FindObjectsOfTypeByName("IAPButton", "UnityEngine.Purchasing"); if (iapButtons == null) { return; } foreach (UnityEngine.Object btn in iapButtons) { addListenerToGameObject(btn, listenerObject); } } internal static void addListenerToGameObject(UnityEngine.Object gameObject, object listenerObject) { // Code stripping will work here when developer uses Unity IAP service the UnityEngine.Purchasing will be linked // If it's not enabled, this will return null and it's expected and handled in null check Type productType = FindTypeInAssemblies("Product", "UnityEngine.Purchasing"); if (productType == null) { return; } Type eventGeneric = typeof(UnityEvent<>); Type actionGeneric = typeof(UnityAction<>); Type[] typeArgs = { productType }; Type unityEventProduct = eventGeneric.MakeGenericType(typeArgs); Type unityActionProduct = actionGeneric.MakeGenericType(typeArgs); UnityEventBase onPurchaseComplete = (UnityEventBase)GetField(gameObject, "onPurchaseComplete"); MethodInfo addListener = unityEventProduct.GetMethod("AddListener"); MethodInfo removeListener = unityEventProduct.GetMethod("RemoveListener"); MethodInfo method = listenerObject.GetType().GetMethod( "onPurchaseCompleteHandler", BindingFlags.Instance | BindingFlags.Public ); removeListener.Invoke (onPurchaseComplete, new object[] { System.Delegate.CreateDelegate(unityActionProduct, listenerObject, method) }); addListener.Invoke (onPurchaseComplete, new object[] { System.Delegate.CreateDelegate(unityActionProduct, listenerObject, method) }); } private static System.Type FindTypeInAssemblies(string typeName, string nameSpace) { var assemblies = System.AppDomain.CurrentDomain.GetAssemblies(); for(int i = 0; i < assemblies.Length; i++) { var types = assemblies[i].GetTypes(); for(int n = 0; n < types.Length; n++) { if (typeName == types[n].Name && nameSpace == types[n].Namespace) { return types[n]; } } } return null; } private static UnityEngine.Object[] FindObjectsOfTypeByName(string typeName, string nameSpace) { // Code stripping will work here when developer uses Unity IAP service the UnityEngine.Purchasing will be linked // If it's not enabled, this will return null and it's expected and handled in null check Type type = FindTypeInAssemblies(typeName, nameSpace); if (type == null) { return null; } return UnityEngine.Object.FindObjectsOfType(type); } private static object GetField(object inObj, string fieldName) { object ret = null; FieldInfo info = inObj.GetType().GetField(fieldName); if (info != null) ret = info.GetValue(inObj); return ret; } private static object GetProperty(object inObj, string propertyName) { object ret = null; PropertyInfo info = inObj.GetType().GetProperty(propertyName); if (info != null) ret = info.GetValue(inObj, null); return ret; } } }
147
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As with any software that integrates with the Facebook platform, your use of * this software is subject to the Facebook Developer Principles and Policies * [http://developers.facebook.com/policy/]. This copyright notice shall be * included in all copies or substantial portions of the software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ namespace Facebook.Unity { using UnityEngine; internal static class FacebookLogger { static FacebookLogger() { FacebookLogger.Instance = new DebugLogger(); } internal static IFacebookLogger Instance { private get; set; } public static void Log(string msg) { FacebookLogger.Instance.Log(msg); } public static void Log(string format, params string[] args) { FacebookLogger.Log(string.Format(format, args)); } public static void Info(string msg) { FacebookLogger.Instance.Info(msg); } public static void Info(string format, params string[] args) { FacebookLogger.Info(string.Format(format, args)); } public static void Warn(string msg) { FacebookLogger.Instance.Warn(msg); } public static void Warn(string format, params string[] args) { FacebookLogger.Warn(string.Format(format, args)); } public static void Error(string msg) { FacebookLogger.Instance.Error(msg); } public static void Error(string format, params string[] args) { FacebookLogger.Error(string.Format(format, args)); } private class DebugLogger : IFacebookLogger { public DebugLogger() { } public void Log(string msg) { if (Debug.isDebugBuild) { Debug.Log(msg); } } public void Info(string msg) { Debug.Log(msg); } public void Warn(string msg) { Debug.LogWarning(msg); } public void Error(string msg) { Debug.LogError(msg); } } } }
105
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As with any software that integrates with the Facebook platform, your use of * this software is subject to the Facebook Developer Principles and Policies * [http://developers.facebook.com/policy/]. This copyright notice shall be * included in all copies or substantial portions of the software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ namespace Facebook.Unity { using System; using System.Collections; using System.Collections.Generic; using UnityEngine; internal class FacebookScheduler : MonoBehaviour, IFacebookScheduler { public void Schedule(Action action, long delay) { this.StartCoroutine(DelayEvent(action, delay)); } public IEnumerator DelayEvent(Action action, long delay) { yield return new WaitForSeconds(delay); action(); } } }
42
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As with any software that integrates with the Facebook platform, your use of * this software is subject to the Facebook Developer Principles and Policies * [http://developers.facebook.com/policy/]. This copyright notice shall be * included in all copies or substantial portions of the software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ namespace Facebook.Unity { using System; using UnityEngine; internal class FacebookSchedulerFactory : IFacebookSchedulerFactory { public IFacebookScheduler GetInstance() { FacebookScheduler scheduler = ComponentFactory.GetComponent<FacebookScheduler>(); return scheduler; } } }
35
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As with any software that integrates with the Facebook platform, your use of * this software is subject to the Facebook Developer Principles and Policies * [http://developers.facebook.com/policy/]. This copyright notice shall be * included in all copies or substantial portions of the software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ namespace Facebook.Unity { using System; using UnityEngine; internal static class FBUnityUtility { private static string currentDeviceIdentifier; private static IAsyncRequestStringWrapper asyncRequestStringWrapper; public static string UnityDeviceIdentifier { get { if (string.IsNullOrEmpty(FBUnityUtility.currentDeviceIdentifier)) { FBUnityUtility.currentDeviceIdentifier = SystemInfo.deviceUniqueIdentifier; } return FBUnityUtility.currentDeviceIdentifier; } set { FBUnityUtility.currentDeviceIdentifier = value; } } public static IAsyncRequestStringWrapper AsyncRequestStringWrapper { get { if (FBUnityUtility.asyncRequestStringWrapper == null) { FBUnityUtility.asyncRequestStringWrapper = new AsyncRequestStringWrapper(); } return FBUnityUtility.asyncRequestStringWrapper; } set { FBUnityUtility.asyncRequestStringWrapper = value; } } } }
68
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As with any software that integrates with the Facebook platform, your use of * this software is subject to the Facebook Developer Principles and Policies * [http://developers.facebook.com/policy/]. This copyright notice shall be * included in all copies or substantial portions of the software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ namespace Facebook.Unity { /// <summary> /// Http method. /// </summary> public enum HttpMethod { /// <summary> /// Indicates that the request is a GET request. /// </summary> GET, /// <summary> /// Indicates that the request is a POST request. /// </summary> POST, /// <summary> /// Indicates that the request is a DELETE request. /// </summary> DELETE, } }
44
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As with any software that integrates with the Facebook platform, your use of * this software is subject to the Facebook Developer Principles and Policies * [http://developers.facebook.com/policy/]. This copyright notice shall be * included in all copies or substantial portions of the software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ namespace Facebook.Unity { using System; using System.Collections.Generic; using UnityEngine; public interface IAsyncRequestStringHandler { void Request( Uri url, HttpMethod method, WWWForm query = null, FacebookDelegate<IGraphResult> callback = null); void Request( Uri url, HttpMethod method, IDictionary<string, string> formData = null, FacebookDelegate<IGraphResult> callback = null); } }
42
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As with any software that integrates with the Facebook platform, your use of * this software is subject to the Facebook Developer Principles and Policies * [http://developers.facebook.com/policy/]. This copyright notice shall be * included in all copies or substantial portions of the software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ namespace Facebook.Unity { using System; using System.Collections.Generic; using UnityEngine; internal interface IAsyncRequestStringWrapper { void Request( Uri url, HttpMethod method, WWWForm query = null, FacebookDelegate<IGraphResult> callback = null); void Request( Uri url, HttpMethod method, IDictionary<string, string> formData = null, FacebookDelegate<IGraphResult> callback = null); } }
42
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As with any software that integrates with the Facebook platform, your use of * this software is subject to the Facebook Developer Principles and Policies * [http://developers.facebook.com/policy/]. This copyright notice shall be * included in all copies or substantial portions of the software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ namespace Facebook.Unity { internal interface IFacebookLogger { void Log(string msg); void Info(string msg); void Warn(string msg); void Error(string msg); } }
34
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As with any software that integrates with the Facebook platform, your use of * this software is subject to the Facebook Developer Principles and Policies * [http://developers.facebook.com/policy/]. This copyright notice shall be * included in all copies or substantial portions of the software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ namespace Facebook.Unity { using System; internal interface IFacebookScheduler { void Schedule( Action action, long delay = 0); } }
32
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As with any software that integrates with the Facebook platform, your use of * this software is subject to the Facebook Developer Principles and Policies * [http://developers.facebook.com/policy/]. This copyright notice shall be * included in all copies or substantial portions of the software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ namespace Facebook.Unity { using System; internal interface IFacebookSchedulerFactory { IFacebookScheduler GetInstance(); } }
30
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As with any software that integrates with the Facebook platform, your use of * this software is subject to the Facebook Developer Principles and Policies * [http://developers.facebook.com/policy/]. This copyright notice shall be * included in all copies or substantial portions of the software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ namespace Facebook.MiniJSON { using System; using System.Collections; using System.Collections.Generic; using System.Globalization; using System.IO; using System.Text; // Example usage: // // using UnityEngine; // using System.Collections; // using System.Collections.Generic; // using MiniJSON; // // public class MiniJSONTest : MonoBehaviour { // void Start () { // var jsonString = "{ \"array\": [1.44,2,3], " + // "\"object\": {\"key1\":\"value1\", \"key2\":256}, " + // "\"string\": \"The quick brown fox \\\"jumps\\\" over the lazy dog \", " + // "\"unicode\": \"\\u3041 Men\u00fa sesi\u00f3n\", " + // "\"int\": 65536, " + // "\"float\": 3.1415926, " + // "\"bool\": true, " + // "\"null\": null }"; // // var dict = Json.Deserialize(jsonString) as Dictionary<string,object>; // // Debug.Log("deserialized: " + dict.GetType()); // Debug.Log("dict['array'][0]: " + ((List<object>) dict["array"])[0]); // Debug.Log("dict['string']: " + (string) dict["string"]); // Debug.Log("dict['float']: " + (double) dict["float"]); // floats come out as doubles // Debug.Log("dict['int']: " + (long) dict["int"]); // ints come out as longs // Debug.Log("dict['unicode']: " + (string) dict["unicode"]); // // var str = Json.Serialize(dict); // // Debug.Log("serialized: " + str); // } // } /// <summary> /// This class encodes and decodes JSON strings. /// Spec. details, see http://www.json.org/ /// JSON uses Arrays and Objects. These correspond here to the datatypes IList and IDictionary. /// All numbers are parsed to doubles. /// </summary> public static class Json { // interpret all numbers as if they are english US formatted numbers private static NumberFormatInfo numberFormat = (new CultureInfo("en-US")).NumberFormat; /// <summary> /// Parses the string json into a value. /// </summary> /// <param name="json">A JSON string.</param> /// <returns>An List&lt;object&gt;, a Dictionary&lt;string, object&gt;, a double, an integer,a string, null, true, or false.</returns> public static object Deserialize(string json) { // save the string for debug information if (json == null) { return null; } return Parser.Parse(json); } /// <summary> /// Converts a IDictionary / IList object or a simple type (string, int, etc.) into a JSON string. /// </summary> /// <param name="obj">A Dictionary&lt;string, object&gt; / List&lt;object&gt;.</param> /// <returns>A JSON encoded string, or null if object 'json' is not serializable.</returns> public static string Serialize(object obj) { return Serializer.Serialize(obj); } private sealed class Parser : IDisposable { private const string WhiteSpace = " \t\n\r"; private const string WordBreak = " \t\n\r{}[],:\""; private StringReader json; private Parser(string jsonString) { this.json = new StringReader(jsonString); } private enum TOKEN { NONE, CURLY_OPEN, CURLY_CLOSE, SQUARED_OPEN, SQUARED_CLOSE, COLON, COMMA, STRING, NUMBER, TRUE, FALSE, NULL } private char PeekChar { get { return Convert.ToChar(this.json.Peek()); } } private char NextChar { get { return Convert.ToChar(this.json.Read()); } } private string NextWord { get { StringBuilder word = new StringBuilder(); while (WordBreak.IndexOf(this.PeekChar) == -1) { word.Append(this.NextChar); if (this.json.Peek() == -1) { break; } } return word.ToString(); } } private TOKEN NextToken { get { this.EatWhitespace(); if (this.json.Peek() == -1) { return TOKEN.NONE; } char c = this.PeekChar; switch (c) { case '{': return TOKEN.CURLY_OPEN; case '}': this.json.Read(); return TOKEN.CURLY_CLOSE; case '[': return TOKEN.SQUARED_OPEN; case ']': this.json.Read(); return TOKEN.SQUARED_CLOSE; case ',': this.json.Read(); return TOKEN.COMMA; case '"': return TOKEN.STRING; case ':': return TOKEN.COLON; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': case '-': return TOKEN.NUMBER; } string word = this.NextWord; switch (word) { case "false": return TOKEN.FALSE; case "true": return TOKEN.TRUE; case "null": return TOKEN.NULL; } return TOKEN.NONE; } } public static object Parse(string jsonString) { using (var instance = new Parser(jsonString)) { return instance.ParseValue(); } } public void Dispose() { this.json.Dispose(); this.json = null; } private Dictionary<string, object> ParseObject() { Dictionary<string, object> table = new Dictionary<string, object>(); // ditch opening brace this.json.Read(); // { while (true) { switch (this.NextToken) { case TOKEN.NONE: return null; case TOKEN.COMMA: continue; case TOKEN.CURLY_CLOSE: return table; default: // name string name = this.ParseString(); if (name == null) { return null; } // : if (this.NextToken != TOKEN.COLON) { return null; } // ditch the colon this.json.Read(); // value table[name] = this.ParseValue(); break; } } } private List<object> ParseArray() { List<object> array = new List<object>(); // ditch opening bracket this.json.Read(); // [ var parsing = true; while (parsing) { TOKEN nextToken = this.NextToken; switch (nextToken) { case TOKEN.NONE: return null; case TOKEN.COMMA: continue; case TOKEN.SQUARED_CLOSE: parsing = false; break; default: object value = this.ParseByToken(nextToken); array.Add(value); break; } } return array; } private object ParseValue() { TOKEN nextToken = this.NextToken; return this.ParseByToken(nextToken); } private object ParseByToken(TOKEN token) { switch (token) { case TOKEN.STRING: return this.ParseString(); case TOKEN.NUMBER: return this.ParseNumber(); case TOKEN.CURLY_OPEN: return this.ParseObject(); case TOKEN.SQUARED_OPEN: return this.ParseArray(); case TOKEN.TRUE: return true; case TOKEN.FALSE: return false; case TOKEN.NULL: return null; default: return null; } } private string ParseString() { StringBuilder s = new StringBuilder(); char c; // ditch opening quote this.json.Read(); bool parsing = true; while (parsing) { if (this.json.Peek() == -1) { parsing = false; break; } c = this.NextChar; switch (c) { case '"': parsing = false; break; case '\\': if (this.json.Peek() == -1) { parsing = false; break; } c = this.NextChar; switch (c) { case '"': case '\\': case '/': s.Append(c); break; case 'b': s.Append('\b'); break; case 'f': s.Append('\f'); break; case 'n': s.Append('\n'); break; case 'r': s.Append('\r'); break; case 't': s.Append('\t'); break; case 'u': var hex = new StringBuilder(); for (int i = 0; i < 4; i++) { hex.Append(this.NextChar); } s.Append((char)Convert.ToInt32(hex.ToString(), 16)); break; } break; default: s.Append(c); break; } } return s.ToString(); } private object ParseNumber() { string number = this.NextWord; if (number.IndexOf('.') == -1) { return long.Parse(number, numberFormat); } return double.Parse(number, numberFormat); } private void EatWhitespace() { while (WhiteSpace.IndexOf(this.PeekChar) != -1) { this.json.Read(); if (this.json.Peek() == -1) { break; } } } } private sealed class Serializer { private StringBuilder builder; private Serializer() { this.builder = new StringBuilder(); } public static string Serialize(object obj) { var instance = new Serializer(); instance.SerializeValue(obj); return instance.builder.ToString(); } private void SerializeValue(object value) { IList asList; IDictionary asDict; string asStr; if (value == null) { this.builder.Append("null"); } else if ((asStr = value as string) != null) { this.SerializeString(asStr); } else if (value is bool) { this.builder.Append(value.ToString().ToLower()); } else if ((asList = value as IList) != null) { this.SerializeArray(asList); } else if ((asDict = value as IDictionary) != null) { this.SerializeObject(asDict); } else if (value is char) { this.SerializeString(value.ToString()); } else { this.SerializeOther(value); } } private void SerializeObject(IDictionary obj) { bool first = true; this.builder.Append('{'); foreach (object e in obj.Keys) { if (!first) { this.builder.Append(','); } this.SerializeString(e.ToString()); this.builder.Append(':'); this.SerializeValue(obj[e]); first = false; } this.builder.Append('}'); } private void SerializeArray(IList array) { this.builder.Append('['); bool first = true; foreach (object obj in array) { if (!first) { this.builder.Append(','); } this.SerializeValue(obj); first = false; } this.builder.Append(']'); } private void SerializeString(string str) { this.builder.Append('\"'); char[] charArray = str.ToCharArray(); foreach (var c in charArray) { switch (c) { case '"': this.builder.Append("\\\""); break; case '\\': this.builder.Append("\\\\"); break; case '\b': this.builder.Append("\\b"); break; case '\f': this.builder.Append("\\f"); break; case '\n': this.builder.Append("\\n"); break; case '\r': this.builder.Append("\\r"); break; case '\t': this.builder.Append("\\t"); break; default: int codepoint = Convert.ToInt32(c); if ((codepoint >= 32) && (codepoint <= 126)) { this.builder.Append(c); } else { this.builder.Append("\\u" + Convert.ToString(codepoint, 16).PadLeft(4, '0')); } break; } } this.builder.Append('\"'); } private void SerializeOther(object value) { if (value is float || value is int || value is uint || value is long || value is double || value is sbyte || value is byte || value is short || value is ushort || value is ulong || value is decimal) { this.builder.Append(value.ToString()); } else { this.SerializeString(value.ToString()); } } } } }
615
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As with any software that integrates with the Facebook platform, your use of * this software is subject to the Facebook Developer Principles and Policies * [http://developers.facebook.com/policy/]. This copyright notice shall be * included in all copies or substantial portions of the software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ namespace Facebook.Unity { using System; using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Text; internal static class Utilities { private const string WarningMissingParameter = "Did not find expected value '{0}' in dictionary"; private static Dictionary<string, string> commandLineArguments; public delegate void Callback<T>(T obj); public static Dictionary<string, string> CommandLineArguments { get { if (commandLineArguments != null) { return commandLineArguments; } var localCommandLineArguments = new Dictionary<string, string>(); var arguments = Environment.GetCommandLineArgs(); for (int i = 0; i < arguments.Length; i++) { if (arguments[i].StartsWith("/") || arguments[i].StartsWith("-")) { var value = i + 1 < arguments.Length ? arguments[i + 1] : null; localCommandLineArguments.Add(arguments[i], value); } } commandLineArguments = localCommandLineArguments; return commandLineArguments; } } public static bool TryGetValue<T>( this IDictionary<string, object> dictionary, string key, out T value) { object resultObj; if (dictionary.TryGetValue(key, out resultObj) && resultObj is T) { value = (T)resultObj; return true; } value = default(T); return false; } public static long TotalSeconds(this DateTime dateTime) { TimeSpan t = dateTime - new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); long secondsSinceEpoch = (long)t.TotalSeconds; return secondsSinceEpoch; } public static T GetValueOrDefault<T>( this IDictionary<string, object> dictionary, string key, bool logWarning = true) { T result; if (!dictionary.TryGetValue<T>(key, out result) && logWarning) { FacebookLogger.Warn(WarningMissingParameter, key); } return result; } public static string ToCommaSeparateList(this IEnumerable<string> list) { if (list == null) { return string.Empty; } return string.Join(",", list.ToArray()); } public static string AbsoluteUrlOrEmptyString(this Uri uri) { if (uri == null) { return string.Empty; } return uri.AbsoluteUri; } public static string GetUserAgent(string productName, string productVersion) { return string.Format( CultureInfo.InvariantCulture, "{0}/{1}", productName, productVersion); } public static string ToJson(this IDictionary<string, object> dictionary) { return MiniJSON.Json.Serialize(dictionary); } public static void AddAllKVPFrom<T1, T2>(this IDictionary<T1, T2> dest, IDictionary<T1, T2> source) { foreach (T1 key in source.Keys) { dest[key] = source[key]; } } public static AccessToken ParseAccessTokenFromResult(IDictionary<string, object> resultDictionary) { string userID = resultDictionary.GetValueOrDefault<string>(LoginResult.UserIdKey); string accessToken = resultDictionary.GetValueOrDefault<string>(LoginResult.AccessTokenKey); DateTime expiration = Utilities.ParseExpirationDateFromResult(resultDictionary); ICollection<string> permissions = Utilities.ParsePermissionFromResult(resultDictionary); DateTime? lastRefresh = Utilities.ParseLastRefreshFromResult(resultDictionary); string graphDomain = resultDictionary.GetValueOrDefault<string>(LoginResult.GraphDomain); return new AccessToken( accessToken, userID, expiration, permissions, lastRefresh, graphDomain); } public static AuthenticationToken ParseAuthenticationTokenFromResult(IDictionary<string, object> resultDictionary) { string tokenString = resultDictionary.GetValueOrDefault<string>(LoginResult.AuthTokenString); string nonce = resultDictionary.GetValueOrDefault<string>(LoginResult.AuthNonce); return new AuthenticationToken(tokenString, nonce); } public static string ToStringNullOk(this object obj) { if (obj == null) { return "null"; } return obj.ToString(); } // Use this instead of reflection to avoid crashing at // runtime due to Unity's stripping public static string FormatToString( string baseString, string className, IDictionary<string, string> propertiesAndValues) { StringBuilder sb = new StringBuilder(); if (baseString != null) { sb.Append(baseString); } sb.AppendFormat("\n{0}:", className); foreach (var kvp in propertiesAndValues) { string value = kvp.Value != null ? kvp.Value : "null"; sb.AppendFormat("\n\t{0}: {1}", kvp.Key, value); } return sb.ToString(); } private static DateTime ParseExpirationDateFromResult(IDictionary<string, object> resultDictionary) { DateTime expiration; if (Constants.IsWeb) { // For canvas we get back the time as seconds since now instead of in epoch time. long timeTillExpiration = resultDictionary.GetValueOrDefault<long>(LoginResult.ExpirationTimestampKey); expiration = DateTime.UtcNow.AddSeconds(timeTillExpiration); } else { string expirationStr = resultDictionary.GetValueOrDefault<string>(LoginResult.ExpirationTimestampKey); int expiredTimeSeconds; if (int.TryParse(expirationStr, out expiredTimeSeconds) && expiredTimeSeconds > 0) { expiration = Utilities.FromTimestamp(expiredTimeSeconds); } else { expiration = DateTime.MaxValue; } } return expiration; } private static DateTime? ParseLastRefreshFromResult(IDictionary<string, object> resultDictionary) { string lastRefreshStr = resultDictionary.GetValueOrDefault<string>(LoginResult.LastRefreshKey, false); int lastRefresh; if (int.TryParse(lastRefreshStr, out lastRefresh) && lastRefresh > 0) { return Utilities.FromTimestamp(lastRefresh); } else { return null; } } private static ICollection<string> ParsePermissionFromResult(IDictionary<string, object> resultDictionary) { string permissions; IEnumerable<object> permissionList; // For permissions we can get the result back in either a comma separated string or // a list depending on the platform. if (resultDictionary.TryGetValue(LoginResult.PermissionsKey, out permissions)) { permissionList = permissions.Split(','); } else if (!resultDictionary.TryGetValue(LoginResult.PermissionsKey, out permissionList)) { permissionList = new string[0]; FacebookLogger.Warn("Failed to find parameter '{0}' in login result", LoginResult.PermissionsKey); } return permissionList.Select(permission => permission.ToString()).ToList(); } public static IList<Product> ParseCatalogFromResult(IDictionary<string, object> resultDictionary) { object catalogObject; IList<Product> products = new List<Product>(); if (resultDictionary.TryGetValue("success", out catalogObject)) { IList<object> deserializedCatalogObject = (IList<object>) MiniJSON.Json.Deserialize(catalogObject as string); foreach (IDictionary<string, object> product in deserializedCatalogObject) { products.Add(ParseProductFromCatalogResult(product)); } return products; } else { return null; } } public static Product ParseProductFromCatalogResult(IDictionary<string, object> product, bool isWindows = false) { string title = product["title"].ToStringNullOk(); string productID = product[isWindows ? "product_id" : "productID"].ToStringNullOk(); string description = product.ContainsKey("description") ? product["description"].ToStringNullOk():""; string imageURI = product.ContainsKey(isWindows ? "image_uri" : "imageURI") ? product[isWindows ? "image_uri" : "imageURI"].ToStringNullOk() : ""; string price = product["price"].ToStringNullOk(); double? priceAmount = product.ContainsKey(isWindows ? "price_amount" : "priceAmount") ? (double?)Convert.ToDouble(product[isWindows ? "price_amount" : "priceAmount"]) : null; string priceCurrencyCode = product[isWindows ? "price_currency_code" : "priceCurrencyCode"].ToStringNullOk(); return new Product(title, productID, description, imageURI, price, priceAmount, priceCurrencyCode); } public static IList<SubscribableProduct> ParseSubscribableCatalogFromResult(IDictionary<string, object> resultDictionary) { object catalogObject; IList<SubscribableProduct> subscribableProducts = new List<SubscribableProduct>(); if (resultDictionary.TryGetValue("success", out catalogObject)) { IList<object> deserializedCatalogObject = (IList<object>) MiniJSON.Json.Deserialize(catalogObject as string); foreach (IDictionary<string, object> subscribableProduct in deserializedCatalogObject) { subscribableProducts.Add(ParseSubscribableProductFromCatalogResult(subscribableProduct)); } return subscribableProducts; } else { return null; } } public static SubscribableProduct ParseSubscribableProductFromCatalogResult(IDictionary<string, object> product, bool isWindows = false) { string title = product["title"].ToStringNullOk(); string productID = product[isWindows ? "product_id" : "productID"].ToStringNullOk(); string description = product.ContainsKey("description") ? product["description"].ToStringNullOk():""; string imageURI = product.ContainsKey(isWindows ? "image_uri" : "imageURI") ? product[isWindows ? "image_uri" : "imageURI"].ToStringNullOk() : ""; string price = product["price"].ToStringNullOk(); double? priceAmount = product.ContainsKey(isWindows ? "price_amount" : "priceAmount") ? (double?)product[isWindows ? "price_amount" : "priceAmount"] : null; string priceCurrencyCode = product[isWindows ? "price_currency_code" : "priceCurrencyCode"].ToStringNullOk(); string subscriptionTerm = product[isWindows ? "subscription_term" : "subscriptionTerm"].ToStringNullOk(); return new SubscribableProduct(title, productID, description, imageURI, price, priceAmount, priceCurrencyCode, subscriptionTerm); } public static IList<Purchase> ParsePurchasesFromResult(IDictionary<string, object> resultDictionary) { object purchasesObject; IList<Purchase> purchases = new List<Purchase>(); if (resultDictionary.TryGetValue("success", out purchasesObject)) { IList<object> deserializedPurchasesObject = (IList<object>) MiniJSON.Json.Deserialize(purchasesObject as string); foreach (IDictionary<string, object> purchase in (List<object>) deserializedPurchasesObject) { purchases.Add(ParsePurchaseFromDictionary(purchase)); } return purchases; } else { return null; } } public static Purchase ParsePurchaseFromResult(IDictionary<string, object> resultDictionary) { object purchaseObject; if (resultDictionary.TryGetValue("success", out purchaseObject)) { IDictionary<string, object> deserializedPurchaseObject = (IDictionary<string, object>) MiniJSON.Json.Deserialize(purchaseObject as string); return ParsePurchaseFromDictionary(deserializedPurchaseObject); } else { return null; } } public static IList<Subscription> ParseSubscriptionsFromResult(IDictionary<string, object> resultDictionary) { object subscriptionsObject; IList<Subscription> subscriptions = new List<Subscription>(); if (resultDictionary.TryGetValue("success", out subscriptionsObject)) { IList<object> deserializedSubscriptionsObject = (IList<object>) MiniJSON.Json.Deserialize(subscriptionsObject as string); foreach (IDictionary<string, object> subscription in (List<object>) deserializedSubscriptionsObject) { subscriptions.Add(ParseSubscriptionFromDictionary(subscription)); } return subscriptions; } else { return null; } } public static Subscription ParseSubscriptionFromResult(IDictionary<string, object> resultDictionary) { object subscriptionObject; if (resultDictionary.TryGetValue("success", out subscriptionObject)) { IDictionary<string, object> deserializedSubscriptionObject = (IDictionary<string, object>) MiniJSON.Json.Deserialize(subscriptionObject as string); return ParseSubscriptionFromDictionary(deserializedSubscriptionObject); } else { return null; } } public static Purchase ParsePurchaseFromDictionary(IDictionary<string, object> purchase, bool isWindows = false) { bool isConsumed = false; if ( !purchase.TryGetValue(isWindows ? "is_consumed" : "isConsumed", out isConsumed)) // compatibility with Graph API 11 or higher { purchase.TryGetValue(isWindows ? "consumed" : "isConsumed", out isConsumed); // compatibility with Graph API 10 or lower } string developerPayload = purchase.ContainsKey(isWindows ? "developer_payload" : "developerPayload") ? purchase[isWindows ? "developer_payload" : "developerPayload"].ToStringNullOk() : ""; string paymentActionType = "charge"; if (purchase.ContainsKey("payment_action_type") || purchase.ContainsKey("paymentActionType")) { paymentActionType = purchase[isWindows ? "payment_action_type" : "paymentActionType"].ToStringNullOk(); } string paymentID = purchase[isWindows ? "payment_id" : "paymentID"].ToStringNullOk(); string productID = purchase[isWindows ? "product_id" : "productID"].ToStringNullOk(); IDictionary<string, object> purchasePrice = new Dictionary<string, object>(); if (purchase.ContainsKey("purchase_price") || purchase.ContainsKey("purchasePrice")) { purchasePrice = (IDictionary<string, object>)purchase[isWindows ? "purchase_price" : "purchasePrice"]; } else { purchasePrice.Add("amount", "1.11"); purchasePrice.Add("currency", "USD"); } long purchaseTime; if (isWindows) { purchase.TryGetValue("purchase_time", out purchaseTime); } else { purchase.TryGetValue("purchaseTime", out purchaseTime); } string purchaseToken = purchase[isWindows ? "purchase_token" : "purchaseToken"].ToStringNullOk(); string signedRequest = purchase[isWindows ? "signed_request" : "signedRequest"].ToStringNullOk(); string purchasePlatform = purchase[isWindows ? "purchase_platform" : "purchasePlatform"].ToStringNullOk(); return new Purchase(developerPayload, isConsumed, paymentActionType, paymentID, productID, purchasePlatform, purchasePrice, purchaseTime, purchaseToken, signedRequest); } public static Subscription ParseSubscriptionFromDictionary(IDictionary<string, object> subscription, bool isWindows = false) { long deactivationTime; subscription.TryGetValue(isWindows ? "deactivation_time" : "deactivationTime", out deactivationTime); bool isEntitlementActive; subscription.TryGetValue(isWindows ? "is_entitlement_active" : "isEntitlementActive", out isEntitlementActive); // compatibility with Graph API 10 or lower long periodStartTime; subscription.TryGetValue(isWindows ? "period_start_time" : "periodStartTime", out periodStartTime); long periodEndTime; subscription.TryGetValue(isWindows ? "period_end_time" : "period_end_time", out periodEndTime); string productID = subscription[isWindows ? "product_id" : "productID"].ToStringNullOk(); long purchaseTime; subscription.TryGetValue(isWindows ? "purchase_time" : "purchaseTime", out purchaseTime); IDictionary<string, object> purchasePrice = new Dictionary<string, object>(); purchasePrice = (IDictionary<string, object>)subscription[isWindows ? "purchase_price" : "purchasePrice"]; string purchasePlatform = subscription[isWindows ? "purchase_platform" : "purchasePlatform"].ToStringNullOk(); string purchaseToken = subscription[isWindows ? "purchase_token" : "purchaseToken"].ToStringNullOk(); string status = subscription["status"].ToStringNullOk(); string signedRequest = subscription[isWindows ? "signed_request" : "signedRequest"].ToStringNullOk(); string subscriptionTerm = subscription[isWindows ? "subscription_term" : "subscriptionTerm"].ToStringNullOk(); return new Subscription(deactivationTime, isEntitlementActive, periodStartTime, periodEndTime, productID, purchasePlatform, purchasePrice, purchaseTime, purchaseToken, signedRequest, status, subscriptionTerm); } public static IDictionary<string, string> ParseStringDictionaryFromString(string input) { Dictionary<string, object> dict = MiniJSON.Json.Deserialize(input) as Dictionary<string, object>; if (dict == null || dict.Count == 0) { return null; } IDictionary<string, string> result = new Dictionary<string, string>(); foreach (KeyValuePair<string, object> kvp in dict) { result.Add(kvp.Key, kvp.Value != null ? kvp.Value.ToString() : ""); } return result; } // key parameter is the key whose value is the inner dictionary that will be parsed public static IDictionary<string, string> ParseInnerStringDictionary(IDictionary<string, object> resultDictionary, string key) { object resultObject; if (resultDictionary.TryGetValue(key, out resultObject)) { return ParseStringDictionaryFromString(resultObject as string); } else { return null; } } public static DateTime FromTimestamp(int timestamp) { return new DateTime(1970, 1, 1, 0, 0, 0, 0).AddSeconds(timestamp); } } }
500
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As with any software that integrates with the Facebook platform, your use of * this software is subject to the Facebook Developer Principles and Policies * [http://developers.facebook.com/policy/]. This copyright notice shall be * included in all copies or substantial portions of the software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ namespace Facebook.Unity.Windows { internal interface IWindowsFacebook : IPayFacebook, IFacebook { void SetVirtualGamepadLayout(string layout, FacebookDelegate<IVirtualGamepadLayoutResult> callback); void SetSoftKeyboardOpen(bool open, FacebookDelegate<ISoftKeyboardOpenResult> callback); void CreateReferral(string payload, FacebookDelegate<IReferralsCreateResult> callback); void GetDataReferral(FacebookDelegate<IReferralsGetDataResult> callback); } }
34
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As with any software that integrates with the Facebook platform, your use of * this software is subject to the Facebook Developer Principles and Policies * [http://developers.facebook.com/policy/]. This copyright notice shall be * included in all copies or substantial portions of the software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ namespace Facebook.Unity.Windows { internal interface IWindowsFacebookImplementation : IWindowsFacebook, IWindowsFacebookResultHandler { void Tick(); void Deinit(); } }
30
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As with any software that integrates with the Facebook platform, your use of * this software is subject to the Facebook Developer Principles and Policies * [http://developers.facebook.com/policy/]. This copyright notice shall be * included in all copies or substantial portions of the software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ namespace Facebook.Unity.Windows { internal interface IWindowsFacebookResultHandler : IFacebookResultHandler { } }
27
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As with any software that integrates with the Facebook platform, your use of * this software is subject to the Facebook Developer Principles and Policies * [http://developers.facebook.com/policy/]. This copyright notice shall be * included in all copies or substantial portions of the software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ namespace Facebook.Unity.Windows { using System; using System.Collections.Generic; internal interface IWindowsWrapper { bool Init(string appId, string clientToken); void LogInWithScopes(IEnumerable<string> scope, string callbackId, CallbackManager callbackManager); bool IsLoggedIn(); void LogOut(); void Tick(); void Deinit(); void GetCatalog(string callbackId, CallbackManager callbackManager); void GetPurchases(string callbackId, CallbackManager callbackManager); void Purchase(string productID, string developerPayload, string callbackId, CallbackManager callbackManager); void ConsumePurchase(string productToken, string callbackId, CallbackManager callbackManager); void CurrentProfile(string callbackId, CallbackManager callbackManager); void LoadInterstitialAd(string placementID, string callbackId, CallbackManager callbackManager); void ShowInterstitialAd(string placementID, string callbackId, CallbackManager callbackManager); void LoadRewardedVideo(string placementID, string callbackId, CallbackManager callbackManager); void ShowRewardedVideo(string placementID, string callbackId, CallbackManager callbackManager); void OpenFriendFinderDialog(string callbackId, CallbackManager callbackManager); void GetFriendFinderInvitations(string callbackId, CallbackManager callbackManager); void DeleteFriendFinderInvitation(string invitationId, string callbackId, CallbackManager callbackManager); void ScheduleAppToUserNotification(string title, string body, Uri media, int timeInterval, string payload, string callbackId, CallbackManager callbackManager); void PostSessionScore(int score, string callbackId, CallbackManager callbackManager); void PostTournamentScore(int score, string callbackId, CallbackManager callbackManager); void GetTournament(string callbackId, CallbackManager callbackManager); void ShareTournament(int score, Dictionary<string, string> data, string callbackId, CallbackManager callbackManager); void CreateTournament(int initialScore, string title, string imageBase64DataUrl, string sortOrder, string scoreFormat, Dictionary<string, string> data, string callbackId, CallbackManager callbackManager); void UploadImageToMediaLibrary(string caption, Uri imageUri, bool shouldLaunchMediaDialog, string callbackId, string travelId, CallbackManager callbackManager); void UploadVideoToMediaLibrary(string caption, Uri videoUri, bool shouldLaunchMediaDialog, string callbackId, string travelId, CallbackManager callbackManager); void SetVirtualGamepadLayout(string layout, string callbackId, CallbackManager callbackManager); void GetUserLocale(string callbackId, CallbackManager callbackManager); void SetSoftKeyboardOpen(bool open, string callbackId, CallbackManager callbackManager); void CreateReferral(string payload, string callbackId, CallbackManager callbackManager); void GetDataReferral(string callbackId, CallbackManager callbackManager); } }
91
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As with any software that integrates with the Facebook platform, your use of * this software is subject to the Facebook Developer Principles and Policies * [http://developers.facebook.com/policy/]. This copyright notice shall be * included in all copies or substantial portions of the software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ namespace Facebook.Unity.Windows { using System; using System.Collections.Generic; using System.Reflection; internal sealed class WindowsFacebook : FacebookBase, IWindowsFacebookImplementation { private string appId; private IWindowsWrapper windowsWrapper; public WindowsFacebook() : this(GetWindowsWrapper(), new CallbackManager()) { } public WindowsFacebook(IWindowsWrapper windowsWrapper, CallbackManager callbackManager) : base(callbackManager) { this.windowsWrapper = windowsWrapper; } public delegate void OnComplete(ResultContainer resultContainer); public override bool LimitEventUsage { get; set; } public override string SDKName { get { return "FBWindowsSDK"; } } public override string SDKVersion { get { return "1.0.15"; } } public void Init( string appId, string clientToken, HideUnityDelegate hideUnityDelegate, InitDelegate onInitComplete) { this.appId = appId; Initialized = this.windowsWrapper.Init(appId, clientToken); onInitComplete.Invoke(); } public override void LogInWithPublishPermissions(IEnumerable<string> scope, FacebookDelegate<ILoginResult> callback) { this.windowsWrapper.LogInWithScopes(scope, this.CallbackManager.AddFacebookDelegate(callback), this.CallbackManager); } public override void LogInWithReadPermissions(IEnumerable<string> scope, FacebookDelegate<ILoginResult> callback) { this.windowsWrapper.LogInWithScopes(scope, this.CallbackManager.AddFacebookDelegate(callback), this.CallbackManager); } public override void LogOut() { this.windowsWrapper.LogOut(); } public override bool LoggedIn { get { return this.windowsWrapper.IsLoggedIn(); } } public override void ActivateApp(string appId = null) { this.AppEventsLogEvent( AppEventName.ActivatedApp, null, new Dictionary<string, object>()); } public override void AppEventsLogEvent(string logEvent, float? valueToSum, Dictionary<string, object> parameters) { var appEventParameters = parameters != null ? parameters : new Dictionary<string, object>(); appEventParameters.Add("_eventName", logEvent); if (valueToSum.HasValue) { appEventParameters.Add("_valueToSum", valueToSum.Value); } var formData = new Dictionary<string, string> { { "event", "CUSTOM_APP_EVENTS" }, { "application_tracking_enabled", "0" }, { "advertiser_tracking_enabled", "0" }, { "custom_events", string.Format("[{0}]", MiniJSON.Json.Serialize(appEventParameters)) }, }; FB.API( string.Format("{0}/activities", this.appId), HttpMethod.POST, null, formData); } public override void AppEventsLogPurchase( float logPurchase, string currency, Dictionary<string, object> parameters) { if (parameters == null) { parameters = new Dictionary<string, object>(); } parameters.Add("currency", currency); this.AppEventsLogEvent( AppEventName.Purchased, logPurchase, parameters); } public override void GetCatalog(FacebookDelegate<ICatalogResult> callback) { this.windowsWrapper.GetCatalog(this.CallbackManager.AddFacebookDelegate(callback), this.CallbackManager); } public override void GetPurchases(FacebookDelegate<IPurchasesResult> callback) { this.windowsWrapper.GetPurchases(this.CallbackManager.AddFacebookDelegate(callback), this.CallbackManager); } public override void Purchase(string productID, FacebookDelegate<IPurchaseResult> callback, string developerPayload = "") { this.windowsWrapper.Purchase(productID, developerPayload, this.CallbackManager.AddFacebookDelegate(callback), this.CallbackManager); } public override void ConsumePurchase(string productToken, FacebookDelegate<IConsumePurchaseResult> callback) { this.windowsWrapper.ConsumePurchase(productToken, this.CallbackManager.AddFacebookDelegate(callback), this.CallbackManager); } public override void GetSubscribableCatalog(FacebookDelegate<ISubscribableCatalogResult> callback) { throw new NotImplementedException(); } public override void GetSubscriptions(FacebookDelegate<ISubscriptionsResult> callback) { throw new NotImplementedException(); } public override void PurchaseSubscription(string productID, FacebookDelegate<ISubscriptionResult> callback) { throw new NotImplementedException(); } public override void CancelSubscription(string purchaseToken, FacebookDelegate<ICancelSubscriptionResult> callback) { throw new NotImplementedException(); } public override void CurrentProfile(FacebookDelegate<IProfileResult> callback) { this.windowsWrapper.CurrentProfile(this.CallbackManager.AddFacebookDelegate(callback), this.CallbackManager); } public override void LoadInterstitialAd(string placementID, FacebookDelegate<IInterstitialAdResult> callback) { this.windowsWrapper.LoadInterstitialAd(placementID, this.CallbackManager.AddFacebookDelegate(callback), this.CallbackManager); } public override void ShowInterstitialAd(string placementID, FacebookDelegate<IInterstitialAdResult> callback) { this.windowsWrapper.ShowInterstitialAd(placementID, this.CallbackManager.AddFacebookDelegate(callback), this.CallbackManager); } public override void LoadRewardedVideo(string placementID, FacebookDelegate<IRewardedVideoResult> callback) { this.windowsWrapper.LoadRewardedVideo(placementID, this.CallbackManager.AddFacebookDelegate(callback), this.CallbackManager); } public override void ShowRewardedVideo(string placementID, FacebookDelegate<IRewardedVideoResult> callback) { this.windowsWrapper.ShowRewardedVideo(placementID, this.CallbackManager.AddFacebookDelegate(callback), this.CallbackManager); } public override void OpenFriendFinderDialog(FacebookDelegate<IGamingServicesFriendFinderResult> callback) { this.windowsWrapper.OpenFriendFinderDialog(this.CallbackManager.AddFacebookDelegate(callback), this.CallbackManager); } public override void GetFriendFinderInvitations(FacebookDelegate<IFriendFinderInvitationResult> callback) { this.windowsWrapper.GetFriendFinderInvitations(this.CallbackManager.AddFacebookDelegate(callback), this.CallbackManager); } public override void DeleteFriendFinderInvitation(string invitationId, FacebookDelegate<IFriendFinderInvitationResult> callback) { this.windowsWrapper.DeleteFriendFinderInvitation(invitationId, this.CallbackManager.AddFacebookDelegate(callback), this.CallbackManager); } public override void ScheduleAppToUserNotification(string title, string body, Uri media, int timeInterval, string payload, FacebookDelegate<IScheduleAppToUserNotificationResult> callback) { this.windowsWrapper.ScheduleAppToUserNotification(title, body, media, timeInterval, payload, this.CallbackManager.AddFacebookDelegate(callback), this.CallbackManager); } public override void PostSessionScore(int score, FacebookDelegate<ISessionScoreResult> callback) { this.windowsWrapper.PostSessionScore(score, this.CallbackManager.AddFacebookDelegate(callback), this.CallbackManager); } public override void PostTournamentScore(int score, FacebookDelegate<ITournamentScoreResult> callback) { this.windowsWrapper.PostTournamentScore(score, this.CallbackManager.AddFacebookDelegate(callback), this.CallbackManager); } public override void GetTournament(FacebookDelegate<ITournamentResult> callback) { this.windowsWrapper.GetTournament(this.CallbackManager.AddFacebookDelegate(callback), this.CallbackManager); } public override void ShareTournament(int score, Dictionary<string, string> data, FacebookDelegate<ITournamentScoreResult> callback) { this.windowsWrapper.ShareTournament(score,data,this.CallbackManager.AddFacebookDelegate(callback), this.CallbackManager); } public override void CreateTournament(int initialScore, string title, string imageBase64DataUrl, string sortOrder, string scoreFormat, Dictionary<string, string> data, FacebookDelegate<ITournamentResult> callback) { this.windowsWrapper.CreateTournament(initialScore, title, imageBase64DataUrl, sortOrder, scoreFormat, data, this.CallbackManager.AddFacebookDelegate(callback), this.CallbackManager); } public new void UploadImageToMediaLibrary(string caption, Uri imageUri, bool shouldLaunchMediaDialog, string travelId, FacebookDelegate<IMediaUploadResult> callback) { this.windowsWrapper.UploadImageToMediaLibrary(caption,imageUri, shouldLaunchMediaDialog, travelId, this.CallbackManager.AddFacebookDelegate(callback), this.CallbackManager); } public new void UploadVideoToMediaLibrary(string caption, Uri videoUri, bool shouldLaunchMediaDialog, string travelId, FacebookDelegate<IMediaUploadResult> callback) { this.windowsWrapper.UploadVideoToMediaLibrary(caption, videoUri, shouldLaunchMediaDialog, travelId, this.CallbackManager.AddFacebookDelegate(callback), this.CallbackManager); } public override void UploadImageToMediaLibrary(string caption, Uri imageUri, bool shouldLaunchMediaDialog, FacebookDelegate<IMediaUploadResult> callback) { this.windowsWrapper.UploadImageToMediaLibrary(caption, imageUri, shouldLaunchMediaDialog, "", this.CallbackManager.AddFacebookDelegate(callback), this.CallbackManager); } public override void UploadVideoToMediaLibrary(string caption, Uri videoUri, bool shouldLaunchMediaDialog, FacebookDelegate<IMediaUploadResult> callback) { this.windowsWrapper.UploadVideoToMediaLibrary(caption, videoUri, shouldLaunchMediaDialog, "", this.CallbackManager.AddFacebookDelegate(callback), this.CallbackManager); } public override void GetUserLocale(FacebookDelegate<ILocaleResult> callback) { this.windowsWrapper.GetUserLocale(this.CallbackManager.AddFacebookDelegate(callback), this.CallbackManager); } private static IWindowsWrapper GetWindowsWrapper() { Assembly assembly = Assembly.Load("Facebook.Unity.Windows"); Type type = assembly.GetType("Facebook.Unity.Windows.WindowsWrapper"); IWindowsWrapper windowsWrapper = (IWindowsWrapper)Activator.CreateInstance(type); return windowsWrapper; } // Only Windows SDK public void Tick() { this.windowsWrapper.Tick(); } public void Deinit() { this.windowsWrapper.Deinit(); } public void SetVirtualGamepadLayout(string layout, FacebookDelegate<IVirtualGamepadLayoutResult> callback) { this.windowsWrapper.SetVirtualGamepadLayout(layout, this.CallbackManager.AddFacebookDelegate(callback), this.CallbackManager); } public void SetSoftKeyboardOpen(bool open, FacebookDelegate<ISoftKeyboardOpenResult> callback) { this.windowsWrapper.SetSoftKeyboardOpen(open, this.CallbackManager.AddFacebookDelegate(callback), this.CallbackManager); } public void CreateReferral(string payload, FacebookDelegate<IReferralsCreateResult> callback) { this.windowsWrapper.CreateReferral(payload, this.CallbackManager.AddFacebookDelegate(callback), this.CallbackManager); } public void GetDataReferral(FacebookDelegate<IReferralsGetDataResult> callback) { this.windowsWrapper.GetDataReferral(this.CallbackManager.AddFacebookDelegate(callback), this.CallbackManager); } // Not supported by Windows SDK 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) { throw new NotSupportedException(); } public override void OnAppRequestsComplete(ResultContainer resultContainer) { throw new NotSupportedException(); } public override void OnLoginComplete(ResultContainer resultContainer) { throw new NotSupportedException(); } public override void FeedShare(string toId, Uri link, string linkName, string linkCaption, string linkDescription, Uri picture, string mediaSource, FacebookDelegate<IShareResult> callback) { throw new NotSupportedException(); } public override void ShareLink(Uri contentURL, string contentTitle, string contentDescription, Uri photoURL, FacebookDelegate<IShareResult> callback) { throw new NotSupportedException(); } public override void GetAppLink(FacebookDelegate<IAppLinkResult> callback) { throw new NotSupportedException(); } public override void OnShareLinkComplete(ResultContainer resultContainer) { throw new NotSupportedException(); } public override void OnGetAppLinkComplete(ResultContainer resultContainer) { throw new NotSupportedException(); } public void Pay(string product, string action, int quantity, int? quantityMin, int? quantityMax, string requestId, string pricepointId, string testCurrency, FacebookDelegate<IPayResult> callback) { throw new NotSupportedException(); } public void PayWithProductId(string productId, string action, int quantity, int? quantityMin, int? quantityMax, string requestId, string pricepointId, string testCurrency, FacebookDelegate<IPayResult> callback) { throw new NotSupportedException(); } public void PayWithProductId(string productId, string action, string developerPayload, string testCurrency, FacebookDelegate<IPayResult> callback) { throw new NotSupportedException(); } public override Profile CurrentProfile() { throw new NotSupportedException(); } } }
370
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As with any software that integrates with the Facebook platform, your use of * this software is subject to the Facebook Developer Principles and Policies * [http://developers.facebook.com/policy/]. This copyright notice shall be * included in all copies or substantial portions of the software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ namespace Facebook.Unity.Windows { using System.Collections; internal class WindowsFacebookGameObject : FacebookGameObject, IFacebookCallbackHandler { protected IWindowsFacebookImplementation WindowsFacebookImpl { get { return (IWindowsFacebookImplementation)this.Facebook; } } protected override void OnAwake() { } public void Update() { this.WindowsFacebookImpl.Tick(); } public void OnDestroy() { this.WindowsFacebookImpl.Deinit(); } } }
49
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As with any software that integrates with the Facebook platform, your use of * this software is subject to the Facebook Developer Principles and Policies * [http://developers.facebook.com/policy/]. This copyright notice shall be * included in all copies or substantial portions of the software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ namespace Facebook.Unity.Windows { internal class WindowsFacebookLoader : FB.CompiledFacebookLoader { protected override FacebookGameObject FBGameObject { get { WindowsFacebookGameObject windowsFB = ComponentFactory.GetComponent<WindowsFacebookGameObject>(); if (windowsFB.Facebook == null) { windowsFB.Facebook = new WindowsFacebook(); } return windowsFB; } } } }
40
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As with any software that integrates with the Facebook platform, your use of * this software is subject to the Facebook Developer Principles and Policies * [http://developers.facebook.com/policy/]. This copyright notice shall be * included in all copies or substantial portions of the software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ namespace Facebook.Unity.Android { using Facebook.Unity.Mobile.Android; using UnityEngine; internal class AndroidWrapper : IAndroidWrapper { private const string FacebookJavaClassName = "com.facebook.unity.FB"; private AndroidJavaClass facebookJavaClass = new AndroidJavaClass(FacebookJavaClassName); public T CallStatic<T>(string methodName) { return this.facebookJavaClass.CallStatic<T>(methodName); } public void CallStatic(string methodName, params object[] args) { this.facebookJavaClass.CallStatic(methodName, args); } } }
42
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As with any software that integrates with the Facebook platform, your use of * this software is subject to the Facebook Developer Principles and Policies * [http://developers.facebook.com/policy/]. This copyright notice shall be * included in all copies or substantial portions of the software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ using System.Reflection; using System.Runtime.CompilerServices; [assembly: AssemblyVersion("16.0.1")]
25
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As with any software that integrates with the Facebook platform, your use of * this software is subject to the Facebook Developer Principles and Policies * [http://developers.facebook.com/policy/]. This copyright notice shall be * included in all copies or substantial portions of the software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ namespace Facebook.Unity.Android { public class AndroidWrapper { } }
27
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As with any software that integrates with the Facebook platform, your use of * this software is subject to the Facebook Developer Principles and Policies * [http://developers.facebook.com/policy/]. This copyright notice shall be * included in all copies or substantial portions of the software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ using System.Reflection; using System.Runtime.CompilerServices; [assembly: AssemblyVersion("16.0.1")]
25
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As with any software that integrates with the Facebook platform, your use of * this software is subject to the Facebook Developer Principles and Policies * [http://developers.facebook.com/policy/]. This copyright notice shall be * included in all copies or substantial portions of the software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ namespace Facebook.Unity.Canvas { using System.Collections.Generic; using System.Runtime.InteropServices; using UnityEngine; internal class CanvasJSWrapper : ICanvasJSWrapper { public string GetSDKVersion() { return Constants.GraphApiVersion; } public void DisableFullScreen() { if (Screen.fullScreen) { Screen.fullScreen = false; } } public void Init(string connectFacebookUrl, string locale, int debug, string initParams, int status) { init(connectFacebookUrl, locale, debug, initParams, status); } public void Login(IEnumerable<string> scope, string callback_id) { login(MiniJSON.Json.Serialize(scope), callback_id); } public void Logout() { logout(); } public void ActivateApp() { activateApp(); } public void LogAppEvent(string eventName, float? valueToSum, string parameters) { logAppEvent(eventName, valueToSum.GetValueOrDefault(), parameters); } public void LogPurchase(float purchaseAmount, string currency, string parameters) { logPurchase(purchaseAmount, currency, parameters); } public void Ui(string x, string uid, string callbackMethodName) { ui(x, uid, callbackMethodName); } public void InitScreenPosition() { initScreenPosition(); } [DllImport("__Internal")] private static extern void init(string connectFacebookUrl, string locale, int debug, string initParams, int status); [DllImport("__Internal")] private static extern void login(string scope, string callback_id); [DllImport("__Internal")] private static extern void logout(); [DllImport("__Internal")] private static extern void activateApp(); [DllImport("__Internal")] private static extern void logAppEvent(string eventName, float valueToSum, string parameters); [DllImport("__Internal")] private static extern void logPurchase(float purchaseAmount, string currency, string parameters); [DllImport("__Internal")] private static extern void ui(string x, string uid, string callbackMethodName); [DllImport("__Internal")] private static extern void initScreenPosition(); } }
101
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As with any software that integrates with the Facebook platform, your use of * this software is subject to the Facebook Developer Principles and Policies * [http://developers.facebook.com/policy/]. This copyright notice shall be * included in all copies or substantial portions of the software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ using System.Reflection; using System.Runtime.CompilerServices; [assembly: AssemblyVersion("16.0.1")]
25
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As with any software that integrates with the Facebook platform, your use of * this software is subject to the Facebook Developer Principles and Policies * [http://developers.facebook.com/policy/]. This copyright notice shall be * included in all copies or substantial portions of the software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ namespace Facebook.Unity.Editor { using System.Globalization; using System.IO; using UnityEditor; using UnityEngine; internal class FacebookBuild { private const string FacebookPath = "Assets/FacebookSDK/"; private const string SDKPath = "Assets/FacebookSDK/SDK/"; private const string ExamplesPath = "Assets/FacebookSDK/Examples/"; private const string PluginsPath = "Assets/FacebookSDK/Plugins/"; private const string StreamingAssetsPath = "Assets/StreamingAssets/"; private const string ExternalDependencyManagerPath = "Assets/ExternalDependencyManager/"; private const string EditorPath = "Assets/Editor/"; public enum Target { DEBUG, RELEASE } private static string PackageName { get { return string.Format( CultureInfo.InvariantCulture, "facebook-unity-sdk-{0}.unitypackage", FacebookSdkVersion.Build); } } private static string OutputPath { get { DirectoryInfo projectRoot = Directory.GetParent(Directory.GetCurrentDirectory()); var outputDirectory = new DirectoryInfo(Path.Combine(projectRoot.FullName, "out")); // Create the directory if it doesn't exist outputDirectory.Create(); return Path.Combine(outputDirectory.FullName, FacebookBuild.PackageName); } } // Exporting the *.unityPackage for Asset store public static string ExportPackage() { Debug.Log("Exporting Facebook Unity Package..."); string path = OutputPath; try { if (!File.Exists(Path.Combine(Application.dataPath, "Temp"))) { AssetDatabase.CreateFolder("Assets", "Temp"); } AssetDatabase.MoveAsset(SDKPath + "Resources/FacebookSettings.asset", "Assets/Temp/FacebookSettings.asset"); AssetDatabase.DeleteAsset(PluginsPath + "Android/AndroidManifest.xml"); AssetDatabase.DeleteAsset(PluginsPath + "Android/AndroidManifest.xml.meta"); string[] facebookFiles = (string[])Directory.GetFiles(FacebookPath, "*.*", SearchOption.TopDirectoryOnly); string[] sdkFiles = (string[])Directory.GetFiles(SDKPath, "*.*", SearchOption.AllDirectories); string[] exampleFiles = (string[])Directory.GetFiles(ExamplesPath, "*.*", SearchOption.AllDirectories); string[] pluginsFiles = (string[])Directory.GetFiles(PluginsPath, "*.*", SearchOption.AllDirectories); string[] streamingAssetsFiles = (string[])Directory.GetFiles(StreamingAssetsPath, "*.*", SearchOption.AllDirectories); string[] externalDependencyManagerFiles = (string[])Directory.GetFiles(ExternalDependencyManagerPath, "*.*", SearchOption.AllDirectories); string[] editorFiles = (string[])Directory.GetFiles(EditorPath, "*.*", SearchOption.AllDirectories); string[] files = new string[facebookFiles.Length + sdkFiles.Length + exampleFiles.Length + pluginsFiles.Length + streamingAssetsFiles.Length + externalDependencyManagerFiles.Length + editorFiles.Length]; facebookFiles.CopyTo(files, 0); sdkFiles.CopyTo(files, facebookFiles.Length); exampleFiles.CopyTo(files, sdkFiles.Length + facebookFiles.Length); pluginsFiles.CopyTo(files, sdkFiles.Length + facebookFiles.Length + exampleFiles.Length); streamingAssetsFiles.CopyTo(files, sdkFiles.Length + facebookFiles.Length + exampleFiles.Length + pluginsFiles.Length); externalDependencyManagerFiles.CopyTo(files, sdkFiles.Length + facebookFiles.Length + exampleFiles.Length + pluginsFiles.Length + streamingAssetsFiles.Length); editorFiles.CopyTo(files, sdkFiles.Length + facebookFiles.Length + exampleFiles.Length + pluginsFiles.Length + streamingAssetsFiles.Length + externalDependencyManagerFiles.Length); AssetDatabase.ExportPackage( files, path, ExportPackageOptions.IncludeDependencies | ExportPackageOptions.Recurse); } finally { // Move files back no matter what AssetDatabase.MoveAsset("Assets/Temp/FacebookSettings.asset", SDKPath + "Resources/FacebookSettings.asset"); AssetDatabase.DeleteAsset("Assets/Temp"); // regenerate the manifest ManifestMod.GenerateManifest(); } Debug.Log("Finished exporting!"); return path; } } }
123
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As with any software that integrates with the Facebook platform, your use of * this software is subject to the Facebook Developer Principles and Policies * [http://developers.facebook.com/policy/]. This copyright notice shall be * included in all copies or substantial portions of the software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /// <summary> /// Facebook console endpoint. This endpoint exposes some internal functionality /// that can be called with unity from the command line. This class is public and static /// outside of a namespace to enable it to be called by unity. /// </summary> using Facebook.Unity.Editor; public static class FacebookConsoleEndpoint { public static void ExportPackage() { FacebookBuild.ExportPackage(); } }
35
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As with any software that integrates with the Facebook platform, your use of * this software is subject to the Facebook Developer Principles and Policies * [http://developers.facebook.com/policy/]. This copyright notice shall be * included in all copies or substantial portions of the software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ namespace Facebook.Unity.Editor { using UnityEditor; using UnityEngine; public class FacebookImporter : AssetPostprocessor { private enum WindowsArchitecture { x86, x86_64, both } private static string currentAsset = ""; static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths) { foreach (string str in importedAssets) { currentAsset=str; SetCanvasDllConfiguration("/Facebook.Unity.Canvas.dll"); SetCanvasDllConfiguration("/CanvasJSSDKBindings.jslib"); SetAndroidDllConfiguration("/Facebook.Unity.Android.dll"); SetAndroidDllConfiguration("/libs/facebook-android-wrapper-15.0.0.aar"); SetiOSDllConfiguration("/Facebook.Unity.IOS.dll"); SetiOSEditorSwiftConfiguration("/FBSDKShareTournamentDialog.swift"); SetiOSEditorSwiftConfiguration("/FBSDKTournament.swift"); SetiOSEditorSwiftConfiguration("/FBSDKTournamentFetcher.swift"); SetiOSEditorSwiftConfiguration("/FBSDKTournamentUpdater.swift"); SetWindowsDllConfiguration("/Facebook.Unity.Windows.dll", WindowsArchitecture.both); // Windows SDK Dlls x84 and x64 SetWindowsDllConfiguration("/LibFBGManaged.dll", WindowsArchitecture.both); SetWindowsDllConfiguration("/XInputDotNetPure.dll", WindowsArchitecture.both); // Windows SDK Dlls only x84 SetWindowsDllConfiguration("/x86/LibFBGPlatform.dll", WindowsArchitecture.x86); SetWindowsDllConfiguration("/x86/cpprest_2_10.dll", WindowsArchitecture.x86); SetWindowsDllConfiguration("/x86/libcrypto-3.dll", WindowsArchitecture.x86); SetWindowsDllConfiguration("/x86/libcurl.dll", WindowsArchitecture.x86); SetWindowsDllConfiguration("/x86/LibFBGUI.dll", WindowsArchitecture.x86); SetWindowsDllConfiguration("/x86/libssl-3.dll", WindowsArchitecture.x86); SetWindowsDllConfiguration("/x86/tinyxml2.dll", WindowsArchitecture.x86); SetWindowsDllConfiguration("/x86/WebView2Loader.dll", WindowsArchitecture.x86); SetWindowsDllConfiguration("/x86/XInputInterface.dll", WindowsArchitecture.x86); SetWindowsDllConfiguration("/x86/zlib1.dll", WindowsArchitecture.x86); // Windows SDK Dlls only x64 SetWindowsDllConfiguration("/x64/LibFBGPlatform.dll", WindowsArchitecture.x86_64); SetWindowsDllConfiguration("/x64/cpprest_2_10.dll", WindowsArchitecture.x86_64); SetWindowsDllConfiguration("/x64/libcrypto-3-x64.dll", WindowsArchitecture.x86_64); SetWindowsDllConfiguration("/x64/libcurl.dll", WindowsArchitecture.x86_64); SetWindowsDllConfiguration("/x64/LibFBGUI.dll", WindowsArchitecture.x86_64); SetWindowsDllConfiguration("/x64/libssl-3-x64.dll", WindowsArchitecture.x86_64); SetWindowsDllConfiguration("/x64/tinyxml2.dll", WindowsArchitecture.x86_64); SetWindowsDllConfiguration("/x64/WebView2Loader.dll", WindowsArchitecture.x86_64); SetWindowsDllConfiguration("/x64/XInputInterface.dll", WindowsArchitecture.x86_64); SetWindowsDllConfiguration("/x64/zlib1.dll", WindowsArchitecture.x86_64); } } private static PluginImporter GetPluginImporter(string path) { string sdkAsset="Assets"+path; if (currentAsset == sdkAsset) { return ((PluginImporter)PluginImporter.GetAtPath(sdkAsset)); } return null; } private static void SetCanvasDllConfiguration(string path) { PluginImporter canvasDLL = GetPluginImporter("/FacebookSDK/Plugins/Canvas" + path); if (canvasDLL) { canvasDLL.ClearSettings(); canvasDLL.SetCompatibleWithAnyPlatform(false); canvasDLL.SetCompatibleWithEditor(true); canvasDLL.SetCompatibleWithPlatform(BuildTarget.WebGL, true); } } private static void SetAndroidDllConfiguration(string path) { PluginImporter androidDLL = GetPluginImporter("/FacebookSDK/Plugins/Android" + path); if (androidDLL) { androidDLL.ClearSettings(); androidDLL.SetCompatibleWithAnyPlatform(false); androidDLL.SetCompatibleWithEditor(true); androidDLL.SetCompatibleWithPlatform(BuildTarget.Android, true); } } private static void SetiOSDllConfiguration(string path) { PluginImporter iOSDLL = GetPluginImporter("/FacebookSDK/Plugins/iOS" + path); if (iOSDLL) { iOSDLL.ClearSettings(); iOSDLL.SetCompatibleWithAnyPlatform(false); iOSDLL.SetCompatibleWithPlatform(BuildTarget.iOS, true); } } private static void SetiOSEditorSwiftConfiguration(string path) { PluginImporter iOSDLL = GetPluginImporter("/FacebookSDK/SDK/Editor/iOS/Swift" + path); if (iOSDLL) { iOSDLL.ClearSettings(); iOSDLL.SetCompatibleWithAnyPlatform(false); iOSDLL.SetCompatibleWithEditor(true); iOSDLL.SetCompatibleWithPlatform(BuildTarget.iOS, true); } } private static void SetWindowsDllConfiguration(string path, WindowsArchitecture architecture) { PluginImporter windowsDLL = GetPluginImporter("/FacebookSDK/Plugins/Windows" + path); if (windowsDLL) { windowsDLL.ClearSettings(); bool isEditor = architecture == WindowsArchitecture.x86_64 || architecture == WindowsArchitecture.both; windowsDLL.SetCompatibleWithAnyPlatform(false); windowsDLL.SetCompatibleWithEditor(isEditor); windowsDLL.SetCompatibleWithPlatform(BuildTarget.WebGL, false); windowsDLL.SetCompatibleWithPlatform(BuildTarget.Android, false); windowsDLL.SetCompatibleWithPlatform(BuildTarget.iOS, false); switch (architecture) { case WindowsArchitecture.x86: windowsDLL.SetCompatibleWithPlatform(BuildTarget.StandaloneWindows, true); windowsDLL.SetPlatformData(BuildTarget.StandaloneWindows, "CPU", "AnyCPU"); windowsDLL.SetCompatibleWithPlatform(BuildTarget.StandaloneWindows64, false); windowsDLL.SetPlatformData(BuildTarget.StandaloneWindows64, "CPU", "none"); break; case WindowsArchitecture.x86_64: windowsDLL.SetCompatibleWithPlatform(BuildTarget.StandaloneWindows, false); windowsDLL.SetPlatformData(BuildTarget.StandaloneWindows, "CPU", "none"); windowsDLL.SetCompatibleWithPlatform(BuildTarget.StandaloneWindows64, true); windowsDLL.SetPlatformData(BuildTarget.StandaloneWindows64, "CPU", "AnyCPU"); break; case WindowsArchitecture.both: windowsDLL.SetCompatibleWithPlatform(BuildTarget.StandaloneWindows, true); windowsDLL.SetPlatformData(BuildTarget.StandaloneWindows, "CPU", "AnyCPU"); windowsDLL.SetCompatibleWithPlatform(BuildTarget.StandaloneWindows64, true); windowsDLL.SetPlatformData(BuildTarget.StandaloneWindows64, "CPU", "AnyCPU"); break; } } } } }
185
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As with any software that integrates with the Facebook platform, your use of * this software is subject to the Facebook Developer Principles and Policies * [http://developers.facebook.com/policy/]. This copyright notice shall be * included in all copies or substantial portions of the software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ namespace Facebook.Unity.Editor { using Facebook.Unity.Settings; using UnityEditor; using System; [InitializeOnLoadAttribute] public static class PlayModeStateChanged { static PlayModeStateChanged() { EditorApplication.playModeStateChanged += OnPlayModeStateChange; } private static void OnPlayModeStateChange(PlayModeStateChange state) { if (state == PlayModeStateChange.EnteredPlayMode) { FacebookSettings.EditorBuildTarget = (FacebookSettings.BuildTarget) Enum.Parse(typeof(FacebookSettings.BuildTarget), EditorUserBuildSettings.activeBuildTarget.ToString(), true); ; } } } }
44
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As with any software that integrates with the Facebook platform, your use of * this software is subject to the Facebook Developer Principles and Policies * [http://developers.facebook.com/policy/]. This copyright notice shall be * included in all copies or substantial portions of the software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ namespace Facebook.Unity.Editor { using System.IO; using Facebook.Unity; using Facebook.Unity.Settings; using UnityEditor; using UnityEditor.Callbacks; using UnityEngine; public static class XCodePostProcess { [PostProcessBuildAttribute(45)] private static void PostProcessBuild_iOS(BuildTarget target, string buildPath) { if (target == BuildTarget.iOS) { string podFilePath = Path.Combine(buildPath, "Podfile"); if (File.Exists(podFilePath)) { string contents = File.ReadAllText(podFilePath); bool isUnityIphoneInPodFile = contents.Contains("Unity-iPhone"); using (StreamWriter sw = File.AppendText(podFilePath)) { if (!isUnityIphoneInPodFile) { sw.WriteLine("target 'Unity-iPhone' do"); sw.WriteLine("end"); } } } else { Debug.LogWarning("No podfile created"); } } } [PostProcessBuild(100)] public static void OnPostProcessBuild(BuildTarget target, string path) { // If integrating with facebook on any platform, throw a warning if the app id is invalid if (!FacebookSettings.IsValidAppId) { Debug.LogWarning("You didn't specify a Facebook app ID. Please add one using the Facebook menu in the main Unity editor."); } // Unity renamed build target from iPhone to iOS in Unity 5, this keeps both versions happy if (target.ToString() == "iOS" || target.ToString() == "iPhone") { UpdatePlist(path); FixupFiles.FixColdStart(path); FixupFiles.AddBuildFlag(path); } if (target == BuildTarget.Android) { // The default Bundle Identifier for Unity does magical things that causes bad stuff to happen var defaultIdentifier = "com.Company.ProductName"; if (Utility.GetApplicationIdentifier() == defaultIdentifier) { Debug.LogError ("The default Unity Bundle Identifier (com.Company.ProductName) will not work correctly."); } if (!FacebookAndroidUtil.SetupProperly) { Debug.LogError("Your Android setup is not correct. See Settings in Facebook menu."); } if (!ManifestMod.CheckManifest()) { // If something is wrong with the Android Manifest, try to regenerate it to fix it for the next build. ManifestMod.GenerateManifest(); } } } public static void UpdatePlist(string path) { const string FileName = "Info.plist"; string appId = FacebookSettings.AppId; string clientToken = FacebookSettings.ClientToken; string fullPath = Path.Combine(path, FileName); if (string.IsNullOrEmpty(appId) || appId.Equals("0")) { Debug.LogError("You didn't specify a Facebook app ID. Please add one using the Facebook menu in the main Unity editor."); return; } var facebookParser = new PListParser(fullPath); facebookParser.UpdateFBSettings( appId, clientToken, FacebookSettings.IosURLSuffix, FacebookSettings.AppLinkSchemes[FacebookSettings.SelectedAppIndex].Schemes); facebookParser.WriteToFile(); } } }
120