Fixes #4682 - Removed read_phone_state_permission (#4723)

This commit is contained in:
Ashish 2021-12-09 18:12:08 +05:30 committed by GitHub
parent d8f7d89a59
commit b373617a68
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 2 additions and 18 deletions

View file

@ -41,6 +41,7 @@ dependencies {
implementation 'com.mapbox.mapboxsdk:mapbox-android-sdk:9.1.0'
implementation 'com.mapbox.mapboxsdk:mapbox-android-plugin-localization-v8:0.11.0'
implementation 'com.mapbox.mapboxsdk:mapbox-android-plugin-scalebar-v9:0.4.0'
implementation 'com.mapbox.mapboxsdk:mapbox-android-telemetry:6.1.0'
implementation 'com.github.deano2390:MaterialShowcaseView:1.2.0'
implementation 'com.dinuscxj:circleprogressbar:1.1.1'
implementation 'com.karumi:dexter:5.0.0'

View file

@ -17,7 +17,6 @@
<uses-permission android:name="com.google.android.apps.photos.permission.GOOGLE_PHOTOS" />
<uses-permission android:name="android.permission.SET_WALLPAPER"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>

View file

@ -143,31 +143,15 @@ public class MainActivity extends BaseActivity
private void setUpPager() {
tabLayout.setOnNavigationItemSelectedListener(item -> {
if (VERSION.SDK_INT >= VERSION_CODES.M) {
if (item.getTitle().equals(getString(R.string.nearby_fragment))
&& checkSelfPermission(permission.READ_PHONE_STATE)
!= PackageManager.PERMISSION_GRANTED) {
requestPhoneStatePermission(() -> {
tabLayout.setSelectedItemId(NavTab.NEARBY.code());
});
return false;
}
}
if (!item.getTitle().equals(getString(R.string.more))) {
// do not change title for more fragment
setTitle(item.getTitle());
}
Fragment fragment = NavTab.of(item.getOrder()).newInstance();
final Fragment fragment = NavTab.of(item.getOrder()).newInstance();
return loadFragment(fragment, true);
});
}
private void requestPhoneStatePermission(final Runnable runnable) {
PermissionUtils.checkPermissionsAndPerformAction(this,
android.Manifest.permission.READ_PHONE_STATE, (Runnable) runnable::run, (Runnable) () -> {
}, R.string.need_permission, R.string.read_phone_state_permission_message);
}
private void setUpLoggedOutPager() {
loadFragment(ExploreFragment.newInstance(),false);
tabLayout.setOnNavigationItemSelectedListener(item -> {