Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better logging gui #2725

Merged
merged 10 commits into from
Nov 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions owncloudApp/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ dependencies {
//Zooming Android ImageView.
implementation 'com.github.chrisbanes:PhotoView:2.1.4'

implementation "androidx.multidex:multidex:2.0.1"

// Convert Java Objects into JSON and back
implementation 'com.google.code.gson:gson:2.8.5'

Expand Down Expand Up @@ -97,6 +99,8 @@ android {
buildConfigField "String", gitRemote, "\"" + getGitOriginRemote() + "\""
buildConfigField "String", commitSHA1, "\"" + getLatestGitHash() + "\""

multiDexEnabled true

javaCompileOptions {
annotationProcessorOptions {
arguments = ["room.schemaLocation": "$projectDir/schemas".toString()]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,9 @@

package com.owncloud.android.settings.more

import android.app.Activity
import android.app.Instrumentation
import android.content.Intent
import androidx.test.espresso.Espresso.onView
import androidx.test.espresso.Espresso.openActionBarOverflowOrOptionsMenu
import androidx.test.espresso.action.ViewActions.click
import androidx.test.espresso.assertion.ViewAssertions.matches
import androidx.test.espresso.intent.Intents
import androidx.test.espresso.intent.Intents.intended
import androidx.test.espresso.intent.Intents.intending
import androidx.test.espresso.intent.matcher.IntentMatchers.hasAction
import androidx.test.espresso.intent.matcher.IntentMatchers.hasExtra
import androidx.test.espresso.intent.matcher.IntentMatchers.hasFlag
import androidx.test.espresso.intent.matcher.IntentMatchers.hasType
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
import androidx.test.espresso.matcher.ViewMatchers.withId
import androidx.test.espresso.matcher.ViewMatchers.withText
Expand All @@ -41,8 +30,6 @@ import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.rule.ActivityTestRule
import com.owncloud.android.R
import com.owncloud.android.ui.activity.LogHistoryActivity
import org.hamcrest.Matchers
import org.junit.Before
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
Expand All @@ -54,44 +41,16 @@ class OCSettingsLogTest {
@JvmField
val activityRule = ActivityTestRule(LogHistoryActivity::class.java, true, true)

@Before
fun setUp() {}

@Test
fun checkTitle(){
fun checkTitle() {
onView(withText(R.string.actionbar_logger)).check(matches(isDisplayed()))
}

@Test
fun itemsToolbar(){
fun itemsToolbar() {
onView(withId(R.id.menu_search)).check(matches(isDisplayed()))
openActionBarOverflowOrOptionsMenu(InstrumentationRegistry.getInstrumentation().targetContext)
onView(withText("Logcat")).check(matches(isDisplayed()))
}

@Test
fun logHistoryButtons(){
onView(withId(R.id.deleteLogHistoryButton)).check(matches(isDisplayed()))
onView(withId(R.id.sendLogHistoryButton)).check(matches(isDisplayed()))
}

@Test
fun sendLogHistory(){
Intents.init()
val intentResult = Instrumentation.ActivityResult(Activity.RESULT_OK, Intent())
intending(hasAction(Intent.ACTION_SEND_MULTIPLE)).respondWith(intentResult);
onView(withId(R.id.sendLogHistoryButton)).perform(click())
intended(
Matchers.allOf(
hasAction(Intent.ACTION_SEND_MULTIPLE),
hasExtra(Intent.EXTRA_SUBJECT,
String.format(
activityRule.activity.getString(R.string.log_send_mail_subject),
activityRule.activity.getString(R.string.app_name))),
hasType("text/plain"),
hasFlag(Intent.FLAG_ACTIVITY_NEW_TASK)
)
)
Intents.release()
}
}
15 changes: 13 additions & 2 deletions owncloudApp/src/main/java/com/owncloud/android/MainApp.kt
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,15 @@ package com.owncloud.android

import android.accounts.Account
import android.app.Activity
import android.app.Application
import android.content.Context
import android.content.pm.PackageInfo
import android.content.pm.PackageManager
import android.os.Build
import android.os.Bundle
import android.os.Environment
import android.preference.PreferenceManager
import androidx.multidex.MultiDex
import androidx.multidex.MultiDexApplication
import android.view.WindowManager

import com.owncloud.android.authentication.FingerprintManager
Expand All @@ -51,10 +52,12 @@ import com.owncloud.android.ui.activity.FingerprintActivity
import com.owncloud.android.ui.activity.PassCodeActivity
import com.owncloud.android.ui.activity.PatternLockActivity
import com.owncloud.android.ui.activity.WhatsNewActivity
import info.hannes.timber.DebugTree
import org.koin.android.ext.koin.androidContext
import org.koin.androidx.viewmodel.dsl.viewModel
import org.koin.core.context.startKoin
import org.koin.dsl.module
import timber.log.Timber

/**
* Main Application of the project
Expand All @@ -63,7 +66,7 @@ import org.koin.dsl.module
* Contains methods to build the "static" strings. These strings were before constants in different
* classes
*/
class MainApp : Application() {
class MainApp : MultiDexApplication() {

override fun onCreate() {
super.onCreate()
Expand Down Expand Up @@ -187,7 +190,15 @@ class MainApp : Application() {
}
}

override fun attachBaseContext(base: Context?) {
super.attachBaseContext(base)
MultiDex.install(this)
}

fun startLogIfDeveloper() {
if (BuildConfig.DEBUG)
Timber.plant(DebugTree(Log_OC::class.java))

isDeveloper = BuildConfig.DEBUG || PreferenceManager.getDefaultSharedPreferences(applicationContext)
.getInt(CLICK_DEV_MENU, CLICKS_DEFAULT) > CLICKS_NEEDED_TO_BE_DEVELOPER

Expand Down
Loading