Skip to content

Commit

Permalink
fix: check current destination before navigating on MainActivity (#218)
Browse files Browse the repository at this point in the history
  • Loading branch information
Yash-Garg authored Dec 13, 2022
1 parent 6d504e2 commit ec3703f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/pr_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ jobs:
with:
submodules: 'recursive'
fetch-depth: 0

- name: Get changed files
id: changed-files
uses: tj-actions/[email protected]
Expand All @@ -28,6 +29,12 @@ jobs:
**/*.kts
**/*.xml
- name: List all changed files
run: |
for file in ${{ steps.changed-files.outputs.all_changed_files }}; do
echo "$file was changed"
done
check-codestyle:
needs: [ file-changes ]
runs-on: ubuntu-latest
Expand Down
1 change: 0 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@

<activity
android:name=".MainActivity"
android:configChanges="orientation|screenSize"
android:exported="true"
android:theme="@style/Theme.Qbit">
<intent-filter>
Expand Down
10 changes: 8 additions & 2 deletions app/src/main/kotlin/dev/yashgarg/qbit/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,20 @@ class MainActivity : AppCompatActivity() {
when (status) {
ConfigStatus.EXISTS -> {
val bundle = bundleOf(TORRENT_INTENT_KEY to intent?.data.toString())
val navController =
findNavController(this@MainActivity, R.id.nav_host_fragment)

serverPrefsStore.data
.map { it.showNotification }
.onEach(::launchWorkManager)
.launchIn(lifecycleScope)

findNavController(this@MainActivity, R.id.nav_host_fragment)
.navigate(R.id.action_homeFragment_to_serverFragment, bundle)
if (navController.currentDestination?.id == R.id.homeFragment) {
navController.navigate(
R.id.action_homeFragment_to_serverFragment,
bundle
)
}
}
ConfigStatus.DOES_NOT_EXIST -> Log.i(ClientManager.tag, "No config found!")
}
Expand Down

0 comments on commit ec3703f

Please sign in to comment.