Skip to content

Commit 7d2a21b

Browse files
committed
Remove sticky notification badge on android
1 parent 6ed8247 commit 7d2a21b

File tree

4 files changed

+33
-24
lines changed

4 files changed

+33
-24
lines changed

android/app/src/main/java/com/httpsms/LogzTree.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ class LogzTree(val context: Context): Timber.DebugTree() {
2222
override fun log(priority: Int, tag: String?, message: String, t: Throwable?) {
2323
val formatter: DateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
2424
val logEntry = LogEntry(
25+
BuildConfig.APPLICATION_ID,
2526
BuildConfig.VERSION_NAME,
2627
priority,
2728
severity(priority),
@@ -73,6 +74,7 @@ class LogzTree(val context: Context): Timber.DebugTree() {
7374
}
7475

7576
class LogEntry(
77+
val name: String,
7678
val release: String,
7779
val priority: Int,
7880
val severity: String,

android/app/src/main/java/com/httpsms/MainActivity.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import android.net.Uri
1010
import android.os.Build
1111
import android.os.Bundle
1212
import android.os.PowerManager
13-
import android.provider.Settings as ProviderSettings
1413
import android.telephony.PhoneNumberUtils
1514
import android.view.View
1615
import android.widget.LinearLayout
@@ -38,6 +37,7 @@ import java.time.ZonedDateTime
3837
import java.time.format.DateTimeFormatter
3938
import java.util.*
4039
import java.util.concurrent.TimeUnit
40+
import android.provider.Settings as ProviderSettings
4141

4242

4343
class MainActivity : AppCompatActivity() {

android/app/src/main/java/com/httpsms/services/StickyNotificationService.kt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,9 @@ class StickyNotificationService: Service() {
4646
notificationChannelId,
4747
notificationChannelId,
4848
NotificationManager.IMPORTANCE_HIGH
49-
).let {
50-
it.enableLights(true)
51-
it.enableVibration(false)
52-
it.lightColor = Color.RED
53-
it
49+
).apply {
50+
enableVibration(false)
51+
setShowBadge(false)
5452
}
5553
notificationManager.createNotificationChannel(channel)
5654

api/cmd/experiments/main.go

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@ package main
22

33
import (
44
"context"
5+
"fmt"
56
"log"
7+
"os"
8+
"sync"
9+
10+
"github.com/carlmjohnson/requests"
611

7-
"github.com/NdoleStudio/httpsms/pkg/di"
8-
"github.com/NdoleStudio/httpsms/pkg/entities"
912
"github.com/joho/godotenv"
10-
"github.com/palantir/stacktrace"
1113
)
1214

1315
func main() {
@@ -16,24 +18,31 @@ func main() {
1618
log.Fatal("Error loading .env file")
1719
}
1820

19-
container := di.NewLiteContainer()
20-
mailer := container.Mailer()
21-
22-
factory := container.UserEmailFactory()
21+
wg := sync.WaitGroup{}
22+
for i := 0; i < 5; i++ {
23+
wg.Add(1)
24+
go func(count int) {
25+
sendSMS(count)
26+
wg.Done()
27+
}(i)
2328

24-
user := &entities.User{
25-
26-
SubscriptionName: entities.SubscriptionNameUltraMonthly,
2729
}
30+
wg.Wait()
31+
}
2832

29-
mail, err := factory.UsageLimitExceeded(user)
33+
func sendSMS(count int) {
34+
var response string
35+
err := requests.URL(os.Getenv("BASIC_URL")).
36+
BodyJSON(map[string]any{
37+
"content": fmt.Sprintf("Hello, World [%d]", count),
38+
"from": os.Getenv("BASIC_FROM"),
39+
"to": os.Getenv("BASIC_TO"),
40+
}).
41+
BasicAuth(os.Getenv("BASIC_USERNAME"), os.Getenv("BASIC_PASSWORD")).
42+
ToString(&response).
43+
Fetch(context.Background())
3044
if err != nil {
31-
container.Logger().Fatal(stacktrace.Propagate(err, "cannot create email"))
45+
log.Fatal(err)
3246
}
33-
34-
if err = mailer.Send(context.Background(), mail); err != nil {
35-
container.Logger().Fatal(stacktrace.Propagate(err, "cannot send email"))
36-
}
37-
38-
container.Logger().Info("email sent")
47+
log.Printf("%s\n", response)
3948
}

0 commit comments

Comments
 (0)