Skip to content
Merged
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

## Unreleased

### Features

- Add isCrashedLastRun ([#186](https://github.com/getsentry/sentry-kotlin-multiplatform/pull/186))
- You can use it with `Sentry.isCrashedLastRun()`

### Dependencies

- Bump Cocoa SDK from v8.17.2 to v8.20.0 ([#180](https://github.com/getsentry/sentry-kotlin-multiplatform/pull/180), [#182](https://github.com/getsentry/sentry-kotlin-multiplatform/pull/182))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ public final class io/sentry/kotlin/multiplatform/Sentry {
public final fun crash ()V
public final fun init (Landroid/content/Context;Lkotlin/jvm/functions/Function1;)V
public final fun init (Lkotlin/jvm/functions/Function1;)V
public final fun isCrashedLastRun ()Z
public final fun setUser (Lio/sentry/kotlin/multiplatform/protocol/User;)V
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ public final class io/sentry/kotlin/multiplatform/Sentry {
public final fun crash ()V
public final fun init (Lio/sentry/kotlin/multiplatform/Context;Lkotlin/jvm/functions/Function1;)V
public final fun init (Lkotlin/jvm/functions/Function1;)V
public final fun isCrashedLastRun ()Z
public final fun setUser (Lio/sentry/kotlin/multiplatform/protocol/User;)V
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ internal actual object SentryBridge {
SentrySDK.setUser(user?.toCocoaUser())
}

actual fun isCrashedLastRun(): Boolean {
return SentrySDK.crashedLastRun()
}

actual fun close() {
SentrySDK.close()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ internal actual object SentryBridge {
Sentry.setUser(user?.toJvmUser())
}

actual fun isCrashedLastRun(): Boolean {
return Sentry.isCrashedLastRun() ?: false
}

actual fun close() {
Sentry.close()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,7 @@ internal expect object SentryBridge {

fun setUser(user: User?)

fun isCrashedLastRun(): Boolean

fun close()
}
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,13 @@ public object Sentry {
SentryBridge.setUser(user)
}

/**
* Returns true if the app crashed during last run.
*/
public fun isCrashedLastRun(): Boolean {
return SentryBridge.isCrashedLastRun()
}

/**
* Throws a RuntimeException, useful for testing.
*/
Expand Down