-
Notifications
You must be signed in to change notification settings - Fork 551
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
feat: Handle app link intent for password reset and add unit test #2081
Conversation
app/src/main/java/org/fossasia/openevent/general/MainActivity.kt
Outdated
Show resolved
Hide resolved
@@ -212,7 +212,7 @@ val apiModule = module { | |||
|
|||
val viewModelModule = module { | |||
viewModel { LoginViewModel(get(), get(), get()) } | |||
viewModel { EventsViewModel(get(), get(), get(), get(), get(), get(), get()) } | |||
viewModel { EventsViewModel(get(), get(), get(), get(), get(), get(), get(), get()) } |
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 getting too big. Open issue to refactor and break into smaller ViewModels
For e.g, similar event functionality should be in its own ViewModel
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.
Where is the issue?
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.
Where is the issue?
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.
similar event functionality should be in its own ViewModel
It's not there, and there are only 4-5 methods, the view model is not so long. We can separate authentication related functions only.
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.
So why 8 parameters are required in it?
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.
private val eventService: EventService,
private val preference: Preference,
private val resource: Resource,
private val mutableConnectionLiveData: MutableConnectionLiveData,
private val authHolder: AuthHolder,
private val authService: AuthService,
private val notificationService: NotificationService,
private val config: PagedList.Config
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 this be merged, issue #2083 is opened for it, will work on that.
else -> { | ||
bundle.putString(EVENT_IDENTIFIER, appLinkData.lastPathSegment) | ||
navController.navigate(R.id.eventDetailsFragment, bundle) | ||
} |
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.
Add a separate class to parse and navigate and add tests
app/src/main/java/org/fossasia/openevent/general/MainActivity.kt
Outdated
Show resolved
Hide resolved
@iamareebjamal Updated |
app/src/test/java/org/fossasia/openevent/general/AppLinkUtilsTest.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/org/fossasia/openevent/general/utils/AppLinkUtils.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/org/fossasia/openevent/general/utils/AppLinkData.kt
Outdated
Show resolved
Hide resolved
app/src/test/java/org/fossasia/openevent/general/AppLinkUtilsTest.kt
Outdated
Show resolved
Hide resolved
app/src/test/java/org/fossasia/openevent/general/AppLinkUtilsTest.kt
Outdated
Show resolved
Hide resolved
app/src/test/java/org/fossasia/openevent/general/AppLinkUtilsTest.kt
Outdated
Show resolved
Hide resolved
Updated |
|
||
class AppLinkUtilsTest { | ||
|
||
private fun getAppLink(type: String): String { |
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 we remove the function and directly write URLs, as I don't think there is any repetition
object AppLinkUtils { | ||
fun getData(uri: String): AppLinkData? { | ||
val value = uri.split("/", "?", "=").last() | ||
return when (uri.split("/", "?", "=")[3]) { |
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.
Why split 2 times, just do once
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.
Updated
Fixes #2079