Merge pull request 'feature/child_mode' (#156) from feature/child_mode into main
Reviewed-on: #156
This commit is contained in:
commit
e98cbefcad
|
@ -15,6 +15,8 @@ import androidx.core.graphics.Insets;
|
||||||
import androidx.core.view.ViewCompat;
|
import androidx.core.view.ViewCompat;
|
||||||
import androidx.core.view.WindowInsetsCompat;
|
import androidx.core.view.WindowInsetsCompat;
|
||||||
|
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
import dagger.hilt.android.AndroidEntryPoint;
|
import dagger.hilt.android.AndroidEntryPoint;
|
||||||
|
@ -78,6 +80,7 @@ public class ChildLoginActivity extends AppCompatActivity {
|
||||||
findViewById(R.id.childLoginButton).setOnClickListener(v -> {
|
findViewById(R.id.childLoginButton).setOnClickListener(v -> {
|
||||||
logger.debug("ログインボタンが押されました");
|
logger.debug("ログインボタンが押されました");
|
||||||
Call<ChildAuthResponse> call = kidShiftApiService.childLogin(new ChildAuthRequest(getLoginCode()));
|
Call<ChildAuthResponse> call = kidShiftApiService.childLogin(new ChildAuthRequest(getLoginCode()));
|
||||||
|
CompletableFuture.runAsync(() -> {
|
||||||
try {
|
try {
|
||||||
ChildAuthResponse childAuthResponse = call.execute().body();
|
ChildAuthResponse childAuthResponse = call.execute().body();
|
||||||
if (childAuthResponse == null || childAuthResponse.getAccessToken() == null) {
|
if (childAuthResponse == null || childAuthResponse.getAccessToken() == null) {
|
||||||
|
@ -89,11 +92,13 @@ public class ChildLoginActivity extends AppCompatActivity {
|
||||||
appCommonSetting.setLoggedIn(true);
|
appCommonSetting.setLoggedIn(true);
|
||||||
appCommonSetting.setAccessToken(childAuthResponse.getAccessToken());
|
appCommonSetting.setAccessToken(childAuthResponse.getAccessToken());
|
||||||
appCommonSetting.setChildMode(true);
|
appCommonSetting.setChildMode(true);
|
||||||
|
finish();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("リクエストに失敗しました");
|
logger.error("リクエストに失敗しました");
|
||||||
Toast.makeText(this, "ログインに失敗しました", Toast.LENGTH_SHORT).show();
|
Toast.makeText(this, "ログインに失敗しました", Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getLoginCode() {
|
private String getLoginCode() {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user