Skip to content

Commit

Permalink
🔥 Remove the NEW_DATA broadcast intent when we pull data from the s…
Browse files Browse the repository at this point in the history
…erver

- The intent does not have the package configured like all the other explicit intents
- The intent is currently unused since we do not read any data from the local cache
- Note that since we don't read any data from the local cache, we can also just
  stop returning any data from the server, and reduce power and data consumption.
  That is implemented in the related PR: e-mission/e-mission-server#978
  • Loading branch information
shankari committed Aug 28, 2024
1 parent 01c4e4c commit 474ccdc
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 20 deletions.
2 changes: 1 addition & 1 deletion plugin.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<plugin xmlns="http://www.phonegap.com/ns/plugins/1.0"
id="cordova-plugin-em-serversync"
version="1.3.2">
version="1.3.3">

<name>ServerSync</name>
<description>Push and pull local data to the server</description>
Expand Down
7 changes: 0 additions & 7 deletions src/android/ServerSyncAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -176,13 +176,6 @@ public void onPerformSync(Account account, Bundle extras, String authority,
new StatsEvent(cachedContext, R.string.pull_duration));
}

// We are sending this only locally, so we don't care about the URI and so on.
Intent localIntent = new Intent("edu.berkeley.eecs.emission.sync.NEW_DATA");
Bundle b = new Bundle();
b.putString( "userdata", "{}" );
localIntent.putExtras(b);
Log.i(cachedContext, TAG, "Finished sync, sending local broadcast");
LocalBroadcastManager.getInstance(cachedContext).sendBroadcastSync(localIntent);
biuc.putMessage(R.string.key_usercache_client_time,
new StatsEvent(cachedContext, R.string.sync_duration, to.elapsedSecs()));
}
Expand Down
13 changes: 1 addition & 12 deletions src/ios/BEMServerSyncCommunicationHelper.m
Original file line number Diff line number Diff line change
Expand Up @@ -171,18 +171,7 @@ +(BFTask*) pullIntoUserCache {
StatsEvent* se = [[StatsEvent alloc] initForReading:@"sync_pull_list_size" withReading:newSectionCount];
[[BuiltinUserCache database] putMessage:@"key.usercache.client_time" value:se];

if (newSectionCount > 0) {
// Note that we need to update the UI before calling the completion handler, otherwise
// when the view appears, users won't see the newly fetched data!
[[NSNotificationCenter defaultCenter] postNotificationName:BackgroundRefreshNewData
object:self];
[[NSNotificationCenter defaultCenter] postNotificationName:@"edu.berkeley.eecs.emission.sync.NEW_DATA"
object:nil
userInfo:nil];
[task setResult:@(TRUE)];
} else {
[task setResult:@(TRUE)];
}
[task setResult:@(TRUE)];
}
StatsEvent* se = [[StatsEvent alloc] initForReading:@"pull_duration" withReading:[t elapsed_secs]];
[[BuiltinUserCache database] putMessage:@"key.usercache.client_time" value:se];
Expand Down

0 comments on commit 474ccdc

Please sign in to comment.