public override void RequestDidSucceed(ApiResult apiResult) { // Your code after the user authorizes application for // requested scopes. // Load new view controller with user identifying information // as the user is now successfully logged in. AIMobileLib.GetProfile(new AMZNGetProfileDelegate(vc)); }
public override bool OpenUrl(UIApplication application, NSUrl url, string sourceApplication, NSObject annotation) { // Pass on the url to the SDK to parse authorization code from the url. bool isValidRedirectSignInURL = AIMobileLib.HandleOpenUrl(url, sourceApplication); if (!isValidRedirectSignInURL) { return(false); } // App may also want to handle url return(true); }
public override void ViewDidLoad() { base.ViewDidLoad(); // Just a few style details // Create Amazon Yellow color so we can use it in the Title text of the Navigation Controller var amznYellow = UIColor.FromRGBA(1.0f, 0.72299367049999996f, 0.1590426486f, 1.0f); View.BackgroundColor = UIColor.White; NavigationController.NavigationBar.BarStyle = UIBarStyle.Black; NavigationController.NavigationBar.Opaque = true; NavigationController.NavigationBar.SetTitleTextAttributes(new UITextAttributes() { TextColor = amznYellow }); // Display a welcome message to the user message = new UITextView(new RectangleF(40, 76, 240, 107)) { Text = "Welcome to Login with Amazon!\nIf this is your first time logging in, " + "you will be asked to give permission for this application to access your profile data.", TextAlignment = UITextAlignment.Center, ContentMode = UIViewContentMode.ScaleToFill, BackgroundColor = UIColor.Clear, Font = UIFont.SystemFontOfSize(14.0f) }; // Here we create the Amazon Login Button // You can get button graphics from http://login.amazon.com/button-guide#ios_images btnLogin = UIButton.FromType(UIButtonType.RoundedRect); btnLogin.Frame = new RectangleF(55, 206, 209, 48); btnLogin.SetImage(UIImage.FromBundle("btnLWA_gold_209x48.png"), UIControlState.Normal); btnLogin.SetImage(UIImage.FromBundle("btnLWA_gold_209x48_pressed.png"), UIControlState.Highlighted); btnLogin.BackgroundColor = UIColor.Clear; // Here we handle the user's touch action btnLogin.TouchUpInside += (sender, e) => { // Make authorize call to SDK to get secure access token for the user. // While making the first call you can specify the minimum basic scopes needed. // Requesting both scopes for the current user. AIMobileLib.AuthorizeUser(new [] { "profile", "postal_code" }, new AMZNAuthorizationDelegate(this)); }; View.AddSubview(message); View.AddSubview(btnLogin); }
public DVCDetails(string name, string email, string userId, string postalCode) : base(UITableViewStyle.Grouped, null) { Root = new RootElement("User Details") { new Section() { new StyledStringElement("Name", name, UITableViewCellStyle.Subtitle), new StyledStringElement("Email", email, UITableViewCellStyle.Subtitle), new StyledMultilineElement("User Id", userId, UITableViewCellStyle.Subtitle), new StyledStringElement("Postal Code", string.IsNullOrEmpty(postalCode) ? "N/A" : postalCode, UITableViewCellStyle.Subtitle) }, new Section() { new StringElement("Log Out", () => { // Here we handle user's Log Out Action, AMZNLogoutDelegate will handle // success or failure AIMobileLib.ClearAuthorizationState(new AMZNLogoutDelegate(this)); }) { Alignment = UITextAlignment.Center } } }; }