Skip to content

Commit 4ea7a8a

Browse files
committed
feat(app) added ios app icons
1 parent 4decc94 commit 4ea7a8a

File tree

25 files changed

+230
-51
lines changed

25 files changed

+230
-51
lines changed

example/BugsnagExample/composeApp/build.gradle.kts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,7 @@ kotlin {
4040

4141
applyDefaultHierarchyTemplate()
4242

43-
4443
sourceSets {
45-
4644
androidMain.dependencies {
4745
implementation(compose.preview)
4846
implementation(libs.androidx.activity.compose)

example/BugsnagExample/composeApp/src/androidMain/AndroidManifest.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
3-
43
<application
4+
android:name="com.example.bugsnag.kmp.KmpApplication"
55
android:allowBackup="true"
66
android:icon="@mipmap/ic_launcher"
77
android:label="@string/app_name"
@@ -13,7 +13,6 @@
1313
android:name="com.example.bugsnag.kmp.MainActivity">
1414
<intent-filter>
1515
<action android:name="android.intent.action.MAIN" />
16-
1716
<category android:name="android.intent.category.LAUNCHER" />
1817
</intent-filter>
1918
</activity>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package com.example.bugsnag.kmp
2+
3+
import android.app.Application
4+
import com.bugsnag.kmp.Configuration
5+
6+
class KmpApplication : Application() {
7+
override fun onCreate() {
8+
super.onCreate()
9+
val config = Configuration(applicationContext, BUGSNAG_API_KEY)
10+
startBugsnag(config)
11+
}
12+
}

example/BugsnagExample/composeApp/src/androidMain/kotlin/com/example/bugsnag/kmp/MainActivity.kt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,10 @@ import androidx.compose.foundation.layout.fillMaxSize
77
import androidx.compose.material3.MaterialTheme
88
import androidx.compose.material3.Surface
99
import androidx.compose.ui.Modifier
10-
import com.bugsnag.kmp.Configuration
1110

1211
class MainActivity : ComponentActivity() {
1312
override fun onCreate(savedInstanceState: Bundle?) {
1413
super.onCreate(savedInstanceState)
15-
val config = Configuration(applicationContext, BUGSNAG_API_KEY)
16-
startBugsnag(config)
17-
1814
setContent {
1915
Surface(
2016
modifier = Modifier.fillMaxSize(),

example/BugsnagExample/composeApp/src/androidMain/res/drawable/ic_launcher_background.xml

Lines changed: 0 additions & 11 deletions
This file was deleted.

example/BugsnagExample/composeApp/src/commonMain/kotlin/com/example/bugsnag/kmp/App.kt

Lines changed: 35 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@ import androidx.compose.material3.MaterialTheme
1010
import androidx.compose.material3.Text
1111
import androidx.compose.runtime.Composable
1212
import androidx.compose.runtime.LaunchedEffect
13+
import androidx.compose.runtime.getValue
1314
import androidx.compose.runtime.mutableStateOf
1415
import androidx.compose.runtime.remember
16+
import androidx.compose.runtime.setValue
1517
import androidx.compose.ui.Modifier
1618
import androidx.compose.ui.graphics.Color
1719
import androidx.compose.ui.unit.dp
@@ -20,63 +22,70 @@ import kotlinx.coroutines.delay
2022

2123
@Composable
2224
fun App() {
23-
val message = remember { mutableStateOf("") }
25+
var message by remember { mutableStateOf("") }
2426

2527
MaterialTheme {
2628
Column(
2729
modifier = Modifier
2830
.fillMaxSize()
2931
.padding(16.dp),
30-
verticalArrangement = Arrangement.spacedBy(12.dp),
32+
verticalArrangement = Arrangement
33+
.spacedBy(12.dp),
3134
) {
3235
Text("Bugsnag KMP - Example app")
3336

34-
Button(
37+
TextButton(
38+
text = "Throw An Unhandled Exception",
3539
onClick = {
40+
message = "Unhandled Kotlin Exception triggered"
3641
throw RuntimeException("Unhandled Kotlin Exception")
37-
message.value = "Unhandled Kotlin Exception triggered"
3842
},
39-
modifier = Modifier.fillMaxWidth(),
40-
) {
41-
Text("Throw An Unhandled Exception")
42-
}
43-
44-
Button(
43+
)
44+
TextButton(
45+
text = "A Handled Exception",
4546
onClick = {
4647
Bugsnag.notify(RuntimeException("Handled Kotlin Exception"))
47-
message.value = "Handled Kotlin Exception reported"
48+
message = "Handled Kotlin Exception reported"
4849
},
49-
modifier = Modifier.fillMaxWidth(),
50-
) {
51-
Text("A Handled Exception")
52-
}
50+
)
5351

54-
Button(
52+
TextButton(
53+
text = "Attach Custom Breadcrumbs",
5554
onClick = {
5655
Bugsnag.leaveBreadcrumb(
5756
"WebAuthFailure",
5857
mapOf("reason" to "incorrect password"),
5958
)
6059
Bugsnag.notify(RuntimeException("Error Report with Breadcrumbs"))
61-
message.value = "Custom Breadcrumbs attached"
60+
message = "Custom Breadcrumbs attached"
6261
},
63-
modifier = Modifier.fillMaxWidth(),
64-
) {
65-
Text("Attach Custom Breadcrumbs")
66-
}
62+
)
6763

68-
if (message.value.isNotEmpty()) {
64+
if (message.isNotEmpty()) {
6965
Text(
70-
text = message.value,
66+
text = message,
7167
modifier = Modifier.padding(top = 16.dp),
7268
style = MaterialTheme.typography.bodyLarge,
73-
color = Color.Red
69+
color = Color.Red,
7470
)
75-
LaunchedEffect(message.value) {
71+
LaunchedEffect(message) {
7672
delay(1500)
77-
message.value = ""
73+
message = ""
7874
}
7975
}
8076
}
8177
}
8278
}
79+
80+
@Composable
81+
fun TextButton(
82+
text: String,
83+
onClick: () -> Unit,
84+
) {
85+
Button(
86+
onClick = { onClick() },
87+
modifier = Modifier.fillMaxWidth(),
88+
) {
89+
Text(text)
90+
}
91+
}

example/BugsnagExample/composeApp/src/commonMain/kotlin/com/example/bugsnag/kmp/StartBugsnag.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ import com.bugsnag.kmp.Configuration
55

66
fun startBugsnag(configuration: Configuration) {
77
Bugsnag.start(configuration)
8-
}
8+
}

example/BugsnagExample/composeApp/src/jsMain/kotlin/com/example/bugsnag/kmp/JsApp.kt renamed to example/BugsnagExample/composeApp/src/jsMain/kotlin/com/example/bugsnag/kmp/js/JsApp.kt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
package com.example.bugsnag.kmp
1+
package com.example.bugsnag.kmp.js
22

33
import androidx.compose.runtime.Composable
44
import com.bugsnag.kmp.Bugsnag
55
import com.bugsnag.kmp.Configuration
6+
import com.example.bugsnag.kmp.BUGSNAG_API_KEY
7+
import com.example.bugsnag.kmp.startBugsnag
68
import kotlinx.browser.window
79
import org.jetbrains.compose.web.css.DisplayStyle
810
import org.jetbrains.compose.web.css.FlexDirection
@@ -28,15 +30,17 @@ fun StartJsApp(rootId: String) {
2830
Div(
2931
attrs = {
3032
style {
31-
display(DisplayStyle.Flex); flexDirection(FlexDirection.Column); width(20.percent);
33+
display(DisplayStyle.Flex)
34+
flexDirection(FlexDirection.Column)
35+
width(20.percent)
3236
}
3337
},
3438
) {
3539
TextButton(
3640
text = "Throw An Unhandled Exception",
3741
onClick = {
38-
throw Exception("Unhandled Kotlin Exception")
3942
window.alert("Unhandled Exception sent to Bugsnag")
43+
throw Exception("Unhandled Kotlin Exception")
4044
},
4145
)
4246

example/BugsnagExample/gradle/libs.versions.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ androidx-appcompat = { module = "androidx.appcompat:appcompat", version.ref = "a
1515
androidx-activity-compose = { module = "androidx.activity:activity-compose", version.ref = "androidx-activity" }
1616
androidx-lifecycle-viewmodel = { module = "org.jetbrains.androidx.lifecycle:lifecycle-viewmodel", version.ref = "androidx-lifecycle" }
1717
androidx-lifecycle-runtimeCompose = { module = "org.jetbrains.androidx.lifecycle:lifecycle-runtime-compose", version.ref = "androidx-lifecycle" }
18-
bugsnag-android = { group = "com.bugsnag", name = "bugsnag-android", version.ref = "bugsnag-android"}
18+
bugsnag-android = { group = "com.bugsnag", name = "bugsnag-android", version.ref = "bugsnag-android" }
1919
bugsnag-kmp = { module = "com.bugsnag:bugsnag-kmp", version.ref = "kmp" }
2020
compose-html = { module = "org.jetbrains.compose.html:html-core-js", version = "1.7.3" }
2121

2222
[plugins]
2323
androidApplication = { id = "com.android.application", version.ref = "agp" }
2424
androidLibrary = { id = "com.android.library", version.ref = "agp" }
25-
bugsnag-gradle = { id = "com.bugsnag.gradle", version.ref = "bugsnag-gradle"}
25+
bugsnag-gradle = { id = "com.bugsnag.gradle", version.ref = "bugsnag-gradle" }
2626
composeMultiplatform = { id = "org.jetbrains.compose", version.ref = "composeMultiplatform" }
2727
composeCompiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
2828
kotlinMultiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }

0 commit comments

Comments
 (0)