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

Fixed because it was crashing when launched from NFC without a network connection #1248

Merged
merged 2 commits into from
Sep 16, 2023
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,13 @@ import android.content.Intent.FLAG_ACTIVITY_NEW_TASK
import android.content.Intent.FLAG_ACTIVITY_REQUIRE_DEFAULT
import android.net.Uri
import android.os.Bundle
import android.widget.Toast
import androidx.activity.ComponentActivity
import com.google.firebase.dynamiclinks.FirebaseDynamicLinks
import io.github.droidkaigi.confsched2023.model.Lang.ENGLISH
import io.github.droidkaigi.confsched2023.model.Lang.JAPANESE
import io.github.droidkaigi.confsched2023.model.Lang.MIXED
import io.github.droidkaigi.confsched2023.model.defaultLang

class ResolveDynamicLinksActivity : ComponentActivity() {

Expand All @@ -17,9 +22,18 @@ class ResolveDynamicLinksActivity : ComponentActivity() {
FirebaseDynamicLinks.getInstance()
.getDynamicLink(intent)
.addOnSuccessListener(this) { pendingDynamicLinkData ->
val deepLink = pendingDynamicLinkData.link

handleDeepLink(deepLink)
if (pendingDynamicLinkData != null) {
val deepLink = pendingDynamicLinkData.link
handleDeepLink(deepLink)
} else {
val message = when (defaultLang()) {
MIXED -> "Please connect to the network/ネットワークに接続してください"
JAPANESE -> "ネットワークに接続してください"
ENGLISH -> "Please connect to the network"
}
Toast.makeText(this, message, Toast.LENGTH_SHORT).show()
finishAndRemoveTask()
}
}
.addOnFailureListener {
finishAndRemoveTask()
Expand Down
Loading