Skip to content

Commit

Permalink
feat: new push type MicroG
Browse files Browse the repository at this point in the history
Co-authored-by: Matteo <[email protected]>
  • Loading branch information
omg-xtao and matteobtt committed Apr 19, 2024
1 parent 7bdc7c3 commit d77111e
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3836,7 +3836,7 @@ private void showOrUpdateNotification(boolean notifyAboutLast) {
}
SharedPreferences preferences = getAccountInstance().getNotificationsSettings();
int dismissDate = preferences.getInt("dismissDate", 0);
if (!lastMessageObject.isStoryPush && lastMessageObject.messageOwner.date <= dismissDate) {
if (!lastMessageObject.isStoryPush && (lastMessageObject.messageOwner.date <= dismissDate && NaConfig.INSTANCE.getPushServiceType().Int() != 3)) {
dismissNotification();
return;
}
Expand Down Expand Up @@ -3962,7 +3962,7 @@ private void showOrUpdateNotification(boolean notifyAboutLast) {
for (int i = 0; i < count; i++) {
MessageObject messageObject = pushMessages.get(i);
String message = getStringForMessage(messageObject, false, text, null);
if (message == null || !messageObject.isStoryPush && messageObject.messageOwner.date <= dismissDate) {
if (message == null || !messageObject.isStoryPush && (messageObject.messageOwner.date <= dismissDate && NaConfig.INSTANCE.getPushServiceType().Int() != 3)) {
continue;
}
if (silent == 2) {
Expand Down Expand Up @@ -4454,7 +4454,7 @@ private void showExtraNotifications(NotificationCompat.Builder notificationBuild
long dialog_id = messageObject.getDialogId();
long topicId = MessageObject.getTopicId(currentAccount, messageObject.messageOwner, getMessagesController().isForum(messageObject));
int dismissDate = preferences.getInt("dismissDate" + dialog_id, 0);
if (!messageObject.isStoryPush && messageObject.messageOwner.date <= dismissDate) {
if (!messageObject.isStoryPush && (messageObject.messageOwner.date <= dismissDate && NaConfig.INSTANCE.getPushServiceType().Int() != 3)) {
continue;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1440,7 +1440,8 @@ public static IPushListenerServiceProvider getProvider() {
if (instance != null)
return instance;
switch (NaConfig.INSTANCE.getPushServiceType().Int()) {
case 1: {
case 1:
case 3: {
instance = new GooglePushListenerServiceProvider();
break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ public class NekoGeneralSettingsActivity extends BaseNekoXSettingsActivity {
LocaleController.getString(R.string.PushServiceTypeInApp),
LocaleController.getString(R.string.PushServiceTypeFCM),
LocaleController.getString(R.string.PushServiceTypeUnified),
LocaleController.getString(R.string.PushServiceTypeMicroG),
}, null));
private final AbstractConfigCell pushServiceTypeInAppDialogRow = cellGroup.appendCell(new ConfigCellTextCheck(NaConfig.INSTANCE.getPushServiceTypeInAppDialog()));
private final AbstractConfigCell pushServiceTypeUnifiedGatewayRow = cellGroup.appendCell(new ConfigCellTextInput(null, NaConfig.INSTANCE.getPushServiceTypeUnifiedGateway(), null, null, (input) -> input.isEmpty() ? (String) NaConfig.INSTANCE.getPushServiceTypeUnifiedGateway().defaultValue : input));
Expand Down
1 change: 1 addition & 0 deletions TMessagesProj/src/main/res/values/strings_na.xml
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@
<string name="PushServiceTypeInApp">In App</string>
<string name="PushServiceTypeFCM">Google FCM</string>
<string name="PushServiceTypeUnified">Unified Push</string>
<string name="PushServiceTypeMicroG">MicroG</string>
<string name="PushServiceTypeInAppDialog">Show resident notifications</string>
<string name="PushServiceTypeUnifiedGateway">Unified Push Gateway</string>
<string name="SendMp4DocumentAsVideo">Send mp4 document as video</string>
Expand Down

0 comments on commit d77111e

Please sign in to comment.