public AppSettings(string appId, string appKey, BuddyOptions options) { AppID = appId; AppKey = appKey; Options = options; if (appId != null) { Load(); } }
public BuddyClient(string appid, string appkey, BuddyOptions options = null) { if (String.IsNullOrEmpty(appid)) { throw new ArgumentException("Can't be null or empty.", "appId"); } if (String.IsNullOrEmpty(appkey)) { throw new ArgumentException("Can't be null or empty.", "AppKey"); } if (options == null) { options = new BuddyOptions(); } sharedSecret = options.SharedSecret; options.SharedSecret = null; if (!PlatformAccess.Current.SupportsFlags(options.Flags)) { throw new ArgumentException("Invalid flags for this client type."); } this.AppId = appid.Trim(); this.AppKey = appkey.Trim(); this.Options = options; _appSettings = new AppSettings(appid, appkey, options); UpdateAccessLevel(); if (options.Flags.HasFlag(BuddyClientFlags.AutoCrashReport)) { InitCrashReporting(); } PlatformAccess.Current.SetPushToken(_appSettings.DevicePushToken); PlatformAccess.Current.PushTokenChanged += this.PushTokenChanged; PlatformAccess.Current.NotificationReceived += (s, na) => { string id = na.ID; if (_appSettings.DeviceToken != null) { PostAsync <bool>( "/notifications/received/" + id, null); } }; }
public static IBuddyClient Init(string appId, string appKey, BuddyOptions options = null) { if (options == null) { options = new BuddyOptions(); } if (_currentClientKey != null && !options.Flags.HasFlag(BuddyClientFlags.AllowReinitialize)) { throw new InvalidOperationException("Already initialized."); } CurrentInstance = new BuddyClient(appId, appKey, options); return(CurrentInstance); }
public BuddyCreds(string appId, string appKey, BuddyOptions options) { AppID = appId; AppKey = appKey; Options = options; }