Explorar o código

Cleanup

Signed-off-by: Álvaro Brey Vilas <alvaro.brey@nextcloud.com>
Álvaro Brey Vilas %!s(int64=3) %!d(string=hai) anos
pai
achega
1a0d3ed65b

+ 1 - 10
src/main/java/com/nextcloud/client/errorhandling/ShowErrorActivity.kt

@@ -66,16 +66,7 @@ class ShowErrorActivity : AppCompatActivity() {
     private fun reportIssue() {
         ClipboardUtil.copyToClipboard(this, binding.textViewError.text.toString(), false)
         val issueLink = getString(R.string.report_issue_link)
-        val template = getString(R.string.report_issue_template)
-        if (issueLink.isNotEmpty() && template.isNotEmpty()) {
-            // val uriUrl = Uri.parse(
-            //     String.format(
-            //         issueLink,
-            //         StringUtils.escapeStacktrace(
-            //             String.format(template, binding.textViewError.text.toString())
-            //         )
-            //     )
-            // )
+        if (issueLink.isNotEmpty()) {
             val uriUrl = Uri.parse(
                 String.format(
                     issueLink,

+ 0 - 1
src/main/java/com/owncloud/android/MainApp.java

@@ -231,7 +231,6 @@ public class MainApp extends MultiDexApplication implements HasAndroidInjector {
         // we don't want to handle crashes occurring inside crash reporter activity/process;
         // let the platform deal with those
         final boolean isCrashReportingProcess = getAppProcessName().endsWith(":crash");
-        final boolean useExceptionHandler = !appInfo.isDebugBuild();
 
         if (!isCrashReportingProcess) {
             Thread.UncaughtExceptionHandler defaultPlatformHandler = Thread.getDefaultUncaughtExceptionHandler();

+ 14 - 15
src/main/java/com/owncloud/android/ui/activity/DrawerActivity.java

@@ -102,6 +102,7 @@ import com.owncloud.android.ui.events.SearchEvent;
 import com.owncloud.android.ui.fragment.FileDetailsSharingProcessFragment;
 import com.owncloud.android.ui.fragment.GalleryFragment;
 import com.owncloud.android.ui.fragment.OCFileListFragment;
+import com.owncloud.android.ui.preview.PreviewTextStringFragment;
 import com.owncloud.android.ui.trashbin.TrashbinActivity;
 import com.owncloud.android.utils.BitmapUtils;
 import com.owncloud.android.utils.DisplayUtils;
@@ -430,21 +431,19 @@ public abstract class DrawerActivity extends ToolbarActivity
         int itemId = menuItem.getItemId();
 
         if (itemId == R.id.nav_all_files) {
-            throw new RuntimeException(new RuntimeException((new RuntimeException(new RuntimeException()))));
-
-//            if (this instanceof FileDisplayActivity &&
-//                !(((FileDisplayActivity) this).getLeftFragment() instanceof GalleryFragment) &&
-//                !(((FileDisplayActivity) this).getLeftFragment() instanceof PreviewTextStringFragment)) {
-//                showFiles(false);
-//                ((FileDisplayActivity) this).browseToRoot();
-//                EventBus.getDefault().post(new ChangeMenuEvent());
-//            } else {
-//                Intent intent = new Intent(getApplicationContext(), FileDisplayActivity.class);
-//                intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
-//                intent.setAction(FileDisplayActivity.ALL_FILES);
-//                intent.putExtra(FileDisplayActivity.DRAWER_MENU_ID, menuItem.getItemId());
-//                startActivity(intent);
-//            }
+            if (this instanceof FileDisplayActivity &&
+                !(((FileDisplayActivity) this).getLeftFragment() instanceof GalleryFragment) &&
+                !(((FileDisplayActivity) this).getLeftFragment() instanceof PreviewTextStringFragment)) {
+                showFiles(false);
+                ((FileDisplayActivity) this).browseToRoot();
+                EventBus.getDefault().post(new ChangeMenuEvent());
+            } else {
+                Intent intent = new Intent(getApplicationContext(), FileDisplayActivity.class);
+                intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
+                intent.setAction(FileDisplayActivity.ALL_FILES);
+                intent.putExtra(FileDisplayActivity.DRAWER_MENU_ID, menuItem.getItemId());
+                startActivity(intent);
+            }
         } else if (itemId == R.id.nav_favorites) {
             handleSearchEvents(new SearchEvent("", SearchRemoteOperation.SearchType.FAVORITE_SEARCH),
                                menuItem.getItemId());

+ 0 - 8
src/main/java/com/owncloud/android/utils/StringUtils.java

@@ -77,12 +77,4 @@ public final class StringUtils {
         }
         return s;
     }
-
-    public static String escapeStacktrace(String string) {
-        return string
-            .replaceAll("\n", "%0A")
-            .replaceAll(" ", "\\+")
-            .replaceAll("`", "%A")
-            .replaceAll("#", "%23");
-    }
 }

+ 0 - 43
src/main/res/values/setup.xml

@@ -98,49 +98,6 @@
     <string name="translation_link" translatable="false">https://www.transifex.com/nextcloud/nextcloud/android/</string>
     <string name="contributing_link" translatable="false">https://github.com/nextcloud/android/blob/master/CONTRIBUTING.md</string>
     <string name="report_issue_link" translatable="false">https://github.com/nextcloud/android/issues/new?labels=bug&amp;body=%1$s</string>
-    <string name="report_issue_template" translatable="false">"### Stacktrace\n"
-            "\n" +
-            "### Steps to reproduce\n" +
-            "1. \n" +
-            "2. \n" +
-            "3. \n" +
-            "\n" +
-            "### Expected behaviour\n" +
-            "- Tell us what should happen\n" +
-            "\n" +
-            "### Actual behaviour\n" +
-            "- Tell us what happens\n" +
-            "\n" +
-            "### Can you reproduce this problem on https://try.nextcloud.com?\n" +
-            "- Please create a test demo account and see if this still happens there.\n" +
-            "- If yes, please open up a bug report\n" +
-            "- If not, please verify server setup and ask for help on forum\n" +
-            "\n" +
-            "### Environment data\n" +
-            "Android version:\n" +
-            "\n" +
-            "Device model: \n" +
-            "\n" +
-            "Stock or customized system:\n" +
-            "\n" +
-            "Nextcloud app version:\n" +
-            "\n" +
-            "Nextcloud server version:\n" +
-            "\n" +
-            "Reverse proxy:\n" +
-            "\n" +
-            "### Logs\n" +
-            "#### Web server error log\n" +
-            "```\n" +
-            "Insert your webserver log here\n" +
-            "```\n" +
-            "\n" +
-            "#### Nextcloud log (data/nextcloud.log)\n" +
-            "```\n" +
-            "Insert your Nextcloud log here\n" +
-            "```\n" +
-            "**NOTE:** Be super sure to remove sensitive data like passwords, note that everybody can look here! You " +
-            "can use the Issue Template application to prefill some of the required information: https://apps.nextcloud.com/apps/issuetemplate\n"</string>
 
     <!-- login data links -->
     <string name="login_data_own_scheme" translatable="false">nc</string>

+ 0 - 117
src/test/java/com/owncloud/android/utils/StringUtilsTest.java

@@ -131,121 +131,4 @@ public class StringUtilsTest {
         assertEquals("returned text without prefix was incorrect",
                      expectedReturn, StringUtils.removePrefix(text, prefix));
     }
-
-    @Test
-    public void escapeString() {
-        // we cannot use R.string.report_issue_template
-        // filled with a random stacktrace
-        String raw = "### Stacktrace\n" +
-            "java.lang.RuntimeException\n" +
-            "at com.owncloud.android.ui.activity.DrawerActivity.onNavigationItemClicked(DrawerActivity.java:423)\n" +
-            "at com.owncloud.android.ui.activity.DrawerActivity.lambda$null$0$DrawerActivity(DrawerActivity.java:383)\n" +
-            "at com.owncloud.android.ui.activity.-$$Lambda$DrawerActivity$WuFXuKRKoNjsgnTzctIqSi-LJ_I.run(Unknown Source:4)\n" +
-            "at android.os.Handler.handleCallback(Handler.java:883)\n" +
-            "at android.os.Handler.dispatchMessage(Handler.java:100)\n" +
-            "at android.os.Looper.loop(Looper.java:214)\n" +
-            "at android.app.ActivityThread.main(ActivityThread.java:7356)\n" +
-            "at java.lang.reflect.Method.invoke(Native Method)\n" +
-            "at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)\n" +
-            "at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)\n" +
-            "\n" +
-            "### Steps to reproduce\n" +
-            "1. \n" +
-            "2. \n" +
-            "3. \n" +
-            "\n" +
-            "### Expected behaviour\n" +
-            "- Tell us what should happen\n" +
-            "\n" +
-            "### Actual behaviour\n" +
-            "- Tell us what happens\n" +
-            "\n" +
-            "### Can you reproduce this problem on https://try.nextcloud.com?\n" +
-            "- Please create a test demo account and see if this still happens there.\n" +
-            "- If yes, please open up a bug report\n" +
-            "- If not, please verify server setup and ask for help on forum\n" +
-            "\n" +
-            "### Environment data\n" +
-            "Android version:\n" +
-            "\n" +
-            "Device model: \n" +
-            "\n" +
-            "Stock or customized system:\n" +
-            "\n" +
-            "Nextcloud app version:\n" +
-            "\n" +
-            "Nextcloud server version:\n" +
-            "\n" +
-            "Reverse proxy:\n" +
-            "\n" +
-            "### Logs\n" +
-            "#### Web server error log\n" +
-            "```\n" +
-            "Insert your webserver log here\n" +
-            "```\n" +
-            "\n" +
-            "#### Nextcloud log (data/nextcloud.log)\n" +
-            "```\n" +
-            "Insert your Nextcloud log here\n" +
-            "```\n" +
-            "**NOTE:** Be super sure to remove sensitive data like passwords, note that everybody can look here! You " +
-            "can use the Issue Template application to prefill some of the required information: https://apps.nextcloud.com/apps/issuetemplate\n";
-
-        String escaped = "###+Stacktrace%0A" +
-            "java.lang.RuntimeException%0A" +
-            "at+com.owncloud.android.ui.activity.DrawerActivity.onNavigationItemClicked(DrawerActivity.java:423)%0A" +
-            "at+com.owncloud.android.ui.activity.DrawerActivity.lambda$null$0$DrawerActivity(DrawerActivity.java:383)%0A" +
-            "at+com.owncloud.android.ui.activity.-$$Lambda$DrawerActivity$WuFXuKRKoNjsgnTzctIqSi-LJ_I.run(Unknown+Source:4)%0A" +
-            "at+android.os.Handler.handleCallback(Handler.java:883)%0A" +
-            "at+android.os.Handler.dispatchMessage(Handler.java:100)%0A" +
-            "at+android.os.Looper.loop(Looper.java:214)%0A" +
-            "at+android.app.ActivityThread.main(ActivityThread.java:7356)%0A" +
-            "at+java.lang.reflect.Method.invoke(Native+Method)%0A" +
-            "at+com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)%0A" +
-            "at+com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)%0A" +
-            "%0A" +
-            "###+Steps+to+reproduce%0A" +
-            "1.+%0A" +
-            "2.+%0A" +
-            "3.+%0A" +
-            "%0A" +
-            "###+Expected+behaviour%0A" +
-            "-+Tell+us+what+should+happen%0A" +
-            "%0A" +
-            "###+Actual+behaviour%0A" +
-            "-+Tell+us+what+happens%0A" +
-            "%0A" +
-            "###+Can+you+reproduce+this+problem+on+https://try.nextcloud.com?%0A" +
-            "-+Please+create+a+test+demo+account+and+see+if+this+still+happens+there.%0A" +
-            "-+If+yes,+please+open+up+a+bug+report%0A" +
-            "-+If+not,+please+verify+server+setup+and+ask+for+help+on+forum%0A" +
-            "%0A" +
-            "###+Environment+data%0A" +
-            "Android+version:%0A" +
-            "%0A" +
-            "Device+model:+%0A" +
-            "%0A" +
-            "Stock+or+customized+system:%0A" +
-            "%0A" +
-            "Nextcloud+app+version:%0A" +
-            "%0A" +
-            "Nextcloud+server+version:%0A" +
-            "%0A" +
-            "Reverse+proxy:%0A" +
-            "%0A" +
-            "###+Logs%0A" +
-            "####+Web+server+error+log%0A" +
-            "```%0A" +
-            "Insert+your+webserver+log+here%0A" +
-            "```%0A" +
-            "%0A" +
-            "####+Nextcloud+log+(data/nextcloud.log)%0A" +
-            "```%0A" +
-            "Insert+your+Nextcloud+log+here%0A" +
-            "```%0A" +
-            "**NOTE:**+Be+super+sure+to+remove+sensitive+data+like+passwords,+note+that+everybody+can+look+here!+You+" +
-            "can+use+the+Issue+Template+application+to+prefill+some+of+the+required+information:+https://apps.nextcloud.com/apps/issuetemplate%0A";
-
-        assertEquals(escaped, StringUtils.escapeStacktrace(raw));
-    }
 }