Browse Source

Up OkHttp

pull/61/merge
Ezerous 6 years ago
parent
commit
3ed2081d8b
No known key found for this signature in database GPG Key ID: 262B2954BBA319E3
  1. 4
      app/build.gradle
  2. 2
      app/proguard-rules.pro
  3. 2
      app/src/main/assets/apache_libraries.html
  4. 11
      app/src/main/java/gr/thmmy/mthmmy/services/NotificationService.java

4
app/build.gradle

@ -25,7 +25,7 @@ android {
def date = new Date().format('ddMMyy_HHmmss')
archivesBaseName = archivesBaseName + "-$date"
// Disable fabric build ID generation for debug builds
ext.enableCrashlytics = false;
ext.enableCrashlytics = false
}
}
@ -58,7 +58,7 @@ dependencies {
implementation 'com.google.firebase:firebase-core:16.0.4'
implementation 'com.google.firebase:firebase-messaging:17.3.3'
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.5'
implementation 'com.squareup.okhttp3:okhttp:3.10.0'
implementation 'com.squareup.okhttp3:okhttp:3.11.0'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.jakewharton.picasso:picasso2-okhttp3-downloader:1.1.0'
implementation 'org.jsoup:jsoup:1.10.3' //TODO: Warning: upgrading from 1.10.3 will break stuff!

2
app/proguard-rules.pro

@ -26,6 +26,8 @@
-dontwarn org.conscrypt.**
# A resource is loaded with a relative path so the package of this class must be preserved.
-keepnames class okhttp3.internal.publicsuffix.PublicSuffixDatabase
# Animal Sniffer compileOnly dependency to ensure APIs are compatible with older versions of Java.
-dontwarn org.codehaus.mojo.animal_sniffer.*
# Picasso
-dontwarn com.squareup.okhttp.**

2
app/src/main/assets/apache_libraries.html

@ -39,7 +39,7 @@
<body>
<ul>
<li>
<h5><a href="https://square.github.io/okhttp/">OkHttp</a>&nbsp;v3.10.0 (Copyright ©2016 Square, Inc.)</h5>
<h5><a href="https://square.github.io/okhttp/">OkHttp</a>&nbsp;v3.11.0 (Copyright ©2016 Square, Inc.)</h5>
</li>
<li>
<h5><a href="https://square.github.io/picasso/">Picasso</a>&nbsp;v2.5.2 (Copyright ©2013 Square, Inc.)</h5>

11
app/src/main/java/gr/thmmy/mthmmy/services/NotificationService.java

@ -156,7 +156,7 @@ public class NotificationService extends FirebaseMessagingService {
int k1 = postNotification.getTopicId();
int k2 = postNotification.getBoardId();
notificationId = -(((k1+k2)*(k1+k2+1))/2+k2);
contentText = "New post in " + postNotification.getTopicTitle();
contentText = "New post in \"" + postNotification.getTopicTitle() + "\"";
}
int newPostsCount = 1;
@ -221,16 +221,17 @@ public class NotificationService extends FirebaseMessagingService {
.setGroup(GROUP_KEY)
.setAutoCancel(true)
.setStyle(new NotificationCompat.InboxStyle()
.setSummaryText("New Posts"))
.setSummaryText("New Posts"))
.setDefaults(Notification.DEFAULT_ALL);
}
NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
// Since Android Oreo notification channel is needed.
if (buildVersion >= Build.VERSION_CODES.O)
notificationManager.createNotificationChannel(new NotificationChannel(CHANNEL_ID, CHANNEL_NAME, NotificationManager.IMPORTANCE_HIGH));
if (buildVersion >= Build.VERSION_CODES.O){
if (notificationManager.getNotificationChannel(CHANNEL_ID) == null)
notificationManager.createNotificationChannel(new NotificationChannel(CHANNEL_ID, CHANNEL_NAME, NotificationManager.IMPORTANCE_HIGH));
}
notificationManager.notify(NEW_POST_TAG, notificationId, notificationBuilder.build());

Loading…
Cancel
Save