-
Notifications
You must be signed in to change notification settings - Fork 732
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FTUE - Choose a display picture #5323
Merged
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
6b62b5b
adding tests around the onboarding view model
ouchadam 53e9e8f
adding base choose name fragment with UI
ouchadam 281b65c
add click handling for the display name actions
ouchadam 8172589
adding tests around the onboarding view model
ouchadam c4dc874
adding barebones profile picture fragment with ability to select a us…
ouchadam 05394a9
extracting uri filename resolving to a class which can be injected
ouchadam dcb16dd
updating upstream avatar on profile picture save and continue step
ouchadam bcf84b8
adding test case for skipping profile picture setting
ouchadam d3589fb
taking the profile loading into account when rendering the onboarding…
ouchadam 479bff3
extracting method for the handling of the profile picture selection
ouchadam efb08b1
adding dedicated camera icon for choosing profile picture
ouchadam 146ad6f
adding toolbar to back to profile picture page
ouchadam 9518581
changing edit/add picture icon based on if we're already selected an …
ouchadam 989e762
making use of debounced clicks to avoid potential extra clicks
ouchadam c934fdc
making the avatar height and camera icon relative percentage based
ouchadam aa3f1b0
fixing formatting
ouchadam 6b04efd
making use of fake session id for user id assertion
ouchadam deec923
using a real matrix id syntax for the fake session user id
ouchadam 1fc1935
removing duplicated dimens
ouchadam 3a2dea2
using self closing imageview tag
ouchadam File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
41 changes: 41 additions & 0 deletions
41
vector/src/main/java/im/vector/app/features/onboarding/UriFilenameResolver.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,41 @@ | ||
/* | ||
* Copyright (c) 2022 New Vector Ltd | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package im.vector.app.features.onboarding | ||
|
||
import android.content.Context | ||
import android.net.Uri | ||
import android.provider.OpenableColumns | ||
import im.vector.lib.multipicker.utils.readStringColumnOrNull | ||
import javax.inject.Inject | ||
|
||
class UriFilenameResolver @Inject constructor(private val context: Context) { | ||
|
||
fun getFilenameFromUri(uri: Uri): String? { | ||
val fallback = uri.path?.substringAfterLast('/') | ||
return when (uri.scheme) { | ||
"content" -> readResolvedDisplayName(uri) ?: fallback | ||
else -> fallback | ||
} | ||
} | ||
|
||
private fun readResolvedDisplayName(uri: Uri): String? { | ||
return context.contentResolver.query(uri, null, null, null, null)?.use { cursor -> | ||
cursor.takeIf { cursor.moveToFirst() } | ||
?.readStringColumnOrNull(OpenableColumns.DISPLAY_NAME) | ||
} | ||
} | ||
} |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't it be
asyncDisplayName = Success(displayName)
instead of storing the value inpersonalizationState
. The remark is also applicable toselectedPictureUri
I guess.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a good point, at the moment those asyncs are only being used for showing/hiding the loading view, in
Login2
they're replaced with a singleisLoading: Boolean
, I was thinking of doing the same but wanted to do all the asyncs at the same timeWDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That sounds like a plan! OK for me. What I want to avoid is having multiple sources of truth.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will raise a PR for it 💯