summaryrefslogtreecommitdiffstats
path: root/mobile/android/services/src/main/java/org/mozilla/gecko/fxa/login/FxAccountLoginTransition.java
blob: 683217853336a35b0298c866f1f88c6610d2d077 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

package org.mozilla.gecko.fxa.login;


public class FxAccountLoginTransition {
  public interface Transition {
  }

  public static class LogMessage implements Transition {
    public final String detailMessage;

    public LogMessage(String detailMessage) {
      this.detailMessage = detailMessage;
    }

    @Override
    public String toString() {
      return getClass().getSimpleName() + (this.detailMessage == null ? "" : "('" + this.detailMessage + "')");
    }
  }

  public static class AccountNeedsVerification extends LogMessage {
    public AccountNeedsVerification() {
      super(null);
    }
  }

  public static class AccountVerified extends LogMessage {
    public AccountVerified() {
      super(null);
    }
  }

  public static class PasswordRequired extends LogMessage {
    public PasswordRequired() {
      super(null);
    }
  }

  public static class LocalError implements Transition {
    public final Exception e;

    public LocalError(Exception e) {
      this.e = e;
    }

    @Override
    public String toString() {
      return "Log(" + this.e + ")";
    }
  }

  public static class RemoteError implements Transition {
    public final Exception e;

    public RemoteError(Exception e) {
      this.e = e;
    }

    @Override
    public String toString() {
      return "Log(" + (this.e == null ? "null" : this.e) + ")";
    }
  }
}