Prevent crash clinking on link if no browser is installed on device

This commit is contained in:
Sylvain Berfini 2025-03-16 20:39:06 +01:00
parent 614ac7f9cf
commit 87b6c2deef
5 changed files with 45 additions and 0 deletions

View file

@ -19,6 +19,7 @@
*/
package org.linphone.ui.assistant.fragment
import android.content.ActivityNotFoundException
import android.content.Context
import android.content.Intent
import android.os.Bundle
@ -110,6 +111,10 @@ class LandingFragment : GenericFragment() {
Log.e(
"$TAG Can't start ACTION_VIEW intent for URL [$url], IllegalStateException: $ise"
)
} catch (anfe: ActivityNotFoundException) {
Log.e(
"$TAG Can't start ACTION_VIEW intent for URL [$url], ActivityNotFoundException: $anfe"
)
}
}
@ -213,6 +218,10 @@ class LandingFragment : GenericFragment() {
Log.e(
"$TAG Can't start ACTION_VIEW intent for URL [$url], IllegalStateException: $ise"
)
} catch (anfe: ActivityNotFoundException) {
Log.e(
"$TAG Can't start ACTION_VIEW intent for URL [$url], ActivityNotFoundException: $anfe"
)
}
}
}
@ -227,6 +236,10 @@ class LandingFragment : GenericFragment() {
Log.e(
"$TAG Can't start ACTION_VIEW intent for URL [$url], IllegalStateException: $ise"
)
} catch (anfe: ActivityNotFoundException) {
Log.e(
"$TAG Can't start ACTION_VIEW intent for URL [$url], ActivityNotFoundException: $anfe"
)
}
}
}

View file

@ -19,6 +19,7 @@
*/
package org.linphone.ui.assistant.fragment
import android.content.ActivityNotFoundException
import android.content.Context
import android.content.Intent
import android.os.Bundle
@ -108,6 +109,10 @@ class RegisterFragment : GenericFragment() {
Log.e(
"$TAG Can't start ACTION_VIEW intent for URL [$url], IllegalStateException: $ise"
)
} catch (anfe: ActivityNotFoundException) {
Log.e(
"$TAG Can't start ACTION_VIEW intent for URL [$url], ActivityNotFoundException: $anfe"
)
}
}

View file

@ -19,6 +19,7 @@
*/
package org.linphone.ui.assistant.fragment
import android.content.ActivityNotFoundException
import android.content.Intent
import android.os.Bundle
import android.view.LayoutInflater
@ -67,6 +68,10 @@ class ThirdPartySipAccountWarningFragment : GenericFragment() {
Log.e(
"$TAG Can't start ACTION_VIEW intent for URL [$url], IllegalStateException: $ise"
)
} catch (anfe: ActivityNotFoundException) {
Log.e(
"$TAG Can't start ACTION_VIEW intent for URL [$url], ActivityNotFoundException: $anfe"
)
}
}

View file

@ -19,6 +19,7 @@
*/
package org.linphone.ui.main.fragment
import android.content.ActivityNotFoundException
import android.content.Intent
import android.os.Bundle
import android.view.Gravity
@ -152,6 +153,10 @@ class DrawerMenuFragment : GenericMainFragment() {
Log.e(
"$TAG Can't start ACTION_VIEW intent for URL [$link], IllegalStateException: $ise"
)
} catch (anfe: ActivityNotFoundException) {
Log.e(
"$TAG Can't start ACTION_VIEW intent for URL [$link], ActivityNotFoundException: $anfe"
)
}
}
}

View file

@ -19,6 +19,7 @@
*/
package org.linphone.ui.main.help.fragment
import android.content.ActivityNotFoundException
import android.content.Intent
import android.os.Bundle
import android.view.LayoutInflater
@ -84,6 +85,10 @@ class HelpFragment : GenericMainFragment() {
Log.e(
"$TAG Can't start ACTION_VIEW intent for URL [$url], IllegalStateException: $ise"
)
} catch (anfe: ActivityNotFoundException) {
Log.e(
"$TAG Can't start ACTION_VIEW intent for URL [$url], ActivityNotFoundException: $anfe"
)
}
}
@ -96,6 +101,10 @@ class HelpFragment : GenericMainFragment() {
Log.e(
"$TAG Can't start ACTION_VIEW intent for URL [$url], IllegalStateException: $ise"
)
} catch (anfe: ActivityNotFoundException) {
Log.e(
"$TAG Can't start ACTION_VIEW intent for URL [$url], ActivityNotFoundException: $anfe"
)
}
}
@ -108,6 +117,10 @@ class HelpFragment : GenericMainFragment() {
Log.e(
"$TAG Can't start ACTION_VIEW intent for URL [$url], IllegalStateException: $ise"
)
} catch (anfe: ActivityNotFoundException) {
Log.e(
"$TAG Can't start ACTION_VIEW intent for URL [$url], ActivityNotFoundException: $anfe"
)
}
}
@ -163,6 +176,10 @@ class HelpFragment : GenericMainFragment() {
Log.e(
"$TAG Can't start ACTION_VIEW intent for URL [$url], IllegalStateException: $ise"
)
} catch (anfe: ActivityNotFoundException) {
Log.e(
"$TAG Can't start ACTION_VIEW intent for URL [$url], ActivityNotFoundException: $anfe"
)
}
dialog.dismiss()
}