LEFT | RIGHT |
1 /* | 1 /* |
2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
3 * Copyright (C) 2006-present eyeo GmbH | 3 * Copyright (C) 2006-present eyeo GmbH |
4 * | 4 * |
5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
8 * | 8 * |
9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 17 matching lines...) Expand all Loading... |
28 import org.adblockplus.sbrowser.contentblocker.util.SharedPrefsUtils; | 28 import org.adblockplus.sbrowser.contentblocker.util.SharedPrefsUtils; |
29 | 29 |
30 import android.content.Context; | 30 import android.content.Context; |
31 import android.text.format.DateUtils; | 31 import android.text.format.DateUtils; |
32 import android.util.Log; | 32 import android.util.Log; |
33 | 33 |
34 import javax.net.ssl.HttpsURLConnection; | 34 import javax.net.ssl.HttpsURLConnection; |
35 | 35 |
36 public class Notification | 36 public class Notification |
37 { | 37 { |
38 public static final String TAG = Notification.class.getSimpleName(); | 38 private static final String TAG = Notification.class.getSimpleName(); |
39 public static final String NOTIFICATION_URL = "https://notification.adblockplu
s.org/notification.json"; | 39 public static final String NOTIFICATION_URL = "https://notification.adblockplu
s.org/notification.json"; |
40 public static final String NOTIFICATION_DATA_FILE_NAME = TAG.toLowerCase() + "
.abp"; | 40 public static final String NOTIFICATION_DATA_FILE_NAME = "notification.abp"; |
41 public static final String KEY_EXTRA_ID = "_extra_id"; | 41 public static final String KEY_EXTRA_ID = "_extra_id"; |
42 public static final String KEY_EXTRA_URL = "_extra_url"; | 42 public static final String KEY_EXTRA_URL = "_extra_url"; |
43 | 43 |
44 private static final long NOTIFICATION_DOWNLOAD_INTERVAL = DateUtils.DAY_IN_MI
LLIS; | 44 private static final long NOTIFICATION_DOWNLOAD_INTERVAL = DateUtils.DAY_IN_MI
LLIS; |
45 private static final long DOWNLOAD_RETRY_INTERVAL = DateUtils.HOUR_IN_MILLIS; | 45 private static final long DOWNLOAD_RETRY_INTERVAL = DateUtils.HOUR_IN_MILLIS; |
46 | 46 |
47 public static boolean shouldUpdate(final Context context) | 47 public static boolean shouldUpdate(final Context context) |
48 { | 48 { |
49 final long now = System.currentTimeMillis(); | 49 final long now = System.currentTimeMillis(); |
50 final long lastUpdate = SharedPrefsUtils.getLong(context, R.string.key_last_
notification_update_timestamp, 0); | 50 final long lastUpdate = SharedPrefsUtils.getLong(context, R.string.key_last_
notification_update_timestamp, 0); |
(...skipping 29 matching lines...) Expand all Loading... |
80 new GZIPOutputStream(new FileOutputStream(filtersFile))))) | 80 new GZIPOutputStream(new FileOutputStream(filtersFile))))) |
81 { | 81 { |
82 outputStream.write(text.getBytes()); | 82 outputStream.write(text.getBytes()); |
83 } | 83 } |
84 catch (IOException e) | 84 catch (IOException e) |
85 { | 85 { |
86 Log.d(TAG, "Failed to write notification data to internal storage.", e); | 86 Log.d(TAG, "Failed to write notification data to internal storage.", e); |
87 } | 87 } |
88 } | 88 } |
89 } | 89 } |
LEFT | RIGHT |