()
| 51 | } |
| 52 | |
| 53 | public void start() { |
| 54 | //This needs to be at the begnning of the start method for Oauth2 to work |
| 55 | // correctly on the web. This handles the login when the Oauth2 login page |
| 56 | // redirects back tothe app |
| 57 | if (Oauth2.handleRedirect(e->{ |
| 58 | |
| 59 | |
| 60 | if(e.getSource() instanceof AccessToken) { |
| 61 | Log.p("Logged in: " + e); |
| 62 | AccessToken token = (AccessToken)e.getSource(); |
| 63 | setAccessToken(token); |
| 64 | showLoggedIn(); |
| 65 | } else { |
| 66 | Log.p("Failed to login " + e.getSource()); |
| 67 | showLogin(); |
| 68 | |
| 69 | } |
| 70 | return; |
| 71 | |
| 72 | })) { |
| 73 | // The Oauth redirect was handled. Use the handleRedirect callback for control flow |
| 74 | // do not continue with rest of start() method. |
| 75 | return; |
| 76 | } |
| 77 | if(current != null){ |
| 78 | current.show(); |
| 79 | return; |
| 80 | } |
| 81 | showLogin(); |
| 82 | } |
| 83 | |
| 84 | private void doLogin() { |
| 85 |
nothing calls this directly
no test coverage detected