Skip to content
This repository was archived by the owner on Jul 25, 2024. It is now read-only.

Commit c6ab9bf

Browse files
kunall17niftynei
authored andcommitted
If new messages are recieved then update the widget
1 parent 25c93f5 commit c6ab9bf

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

app/src/main/java/com/zulip/android/networking/AsyncGetEvents.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import org.json.JSONException;
1313
import org.json.JSONObject;
1414

15+
import android.content.Intent;
1516
import android.os.SystemClock;
1617
import android.util.Log;
1718

@@ -24,6 +25,7 @@
2425
import com.zulip.android.util.ZLog;
2526
import com.zulip.android.activities.ZulipActivity;
2627
import com.zulip.android.ZulipApp;
28+
import com.zulip.android.widget.ZulipWidget;
2729

2830
import okhttp3.Response;
2931

@@ -336,6 +338,14 @@ public void run() {
336338
activity.onNewMessages(messages.toArray(new Message[messages.size()]));
337339
}
338340
});
341+
} else {
342+
if (!messages.isEmpty()) {
343+
//Reload Widget on new messages
344+
Log.d(TAG, "New messages recieved for calledFromWidget: " + messages.size());
345+
final Intent refreshIntent = new Intent(app, ZulipWidget.class);
346+
refreshIntent.setAction(ZulipWidget.WIDGET_REFRESH);
347+
app.startActivity(refreshIntent);
348+
}
339349
}
340350
}
341351

0 commit comments

Comments
 (0)