Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
Mario Danic 2018-07-10 23:02:12 +02:00
parent bdbb3a8cd1
commit 0fcc3a7fea
4 changed files with 18 additions and 5 deletions

View File

@ -28,4 +28,9 @@ public class ClosedInterfaceImpl implements ClosedInterface {
public void providerInstallerInstallIfNeededAsync() {
// does absolutely nothing :)
}
@Override
public boolean isGooglePlayServicesAvailable() {
return false;
}
}

View File

@ -39,9 +39,9 @@ public class ClosedInterfaceImpl implements ClosedInterface, ProviderInstallList
@Override
public boolean isGooglePlayServicesAvailable() {
GoogleApiAvailability api = GoogleApiAvailability.getInstance();
int code = api.isGooglePlayServicesAvailable(NextcloudTalkApplication.getSharedApplication().getApplicationContext());
return code == ConnectionResult.SUCCESS;
GoogleApiAvailability googleApiAvailability = GoogleApiAvailability.getInstance();
int resultCode = googleApiAvailability.isGooglePlayServicesAvailable(context);
return resultCode == ConnectionResult.SUCCESS;
}
@Override

View File

@ -46,10 +46,11 @@ import com.nextcloud.talk.models.json.generic.Status;
import com.nextcloud.talk.models.json.rooms.RoomsOverall;
import com.nextcloud.talk.models.json.userprofile.UserProfileOverall;
import com.nextcloud.talk.utils.ApiUtils;
import com.nextcloud.talk.utils.singletons.ApplicationWideMessageHolder;
import com.nextcloud.talk.utils.ClosedInterfaceImpl;
import com.nextcloud.talk.utils.bundle.BundleKeys;
import com.nextcloud.talk.utils.database.user.UserUtils;
import com.nextcloud.talk.utils.preferences.AppPreferences;
import com.nextcloud.talk.utils.singletons.ApplicationWideMessageHolder;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
@ -261,7 +262,13 @@ public class AccountVerificationController extends BaseController {
public void onNext(UserEntity userEntity) {
internalAccountId = userEntity.getId();
registerForPush();
if (new ClosedInterfaceImpl().isGooglePlayServicesAvailable()) {
registerForPush();
} else {
getActivity().runOnUiThread(() -> progressText.setText(progressText.getText().toString() + "\n" +
getResources().getString(R.string.nc_push_disabled)));
fetchAndStoreCapabilities();
}
}
@Override

View File

@ -22,4 +22,5 @@ package com.nextcloud.talk.interfaces;
public interface ClosedInterface {
void providerInstallerInstallIfNeededAsync();
boolean isGooglePlayServicesAvailable();
}