-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
27 changed files
with
376 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
...monMain/kotlin/social/androiddev/domain/authentication/usecase/LogoutFromCurrentServer.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* | ||
* This file is part of Dodo. | ||
* | ||
* Dodo is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as | ||
* published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. | ||
* | ||
* Dodo is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty | ||
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License along with Dodo. | ||
* If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
package social.androiddev.domain.authentication.usecase | ||
|
||
import social.androiddev.domain.authentication.repository.AuthenticationRepository | ||
|
||
class LogoutFromCurrentServer(private val authenticationRepository: AuthenticationRepository) { | ||
operator fun invoke() { | ||
val server = authenticationRepository.selectedServer | ||
if (server != null) { | ||
authenticationRepository.removeAccessToken(server) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
plugins { | ||
id("social.androiddev.library") | ||
} | ||
|
||
android { | ||
namespace = "social.androiddev.kotlinutils" | ||
} |
33 changes: 33 additions & 0 deletions
33
kotlin-utils/src/commonMain/kotlin/social/androiddev/kotlinutils/NullUnless.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* This file is part of Dodo. | ||
* | ||
* Dodo is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as | ||
* published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. | ||
* | ||
* Dodo is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty | ||
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License along with Dodo. | ||
* If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
package social.androiddev.kotlinutils | ||
|
||
import kotlin.contracts.ExperimentalContracts | ||
import kotlin.contracts.InvocationKind | ||
import kotlin.contracts.contract | ||
|
||
/** | ||
* Only return the result of [block] if [expression] is true, otherwise always returns null | ||
*/ | ||
@OptIn(ExperimentalContracts::class) | ||
inline fun <T> nullUnless(expression: Boolean, block: () -> T): T? { | ||
contract { | ||
returnsNotNull() implies (expression) | ||
callsInPlace(block, InvocationKind.AT_MOST_ONCE) | ||
} | ||
return if (!expression) { | ||
null | ||
} else { | ||
block() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
plugins { | ||
id("social.androiddev.library.ui") | ||
} | ||
|
||
android { | ||
namespace = "social.androiddev.ui.settings" | ||
} | ||
|
||
kotlin { | ||
sourceSets { | ||
val commonMain by getting { | ||
dependencies { | ||
implementation(projects.ui.common) | ||
implementation(projects.domain.authentication) | ||
implementation(projects.data.persistence) | ||
implementation(projects.data.repository) | ||
implementation(libs.io.insert.koin.core) | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.