Skip to content

Commit

Permalink
Merge pull request #2010 from moneymanagerex/google
Browse files Browse the repository at this point in the history
ANR: just enable light check
  • Loading branch information
guanlisheng authored Dec 27, 2024
2 parents 87928d1 + 4bbd45e commit 69d093a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ public void onReceive(Context context, Intent intent) {
Timber.d("receiving a sync intent %s",intent);

SyncManager sync = new SyncManager(context);
if (!sync.canSync()) return;

sync.triggerSynchronization();
}
}
10 changes: 4 additions & 6 deletions app/src/main/java/com/money/manager/ex/sync/SyncManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,7 @@ public Context getContext() {
* @return boolean indicating if auto sync should be done.
*/
public boolean canSync() {
// file can be manually removed from storage both intenal and external
if (isPhoneStorage() && isRemoteFileAccessible(true ) ) return true;
if (isPhoneStorage()) return true;

// check if online
if (!isActive()) return false;
Expand All @@ -122,11 +121,10 @@ public boolean canSync() {
return false;
}
}

return isRemoteFileAccessible(true ) ;
return true;
}

public boolean isRemoteFileAccessible(boolean showAllert) {
public boolean isRemoteFileAccessible(boolean showAlert) {
// check if remote file is accessible
isRemoteFileAccessibleExist = false;
String remotePath = getRemotePath();
Expand All @@ -148,7 +146,7 @@ public boolean isRemoteFileAccessible(boolean showAllert) {
}

if (!isRemoteFileAccessibleExist) {
if (showAllert) {
if (showAlert) {
Toast.makeText(getContext(), R.string.remote_unavailable, Toast.LENGTH_SHORT).show();
Timber.i("Remote file is no longer available.");
NotificationManager notificationManager = (NotificationManager) getContext()
Expand Down

0 comments on commit 69d093a

Please sign in to comment.