Merge branch 'master' into 2.8-release

This commit is contained in:
Vivek Maskara 2018-09-07 05:24:53 +05:30 committed by GitHub
commit 15f9895336
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
110 changed files with 3255 additions and 675 deletions

View file

@ -1,10 +1,14 @@
package fr.free.nrw.commons;
import android.annotation.SuppressLint;
import android.app.Application;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.content.Context;
import android.content.SharedPreferences;
import android.database.sqlite.SQLiteDatabase;
import android.support.multidex.MultiDexApplication;
import android.os.Build;
import android.support.annotation.RequiresApi;
import com.facebook.drawee.backends.pipeline.Fresco;
import com.facebook.imagepipeline.core.ImagePipelineConfig;
@ -44,7 +48,7 @@ import timber.log.Timber;
resDialogCommentPrompt = R.string.crash_dialog_comment_prompt,
resDialogOkToast = R.string.crash_dialog_ok_toast
)
public class CommonsApplication extends MultiDexApplication {
public class CommonsApplication extends Application {
@Inject SessionManager sessionManager;
@Inject DBOpenHelper dbOpenHelper;
@ -53,6 +57,11 @@ public class CommonsApplication extends MultiDexApplication {
@Inject @Named("application_preferences") SharedPreferences applicationPrefs;
@Inject @Named("prefs") SharedPreferences otherPrefs;
/**
* Constants begin
*/
public static final int OPEN_APPLICATION_DETAIL_SETTINGS = 1001;
public static final String DEFAULT_EDIT_SUMMARY = "Uploaded using [[COM:MOA|Commons Mobile App]]";
public static final String FEEDBACK_EMAIL = "commons-app-android@googlegroups.com";
@ -63,6 +72,12 @@ public class CommonsApplication extends MultiDexApplication {
public static final String LOGS_PRIVATE_EMAIL_SUBJECT = "Commons Android App (%s) Logs";
public static final String NOTIFICATION_CHANNEL_ID_ALL = "CommonsNotificationAll";
/**
* Constants End
*/
private RefWatcher refWatcher;
@ -101,10 +116,23 @@ public class CommonsApplication extends MultiDexApplication {
Stetho.initializeWithDefaults(this);
}
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.O) {
createNotificationChannel();
}
// Fire progress callbacks for every 3% of uploaded content
System.setProperty("in.yuvi.http.fluent.PROGRESS_TRIGGER_THRESHOLD", "3.0");
}
@RequiresApi(26)
private void createNotificationChannel() {
NotificationChannel channel = new NotificationChannel(
NOTIFICATION_CHANNEL_ID_ALL,
getString(R.string.notifications_channel_name_all), NotificationManager.IMPORTANCE_NONE);
NotificationManager manager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
manager.createNotificationChannel(channel);
}
/**
* Helps in setting up LeakCanary library