Skip to content

Commit

Permalink
Fixes (#65)
Browse files Browse the repository at this point in the history
  • Loading branch information
dylan-muszel authored Jan 8, 2020
1 parent 444026d commit 947a597
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import android.view.View
import androidx.annotation.RequiresPermission
import androidx.core.app.ActivityCompat
import androidx.core.app.ActivityOptionsCompat
import androidx.core.content.ContextCompat
import androidx.core.net.toUri
import java.io.Serializable

Expand All @@ -57,7 +58,7 @@ fun Context.openBrowser(url: String?) {
else -> "${BASE_HTTP}$url"
}
val browserIntent = Intent(Intent.ACTION_VIEW, finalUrl.toUri()).setNewTaskIfNecessary(this)
startActivity(browserIntent)
ContextCompat.startActivity(this, browserIntent, null)
}

private const val BASE_HTTP = "http://"
Expand All @@ -66,7 +67,7 @@ private const val BASE_HTTPS = "https://"
/** Opens the dial with a given [phone]. */
fun Context.openDial(phone: String) {
val intent = Intent(Intent.ACTION_DIAL, "tel:$phone".toUri()).setNewTaskIfNecessary(this)
startActivity(intent)
ContextCompat.startActivity(this, intent, null)
}

/**
Expand All @@ -76,7 +77,7 @@ fun Context.openDial(phone: String) {
@RequiresPermission(value = Manifest.permission.CALL_PHONE)
fun Context.makeCall(phone: String) {
val intent = Intent(Intent.ACTION_CALL, "tel:$phone".toUri()).setNewTaskIfNecessary(this)
startActivity(intent)
ContextCompat.startActivity(this, intent, null)
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
*/
package ar.com.wolox.wolmo.core.presenter

import ar.com.wolox.wolmo.core.util.CoroutineBasePresenter
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.delay
import kotlinx.coroutines.isActive
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public void openBrowserWithUrlShouldStartActivity() {
NavigationUtilsKt.openBrowser(mContextSpy, "http://google.com");

ArgumentCaptor<Intent> intentCaptor = ArgumentCaptor.forClass(Intent.class);
verify(mContextSpy, times(1)).startActivity(intentCaptor.capture());
verify(mContextSpy, times(1)).startActivity(intentCaptor.capture(), any());

Intent intent = intentCaptor.getValue();
assertThat(intent.getData().toString()).isEqualTo("http://google.com");
Expand All @@ -82,7 +82,7 @@ public void openDialWithPhoneShouldStartActivity() {
NavigationUtilsKt.openDial(mContextSpy, "41235678");

ArgumentCaptor<Intent> intentCaptor = ArgumentCaptor.forClass(Intent.class);
verify(mContextSpy, times(1)).startActivity(intentCaptor.capture());
verify(mContextSpy, times(1)).startActivity(intentCaptor.capture(), any());

Intent intent = intentCaptor.getValue();
assertThat(intent.getData().toString()).isEqualTo("tel:41235678");
Expand Down

0 comments on commit 947a597

Please sign in to comment.