-
Notifications
You must be signed in to change notification settings - Fork 0
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
79 changed files
with
1,015 additions
and
957 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
14 changes: 14 additions & 0 deletions
14
app/src/main/java/lab/maxb/dark/domain/model/AuthCredentials.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,14 @@ | ||
package lab.maxb.dark.domain.model | ||
|
||
data class AuthCredentials( | ||
val login: String, | ||
val password: String? = null, | ||
val initial: Boolean = false, | ||
) | ||
|
||
data class ReceivedAuthCredentials( | ||
val token: String, | ||
val id: String, | ||
val role: Role, | ||
val request: AuthCredentials, | ||
) |
This file was deleted.
Oops, something went wrong.
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
14 changes: 14 additions & 0 deletions
14
app/src/main/java/lab/maxb/dark/domain/operations/Credentials.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,14 @@ | ||
package lab.maxb.dark.domain.operations | ||
|
||
import lab.maxb.dark.domain.model.Profile | ||
import lab.maxb.dark.domain.model.ReceivedAuthCredentials | ||
import lab.maxb.dark.domain.model.User | ||
|
||
inline fun ReceivedAuthCredentials.toProfile( | ||
user: (String) -> User? = { null }, | ||
) = Profile( | ||
request.login, | ||
user(id), | ||
token, | ||
role = role | ||
) |
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,3 @@ | ||
package lab.maxb.dark.domain.operations | ||
|
||
typealias ValSource<T> = (String) -> T? |
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
25 changes: 4 additions & 21 deletions
25
app/src/main/java/lab/maxb/dark/presentation/extra/UserSettings.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 |
---|---|---|
@@ -1,23 +1,6 @@ | ||
package lab.maxb.dark.presentation.extra | ||
|
||
import android.content.Context | ||
import android.content.SharedPreferences | ||
import androidx.preference.PreferenceManager | ||
import androidx.security.crypto.EncryptedSharedPreferences | ||
import androidx.security.crypto.MasterKey | ||
import lab.maxb.dark.presentation.extra.delegates.property | ||
import org.koin.core.annotation.Single | ||
|
||
@Single | ||
class UserSettings(context: Context) { | ||
private val pref = PreferenceManager.getDefaultSharedPreferences(context) | ||
private val securePref: SharedPreferences = EncryptedSharedPreferences.create( | ||
context, | ||
"secure_dark_preferences", | ||
MasterKey.Builder(context).setKeyScheme(MasterKey.KeyScheme.AES256_GCM).build(), | ||
EncryptedSharedPreferences.PrefKeyEncryptionScheme.AES256_SIV, | ||
EncryptedSharedPreferences.PrefValueEncryptionScheme.AES256_GCM | ||
) | ||
var token: String by securePref.property() | ||
var login: String by pref.property() | ||
} | ||
interface UserSettings { | ||
var token: String | ||
var login: String | ||
} |
25 changes: 25 additions & 0 deletions
25
app/src/main/java/lab/maxb/dark/presentation/extra/UserSettingsImpl.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,25 @@ | ||
package lab.maxb.dark.presentation.extra | ||
|
||
import android.content.Context | ||
import android.content.SharedPreferences | ||
import androidx.preference.PreferenceManager | ||
import androidx.security.crypto.EncryptedSharedPreferences | ||
import androidx.security.crypto.MasterKey | ||
import lab.maxb.dark.BuildConfig | ||
import lab.maxb.dark.presentation.extra.delegates.property | ||
import org.koin.core.annotation.Single | ||
|
||
@Single | ||
class UserSettingsImpl(context: Context) : UserSettings { | ||
private val pref = PreferenceManager.getDefaultSharedPreferences(context) | ||
private val securePref: SharedPreferences = EncryptedSharedPreferences.create( | ||
context, | ||
"secure_dark.preferences", | ||
MasterKey.Builder(context, BuildConfig.SECURE_PREFS_MASTER_KEY) | ||
.setKeyScheme(MasterKey.KeyScheme.AES256_GCM).build(), | ||
EncryptedSharedPreferences.PrefKeyEncryptionScheme.AES256_SIV, | ||
EncryptedSharedPreferences.PrefValueEncryptionScheme.AES256_GCM | ||
) | ||
override var token: String by securePref.property() | ||
override var login: String by pref.property() | ||
} |
53 changes: 0 additions & 53 deletions
53
...rc/main/java/lab/maxb/dark/presentation/repository/implementation/ImagesRepositoryImpl.kt
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.