|
@@ -29,9 +29,9 @@ public class FilePermissionHelper {
|
|
|
Disposable disposable;
|
|
Disposable disposable;
|
|
|
|
|
|
|
|
public void requestDataFilePermission(ComponentActivity activity, NextStepCallback stepCallback) {
|
|
public void requestDataFilePermission(ComponentActivity activity, NextStepCallback stepCallback) {
|
|
|
- Single.just(AccountRepository.token)
|
|
|
|
|
- .flatMap(token -> {
|
|
|
|
|
- if (TextUtils.isEmpty(token)) {
|
|
|
|
|
|
|
+ Single.just(Build.VERSION.SDK_INT)
|
|
|
|
|
+ .flatMap(sdkInt -> {
|
|
|
|
|
+ if (TextUtils.isEmpty(AccountRepository.token)) {
|
|
|
return (SingleSource<Integer>) observer -> activity.runOnUiThread(() -> {
|
|
return (SingleSource<Integer>) observer -> activity.runOnUiThread(() -> {
|
|
|
PermissionDialog loginDialog = new PermissionDialog(activity);
|
|
PermissionDialog loginDialog = new PermissionDialog(activity);
|
|
|
loginDialog.setDialogContent(R.string.dialog_no_login)
|
|
loginDialog.setDialogContent(R.string.dialog_no_login)
|
|
@@ -47,7 +47,7 @@ public class FilePermissionHelper {
|
|
|
if (!TextUtils.isEmpty(AccountRepository.token)) {
|
|
if (!TextUtils.isEmpty(AccountRepository.token)) {
|
|
|
loginDialog.dismiss();
|
|
loginDialog.dismiss();
|
|
|
activity.getLifecycle().removeObserver(this);
|
|
activity.getLifecycle().removeObserver(this);
|
|
|
- observer.onSuccess(Build.VERSION.SDK_INT);
|
|
|
|
|
|
|
+ observer.onSuccess(sdkInt);
|
|
|
}
|
|
}
|
|
|
} else if (event == Lifecycle.Event.ON_DESTROY) {
|
|
} else if (event == Lifecycle.Event.ON_DESTROY) {
|
|
|
activity.getLifecycle().removeObserver(this);
|
|
activity.getLifecycle().removeObserver(this);
|
|
@@ -61,9 +61,10 @@ public class FilePermissionHelper {
|
|
|
observer.onError(new CancelException());
|
|
observer.onError(new CancelException());
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
|
|
+ loginDialog.show();
|
|
|
});
|
|
});
|
|
|
} else {
|
|
} else {
|
|
|
- return Single.just(Build.VERSION.SDK_INT);
|
|
|
|
|
|
|
+ return Single.just(sdkInt);
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
.flatMap((Function<Integer, SingleSource<Integer>>) sdkInt -> {
|
|
.flatMap((Function<Integer, SingleSource<Integer>>) sdkInt -> {
|