|
|
@@ -150,7 +150,7 @@ public class MainPresenter extends Presenter<MainModel, IMainView> {
|
|
|
|
|
|
if (model.canAccessDeviceLocating()) {
|
|
|
// 사용자 설정 했으면 진행
|
|
|
- requestLocationPermissions();
|
|
|
+ requestPermissionsAndLoadWeather();
|
|
|
}
|
|
|
else {
|
|
|
// 설정 안했으면 팝업 열기
|
|
|
@@ -212,7 +212,7 @@ public class MainPresenter extends Presenter<MainModel, IMainView> {
|
|
|
}
|
|
|
else if (event.getInteger() == SettingViewHolder.SWITCH_LOCATION) {
|
|
|
ToastProvider.showLocation();
|
|
|
- requestLocationPermissions();
|
|
|
+ requestPermissionsAndLoadWeather();
|
|
|
}
|
|
|
break;
|
|
|
case Event.ERROR:
|
|
|
@@ -277,7 +277,7 @@ public class MainPresenter extends Presenter<MainModel, IMainView> {
|
|
|
//날씨영역 클릭
|
|
|
if (model.hasAllWeatherPermission() == false) {
|
|
|
// 권한이 없을 때만 실행
|
|
|
- requestLocationPermissions();
|
|
|
+ requestPermissionsAndLoadWeather();
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
@@ -354,17 +354,18 @@ public class MainPresenter extends Presenter<MainModel, IMainView> {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private void requestLocationPermissions() {
|
|
|
+ private void requestPermissionsAndLoadWeather() {
|
|
|
|
|
|
// 설정 동의 -> api 호출
|
|
|
// 퍼미션 동의 -> 퍼미션 창으로
|
|
|
// 기기 위치 정보 사용 -> 안드로이드 설정 -> 높은 정확도(gps, network 모두 사용) 설정 후 돌아옴
|
|
|
|
|
|
// 사용 동의 체크
|
|
|
- if (model.isLocationServiceEnabled()) {
|
|
|
+ if (model.isLocationServiceEnabled() == false) {
|
|
|
// 위치 동의 팝업
|
|
|
showLocationDialog(R.string.main_location_agree_no, R.string.main_location_agree_yes, R.string.main_location_agree, () -> {
|
|
|
model.setLocationServiceEnabled(true);
|
|
|
+ requestPermissionsAndLoadWeather();
|
|
|
});
|
|
|
return;
|
|
|
}
|
|
|
@@ -384,7 +385,7 @@ public class MainPresenter extends Presenter<MainModel, IMainView> {
|
|
|
renderWeatherButton();
|
|
|
|
|
|
// 모든 권한, 동의 획득
|
|
|
- Log.i("APP# MainPresenter | requestLocationPermissions", "|" + "모든 권한 획득");
|
|
|
+ Log.i("APP# MainPresenter | requestPermissionsAndLoadWeather", "|" + "모든 권한 획득");
|
|
|
model.loadWeatherWithLocation();
|
|
|
}
|
|
|
|
|
|
@@ -452,7 +453,7 @@ public class MainPresenter extends Presenter<MainModel, IMainView> {
|
|
|
|
|
|
if (granted) {
|
|
|
// 모두 허용
|
|
|
- requestLocationPermissions();
|
|
|
+ requestPermissionsAndLoadWeather();
|
|
|
}
|
|
|
else {
|
|
|
// permission denied -> nothing
|