This commit is contained in:
Amine 2017-08-30 22:11:29 +02:00
parent c28fbd37cc
commit faebfc238c
12 changed files with 76 additions and 5 deletions

View File

@ -22,7 +22,8 @@ Always check if the web version of your instance is working.
### Bug reports/Feature request ### Bug reports/Feature request
* Always search before reporting an issue or asking for a feature to avoid duplicates. * Always search before reporting an issue or asking for a feature to avoid duplicates.
* Include every usefull details (app version, phone model, Android version and screenshots when possible) * Include your unique user id. It's displayed on the debug settings page. (You can tap it, it'll be copied to your clipboard)
* Include every other useful details (app version, phone model, Android version and screenshots when possible).
* Avoid bumping non-fatal issues, or feature requests. I'll try to fix them as soon as possible, and try to prioritize the requests. (You may wan to use the [reactions](https://github.com/blog/2119-add-reactions-to-pull-requests-issues-and-comments) for that) * Avoid bumping non-fatal issues, or feature requests. I'll try to fix them as soon as possible, and try to prioritize the requests. (You may wan to use the [reactions](https://github.com/blog/2119-add-reactions-to-pull-requests-issues-and-comments) for that)
### Pull requests ### Pull requests

View File

@ -1,3 +1,11 @@
**1.5.2.11**
- Added a random unique identifier to be used in the logs.
**1.5.2.08/09/10**
- Added settable logs for reading articles problems.
**1.5.2.07** **1.5.2.07**
- Added the ability to choose the number of items loaded (the maximum value is 200 and is imposed by the selfoss api) - Added the ability to choose the number of items loaded (the maximum value is 200 and is imposed by the selfoss api)

View File

@ -92,6 +92,7 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
private var maybeTagFilter: Tag? = null private var maybeTagFilter: Tag? = null
private var maybeSourceFilter: Sources? = null private var maybeSourceFilter: Sources? = null
private var maybeSearchFilter: String? = null private var maybeSearchFilter: String? = null
private var userIdentifier: String = ""
private lateinit var emptyText: TextView private lateinit var emptyText: TextView
private lateinit var recyclerView: RecyclerView private lateinit var recyclerView: RecyclerView
@ -287,6 +288,7 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
displayAllCount = sharedPref.getBoolean("display_other_count", false) displayAllCount = sharedPref.getBoolean("display_other_count", false)
fullHeightCards = sharedPref.getBoolean("full_height_cards", false) fullHeightCards = sharedPref.getBoolean("full_height_cards", false)
itemsNumber = sharedPref.getString("prefer_api_items_number", "200").toInt() itemsNumber = sharedPref.getString("prefer_api_items_number", "200").toInt()
userIdentifier = sharedPref.getString("unique_id", "")
} }
private fun handleDrawer() { private fun handleDrawer() {
@ -644,7 +646,8 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
articleViewer, articleViewer,
fullHeightCards, fullHeightCards,
appColors, appColors,
debugReadingItems) debugReadingItems,
userIdentifier)
} else { } else {
mAdapter = mAdapter =
ItemListAdapter( ItemListAdapter(
@ -655,7 +658,8 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
clickBehavior, clickBehavior,
internalBrowser, internalBrowser,
articleViewer, articleViewer,
debugReadingItems) debugReadingItems,
userIdentifier)
} }
recyclerView.adapter = mAdapter recyclerView.adapter = mAdapter
mAdapter.notifyDataSetChanged() mAdapter.notifyDataSetChanged()

View File

@ -51,6 +51,7 @@ class LoginActivity : AppCompatActivity() {
private lateinit var mPasswordView: EditText private lateinit var mPasswordView: EditText
private lateinit var mHTTPPasswordView: EditText private lateinit var mHTTPPasswordView: EditText
private lateinit var mLoginFormView: View private lateinit var mLoginFormView: View
private lateinit var userIdentifier: String
private var logErrors: Boolean = false private var logErrors: Boolean = false
@ -76,6 +77,7 @@ class LoginActivity : AppCompatActivity() {
settings = getSharedPreferences(Config.settingsName, Context.MODE_PRIVATE) settings = getSharedPreferences(Config.settingsName, Context.MODE_PRIVATE)
userIdentifier = settings.getString("unique_id", "")
logErrors = settings.getBoolean("loging_debug", false) logErrors = settings.getBoolean("loging_debug", false)
editor = settings.edit() editor = settings.edit()
@ -224,6 +226,7 @@ class LoginActivity : AppCompatActivity() {
mHTTPLoginView.error = getString(R.string.wrong_infos) mHTTPLoginView.error = getString(R.string.wrong_infos)
mHTTPPasswordView.error = getString(R.string.wrong_infos) mHTTPPasswordView.error = getString(R.string.wrong_infos)
if (logErrors) { if (logErrors) {
Crashlytics.setUserIdentifier(userIdentifier)
Crashlytics.log(100, "LOGIN_DEBUG_ERRROR", t.message) Crashlytics.log(100, "LOGIN_DEBUG_ERRROR", t.message)
Crashlytics.logException(t) Crashlytics.logException(t)
Toast.makeText(this@LoginActivity, t.message, Toast.LENGTH_LONG).show() Toast.makeText(this@LoginActivity, t.message, Toast.LENGTH_LONG).show()

View File

@ -6,6 +6,7 @@ import android.net.Uri
import android.preference.PreferenceManager import android.preference.PreferenceManager
import android.support.multidex.MultiDexApplication import android.support.multidex.MultiDexApplication
import android.widget.ImageView import android.widget.ImageView
import apps.amine.bou.readerforselfoss.utils.Config
import com.anupcowkur.reservoir.Reservoir import com.anupcowkur.reservoir.Reservoir
import com.bumptech.glide.Glide import com.bumptech.glide.Glide
import com.crashlytics.android.Crashlytics import com.crashlytics.android.Crashlytics
@ -15,9 +16,13 @@ import com.mikepenz.materialdrawer.util.AbstractDrawerImageLoader
import com.mikepenz.materialdrawer.util.DrawerImageLoader import com.mikepenz.materialdrawer.util.DrawerImageLoader
import io.fabric.sdk.android.Fabric import io.fabric.sdk.android.Fabric
import java.io.IOException import java.io.IOException
import java.util.UUID.randomUUID
class MyApp : MultiDexApplication() { class MyApp : MultiDexApplication() {
override fun onCreate() { override fun onCreate() {
super.onCreate() super.onCreate()
Fabric.with(this, Crashlytics()) Fabric.with(this, Crashlytics())
@ -26,6 +31,13 @@ class MyApp : MultiDexApplication() {
initCache() initCache()
val prefs = getSharedPreferences(Config.settingsName, Context.MODE_PRIVATE)
if (prefs.getString("unique_id", "").isEmpty()) {
val editor = prefs.edit()
editor.putString("unique_id", randomUUID().toString())
editor.apply()
}
initDrawerImageLoader() initDrawerImageLoader()
initTheme() initTheme()

View File

@ -43,7 +43,8 @@ class ItemCardAdapter(private val app: Activity,
private val articleViewer: Boolean, private val articleViewer: Boolean,
private val fullHeightCards: Boolean, private val fullHeightCards: Boolean,
private val appColors: AppColors, private val appColors: AppColors,
val debugReadingItems: Boolean) : RecyclerView.Adapter<ItemCardAdapter.ViewHolder>() { val debugReadingItems: Boolean,
val userIdentifier: String) : RecyclerView.Adapter<ItemCardAdapter.ViewHolder>() {
private val c: Context = app.baseContext private val c: Context = app.baseContext
private val generator: ColorGenerator = ColorGenerator.MATERIAL private val generator: ColorGenerator = ColorGenerator.MATERIAL
@ -135,8 +136,10 @@ class ItemCardAdapter(private val app: Activity,
"response errorBody: ${response.errorBody()?.string()} " + "response errorBody: ${response.errorBody()?.string()} " +
"body success: ${response.body()?.success} " + "body success: ${response.body()?.success} " +
"body isSuccess: ${response.body()?.isSuccess}" "body isSuccess: ${response.body()?.isSuccess}"
Crashlytics.setUserIdentifier(userIdentifier)
Crashlytics.log(100, "READ_DEBUG_SUCCESS", message) Crashlytics.log(100, "READ_DEBUG_SUCCESS", message)
Crashlytics.logException(Exception("Was success, but did it work ?")) Crashlytics.logException(Exception("Was success, but did it work ?"))
Toast.makeText(c, message, Toast.LENGTH_LONG).show() Toast.makeText(c, message, Toast.LENGTH_LONG).show()
} }
doUnmark(i, position) doUnmark(i, position)
@ -144,6 +147,7 @@ class ItemCardAdapter(private val app: Activity,
override fun onFailure(call: Call<SuccessResponse>, t: Throwable) { override fun onFailure(call: Call<SuccessResponse>, t: Throwable) {
if (debugReadingItems) { if (debugReadingItems) {
Crashlytics.setUserIdentifier(userIdentifier)
Crashlytics.log(100, "READ_DEBUG_ERROR", t.message) Crashlytics.log(100, "READ_DEBUG_ERROR", t.message)
Crashlytics.logException(t) Crashlytics.logException(t)
Toast.makeText(c, t.message, Toast.LENGTH_LONG).show() Toast.makeText(c, t.message, Toast.LENGTH_LONG).show()

View File

@ -40,7 +40,8 @@ class ItemListAdapter(private val app: Activity,
private val clickBehavior: Boolean, private val clickBehavior: Boolean,
private val internalBrowser: Boolean, private val internalBrowser: Boolean,
private val articleViewer: Boolean, private val articleViewer: Boolean,
val debugReadingItems: Boolean) : RecyclerView.Adapter<ItemListAdapter.ViewHolder>() { val debugReadingItems: Boolean,
val userIdentifier: String) : RecyclerView.Adapter<ItemListAdapter.ViewHolder>() {
private val generator: ColorGenerator = ColorGenerator.MATERIAL private val generator: ColorGenerator = ColorGenerator.MATERIAL
private val c: Context = app.baseContext private val c: Context = app.baseContext
private val bars: ArrayList<Boolean> = ArrayList(Collections.nCopies(items.size + 1, false)) private val bars: ArrayList<Boolean> = ArrayList(Collections.nCopies(items.size + 1, false))
@ -144,6 +145,7 @@ class ItemListAdapter(private val app: Activity,
"response errorBody: ${response.errorBody()?.string()} " + "response errorBody: ${response.errorBody()?.string()} " +
"body success: ${response.body()?.success} " + "body success: ${response.body()?.success} " +
"body isSuccess: ${response.body()?.isSuccess}" "body isSuccess: ${response.body()?.isSuccess}"
Crashlytics.setUserIdentifier(userIdentifier)
Crashlytics.log(100, "READ_DEBUG_SUCCESS", message) Crashlytics.log(100, "READ_DEBUG_SUCCESS", message)
Crashlytics.logException(Exception("Was success, but did it work ?")) Crashlytics.logException(Exception("Was success, but did it work ?"))
Toast.makeText(c, message, Toast.LENGTH_LONG).show() Toast.makeText(c, message, Toast.LENGTH_LONG).show()
@ -154,6 +156,7 @@ class ItemListAdapter(private val app: Activity,
override fun onFailure(call: Call<SuccessResponse>, t: Throwable) { override fun onFailure(call: Call<SuccessResponse>, t: Throwable) {
if (debugReadingItems) { if (debugReadingItems) {
Crashlytics.setUserIdentifier(userIdentifier)
Crashlytics.log(100, "READ_DEBUG_ERROR", t.message) Crashlytics.log(100, "READ_DEBUG_ERROR", t.message)
Crashlytics.logException(t) Crashlytics.logException(t)
Toast.makeText(c, t.message, Toast.LENGTH_LONG).show() Toast.makeText(c, t.message, Toast.LENGTH_LONG).show()

View File

@ -2,8 +2,11 @@ package apps.amine.bou.readerforselfoss.settings;
import android.annotation.TargetApi; import android.annotation.TargetApi;
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences;
import android.content.res.Configuration; import android.content.res.Configuration;
import android.net.Uri; import android.net.Uri;
import android.os.Build; import android.os.Build;
@ -11,6 +14,7 @@ import android.os.Bundle;
import android.preference.EditTextPreference; import android.preference.EditTextPreference;
import android.preference.Preference; import android.preference.Preference;
import android.preference.Preference.OnPreferenceChangeListener; import android.preference.Preference.OnPreferenceChangeListener;
import android.preference.Preference.OnPreferenceClickListener;
import android.preference.PreferenceActivity; import android.preference.PreferenceActivity;
import android.preference.SwitchPreference; import android.preference.SwitchPreference;
import android.support.v7.app.ActionBar; import android.support.v7.app.ActionBar;
@ -19,10 +23,12 @@ import android.preference.PreferenceManager;
import android.text.InputFilter; import android.text.InputFilter;
import android.text.Spanned; import android.text.Spanned;
import android.view.MenuItem; import android.view.MenuItem;
import android.widget.Toast;
import java.util.List; import java.util.List;
import apps.amine.bou.readerforselfoss.R; import apps.amine.bou.readerforselfoss.R;
import apps.amine.bou.readerforselfoss.utils.Config;
import com.ftinc.scoop.ui.ScoopSettingsActivity; import com.ftinc.scoop.ui.ScoopSettingsActivity;
@ -184,6 +190,25 @@ public class SettingsActivity extends AppCompatPreferenceActivity {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.pref_debug); addPreferencesFromResource(R.xml.pref_debug);
setHasOptionsMenu(true); setHasOptionsMenu(true);
SharedPreferences pref = getActivity().getSharedPreferences(Config.Companion.getSettingsName(), Context.MODE_PRIVATE);
final String id = pref.getString("unique_id", "...");
final Preference identifier = findPreference("debug_identifier");
final ClipboardManager clipboard = (ClipboardManager)
getActivity().getSystemService(Context.CLIPBOARD_SERVICE);
identifier.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
ClipData clip = ClipData.newPlainText("Selfoss unique id", id);
clipboard.setPrimaryClip(clip);
Toast.makeText(getActivity(), R.string.unique_id_to_clipboard, Toast.LENGTH_LONG).show();
return true;
}
});
identifier.setTitle(id);
} }
@Override @Override

View File

@ -143,4 +143,6 @@
<string name="read_debug_title">Des articles lus marqués comme non lus ?</string> <string name="read_debug_title">Des articles lus marqués comme non lus ?</string>
<string name="read_debug_on">Les appels API vont être logués lorsequ\'un article est marqué comme lu</string> <string name="read_debug_on">Les appels API vont être logués lorsequ\'un article est marqué comme lu</string>
<string name="read_debug_off">Aucun log quand un article est marqué comme lu</string> <string name="read_debug_off">Aucun log quand un article est marqué comme lu</string>
<string name="summary_debug_identifier">Identifiant de debug</string>
<string name="unique_id_to_clipboard">Texte copié</string>
</resources> </resources>

View File

@ -143,4 +143,6 @@
<string name="read_debug_title">Read articles appearing as unread ?</string> <string name="read_debug_title">Read articles appearing as unread ?</string>
<string name="read_debug_on">Api calls will be logged when marking an article as read</string> <string name="read_debug_on">Api calls will be logged when marking an article as read</string>
<string name="read_debug_off">No log when marking an item as read</string> <string name="read_debug_off">No log when marking an item as read</string>
<string name="summary_debug_identifier">Debug identifier</string>
<string name="unique_id_to_clipboard">Identifier copied to your clipboard</string>
</resources> </resources>

View File

@ -145,4 +145,6 @@
<string name="read_debug_title">Read articles appearing as unread ?</string> <string name="read_debug_title">Read articles appearing as unread ?</string>
<string name="read_debug_off">No log when marking an item as read</string> <string name="read_debug_off">No log when marking an item as read</string>
<string name="read_debug_on">Api calls will be logged when marking an article as read</string> <string name="read_debug_on">Api calls will be logged when marking an article as read</string>
<string name="summary_debug_identifier">Debug identifier</string>
<string name="unique_id_to_clipboard">Identifier copied to your clipboard</string>
</resources> </resources>

View File

@ -15,4 +15,9 @@
android:summaryOff="@string/read_debug_off" android:summaryOff="@string/read_debug_off"
android:summaryOn="@string/read_debug_on" android:summaryOn="@string/read_debug_on"
android:title="@string/read_debug_title" /> android:title="@string/read_debug_title" />
<Preference
android:enabled="true"
android:key="debug_identifier"
android:summary="@string/summary_debug_identifier" />
</PreferenceScreen> </PreferenceScreen>