Skip to content

Commit

Permalink
-remove api strings, removed unused classes for now,updated java doc
Browse files Browse the repository at this point in the history
  • Loading branch information
pm-dimagi committed Feb 25, 2025
1 parent e9fccc0 commit ea816df
Show file tree
Hide file tree
Showing 15 changed files with 114 additions and 680 deletions.
9 changes: 4 additions & 5 deletions app/res/layout/fragment_secondary_phone_number.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,21 +52,20 @@
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:fontFamily="@font/roboto_bold"
android:text="Add Secondary Phone Number"
android:text="@string/add_secondary_phone_number"
android:textColor="@color/connect_dark_blue_color"
android:textSize="18sp" />

<org.commcare.views.connect.connecttextview.ConnectMediumTextView
<TextView
android:id="@+id/secondary_phone_sub_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/secondary_phone_title"
android:layout_marginStart="16dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="16dp"
android:fontFamily="@font/roboto_bold"
android:text="Add secondary phone number to reset your Recovery Code."
android:textStyle="bold"
android:text="@string/add_secondary_phone_number_to_reset_your_recovery_code"
android:textColor="@color/connect_subtext_80"
android:textSize="12sp" />

Expand Down
7 changes: 3 additions & 4 deletions app/res/layout/fragment_signup.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:fontFamily="@font/roboto_bold"
android:text="ConnectId Signup"
android:text="@string/connect_registration_title"
android:textColor="@color/connect_dark_blue_color"
android:textSize="16sp" />

Expand All @@ -50,7 +49,7 @@
android:layout_marginTop="8dp"
android:layout_marginEnd="16dp"
android:fontFamily="@font/roboto_regular"
android:text="ConnectId Signup"
android:text="@string/connect_registration_title"
android:textColor="@color/connect_subtext"
android:textSize="12sp" />

Expand Down Expand Up @@ -254,7 +253,7 @@
style="@style/NegativeButtonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Recover"
android:text="@string/connect_recover"
/>


Expand Down
3 changes: 2 additions & 1 deletion app/res/layout/screen_login.xml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@
android:layout_margin="@dimen/content_min_margin"
android:text="@string/choice_or"
android:textColor="@color/cc_neutral_color"
android:textSize="@dimen/text_medium" />
android:textSize="@dimen/text_medium"
android:visibility="gone"/>

<Spinner
android:id="@+id/app_selection_spinner"
Expand Down
13 changes: 2 additions & 11 deletions app/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -820,16 +820,7 @@
<string name="login_input_auto">AUTO</string>
<string name="connect_button_logged_in">Go to Connect menu</string>
<string name="connect_consent_title">Consent</string>
<string name="ConnectVerifyConfirmSecondaryOTPURL">https://connectid.dimagi.com/users/confirm_secondary_otp</string>
<string name="ConnectConfirmOTPURL">https://connectid.dimagi.com/users/confirm_otp</string>
<string name="ConnectRegisterURL">https://connectid.dimagi.com/users/register</string>
<string name="ConnectOpportunitiesURL">https://%s/api/opportunity/</string>
<string name="ConnectStartLearningURL">https://%s/users/start_learn_app/</string>
<string name="ConnectLearnProgressURL">https://%s/api/opportunity/%d/learn_progress</string>
<string name="ConnectClaimJobURL">https://%s/api/opportunity/%d/claim</string>
<string name="ConnectDeliveriesURL">https://%s/api/opportunity/%d/delivery_progress</string>
<string name="ConnectPaymentConfirmationURL">https://%s/api/payment/%s/confirm</string>
<string name="ConnectInitiateUserAccountDeactivationURL">https://connectid.dimagi.com/users/recover/initiate_deactivation</string>
<string name="ConnectConfirmUserAccountDeactivationURL">https://connectid.dimagi.com/users/recover/confirm_deactivation</string>
<string name="connect_db_corrupt" cc:translatable="true">A problem occurred with the database, please recover your account.</string>
<string name="add_secondary_phone_number">Add Secondary Phone Number</string>
<string name="add_secondary_phone_number_to_reset_your_recovery_code">Add secondary phone number to reset your Recovery Code.</string>
</resources>
13 changes: 7 additions & 6 deletions app/src/org/commcare/connect/network/ApiConnect.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.Multimap;

import org.commcare.connect.network.connectId.ApiEndPoints;
import org.commcare.dalvik.BuildConfig;
import org.commcare.dalvik.R;

Expand All @@ -24,7 +25,7 @@ public static boolean getConnectOpportunities(Context context, IApiCallback hand
return;
}

String url = context.getString(R.string.ConnectOpportunitiesURL, BuildConfig.CCC_HOST);
String url = String.format(ApiEndPoints.connectOpportunitiesURL, BuildConfig.CCC_HOST);
Multimap<String, String> params = ArrayListMultimap.create();

ConnectNetworkHelper.get(context, url, API_VERSION_CONNECT, token, params, false, handler);
Expand All @@ -43,7 +44,7 @@ public static boolean startLearnApp(Context context, int jobId, IApiCallback han
return;
}

String url = context.getString(R.string.ConnectStartLearningURL, BuildConfig.CCC_HOST);
String url = String.format(ApiEndPoints.connectStartLearningURL, BuildConfig.CCC_HOST);
HashMap<String, String> params = new HashMap<>();
params.put("opportunity", String.format(Locale.getDefault(), "%d", jobId));

Expand All @@ -63,7 +64,7 @@ public static boolean getLearnProgress(Context context, int jobId, IApiCallback
return;
}

String url = context.getString(R.string.ConnectLearnProgressURL, BuildConfig.CCC_HOST, jobId);
String url = String.format(ApiEndPoints.connectLearnProgressURL, BuildConfig.CCC_HOST, jobId);
Multimap<String, String> params = ArrayListMultimap.create();

ConnectNetworkHelper.get(context, url, API_VERSION_CONNECT, token, params, false, handler);
Expand All @@ -82,7 +83,7 @@ public static boolean claimJob(Context context, int jobId, IApiCallback handler)
return;
}

String url = context.getString(R.string.ConnectClaimJobURL, BuildConfig.CCC_HOST, jobId);
String url = String.format(ApiEndPoints.connectClaimJobURL, BuildConfig.CCC_HOST, jobId);
HashMap<String, String> params = new HashMap<>();

ConnectNetworkHelper.post(context, url, API_VERSION_CONNECT, token, params, false, false, handler);
Expand All @@ -101,7 +102,7 @@ public static boolean getDeliveries(Context context, int jobId, IApiCallback han
return;
}

String url = context.getString(R.string.ConnectDeliveriesURL, BuildConfig.CCC_HOST, jobId);
String url = String.format(ApiEndPoints.connectDeliveriesURL, BuildConfig.CCC_HOST, jobId);
Multimap<String, String> params = ArrayListMultimap.create();

ConnectNetworkHelper.get(context, url, API_VERSION_CONNECT, token, params, false, handler);
Expand All @@ -120,7 +121,7 @@ public static boolean setPaymentConfirmed(Context context, String paymentId, boo
return;
}

String url = context.getString(R.string.ConnectPaymentConfirmationURL, BuildConfig.CCC_HOST, paymentId);
String url = String.format(ApiEndPoints.connectPaymentConfirmationURL, BuildConfig.CCC_HOST, paymentId);

HashMap<String, String> params = new HashMap<>();
params.put("confirmed", confirmed ? "true" : "false");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,12 @@ public class ApiEndPoints {
public static final String resetPassword = "/users/recover/reset_password";
public static final String changePassword = "/users/change_password";
public static final String confirmPassword = "/users/recover/confirm_password";

public static final String connectOpportunitiesURL = "https://%s/api/opportunity/";
public static final String connectStartLearningURL = "https://%s/users/start_learn_app/";
public static final String connectLearnProgressURL = "https://%s/api/opportunity/%d/learn_progress";
public static final String connectClaimJobURL = "https://%s/api/opportunity/%d/claim";
public static final String connectDeliveriesURL = "https://%s/api/opportunity/%d/delivery_progress";
public static final String connectPaymentConfirmationURL = "https://%s/api/payment/%s/confirm";
public static final String connectInitiateUserAccountDeactivationURL = "https://connectid.dimagi.com/users/recover/initiate_deactivation";
public static final String connectConfirmUserAccountDeactivationURL = "https://connectid.dimagi.com/users/recover/confirm_deactivation";
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
import org.commcare.connect.ConnectManager
import org.commcare.connect.network.ApiConnectId
import org.javarosa.core.services.Logger

class ConnectHeartbeatWorker(context: Context, workerParams: WorkerParameters) :
CoroutineWorker(context, workerParams) {
Expand All @@ -30,11 +31,11 @@ class ConnectHeartbeatWorker(context: Context, workerParams: WorkerParameters) :
return@withContext if (result.responseCode in 200..299) {
Result.success()
} else {
Log.e(TAG, "Heartbeat failed with response code: ${result.responseCode}")
Logger.log(TAG, "Heartbeat failed with response code: ${result.responseCode}")
Result.failure()
}
} catch (e: Exception) {
Log.e(TAG, "Error during heartbeat", e)
Logger.log(TAG, "Error during heartbeat: $e")
return@withContext Result.failure()
}

Expand Down
145 changes: 0 additions & 145 deletions app/src/org/commcare/views/connect/CircleProgressBar.java

This file was deleted.

Loading

0 comments on commit ea816df

Please sign in to comment.