From 0b0cfd49c6368295ffe904a623416d5f2341a997 Mon Sep 17 00:00:00 2001 From: Josephine Lim Date: Fri, 28 Sep 2018 19:37:02 +1000 Subject: [PATCH] Revert to using target SDK hotfix for 2.8.4 (#1908) * Revert "Cherry-pick dbrant's PR from master" This reverts commit 718c70936dacb65ec22838eefb5469e87e8c8f2f. * Change target SDK to 26 temporarily * Should actually target SDK 25 See https://developer.android.com/training/notify-user/channels --- .../fr/free/nrw/commons/CommonsApplication.java | 15 --------------- .../fr/free/nrw/commons/upload/UploadService.java | 2 +- gradle.properties | 3 ++- 3 files changed, 3 insertions(+), 17 deletions(-) diff --git a/app/src/main/java/fr/free/nrw/commons/CommonsApplication.java b/app/src/main/java/fr/free/nrw/commons/CommonsApplication.java index d3507a8484..5fcab1d0b2 100644 --- a/app/src/main/java/fr/free/nrw/commons/CommonsApplication.java +++ b/app/src/main/java/fr/free/nrw/commons/CommonsApplication.java @@ -5,9 +5,6 @@ import android.content.SharedPreferences; import android.database.sqlite.SQLiteDatabase; import android.support.multidex.MultiDexApplication; -import android.os.Build; -import android.support.annotation.NonNull; -import android.support.annotation.RequiresApi; import com.facebook.drawee.backends.pipeline.Fresco; import com.facebook.imagepipeline.core.ImagePipelineConfig; @@ -104,22 +101,10 @@ public void onCreate() { Stetho.initializeWithDefaults(this); } - createNotificationChannel(this); // Fire progress callbacks for every 3% of uploaded content System.setProperty("in.yuvi.http.fluent.PROGRESS_TRIGGER_THRESHOLD", "3.0"); } - public static void createNotificationChannel(@NonNull Context context) { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - NotificationManager manager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); - NotificationChannel channel = manager.getNotificationChannel(NOTIFICATION_CHANNEL_ID_ALL); - if (channel == null) { - channel = new NotificationChannel(NOTIFICATION_CHANNEL_ID_ALL, - context.getString(R.string.notifications_channel_name_all), NotificationManager.IMPORTANCE_DEFAULT); - manager.createNotificationChannel(channel); - } - } - } /** * Helps in setting up LeakCanary library diff --git a/app/src/main/java/fr/free/nrw/commons/upload/UploadService.java b/app/src/main/java/fr/free/nrw/commons/upload/UploadService.java index edae8e38d9..306c7272f8 100644 --- a/app/src/main/java/fr/free/nrw/commons/upload/UploadService.java +++ b/app/src/main/java/fr/free/nrw/commons/upload/UploadService.java @@ -122,7 +122,7 @@ public void onDestroy() { @Override public void onCreate() { super.onCreate(); - CommonsApplication.createNotificationChannel(getApplicationContext()); + notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); } diff --git a/gradle.properties b/gradle.properties index 05aa349498..afb609bda0 100644 --- a/gradle.properties +++ b/gradle.properties @@ -19,7 +19,8 @@ android.useDeprecatedNdk=true BUTTERKNIFE_VERSION=8.6.0 org.gradle.jvmargs=-Xmx1536M buildToolsVersion=27.0.0 -targetSdkVersion=27 +#TODO: Change back to 27 in v2.9, see https://github.com/commons-app/apps-android-commons/issues/1877 +targetSdkVersion=25 #TODO: Temporary disabled. https://developer.android.com/studio/build/gradle-plugin-3-0-0-migration.html#aapt2 #Refer to PR: https://github.com/commons-app/apps-android-commons/pull/932