Remove Microsoft integration
This commit is contained in:
-1
@@ -16,7 +16,6 @@ class BuildInfoSettingsScreenVM : ViewModel(), KoinComponent {
|
||||
|
||||
val buildFeatures = mapOf(
|
||||
"Accounts: Google" to accountsRepository.isSupported(AccountType.Google),
|
||||
"Accounts: Microsoft" to accountsRepository.isSupported(AccountType.Microsoft),
|
||||
"Weather providers: HERE" to availableWeatherProviders.contains(WeatherProvider.Here),
|
||||
"Weather providers: Met No" to availableWeatherProviders.contains(WeatherProvider.MetNo),
|
||||
"Weather providers: OpenWeatherMap" to availableWeatherProviders.contains(WeatherProvider.OpenWeatherMap),
|
||||
|
||||
-35
@@ -140,41 +140,6 @@ fun FileSearchSettingsScreen() {
|
||||
enabled = owncloudAccount != null
|
||||
)
|
||||
|
||||
if (viewModel.microsoftAvailable) {
|
||||
val onedrive by viewModel.onedrive.collectAsState()
|
||||
val microsoftAccount by viewModel.microsoftAccount
|
||||
AnimatedVisibility(microsoftAccount == null) {
|
||||
Banner(
|
||||
text = stringResource(R.string.no_account_microsoft),
|
||||
icon = Icons.Rounded.AccountBox,
|
||||
primaryAction = {
|
||||
TextButton(onClick = {
|
||||
viewModel.login(
|
||||
context as AppCompatActivity,
|
||||
AccountType.Microsoft
|
||||
)
|
||||
}) {
|
||||
Text(
|
||||
stringResource(R.string.connect_account),
|
||||
)
|
||||
}
|
||||
},
|
||||
modifier = Modifier.padding(16.dp)
|
||||
)
|
||||
}
|
||||
SwitchPreference(
|
||||
title = stringResource(R.string.preference_search_onedrive),
|
||||
summary = microsoftAccount?.let {
|
||||
stringResource(R.string.preference_search_onedrive_summary, it.userName)
|
||||
} ?: stringResource(R.string.preference_summary_not_logged_in),
|
||||
value = onedrive == true && microsoftAccount != null,
|
||||
onValueChanged = {
|
||||
viewModel.setOneDrive(it)
|
||||
},
|
||||
enabled = microsoftAccount != null
|
||||
)
|
||||
}
|
||||
|
||||
if (viewModel.googleAvailable) {
|
||||
val gdrive by viewModel.gdrive.collectAsState()
|
||||
val googleAccount by viewModel.googleAccount
|
||||
|
||||
-4
@@ -28,10 +28,8 @@ class FileSearchSettingsScreenVM : ViewModel(), KoinComponent {
|
||||
val loading = mutableStateOf(true)
|
||||
val nextcloudAccount = mutableStateOf<Account?>(null)
|
||||
val owncloudAccount = mutableStateOf<Account?>(null)
|
||||
val microsoftAccount = mutableStateOf<Account?>(null)
|
||||
val googleAccount = mutableStateOf<Account?>(null)
|
||||
|
||||
val microsoftAvailable = accountsRepository.isSupported(AccountType.Microsoft)
|
||||
val googleAvailable = accountsRepository.isSupported(AccountType.Google)
|
||||
|
||||
fun onResume() {
|
||||
@@ -40,8 +38,6 @@ class FileSearchSettingsScreenVM : ViewModel(), KoinComponent {
|
||||
accountsRepository.getCurrentlySignedInAccount(AccountType.Nextcloud)
|
||||
owncloudAccount.value =
|
||||
accountsRepository.getCurrentlySignedInAccount(AccountType.Owncloud)
|
||||
microsoftAccount.value =
|
||||
accountsRepository.getCurrentlySignedInAccount(AccountType.Microsoft)
|
||||
googleAccount.value = accountsRepository.getCurrentlySignedInAccount(AccountType.Google)
|
||||
loading.value = false
|
||||
}
|
||||
|
||||
+1
-23
@@ -126,29 +126,7 @@ fun IntegrationsSettingsScreen() {
|
||||
},
|
||||
enabled = !loading,
|
||||
)
|
||||
if (viewModel.isMicrosoftAvailable) {
|
||||
Preference(
|
||||
title = if (msUser != null) {
|
||||
stringResource(R.string.preference_microsoft)
|
||||
} else {
|
||||
stringResource(R.string.preference_ms_signin)
|
||||
},
|
||||
summary = msUser?.let {
|
||||
stringResource(R.string.preference_signin_user, it.userName)
|
||||
} ?: stringResource(R.string.preference_ms_signin_summary),
|
||||
onClick = {
|
||||
if (msUser != null) {
|
||||
viewModel.signOut(AccountType.Microsoft)
|
||||
} else {
|
||||
viewModel.signIn(
|
||||
context as AppCompatActivity,
|
||||
AccountType.Microsoft
|
||||
)
|
||||
}
|
||||
},
|
||||
enabled = !loading,
|
||||
)
|
||||
}
|
||||
|
||||
if (viewModel.isGoogleAvailable) {
|
||||
Preference(
|
||||
title = if (googleUser != null) {
|
||||
|
||||
-3
@@ -15,7 +15,6 @@ class IntegrationsSettingsScreenVM : ViewModel(), KoinComponent {
|
||||
private val accountsRepository: AccountsRepository by inject()
|
||||
|
||||
val isGoogleAvailable = accountsRepository.isSupported(AccountType.Google)
|
||||
val isMicrosoftAvailable = accountsRepository.isSupported(AccountType.Microsoft)
|
||||
|
||||
val googleUser = mutableStateOf<Account?>(null)
|
||||
val msUser= mutableStateOf<Account?>(null)
|
||||
@@ -29,7 +28,6 @@ class IntegrationsSettingsScreenVM : ViewModel(), KoinComponent {
|
||||
loading.value = true
|
||||
googleUser.value = accountsRepository.getCurrentlySignedInAccount(AccountType.Google)
|
||||
nextcloudUser.value = accountsRepository.getCurrentlySignedInAccount(AccountType.Nextcloud)
|
||||
msUser.value = accountsRepository.getCurrentlySignedInAccount(AccountType.Microsoft)
|
||||
owncloudUser.value = accountsRepository.getCurrentlySignedInAccount(AccountType.Owncloud)
|
||||
loading.value = false
|
||||
}
|
||||
@@ -43,7 +41,6 @@ class IntegrationsSettingsScreenVM : ViewModel(), KoinComponent {
|
||||
accountsRepository.signout(accountType)
|
||||
when(accountType){
|
||||
AccountType.Google -> googleUser.value = null
|
||||
AccountType.Microsoft -> msUser.value = null
|
||||
AccountType.Nextcloud -> nextcloudUser.value = null
|
||||
AccountType.Owncloud -> owncloudUser.value = null
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user