Merge branch 'master' of github.com:gotify/android into feature/self-signed-ssl
This commit is contained in:
@@ -29,13 +29,13 @@ android:
|
|||||||
|
|
||||||
before_install:
|
before_install:
|
||||||
- yes | sdkmanager "platforms;android-28"
|
- yes | sdkmanager "platforms;android-28"
|
||||||
- openssl aes-256-cbc -K $encrypted_f6e0f94759d3_key -iv $encrypted_f6e0f94759d3_iv
|
|
||||||
-in gotify-release-key.jks.enc -out gotify-release-key.jks -d
|
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- ./gradlew clean build --stacktrace
|
- ./gradlew clean build --stacktrace
|
||||||
|
|
||||||
before_deploy:
|
before_deploy:
|
||||||
|
- openssl aes-256-cbc -K $encrypted_f6e0f94759d3_key -iv $encrypted_f6e0f94759d3_iv
|
||||||
|
-in gotify-release-key.jks.enc -out gotify-release-key.jks -d
|
||||||
- cp $TRAVIS_BUILD_DIR/gotify-release-key.jks $HOME
|
- cp $TRAVIS_BUILD_DIR/gotify-release-key.jks $HOME
|
||||||
- cd app/build/outputs/apk/release
|
- cd app/build/outputs/apk/release
|
||||||
- jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore $HOME/gotify-release-key.jks
|
- jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore $HOME/gotify-release-key.jks
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.github.gotify;
|
|||||||
|
|
||||||
import android.app.NotificationChannel;
|
import android.app.NotificationChannel;
|
||||||
import android.app.NotificationManager;
|
import android.app.NotificationManager;
|
||||||
|
import android.graphics.Color;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import androidx.annotation.RequiresApi;
|
import androidx.annotation.RequiresApi;
|
||||||
import com.github.gotify.log.Log;
|
import com.github.gotify.log.Log;
|
||||||
@@ -24,16 +25,22 @@ public class NotificationSupport {
|
|||||||
@RequiresApi(Build.VERSION_CODES.O)
|
@RequiresApi(Build.VERSION_CODES.O)
|
||||||
public static void createChannels(NotificationManager notificationManager) {
|
public static void createChannels(NotificationManager notificationManager) {
|
||||||
try {
|
try {
|
||||||
|
// Low importance so that persistent notification can be sorted towards bottom of
|
||||||
|
// notification shade. Also prevents vibrations caused by persistent notification
|
||||||
NotificationChannel foreground =
|
NotificationChannel foreground =
|
||||||
new NotificationChannel(
|
new NotificationChannel(
|
||||||
Channel.FOREGROUND,
|
Channel.FOREGROUND,
|
||||||
"Gotify foreground notification",
|
"Gotify foreground notification",
|
||||||
NotificationManager.IMPORTANCE_DEFAULT);
|
NotificationManager.IMPORTANCE_LOW);
|
||||||
|
// High importance for message notifications so that they are shown as heads-up
|
||||||
|
// notifications and sorted towards the top of the notification shade
|
||||||
NotificationChannel messages =
|
NotificationChannel messages =
|
||||||
new NotificationChannel(
|
new NotificationChannel(
|
||||||
Channel.MESSAGES,
|
Channel.MESSAGES,
|
||||||
"Gotify messages",
|
"Gotify messages",
|
||||||
NotificationManager.IMPORTANCE_DEFAULT);
|
NotificationManager.IMPORTANCE_HIGH);
|
||||||
|
messages.enableLights(true);
|
||||||
|
messages.setLightColor(Color.CYAN);
|
||||||
notificationManager.createNotificationChannel(foreground);
|
notificationManager.createNotificationChannel(foreground);
|
||||||
notificationManager.createNotificationChannel(messages);
|
notificationManager.createNotificationChannel(messages);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|||||||
@@ -6,11 +6,13 @@ import android.app.PendingIntent;
|
|||||||
import android.app.Service;
|
import android.app.Service;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.graphics.Color;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.annotation.RequiresApi;
|
import androidx.annotation.RequiresApi;
|
||||||
import androidx.core.app.NotificationCompat;
|
import androidx.core.app.NotificationCompat;
|
||||||
|
import androidx.core.content.ContextCompat;
|
||||||
import com.github.gotify.MissedMessageUtil;
|
import com.github.gotify.MissedMessageUtil;
|
||||||
import com.github.gotify.NotificationSupport;
|
import com.github.gotify.NotificationSupport;
|
||||||
import com.github.gotify.R;
|
import com.github.gotify.R;
|
||||||
@@ -164,6 +166,9 @@ public class WebSocketService extends Service {
|
|||||||
.setContentText(message)
|
.setContentText(message)
|
||||||
.setStyle(new NotificationCompat.BigTextStyle().bigText(message))
|
.setStyle(new NotificationCompat.BigTextStyle().bigText(message))
|
||||||
.setContentIntent(pendingIntent)
|
.setContentIntent(pendingIntent)
|
||||||
|
.setColor(
|
||||||
|
ContextCompat.getColor(
|
||||||
|
getApplicationContext(), R.color.colorPrimary))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
startForeground(NotificationSupport.ID.FOREGROUND, notification);
|
startForeground(NotificationSupport.ID.FOREGROUND, notification);
|
||||||
@@ -191,6 +196,8 @@ public class WebSocketService extends Service {
|
|||||||
.setContentText(message)
|
.setContentText(message)
|
||||||
.setStyle(new NotificationCompat.BigTextStyle().bigText(message))
|
.setStyle(new NotificationCompat.BigTextStyle().bigText(message))
|
||||||
.setDefaults(Notification.DEFAULT_LIGHTS | Notification.DEFAULT_SOUND)
|
.setDefaults(Notification.DEFAULT_LIGHTS | Notification.DEFAULT_SOUND)
|
||||||
|
.setLights(Color.CYAN, 1000, 5000)
|
||||||
|
.setColor(ContextCompat.getColor(getApplicationContext(), R.color.colorPrimary))
|
||||||
.setContentIntent(contentIntent);
|
.setContentIntent(contentIntent);
|
||||||
|
|
||||||
NotificationManager notificationManager =
|
NotificationManager notificationManager =
|
||||||
@@ -213,9 +220,11 @@ public class WebSocketService extends Service {
|
|||||||
.setSmallIcon(R.drawable.ic_gotify)
|
.setSmallIcon(R.drawable.ic_gotify)
|
||||||
.setTicker(getString(R.string.app_name))
|
.setTicker(getString(R.string.app_name))
|
||||||
.setGroup(NotificationSupport.Group.MESSAGES)
|
.setGroup(NotificationSupport.Group.MESSAGES)
|
||||||
|
.setGroupAlertBehavior(NotificationCompat.GROUP_ALERT_CHILDREN)
|
||||||
.setContentTitle(getString(R.string.grouped_notification_text))
|
.setContentTitle(getString(R.string.grouped_notification_text))
|
||||||
.setGroupSummary(true)
|
.setGroupSummary(true)
|
||||||
.setContentText(getString(R.string.grouped_notification_text))
|
.setContentText(getString(R.string.grouped_notification_text))
|
||||||
|
.setColor(ContextCompat.getColor(getApplicationContext(), R.color.colorPrimary))
|
||||||
.setContentIntent(contentIntent);
|
.setContentIntent(contentIntent);
|
||||||
|
|
||||||
NotificationManager notificationManager =
|
NotificationManager notificationManager =
|
||||||
|
|||||||
Reference in New Issue
Block a user