Skip to content

Commit ae51e7f

Browse files
authored
Merge pull request #3242 from dimagi/pm_qa_7909_copy
- fixed view jib status click issue
2 parents 70b2464 + 0280e22 commit ae51e7f

File tree

5 files changed

+31
-24
lines changed

5 files changed

+31
-24
lines changed

app/build.gradle

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,9 @@ dependencies {
173173
implementation "androidx.camera:camera-lifecycle:$cameraX_version"
174174
implementation 'com.google.android.gms:play-services-mlkit-face-detection:17.1.0'
175175
implementation "com.google.firebase:firebase-auth:22.3.0"
176+
//Tobe removed with nav version 2.9
177+
implementation 'org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.3'
178+
176179
}
177180

178181
ext {

app/proguard.cfg

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,4 +235,7 @@
235235
# androidx.test.ext.truth.content.IntentSubject.hasAction fails in it-tests without this
236236
-keep class com.google.common.base.Preconditions { *; }
237237

238+
# Keep all kotlinx serialization-related classes and methods
239+
-keep class kotlinx.serialization.** { *; }
240+
238241
# Guava Config End

app/res/layout/screen_connect.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
app:layout_constraintRight_toRightOf="parent"
1515
app:layout_constraintTop_toTopOf="parent"
1616
app:layout_constraintBottom_toBottomOf="parent"
17-
app:navGraph="@navigation/nav_graph_connect"
1817
/>
1918

2019
</androidx.constraintlayout.widget.ConstraintLayout>

app/res/navigation/nav_graph_connect.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
xmlns:app="http://schemas.android.com/apk/res-auto"
44
xmlns:tools="http://schemas.android.com/tools"
55
android:id="@+id/nav_graph_connect"
6-
app:startDestination="@id/connect_jobs_list_fragment">
6+
>
77

88
<fragment
99
android:id="@+id/connect_unlock_fragment"

app/src/org/commcare/activities/connect/ConnectActivity.java

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
import androidx.core.content.res.ResourcesCompat;
1717
import androidx.fragment.app.Fragment;
1818
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
19-
import androidx.navigation.NavOptions;
19+
import androidx.navigation.NavGraph;
20+
import androidx.navigation.NavInflater;
2021
import androidx.navigation.fragment.NavHostFragment;
2122

2223
import com.google.common.base.Strings;
@@ -65,45 +66,46 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
6566

6667
redirectionAction = getIntent().getStringExtra("action");
6768
opportunityId = getIntent().getStringExtra("opportunity_id");
68-
if(opportunityId == null) {
69+
if (opportunityId == null) {
6970
opportunityId = "";
7071
}
7172

7273
updateBackButton();
7374

75+
// Wait for fragment to attach
76+
getSupportFragmentManager().executePendingTransactions();
77+
NavInflater inflater = navController.getNavInflater();
78+
NavGraph graph = inflater.inflate(R.navigation.nav_graph_connect);
79+
80+
int startDestinationId = R.id.connect_jobs_list_fragment;
81+
Bundle startArgs = null;
82+
7483
if (getIntent().getBooleanExtra("info", false)) {
7584
ConnectJobRecord job = ConnectJobHelper.INSTANCE.getActiveJob();
7685
Objects.requireNonNull(job);
7786

78-
int fragmentId = job.getStatus() == ConnectJobRecord.STATUS_DELIVERING ?
79-
R.id.connect_job_delivery_progress_fragment :
80-
R.id.connect_job_learning_progress_fragment;
87+
startDestinationId = job.getStatus() == ConnectJobRecord.STATUS_DELIVERING
88+
? R.id.connect_job_delivery_progress_fragment
89+
: R.id.connect_job_learning_progress_fragment;
8190

8291
boolean buttons = getIntent().getBooleanExtra("buttons", true);
92+
startArgs = new Bundle();
93+
startArgs.putBoolean("showLaunch", buttons);
8394

84-
Bundle bundle = new Bundle();
85-
bundle.putBoolean("showLaunch", buttons);
86-
87-
NavOptions options = new NavOptions.Builder()
88-
.setPopUpTo(navController.getGraph().getStartDestinationId(), true)
89-
.build();
90-
navController.navigate(fragmentId, bundle, options);
9195
} else if (!Strings.isNullOrEmpty(redirectionAction)) {
9296
Logger.log("ConnectActivity", "Redirecting to unlock fragment");
9397
//Entering from a notification, so we may need to initialize
9498
PersonalIdManager.getInstance().init(this);
95-
96-
//Navigate to the unlock fragment first, then it will navigate on as desired
97-
NavOptions options = new NavOptions.Builder()
98-
.setPopUpTo(navController.getGraph().getStartDestinationId(), true)
99-
.build();
100-
Bundle bundle = new Bundle();
101-
bundle.putString("action", redirectionAction);
102-
bundle.putString("opportunity_id", opportunityId);
103-
bundle.putBoolean("buttons", getIntent().getBooleanExtra("buttons", true));
104-
navController.navigate(R.id.connect_unlock_fragment, bundle, options);
99+
startDestinationId = R.id.connect_unlock_fragment;
100+
startArgs = new Bundle();
101+
startArgs.putString("action", redirectionAction);
102+
startArgs.putString("opportunity_id", opportunityId);
103+
startArgs.putBoolean("buttons", getIntent().getBooleanExtra("buttons", true));
105104
}
106105

106+
graph.setStartDestination(startDestinationId);
107+
navController.setGraph(graph, startArgs);
108+
107109
prepareConnectMessagingScreen();
108110
}
109111

0 commit comments

Comments
 (0)