Skip to content
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

Pm Bug fixes-bug fixes for crashlytics #2818

Open
wants to merge 1 commit into
base: connect_qa
Choose a base branch
from
Open
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
3 changes: 3 additions & 0 deletions app/src/org/commcare/activities/connect/ConnectActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {

if (getIntent().getBooleanExtra("info", false)) {
ConnectJobRecord job = ConnectManager.getActiveJob();
if(job==null){
job=ConnectManager.getActiveJob();
}
int fragmentId = job.getStatus() == ConnectJobRecord.STATUS_DELIVERING ?
R.id.connect_job_delivery_progress_fragment :
R.id.connect_job_learning_progress_fragment;
Expand Down
2 changes: 1 addition & 1 deletion app/src/org/commcare/adapters/ConnectJobAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ private void launchActiveAppForJob(ConnectJobRecord job, View view) {
boolean isLearning = job.getStatus() == ConnectJobRecord.STATUS_LEARNING;
String appId = isLearning ? job.getLearnAppInfo().getAppId() : job.getDeliveryAppInfo().getAppId();

if(ConnectManager.isAppInstalled(appId)) {
if(launcher!=null && ConnectManager.isAppInstalled(appId)) {
launcher.launchApp(appId, isLearning);
}
else {
Expand Down
14 changes: 14 additions & 0 deletions app/src/org/commcare/connect/ConnectManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,20 @@ public static ConnectJobRecord setConnectJobForApp(Context context, String appId
return job;
}


public static ConnectJobRecord getActiveJob(Context context) {
ConnectJobRecord job = null;
String appId = CommCareApplication.instance().getCurrentApp().getUniqueId();
ConnectAppRecord appRecord = getAppRecord(context, appId);
if(appRecord != null) {
job = ConnectDatabaseHelper.getJob(context, appRecord.getJobId());
}

setActiveJob(job);

return job;
}

private ConnectJobRecord activeJob = null;
private int failedPinAttempts = 0;

Expand Down
14 changes: 8 additions & 6 deletions app/src/org/commcare/fragments/SelectInstallModeFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -200,12 +200,14 @@ public void showOrHideErrorMessage() {

public void updateConnectButton(boolean connectEnabled, View.OnClickListener listener) {
boolean enabled = connectEnabled && ConnectManager.shouldShowConnectButton();

if(enabled) {
mConnectButton.setOnClickListener(listener);
if (mConnectButton != null) {
if (enabled) {
mConnectButton.setOnClickListener(listener);
}
mConnectButton.setVisibility(enabled ? View.VISIBLE : View.GONE);
}
if (mOrText != null) {
mOrText.setVisibility(enabled ? View.VISIBLE : View.GONE);
}

mConnectButton.setVisibility(enabled ? View.VISIBLE : View.GONE);
mOrText.setVisibility(enabled ? View.VISIBLE : View.GONE);
}
}
19 changes: 11 additions & 8 deletions app/src/org/commcare/preferences/HiddenPreferences.java
Original file line number Diff line number Diff line change
Expand Up @@ -118,14 +118,17 @@ public class HiddenPreferences {
*/
public static int getLoginDuration() {
final int oneDayInSecs = 60 * 60 * 24;

SharedPreferences properties = CommCareApplication.instance().getCurrentApp().getAppPreferences();

// try loading setting but default to 24 hours
try {
return Integer.parseInt(properties.getString(LOGIN_DURATION,
Integer.toString(oneDayInSecs)));
} catch (NumberFormatException e) {
if(CommCareApplication.instance().getCurrentApp()!=null) {
SharedPreferences properties = CommCareApplication.instance().getCurrentApp().getAppPreferences();

// try loading setting but default to 24 hours
try {
return Integer.parseInt(properties.getString(LOGIN_DURATION,
Integer.toString(oneDayInSecs)));
} catch (NumberFormatException e) {
return oneDayInSecs;
}
}else{
return oneDayInSecs;
}
}
Expand Down