-
-
Notifications
You must be signed in to change notification settings - Fork 28
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
ConnectID Foundation #2847
Open
OrangeAndGreen
wants to merge
16
commits into
master
Choose a base branch
from
dv/connectid_foundation
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
ConnectID Foundation #2847
Changes from 4 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
1e72821
Created branch with foundational code for ConnectID and later Connect.
OrangeAndGreen 56bb1fb
Added wrapper class for ConnectID API calls
OrangeAndGreen 1351a0a
Added unit tests for encryption, and mock encryption provider to supp…
OrangeAndGreen fcfbb71
Added externalizables to test.
OrangeAndGreen b58c6eb
Merge branch 'master' of https://github.com/dimagi/commcare-android i…
OrangeAndGreen 93314ed
Addressing PR feedback.
OrangeAndGreen 906137d
Simplified linkHqWorker to take ConnectLinkedAppRecord from caller in…
OrangeAndGreen a8bcc43
Better error handling when linkHqWorker fails
OrangeAndGreen 445ec10
Added ServerUrls.buildEndpoint helper method to build new endpoints u…
OrangeAndGreen b4dad76
Added SsoToken class with common code for retrieving token info from …
OrangeAndGreen 9312dfd
Removed date-related functions from network helper class, using exist…
OrangeAndGreen 3d9b7ea
Extracted common code for building POST data from parameters, to be u…
OrangeAndGreen b2aa121
Moved Connect-related classes to v2.55 section
OrangeAndGreen ea2db93
Added static helper class to lazy load KeyStore singleton.
OrangeAndGreen d412539
Lint
OrangeAndGreen b842ebd
Merge branch 'master' into dv/connectid_foundation
OrangeAndGreen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,27 @@ | |
<string name="your_comment">Your comment</string> | ||
<string name="support_email_address_default">[email protected]</string> | ||
|
||
<string name="ConnectTokenURL">https://connectid.dimagi.com/o/token/</string> | ||
<string name="ConnectHeartbeatURL">https://connectid.dimagi.com/users/heartbeat</string> | ||
<string name="ConnectFetchDbKeyURL">https://connectid.dimagi.com/users/fetch_db_key</string> | ||
<string name="ConnectChangePasswordURL">https://connectid.dimagi.com/users/change_password</string> | ||
<string name="ConnectResetPasswordURL">https://connectid.dimagi.com/users/recover/reset_password</string> | ||
<string name="ConnectConfirmPasswordURL">https://connectid.dimagi.com/users/recover/confirm_password</string> | ||
<string name="ConnectSetPinURL">https://connectid.dimagi.com/users/set_recovery_pin</string> | ||
<string name="ConnectConfirmPinURL">https://connectid.dimagi.com/users/recover/confirm_pin</string> | ||
<string name="ConnectUpdateProfileURL">https://connectid.dimagi.com/users/update_profile</string> | ||
<string name="ConnectChangePhoneURL">https://connectid.dimagi.com/users/change_phone</string> | ||
<string name="ConnectPhoneAvailableURL">https://connectid.dimagi.com/users/phone_available</string> | ||
<string name="ConnectRecoverURL">https://connectid.dimagi.com/users/recover</string> | ||
<string name="ConnectRecoverSecondaryURL">https://connectid.dimagi.com/users/recover/secondary</string> | ||
<string name="ConnectVerifySecondaryURL">https://connectid.dimagi.com/users/validate_secondary_phone</string> | ||
<string name="ConnectValidatePhoneURL">https://connectid.dimagi.com/users/validate_phone</string> | ||
<string name="ConnectRecoverConfirmOTPURL">https://connectid.dimagi.com/users/recover/confirm_otp</string> | ||
<string name="ConnectRecoverConfirmSecondaryOTPURL">https://connectid.dimagi.com/users/recover/confirm_secondary_otp</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> | ||
|
||
<!-- region: All strings for multiple apps and app-agnostic properties --> | ||
|
||
<string name="manager_activity_name">App Manager</string> | ||
|
@@ -384,6 +405,7 @@ | |
<string name="recovery_forms_send_error" cc:translatable="true">Error while sending forms</string> | ||
<string name="recovery_forms_state_unavailable" cc:translatable="true">Forms are not available. Make sure your phone storage is available</string> | ||
<string name="recovery_network_unavailable" cc:translatable="true">No network connection. Please check your internet and try again.</string> | ||
<string name="recovery_network_outdated" cc:translatable="true">The app is outdated and can no longer communicate with the server. Please update the app on the Google Play Store.</string> | ||
<string name="recovery_app_manager" cc:translatable="true">Go to App Manager</string> | ||
<string name="recovery_retry" cc:translatable="true">Retry Recovery</string> | ||
|
||
|
@@ -456,4 +478,6 @@ | |
<string name="fcm_default_notification_channel">notification-channel-push-notifications</string> | ||
<string name="app_with_id_not_found">Required CommCare App is not installed on device</string> | ||
<string name="audio_recording_notification">Audio Recording Notification</string> | ||
|
||
<string name="connect_db_corrupt">A problem occurred with the database, please recover your account.</string> | ||
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
105 changes: 105 additions & 0 deletions
105
app/src/org/commcare/android/database/connect/models/ConnectAppRecord.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
package org.commcare.android.database.connect.models; | ||
|
||
import org.commcare.android.storage.framework.Persisted; | ||
import org.commcare.models.framework.Persisting; | ||
import org.commcare.modern.database.Table; | ||
import org.commcare.modern.models.MetaField; | ||
import org.json.JSONArray; | ||
import org.json.JSONException; | ||
import org.json.JSONObject; | ||
|
||
import java.io.Serializable; | ||
import java.util.ArrayList; | ||
import java.util.Date; | ||
import java.util.List; | ||
|
||
@Table(ConnectAppRecord.STORAGE_KEY) | ||
public class ConnectAppRecord extends Persisted implements Serializable { | ||
/** | ||
* Name of database that stores app info for Connect jobs | ||
OrangeAndGreen marked this conversation as resolved.
Show resolved
Hide resolved
|
||
*/ | ||
public static final String STORAGE_KEY = "connect_apps"; | ||
|
||
public static final String META_JOB_ID = "job_id"; | ||
public static final String META_DOMAIN = "cc_domain"; | ||
public static final String META_APP_ID = "cc_app_id"; | ||
public static final String META_NAME = "name"; | ||
public static final String META_DESCRIPTION = "description"; | ||
public static final String META_ORGANIZATION = "organization"; | ||
public static final String META_PASSING_SCORE = "passing_score"; | ||
public static final String META_INSTALL_URL = "install_url"; | ||
public static final String META_MODULES = "learn_modules"; | ||
|
||
@Persisting(1) | ||
@MetaField(META_JOB_ID) | ||
private int jobId; | ||
@Persisting(2) | ||
private boolean isLearning; | ||
@Persisting(3) | ||
@MetaField(META_DOMAIN) | ||
private String domain; | ||
@Persisting(4) | ||
@MetaField(META_APP_ID) | ||
private String appId; | ||
@Persisting(5) | ||
@MetaField(META_NAME) | ||
private String name; | ||
@Persisting(6) | ||
@MetaField(META_DESCRIPTION) | ||
private String description; | ||
@Persisting(7) | ||
@MetaField(META_ORGANIZATION) | ||
private String organization; | ||
|
||
@Persisting(8) | ||
@MetaField(META_PASSING_SCORE) | ||
private int passingScore; | ||
@Persisting(9) | ||
@MetaField(META_INSTALL_URL) | ||
private String installUrl; | ||
@Persisting(10) | ||
private Date lastUpdate; | ||
|
||
private List<ConnectLearnModuleSummaryRecord> learnModules; | ||
|
||
public ConnectAppRecord() { | ||
|
||
} | ||
|
||
public static ConnectAppRecord fromJson(JSONObject json, int jobId, boolean isLearning) throws JSONException { | ||
ConnectAppRecord app = new ConnectAppRecord(); | ||
|
||
app.jobId = jobId; | ||
app.isLearning = isLearning; | ||
|
||
app.domain = json.has(META_DOMAIN) ? json.getString(META_DOMAIN) : ""; | ||
app.appId = json.has(META_APP_ID) ? json.getString(META_APP_ID) : ""; | ||
app.name = json.has(META_NAME) ? json.getString(META_NAME) : ""; | ||
app.description = json.has(META_DESCRIPTION) ? json.getString(META_DESCRIPTION) : ""; | ||
app.organization = json.has(META_ORGANIZATION) ? json.getString(META_ORGANIZATION) : ""; | ||
app.passingScore = json.has(META_PASSING_SCORE) && !json.isNull(META_PASSING_SCORE) ? json.getInt(META_PASSING_SCORE) : -1; | ||
app.installUrl = json.has(META_INSTALL_URL) ? json.getString(META_INSTALL_URL) : ""; | ||
|
||
JSONArray array = json.getJSONArray(META_MODULES); | ||
app.learnModules = new ArrayList<>(); | ||
for(int i=0; i<array.length(); i++) { | ||
JSONObject obj = (JSONObject)array.get(i); | ||
app.learnModules.add(ConnectLearnModuleSummaryRecord.fromJson(obj, i)); | ||
} | ||
|
||
return app; | ||
} | ||
|
||
public boolean getIsLearning() { return isLearning; } | ||
public int getJobId() { return jobId; } | ||
public void setJobId(int jobId) { this.jobId = jobId; } | ||
|
||
public String getAppId() { return appId; } | ||
public String getDomain() { return domain; } | ||
public int getPassingScore() { return passingScore; } | ||
|
||
public List<ConnectLearnModuleSummaryRecord> getLearnModules() { return learnModules; } | ||
public String getInstallUrl() { return installUrl; } | ||
public void setLearnModules(List<ConnectLearnModuleSummaryRecord> modules) { learnModules = modules; } | ||
public void setLastUpdate(Date lastUpdate) { this.lastUpdate = lastUpdate; } | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why was this removed ?