mobile/android/base/fxa/login/FxAccountLoginTransition.java

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/mobile/android/base/fxa/login/FxAccountLoginTransition.java	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,68 @@
     1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.7 +
     1.8 +package org.mozilla.gecko.fxa.login;
     1.9 +
    1.10 +
    1.11 +public class FxAccountLoginTransition {
    1.12 +  public interface Transition {
    1.13 +  }
    1.14 +
    1.15 +  public static class LogMessage implements Transition {
    1.16 +    public final String detailMessage;
    1.17 +
    1.18 +    public LogMessage(String detailMessage) {
    1.19 +      this.detailMessage = detailMessage;
    1.20 +    }
    1.21 +
    1.22 +    @Override
    1.23 +    public String toString() {
    1.24 +      return getClass().getSimpleName() + (this.detailMessage == null ? "" : "('" + this.detailMessage + "')");
    1.25 +    }
    1.26 +  }
    1.27 +
    1.28 +  public static class AccountNeedsVerification extends LogMessage {
    1.29 +    public AccountNeedsVerification() {
    1.30 +      super(null);
    1.31 +    }
    1.32 +  }
    1.33 +
    1.34 +  public static class AccountVerified extends LogMessage {
    1.35 +    public AccountVerified() {
    1.36 +      super(null);
    1.37 +    }
    1.38 +  }
    1.39 +
    1.40 +  public static class PasswordRequired extends LogMessage {
    1.41 +    public PasswordRequired() {
    1.42 +      super(null);
    1.43 +    }
    1.44 +  }
    1.45 +
    1.46 +  public static class LocalError implements Transition {
    1.47 +    public final Exception e;
    1.48 +
    1.49 +    public LocalError(Exception e) {
    1.50 +      this.e = e;
    1.51 +    }
    1.52 +
    1.53 +    @Override
    1.54 +    public String toString() {
    1.55 +      return "Log(" + this.e + ")";
    1.56 +    }
    1.57 +  }
    1.58 +
    1.59 +  public static class RemoteError implements Transition {
    1.60 +    public final Exception e;
    1.61 +
    1.62 +    public RemoteError(Exception e) {
    1.63 +      this.e = e;
    1.64 +    }
    1.65 +
    1.66 +    @Override
    1.67 +    public String toString() {
    1.68 +      return "Log(" + (this.e == null ? "null" : this.e) + ")";
    1.69 +    }
    1.70 +  }
    1.71 +}

mercurial