Skip to content
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

fix: Clicking on room name redirect to connected device fragment #2288

Merged
merged 4 commits into from
Jun 30, 2019
Merged

fix: Clicking on room name redirect to connected device fragment #2288

merged 4 commits into from
Jun 30, 2019

Conversation

atm1504
Copy link
Member

@atm1504 atm1504 commented Jun 29, 2019

Fixes #2286

Changes:

Screenshots for the change:
ezgif com-video-to-gif

Apk:
app-fdroid-debug.apk.zip

@auto-label auto-label bot added the fix label Jun 29, 2019
@ci-reporter
Copy link

ci-reporter bot commented Jun 29, 2019

The build is failing

✨ Good work on this PR so far! ✨ Unfortunately, the Circle CI build is failing as of d05a46c. Here's the output:

Run Tests
> Task :app:preBuild UP-TO-DATE

I'm sure you can fix it! If you need help, don't hesitate to ask a maintainer of the project!


Failed build for 361d40a
spotless check
> Task :app:spotlessKotlin FAILED

This comment was automagically generated by ci-reporter. If you see a problem, open an issue here.

@ci-reporter
Copy link

ci-reporter bot commented Jun 29, 2019

The build is failing

✨ Good work on this PR so far! ✨ Unfortunately, the Circle CI build is failing as of 361d40a. Here's the output:

spotless check
> Task :app:spotlessKotlin FAILED

I'm sure you can fix it! If you need help, don't hesitate to ask a maintainer of the project!


This comment was automagically generated by ci-reporter. If you see a problem, open an issue here.

@atm1504
Copy link
Member Author

atm1504 commented Jun 29, 2019

@iamareebjamal please review it. It is an important bug that needs to be fixed.

@@ -34,6 +34,7 @@ class RoomsAdapter(private val availableRoomsList: ArrayList<DeviceConnectFragme
val roomNameClicked = availableRoomsList[adapterPosition].room
var intent = Intent(context, DeviceActivity::class.java)
intent.putExtra("roomName", roomNameClicked)
intent.putExtra("connectTo", "DeviceConnectFragment")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is it used?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The DeviceActivity is the base activity for 2 major features. The intent parameter is passed to tell the activity which fragment it should load.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make it a constant

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

@@ -15,6 +15,9 @@ object Constant {
const val MIC_INPUT = "mic_input"

const val ACCESS_TOKEN = "access_token"
const val CONNECT_TO = "connectTo"
const val DEVICE_CONNECT_FRAGMENT = "device_connect_fragment"
const val CONNECTED_DEVICE_FRAGMENT = "connected_device_fragment"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move to the activity

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean to rename the variables?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, move them

@@ -48,6 +48,8 @@ class ChatSettingsFragment : PreferenceFragmentCompat(), ISettingsView {
private val TAG_ABOUT_FRAGMENT = "AboutUsFragment"
private val TAG_HELP_FRAGMENT = "HelpFragment"
private val TAG_PRIVACY_FRAGMENT = "PrivacyFragment"
private val TAG_CONNECTED_DEVICE_FRAGMENT = "ConnectedDeviceFragment"
private val TAG_DEVICE_CONNECT_FRAGMENT = "DeviceConnectFragment"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When you duplicate the variable, the entire point of making it a constant is lost

@atm1504
Copy link
Member Author

atm1504 commented Jun 30, 2019

@iamareebjamal please review it.

@@ -34,6 +34,7 @@ class RoomsAdapter(private val availableRoomsList: ArrayList<DeviceConnectFragme
val roomNameClicked = availableRoomsList[adapterPosition].room
var intent = Intent(context, DeviceActivity::class.java)
intent.putExtra("roomName", roomNameClicked)
intent.putExtra(DeviceActivity().CONNECT_TO, DeviceActivity().TAG_DEVICE_CONNECT_FRAGMENT)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow

@@ -34,6 +34,7 @@ class RoomsAdapter(private val availableRoomsList: ArrayList<DeviceConnectFragme
val roomNameClicked = availableRoomsList[adapterPosition].room
var intent = Intent(context, DeviceActivity::class.java)
intent.putExtra("roomName", roomNameClicked)
intent.putExtra(DeviceActivity().CONNECT_TO, DeviceActivity().TAG_DEVICE_CONNECT_FRAGMENT)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to instantiate activity. Heard of static final variables?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we can do so via using the companion object in kotlin.

@iamareebjamal iamareebjamal merged commit a8c2f70 into fossasia:development Jun 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Clicking on room name redirects to wrong page
2 participants