Skip to content

Commit ed843c7

Browse files
Sarnava KonarSarnava Konar
Sarnava Konar
authored and
Sarnava Konar
committed
show username in profile screen
1 parent 7075b9f commit ed843c7

23 files changed

+15
-20
lines changed

.DS_Store

0 Bytes
Binary file not shown.

android/.DS_Store

0 Bytes
Binary file not shown.
Binary file not shown.
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
Binary file not shown.
Binary file not shown.

android/.idea/.DS_Store

-6 KB
Binary file not shown.

android/.idea/deploymentTargetDropDown.xml

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

android/.idea/modules/.DS_Store

-6 KB
Binary file not shown.

android/app/.DS_Store

0 Bytes
Binary file not shown.

android/app/src/.DS_Store

0 Bytes
Binary file not shown.

android/app/src/main/.DS_Store

0 Bytes
Binary file not shown.

android/app/src/main/java/.DS_Store

0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
Binary file not shown.

android/app/src/main/java/com/example/gamebaaz/data/local/SharedPrefHelper.kt

+5
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ class SharedPrefHelper @Inject constructor (@ApplicationContext val context: Con
3030
"$username:$password"
3131
}
3232

33+
fun getUsername(): String? {
34+
val sharedPreference = getPreference()
35+
return sharedPreference.getString(USERNAME, null)
36+
}
37+
3338
private fun getPreference(): SharedPreferences {
3439
return context.getSharedPreferences("USER_CRED",Context.MODE_PRIVATE)
3540
}

android/app/src/main/java/com/example/gamebaaz/repository/Repository.kt

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ class Repository @Inject constructor (
1414

1515
fun getCredentials() = sharedPrefHelper.getCredential()
1616

17+
fun getUsername() = sharedPrefHelper.getUsername()
18+
1719
fun saveCredentials(
1820
username: String,
1921
password: String

android/app/src/main/java/com/example/gamebaaz/view/GameViewModel.kt

+4
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,10 @@ class GameViewModel @Inject constructor (private val repository: Repository): Vi
8080
return repository.getCredentials()
8181
}
8282

83+
fun getUsername(): String? {
84+
return repository.getUsername()
85+
}
86+
8387
fun setToken() {
8488
token = "Basic ${Utils.getBase64(getLoginCredentials()!!)}"
8589
}

android/app/src/main/java/com/example/gamebaaz/view/fragments/ProfileFragment.kt

+2-18
Original file line numberDiff line numberDiff line change
@@ -128,26 +128,10 @@ class ProfileFragment: Fragment() {
128128
)
129129
Spacer(modifier = Modifier.height(height = 16.dp))
130130
Text(
131-
text = "Sarnava Konar",
131+
text = viewModel.getUsername().toString(),
132132
style = MaterialTheme.typography.body2
133133
)
134-
Spacer(modifier = Modifier.height(height = 4.dp))
135-
Text(
136-
text = "Kolkata, India",
137-
style = MaterialTheme.typography.body1.copy(
138-
color = MaterialTheme.colors.onBackground.copy(alpha = 0.5f),
139-
fontSize = 14.sp
140-
)
141-
)
142-
Spacer(modifier = Modifier.height(height = 4.dp))
143-
Text(
144-
text = "9748805006",
145-
style = MaterialTheme.typography.body1.copy(
146-
color = MaterialTheme.colors.onBackground.copy(alpha = 0.5f),
147-
fontSize = 14.sp
148-
)
149-
)
150-
Spacer(modifier = Modifier.height(height = 32.dp))
134+
Spacer(modifier = Modifier.height(height = 24.dp))
151135
Row(
152136
modifier = Modifier
153137
.padding(bottom = 16.dp)

server-side/.DS_Store

0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)