diff options
Diffstat (limited to 'app/src/main/java/org/pacien/tincapp/context/App.kt')
-rw-r--r-- | app/src/main/java/org/pacien/tincapp/context/App.kt | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/app/src/main/java/org/pacien/tincapp/context/App.kt b/app/src/main/java/org/pacien/tincapp/context/App.kt index a877929..4d8d5d0 100644 --- a/app/src/main/java/org/pacien/tincapp/context/App.kt +++ b/app/src/main/java/org/pacien/tincapp/context/App.kt | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * Tinc App, an Android binding and user interface for the tinc mesh VPN daemon | 2 | * Tinc App, an Android binding and user interface for the tinc mesh VPN daemon |
3 | * Copyright (C) 2017-2019 Pacien TRAN-GIRARD | 3 | * Copyright (C) 2017-2020 Pacien TRAN-GIRARD |
4 | * | 4 | * |
5 | * This program is free software: you can redistribute it and/or modify | 5 | * This program is free software: you can redistribute it and/or modify |
6 | * it under the terms of the GNU General Public License as published by | 6 | * it under the terms of the GNU General Public License as published by |
@@ -21,6 +21,7 @@ package org.pacien.tincapp.context | |||
21 | import android.app.Application | 21 | import android.app.Application |
22 | import android.content.Context | 22 | import android.content.Context |
23 | import android.content.Intent | 23 | import android.content.Intent |
24 | import android.content.pm.ApplicationInfo | ||
24 | import android.net.Uri | 25 | import android.net.Uri |
25 | import android.os.Build | 26 | import android.os.Build |
26 | import android.os.Handler | 27 | import android.os.Handler |
@@ -47,7 +48,7 @@ class App : Application() { | |||
47 | 48 | ||
48 | private fun setupCrashHandler() { | 49 | private fun setupCrashHandler() { |
49 | val logger = LoggerFactory.getLogger(this.javaClass) | 50 | val logger = LoggerFactory.getLogger(this.javaClass) |
50 | val systemCrashHandler = Thread.getDefaultUncaughtExceptionHandler() | 51 | val systemCrashHandler = Thread.getDefaultUncaughtExceptionHandler()!! |
51 | val crashRecorder = CrashRecorder(logger, systemCrashHandler) | 52 | val crashRecorder = CrashRecorder(logger, systemCrashHandler) |
52 | Thread.setDefaultUncaughtExceptionHandler(crashRecorder) | 53 | Thread.setDefaultUncaughtExceptionHandler(crashRecorder) |
53 | } | 54 | } |
@@ -61,6 +62,11 @@ class App : Application() { | |||
61 | fun getContext() = appContext!! | 62 | fun getContext() = appContext!! |
62 | fun getResources() = getContext().resources!! | 63 | fun getResources() = getContext().resources!! |
63 | 64 | ||
65 | fun getApplicationInfo(): ApplicationInfo = | ||
66 | getContext() | ||
67 | .packageManager | ||
68 | .getApplicationInfo(BuildConfig.APPLICATION_ID, 0) | ||
69 | |||
64 | fun alert(@StringRes title: Int, msg: String, manualLink: String? = null) = | 70 | fun alert(@StringRes title: Int, msg: String, manualLink: String? = null) = |
65 | notificationManager.notifyError(appContext!!.getString(title), msg, manualLink) | 71 | notificationManager.notifyError(appContext!!.getString(title), msg, manualLink) |
66 | 72 | ||