Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/res/values-es/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -502,4 +502,5 @@

<string name="setup_refresh_opportunities_no_jobs">No se encontraron oportunidades</string>
<string name="setup_refresh_opportunities_with_jobs">Nuevas oportunidades encontradas, haz clic en Oportunidades para obtener más información.</string>
<string name="personalid_not_login_from_fcm_error">Inicie sesión en PersonalId para ver los detalles.</string>
</resources>
1 change: 1 addition & 0 deletions app/res/values-fr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -504,4 +504,5 @@ License.

<string name="setup_refresh_opportunities_no_jobs">Aucune opportunité trouvée</string>
<string name="setup_refresh_opportunities_with_jobs">Nouvelles opportunités trouvées, cliquez sur Opportunités pour en savoir plus.</string>
<string name="personalid_not_login_from_fcm_error">Veuillez vous connecter à PersonalId pour voir les détails</string>
</resources>
1 change: 1 addition & 0 deletions app/res/values-hi/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -500,4 +500,5 @@ License.

<string name="setup_refresh_opportunities_no_jobs">कोई अवसर नहीं मिला</string>
<string name="setup_refresh_opportunities_with_jobs">नए अवसर मिले, अधिक जानने के लिए अवसर पर क्लिक करें।</string>
<string name="personalid_not_login_from_fcm_error">कृपया विवरण देखने के लिए PersonalId पर लॉगिन करें</string>
</resources>
1 change: 1 addition & 0 deletions app/res/values-lt/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,5 @@
<string name="fcm_sync_failed_body_text">Norėdami sužinoti daugiau, spustelėkite čia</string>
<string name="connect_fetch_learning_progress_error">Nepavyko gauti mokymosi eigos</string>
<string name="connect_fetch_delivery_progress_error">Nepavyko gauti pristatymo eigos</string>
<string name="personalid_not_login_from_fcm_error">Norėdami peržiūrėti išsamią informaciją, prisijunkite prie „PersonalId“.</string>
</resources>
1 change: 1 addition & 0 deletions app/res/values-no/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,5 @@
<string name="fcm_sync_failed_body_text">Klikk her for å vite mer</string>
<string name="connect_fetch_learning_progress_error">Kunne ikke hente læringsfremdriften</string>
<string name="connect_fetch_delivery_progress_error">Kunne ikke hente leveringsfremdriften</string>
<string name="personalid_not_login_from_fcm_error">Vennligst logg inn på PersonalId for å se detaljene</string>
</resources>
1 change: 1 addition & 0 deletions app/res/values-pt/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -510,4 +510,5 @@

<string name="setup_refresh_opportunities_no_jobs">Nenhuma oportunidade encontrada</string>
<string name="setup_refresh_opportunities_with_jobs">Novas oportunidades encontradas, clique em Oportunidades para saber mais.</string>
<string name="personalid_not_login_from_fcm_error">Faça login no PersonalId para ver os detalhes</string>
</resources>
1 change: 1 addition & 0 deletions app/res/values-sw/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -510,4 +510,5 @@

<string name="setup_refresh_opportunities_no_jobs">Hakuna fursa zilizopatikana</string>
<string name="setup_refresh_opportunities_with_jobs">Fursa mpya zimepatikana, bofya Fursa kujifunza zaidi.</string>
<string name="personalid_not_login_from_fcm_error">Tafadhali ingia kwenye Kitambulisho cha Kibinafsi ili kuona maelezo</string>
</resources>
1 change: 1 addition & 0 deletions app/res/values-ti/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -492,5 +492,6 @@
<string name="nav_drawer_manage_profile">ፕሮፋይል ኣስተዳደር</string>
<string name="nav_drawer_open">መንቀሳቐሲ ድርዕስ ክፈት</string>
<string name="nav_drawer_close">መንቀሳቐሲ ድርዕስ ዝግ</string>
<string name="personalid_not_login_from_fcm_error">ዝርዝር ንምርኣይ ናብ PersonalId እቶ</string>

</resources>
2 changes: 2 additions & 0 deletions app/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -681,4 +681,6 @@

<string name="setup_refresh_opportunities_no_jobs">No Opportunities found</string>
<string name="setup_refresh_opportunities_with_jobs">New opportunities found, click on Opportunities to learn more.</string>

<string name="personalid_not_login_from_fcm_error">Please login to PersonalId to view the details</string>
</resources>
33 changes: 23 additions & 10 deletions app/src/org/commcare/activities/connect/ConnectActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import android.text.TextUtils;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.Toast;

import androidx.appcompat.app.ActionBar;
import androidx.core.content.res.ResourcesCompat;
Expand Down Expand Up @@ -48,25 +49,37 @@ public class ConnectActivity extends NavigationHostCommCareActivity<ConnectActiv
private String redirectionAction = "";
private ConnectJobRecord job;
private MenuItem messagingMenuItem = null;
private static final int REQUEST_CODE_PERSONAL_ID_ACTIVITY = 1000;

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setTitle(getString(R.string.connect_title));

initStateFromExtras();
updateBackButton();
PersonalIdManager personalIdManager = PersonalIdManager.getInstance();
personalIdManager.init(this);

// Wait for fragment to attach
getSupportFragmentManager().executePendingTransactions();
if(personalIdManager.isloggedIn()){
initStateFromExtras();
updateBackButton();

// Wait for fragment to attach
getSupportFragmentManager().executePendingTransactions();

NavInflater inflater = navController.getNavInflater();
NavGraph graph = inflater.inflate(R.navigation.nav_graph_connect);
Bundle startArgs = new Bundle();
graph.setStartDestination(getStartDestinationId(startArgs));
navController.setGraph(graph, startArgs);

retrieveMessages();
}else{
Toast.makeText(this,R.string.personalid_not_login_from_fcm_error,Toast.LENGTH_LONG).show();
personalIdManager.launchPersonalId(this,REQUEST_CODE_PERSONAL_ID_ACTIVITY);
finish();
}

NavInflater inflater = navController.getNavInflater();
NavGraph graph = inflater.inflate(R.navigation.nav_graph_connect);
Bundle startArgs = new Bundle();
graph.setStartDestination(getStartDestinationId(startArgs));
navController.setGraph(graph, startArgs);

retrieveMessages();
}

private int getStartDestinationId(Bundle startArgs) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,26 @@

public class ConnectMessagingActivity extends NavigationHostCommCareActivity<ConnectMessagingActivity> {
public static final String CHANNEL_ID = "channel_id";
private static final int REQUEST_CODE_PERSONAL_ID_ACTIVITY = 1000;


@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setTitle(R.string.connect_messaging_title);

NavigationUI.setupActionBarWithNavController(this, navController);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
handleRedirectIfAny();
PersonalIdManager personalIdManager = PersonalIdManager.getInstance();
personalIdManager.init(this);

if(personalIdManager.isloggedIn()){
NavigationUI.setupActionBarWithNavController(this, navController);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
handleRedirectIfAny();
}else{
Toast.makeText(this,R.string.personalid_not_login_from_fcm_error,Toast.LENGTH_LONG).show();
personalIdManager.launchPersonalId(this,REQUEST_CODE_PERSONAL_ID_ACTIVITY);
finish();
}
Comment on lines +39 to +43
Copy link
Contributor

Choose a reason for hiding this comment

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

can we have a util method like requirePersonalIdLogin(activity) instead that checks for Personal Id login and if not navigate user to sign up page. That way we can simply add a single statement at the top level to these activities without duplicating this code as I think this will need to be added to other places as well soon in future.

Copy link
Contributor Author

@Jignesh-dimagi Jignesh-dimagi Oct 14, 2025

Choose a reason for hiding this comment

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

@shubham1g5 I was even thinking to create the BasePersonalIdConnectActivity or also Util but this is small changes so thought of putting directly as only 2 activities are only getting effected. I am still ok moving forward with BasePersonalIdConnectActivity where check for personalId or connect (if any) can be done, your thoughts

Copy link
Contributor

Choose a reason for hiding this comment

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

I would be good with BasePersonalIdConnectActivity too, think anything that avoids duplicating this code next time we have to do so should be good enough here. But happy for this change to get merged without that as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@shubham1g5 Ok let's create the base activity if anything major comes up, merging this changes now.

}

@Override
Expand Down
Loading