Skip to content

Commit 403154b

Browse files
committed
Less indents and code -> better readable
Also removed a useless variable
1 parent e5fd24b commit 403154b

1 file changed

Lines changed: 24 additions & 24 deletions

File tree

app/src/main/java/org/schabi/newpipe/CheckForNewAppVersion.java

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -128,33 +128,33 @@ private static void compareAppVersionAndShowNotification(@NonNull final Applicat
128128
final String versionName,
129129
final String apkLocationUrl,
130130
final int versionCode) {
131-
final int notificationId = 2000;
131+
if (BuildConfig.VERSION_CODE >= versionCode) {
132+
return;
133+
}
132134

133-
if (BuildConfig.VERSION_CODE < versionCode) {
134-
// A pending intent to open the apk location url in the browser.
135-
final Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(apkLocationUrl));
136-
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
137-
final PendingIntent pendingIntent
138-
= PendingIntent.getActivity(application, 0, intent, 0);
135+
// A pending intent to open the apk location url in the browser.
136+
final Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(apkLocationUrl));
137+
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
138+
final PendingIntent pendingIntent
139+
= PendingIntent.getActivity(application, 0, intent, 0);
139140

140-
final String channelId = application
141-
.getString(R.string.app_update_notification_channel_id);
142-
final NotificationCompat.Builder notificationBuilder
143-
= new NotificationCompat.Builder(application, channelId)
144-
.setSmallIcon(R.drawable.ic_newpipe_update)
145-
.setVisibility(NotificationCompat.VISIBILITY_PUBLIC)
146-
.setContentIntent(pendingIntent)
147-
.setAutoCancel(true)
148-
.setContentTitle(application
149-
.getString(R.string.app_update_notification_content_title))
150-
.setContentText(application
151-
.getString(R.string.app_update_notification_content_text)
152-
+ " " + versionName);
141+
final String channelId = application
142+
.getString(R.string.app_update_notification_channel_id);
143+
final NotificationCompat.Builder notificationBuilder
144+
= new NotificationCompat.Builder(application, channelId)
145+
.setSmallIcon(R.drawable.ic_newpipe_update)
146+
.setVisibility(NotificationCompat.VISIBILITY_PUBLIC)
147+
.setContentIntent(pendingIntent)
148+
.setAutoCancel(true)
149+
.setContentTitle(application
150+
.getString(R.string.app_update_notification_content_title))
151+
.setContentText(application
152+
.getString(R.string.app_update_notification_content_text)
153+
+ " " + versionName);
153154

154-
final NotificationManagerCompat notificationManager
155-
= NotificationManagerCompat.from(application);
156-
notificationManager.notify(notificationId, notificationBuilder.build());
157-
}
155+
final NotificationManagerCompat notificationManager
156+
= NotificationManagerCompat.from(application);
157+
notificationManager.notify(2000, notificationBuilder.build());
158158
}
159159

160160
public static boolean isReleaseApk(@NonNull final App app) {

0 commit comments

Comments
 (0)