forked from NextAlone/Nagram
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/dev' into dev
- Loading branch information
Showing
11 changed files
with
217 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ | |
.vscode/ | ||
build/ | ||
local.properties | ||
sentry.properties | ||
obj/ | ||
service_account_credentials.json | ||
__pycache__/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
TMessagesProj/src/main/java/tw/nekomimi/nekogram/helpers/AnalyticsHelper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package tw.nekomimi.nekogram.helpers; | ||
|
||
import android.app.Application; | ||
|
||
import org.telegram.messenger.BuildConfig; | ||
import org.telegram.messenger.BuildVars; | ||
|
||
|
||
import io.sentry.Sentry; | ||
import io.sentry.SentryLevel; | ||
import io.sentry.android.core.SentryAndroid; | ||
import xyz.nextalone.nagram.NaConfig; | ||
|
||
public class AnalyticsHelper { | ||
public static String DSN = "https://[email protected]/4507210156998656"; | ||
public static boolean loaded = false; | ||
|
||
public static void start(Application application) { | ||
if (!NaConfig.INSTANCE.getSentryAnalytics().Bool()) { | ||
return; | ||
} | ||
SentryAndroid.init(application, options -> { | ||
options.setDsn(DSN); | ||
options.setEnvironment(BuildVars.DEBUG_VERSION ? "debug" : "release"); | ||
options.setEnableAutoSessionTracking(true); | ||
options.setTracesSampleRate(1.0); | ||
options.setAttachAnrThreadDump(true); | ||
options.setRelease(BuildConfig.APPLICATION_ID + "@" + BuildConfig.VERSION_NAME + "+" + BuildConfig.VERSION_CODE); | ||
options.setBeforeScreenshotCaptureCallback((event, hint, debounce) -> { | ||
// always capture crashed events | ||
if (event.isCrashed()) { | ||
return true; | ||
} | ||
|
||
// if debounce is active, skip capturing | ||
if (debounce) { | ||
return false; | ||
} else { | ||
// also capture fatal events | ||
return event.getLevel() == SentryLevel.FATAL; | ||
} | ||
}); | ||
}); | ||
loaded = true; | ||
} | ||
|
||
public static void captureException(Throwable e) { | ||
if (loaded) { | ||
Sentry.captureException(e); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters