This commit is contained in:
Gergely Hegedus 2024-03-30 21:51:25 +02:00
commit a4c68ca9e2
76 changed files with 2737 additions and 0 deletions

3
android/.idea/.gitignore generated vendored Normal file
View file

@ -0,0 +1,3 @@
# Default ignored files
/shelf/
/workspace.xml

1
android/.idea/.name generated Normal file
View file

@ -0,0 +1 @@
ServerNotifications

6
android/.idea/compiler.xml generated Normal file
View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<bytecodeTargetLevel target="17" />
</component>
</project>

View file

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="deploymentTargetSelector">
<selectionStates>
<SelectionState runConfigName="app">
<option name="selectionMode" value="DROPDOWN" />
</SelectionState>
</selectionStates>
</component>
</project>

6
android/.idea/google-java-format.xml generated Normal file
View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GoogleJavaFormatSettings">
<option name="enabled" value="false" />
</component>
</project>

19
android/.idea/gradle.xml generated Normal file
View file

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleMigrationSettings" migrationVersion="1" />
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleJvm" value="#GRADLE_LOCAL_JAVA_HOME" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/app" />
</set>
</option>
<option name="resolveExternalAnnotations" value="false" />
</GradleProjectSettings>
</option>
</component>
</project>

View file

@ -0,0 +1,32 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="PreviewAnnotationInFunctionWithParameters" enabled="true" level="ERROR" enabled_by_default="true">
<option name="composableFile" value="true" />
</inspection_tool>
<inspection_tool class="PreviewApiLevelMustBeValid" enabled="true" level="ERROR" enabled_by_default="true">
<option name="composableFile" value="true" />
</inspection_tool>
<inspection_tool class="PreviewDimensionRespectsLimit" enabled="true" level="WARNING" enabled_by_default="true">
<option name="composableFile" value="true" />
</inspection_tool>
<inspection_tool class="PreviewFontScaleMustBeGreaterThanZero" enabled="true" level="ERROR" enabled_by_default="true">
<option name="composableFile" value="true" />
</inspection_tool>
<inspection_tool class="PreviewMultipleParameterProviders" enabled="true" level="ERROR" enabled_by_default="true">
<option name="composableFile" value="true" />
</inspection_tool>
<inspection_tool class="PreviewMustBeTopLevelFunction" enabled="true" level="ERROR" enabled_by_default="true">
<option name="composableFile" value="true" />
</inspection_tool>
<inspection_tool class="PreviewNeedsComposableAnnotation" enabled="true" level="ERROR" enabled_by_default="true">
<option name="composableFile" value="true" />
</inspection_tool>
<inspection_tool class="PreviewNotSupportedInUnitTestFiles" enabled="true" level="ERROR" enabled_by_default="true">
<option name="composableFile" value="true" />
</inspection_tool>
<inspection_tool class="PreviewPickerAnnotation" enabled="true" level="ERROR" enabled_by_default="true">
<option name="composableFile" value="true" />
</inspection_tool>
</profile>
</component>

6
android/.idea/kotlinc.xml generated Normal file
View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="KotlinJpsPluginSettings">
<option name="version" value="1.9.0" />
</component>
</project>

10
android/.idea/migrations.xml generated Normal file
View file

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectMigrations">
<option name="MigrateToGradleLocalJavaHome">
<set>
<option value="$PROJECT_DIR$" />
</set>
</option>
</component>
</project>

10
android/.idea/misc.xml generated Normal file
View file

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="jbr-17" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
<option name="id" value="Android" />
</component>
</project>

6
android/.idea/vcs.xml generated Normal file
View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
</component>
</project>

6
android/Gemfile Normal file
View file

@ -0,0 +1,6 @@
source "https://rubygems.org"
gem "fastlane"
plugins_path = File.join(File.dirname(__FILE__), 'fastlane', 'Pluginfile')
eval_gemfile(plugins_path) if File.exist?(plugins_path)

225
android/Gemfile.lock Normal file
View file

@ -0,0 +1,225 @@
GEM
remote: https://rubygems.org/
specs:
CFPropertyList (3.0.6)
rexml
addressable (2.8.5)
public_suffix (>= 2.0.2, < 6.0)
artifactory (3.0.15)
atomos (0.1.3)
aws-eventstream (1.2.0)
aws-partitions (1.815.0)
aws-sdk-core (3.181.0)
aws-eventstream (~> 1, >= 1.0.2)
aws-partitions (~> 1, >= 1.651.0)
aws-sigv4 (~> 1.5)
jmespath (~> 1, >= 1.6.1)
aws-sdk-kms (1.71.0)
aws-sdk-core (~> 3, >= 3.177.0)
aws-sigv4 (~> 1.1)
aws-sdk-s3 (1.134.0)
aws-sdk-core (~> 3, >= 3.181.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.6)
aws-sigv4 (1.6.0)
aws-eventstream (~> 1, >= 1.0.2)
babosa (1.0.4)
claide (1.1.0)
colored (1.2)
colored2 (3.1.2)
commander (4.6.0)
highline (~> 2.0.0)
declarative (0.0.20)
digest-crc (0.6.5)
rake (>= 12.0.0, < 14.0.0)
domain_name (0.5.20190701)
unf (>= 0.0.5, < 1.0.0)
dotenv (2.8.1)
emoji_regex (3.2.3)
excon (0.102.0)
faraday (1.10.3)
faraday-em_http (~> 1.0)
faraday-em_synchrony (~> 1.0)
faraday-excon (~> 1.1)
faraday-httpclient (~> 1.0)
faraday-multipart (~> 1.0)
faraday-net_http (~> 1.0)
faraday-net_http_persistent (~> 1.0)
faraday-patron (~> 1.0)
faraday-rack (~> 1.0)
faraday-retry (~> 1.0)
ruby2_keywords (>= 0.0.4)
faraday-cookie_jar (0.0.7)
faraday (>= 0.8.0)
http-cookie (~> 1.0.0)
faraday-em_http (1.0.0)
faraday-em_synchrony (1.0.0)
faraday-excon (1.1.0)
faraday-httpclient (1.0.1)
faraday-multipart (1.0.4)
multipart-post (~> 2)
faraday-net_http (1.0.1)
faraday-net_http_persistent (1.2.0)
faraday-patron (1.0.0)
faraday-rack (1.0.0)
faraday-retry (1.0.3)
faraday_middleware (1.2.0)
faraday (~> 1.0)
fastimage (2.2.7)
fastlane (2.214.0)
CFPropertyList (>= 2.3, < 4.0.0)
addressable (>= 2.8, < 3.0.0)
artifactory (~> 3.0)
aws-sdk-s3 (~> 1.0)
babosa (>= 1.0.3, < 2.0.0)
bundler (>= 1.12.0, < 3.0.0)
colored
commander (~> 4.6)
dotenv (>= 2.1.1, < 3.0.0)
emoji_regex (>= 0.1, < 4.0)
excon (>= 0.71.0, < 1.0.0)
faraday (~> 1.0)
faraday-cookie_jar (~> 0.0.6)
faraday_middleware (~> 1.0)
fastimage (>= 2.1.0, < 3.0.0)
gh_inspector (>= 1.1.2, < 2.0.0)
google-apis-androidpublisher_v3 (~> 0.3)
google-apis-playcustomapp_v1 (~> 0.1)
google-cloud-storage (~> 1.31)
highline (~> 2.0)
json (< 3.0.0)
jwt (>= 2.1.0, < 3)
mini_magick (>= 4.9.4, < 5.0.0)
multipart-post (>= 2.0.0, < 3.0.0)
naturally (~> 2.2)
optparse (~> 0.1.1)
plist (>= 3.1.0, < 4.0.0)
rubyzip (>= 2.0.0, < 3.0.0)
security (= 0.1.3)
simctl (~> 1.6.3)
terminal-notifier (>= 2.0.0, < 3.0.0)
terminal-table (>= 1.4.5, < 2.0.0)
tty-screen (>= 0.6.3, < 1.0.0)
tty-spinner (>= 0.8.0, < 1.0.0)
word_wrap (~> 1.0.0)
xcodeproj (>= 1.13.0, < 2.0.0)
xcpretty (~> 0.3.0)
xcpretty-travis-formatter (>= 0.0.3)
fastlane-plugin-firebase_app_distribution (0.7.2)
google-apis-firebaseappdistribution_v1 (~> 0.3.0)
gh_inspector (1.1.3)
google-apis-androidpublisher_v3 (0.49.0)
google-apis-core (>= 0.11.0, < 2.a)
google-apis-core (0.11.1)
addressable (~> 2.5, >= 2.5.1)
googleauth (>= 0.16.2, < 2.a)
httpclient (>= 2.8.1, < 3.a)
mini_mime (~> 1.0)
representable (~> 3.0)
retriable (>= 2.0, < 4.a)
rexml
webrick
google-apis-firebaseappdistribution_v1 (0.3.0)
google-apis-core (>= 0.11.0, < 2.a)
google-apis-iamcredentials_v1 (0.17.0)
google-apis-core (>= 0.11.0, < 2.a)
google-apis-playcustomapp_v1 (0.13.0)
google-apis-core (>= 0.11.0, < 2.a)
google-apis-storage_v1 (0.19.0)
google-apis-core (>= 0.9.0, < 2.a)
google-cloud-core (1.6.0)
google-cloud-env (~> 1.0)
google-cloud-errors (~> 1.0)
google-cloud-env (1.6.0)
faraday (>= 0.17.3, < 3.0)
google-cloud-errors (1.3.1)
google-cloud-storage (1.44.0)
addressable (~> 2.8)
digest-crc (~> 0.4)
google-apis-iamcredentials_v1 (~> 0.1)
google-apis-storage_v1 (~> 0.19.0)
google-cloud-core (~> 1.6)
googleauth (>= 0.16.2, < 2.a)
mini_mime (~> 1.0)
googleauth (1.7.0)
faraday (>= 0.17.3, < 3.a)
jwt (>= 1.4, < 3.0)
memoist (~> 0.16)
multi_json (~> 1.11)
os (>= 0.9, < 2.0)
signet (>= 0.16, < 2.a)
highline (2.0.3)
http-cookie (1.0.5)
domain_name (~> 0.5)
httpclient (2.8.3)
jmespath (1.6.2)
json (2.6.3)
jwt (2.7.1)
memoist (0.16.2)
mini_magick (4.12.0)
mini_mime (1.1.5)
multi_json (1.15.0)
multipart-post (2.3.0)
nanaimo (0.3.0)
naturally (2.2.1)
optparse (0.1.1)
os (1.1.4)
plist (3.7.0)
public_suffix (5.0.3)
rake (13.0.6)
representable (3.2.0)
declarative (< 0.1.0)
trailblazer-option (>= 0.1.1, < 0.2.0)
uber (< 0.2.0)
retriable (3.1.2)
rexml (3.2.6)
rouge (2.0.7)
ruby2_keywords (0.0.5)
rubyzip (2.3.2)
security (0.1.3)
signet (0.17.0)
addressable (~> 2.8)
faraday (>= 0.17.5, < 3.a)
jwt (>= 1.5, < 3.0)
multi_json (~> 1.10)
simctl (1.6.10)
CFPropertyList
naturally
terminal-notifier (2.0.0)
terminal-table (1.8.0)
unicode-display_width (~> 1.1, >= 1.1.1)
trailblazer-option (0.1.2)
tty-cursor (0.7.1)
tty-screen (0.8.1)
tty-spinner (0.9.3)
tty-cursor (~> 0.7)
uber (0.1.0)
unf (0.1.4)
unf_ext
unf_ext (0.0.8.2)
unicode-display_width (1.8.0)
webrick (1.8.1)
word_wrap (1.0.0)
xcodeproj (1.22.0)
CFPropertyList (>= 2.3.3, < 4.0)
atomos (~> 0.1.3)
claide (>= 1.0.2, < 2.0)
colored2 (~> 3.1)
nanaimo (~> 0.3.0)
rexml (~> 3.2.4)
xcpretty (0.3.0)
rouge (~> 2.0.7)
xcpretty-travis-formatter (1.0.1)
xcpretty (~> 0.2, >= 0.0.7)
PLATFORMS
arm64-darwin-21
arm64-darwin-22
x86_64-linux
DEPENDENCIES
fastlane
fastlane-plugin-firebase_app_distribution
BUNDLED WITH
2.4.10

2
android/app/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
/build
google-services.json

View file

@ -0,0 +1,103 @@
plugins {
alias(libs.plugins.androidApplication)
alias(libs.plugins.jetbrainsKotlinAndroid)
alias(libs.plugins.googleServices)
alias(libs.plugins.serialization)
}
// custom properties
val applicationIdArgument = project.findProperty("applicationId")?.toString()
val applicationVersionCodeArgument = project.findProperty("versionCode")?.toString()?.toIntOrNull()
val baseUrlArgument = System.getenv("PNS_BASE_URL") ?: "http://127.0.0.1:8080/"
android {
namespace = applicationIdArgument ?: "org.fnives.android.servernotifications"
compileSdk = 34
defaultConfig {
applicationId = applicationIdArgument ?: "org.fnives.android.servernotifications"
minSdk = 29
targetSdk = 34
versionCode = applicationVersionCodeArgument ?: 1
versionName = "1.0"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
useSupportLibrary = true
}
buildConfigField("String", "BASE_URL", "\"$baseUrlArgument\"")
}
signingConfigs {
with(maybeCreate("debug")) {
storeFile = file("debug.keystore")
storePassword = "android"
keyAlias = "androiddebugkey"
keyPassword = "android"
}
with(maybeCreate("release")) {
storeFile = file(System.getenv("PNS_KEYSTORE") ?: "debug.keystore")
keyAlias = System.getenv("PNS_KEY") ?: ""
keyPassword = System.getenv("PNS_KEY_PASS") ?: ""
storePassword = System.getenv("PNS_PASS") ?: ""
}
}
buildTypes {
release {
signingConfig = signingConfigs.getByName("release")
isMinifyEnabled = true
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
}
buildFeatures {
compose = true
buildConfig = true
}
composeOptions {
kotlinCompilerExtensionVersion = "1.5.1"
}
packaging {
resources {
excludes += "/META-INF/{AL2.0,LGPL2.1}"
}
}
}
dependencies {
implementation(libs.androidx.core.ktx)
implementation(libs.androidx.lifecycle.runtime.ktx)
implementation(libs.androidx.activity.compose)
implementation(platform(libs.androidx.compose.bom))
implementation(libs.androidx.ui)
implementation(libs.androidx.ui.graphics)
implementation(libs.androidx.ui.tooling.preview)
implementation(libs.androidx.material3)
implementation(libs.androidx.fragment)
implementation(platform(libs.firebase.bom))
implementation(libs.firebase.messaging)
implementation(libs.serialization.json)
testImplementation(libs.junit)
androidTestImplementation(libs.androidx.junit)
androidTestImplementation(libs.androidx.espresso.core)
androidTestImplementation(platform(libs.androidx.compose.bom))
androidTestImplementation(libs.androidx.ui.test.junit4)
debugImplementation(libs.androidx.ui.tooling)
debugImplementation(libs.androidx.ui.test.manifest)
}

BIN
android/app/debug.keystore Normal file

Binary file not shown.

21
android/app/proguard-rules.pro vendored Normal file
View file

@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile

View file

@ -0,0 +1,24 @@
package org.fnives.android.servernotifications
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.Assert.*
/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("org.fnives.android.servernotifications", appContext.packageName)
}
}

View file

@ -0,0 +1,39 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.ServerNotifications"
android:usesCleartextTraffic="true"
tools:targetApi="31">
<activity
android:name=".MainActivity"
android:exported="true"
android:launchMode="singleInstance"
android:theme="@style/Theme.ServerNotifications">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service
android:name=".FirebaseMessages"
android:exported="false">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
</application>
</manifest>

View file

@ -0,0 +1,155 @@
package org.fnives.android.servernotifications
import android.app.NotificationChannel
import android.app.NotificationManager
import android.app.PendingIntent
import android.content.Context
import android.content.Intent
import android.content.pm.PackageManager
import android.util.Log
import androidx.core.app.NotificationCompat
import androidx.core.app.NotificationManagerCompat
import androidx.core.content.ContextCompat
import com.google.firebase.messaging.FirebaseMessagingService
import com.google.firebase.messaging.RemoteMessage
import java.time.Instant
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.SupervisorJob
import kotlinx.coroutines.launch
import org.fnives.android.servernotifications.message.DecryptMessage
import org.fnives.android.servernotifications.message.EncryptedMessage
import org.fnives.android.servernotifications.message.Message
import org.fnives.android.servernotifications.message.MessageStorage
import org.fnives.android.servernotifications.message.Priority
import org.fnives.android.servernotifications.message.Priority.High
import org.fnives.android.servernotifications.message.Priority.Low
import org.fnives.android.servernotifications.message.Priority.Medium
import org.fnives.android.servernotifications.message.Priority.Undefined
import org.fnives.android.servernotifications.message.PriorityOf
class FirebaseMessages : FirebaseMessagingService() {
private val decryptMessage by lazy { DecryptMessage(this) }
private val messageStorage by lazy { MessageStorage(this) }
private val coroutineScope = CoroutineScope(SupervisorJob() + Dispatchers.IO)
override fun onNewToken(token: String) {
super.onNewToken(token)
showNotification(
Message(
priority = High,
serviceName = "PN Token has changed!",
timestamp = Instant.now(),
message = "",
)
)
}
override fun onMessageSent(msgId: String) {
super.onMessageSent(msgId)
}
override fun onMessageReceived(remoteMessage: RemoteMessage) {
super.onMessageReceived(remoteMessage)
println("received message")
val sessionKey = remoteMessage.data["session_key"]
val iv = remoteMessage.data["iv"]
val messageData = remoteMessage.data["message"]
val priority = PriorityOf(remoteMessage.data["priority"])
val serviceName = remoteMessage.data["service"] ?: "Undefined"
val encryptedMessage = EncryptedMessage(
iv = iv ?: return log("IV not found in message"),
sessionKey = sessionKey ?: return log("SessionKey not found in message"),
data = messageData ?: return log("MessageData not found in message"),
)
coroutineScope.launch {
val decrypted = decryptMessage.decrypt(encryptedMessage) ?: return@launch
val message = Message(
message = decrypted,
priority = priority,
serviceName = serviceName,
timestamp = Instant.now()
)
messageStorage.addMessage(message)
showNotification(message)
}
}
private fun showNotification(message: Message) {
val importance = when (message.priority) {
High -> NotificationCompat.PRIORITY_HIGH
Medium -> NotificationCompat.PRIORITY_DEFAULT
Low -> NotificationCompat.PRIORITY_LOW
Undefined -> NotificationCompat.PRIORITY_DEFAULT
}
showNotification(
importance = importance,
channelId = message.priority.getChannelId(),
title = "${message.priority.iconText()} ${message.serviceName}",
id = message.hashCode()
)
}
private fun Priority.getChannelId(): String {
val importance = when (this) {
High -> NotificationManager.IMPORTANCE_HIGH
Medium -> NotificationManager.IMPORTANCE_DEFAULT
Low -> NotificationManager.IMPORTANCE_LOW
Undefined -> NotificationManager.IMPORTANCE_DEFAULT
}
createChannel(
name = name,
description = "$name priority status updates from server",
importance = importance,
id = name
)
return name
}
private fun showNotification(
importance: Int, title: String, channelId: String, id: Int,
intent: Intent = Intent(this, MainActivity::class.java),
) {
val builder = NotificationCompat.Builder(this, channelId)
.setSmallIcon(R.drawable.ic_server)
.setContentTitle(title)
.setPriority(importance)
.setContentIntent(
PendingIntent.getActivity(
this, 0, intent, PendingIntent.FLAG_ONE_SHOT or PendingIntent.FLAG_IMMUTABLE
)
)
.setAutoCancel(true)
if (ContextCompat.checkSelfPermission(
this,
android.Manifest.permission.POST_NOTIFICATIONS
) == PackageManager.PERMISSION_GRANTED
) {
NotificationManagerCompat.from(this).notify(id, builder.build())
}
}
private fun createChannel(
name: String,
description: String,
id: String,
importance: Int = NotificationManager.IMPORTANCE_DEFAULT
) {
val channel = NotificationChannel(id, name, importance).apply {
this.description = description
}
val notificationManager =
getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
notificationManager.createNotificationChannel(channel)
}
private fun log(message: String) {
Log.d("FirebaseMessages", message)
}
}

View file

@ -0,0 +1,249 @@
package org.fnives.android.servernotifications
import android.Manifest
import android.content.pm.PackageManager
import android.os.Build
import android.os.Bundle
import android.widget.Space
import androidx.activity.ComponentActivity
import androidx.activity.compose.BackHandler
import androidx.activity.compose.setContent
import androidx.activity.result.contract.ActivityResultContracts
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.text.KeyboardActions
import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.material3.Button
import androidx.compose.material3.LocalTextStyle
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.material3.TextField
import androidx.compose.runtime.Composable
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.text.input.ImeAction
import androidx.compose.ui.text.input.KeyboardCapitalization
import androidx.compose.ui.unit.dp
import androidx.core.app.ActivityCompat
import java.time.ZoneId
import java.time.format.DateTimeFormatter
import java.util.Locale
import kotlinx.coroutines.flow.MutableSharedFlow
import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.onStart
import kotlinx.coroutines.launch
import org.fnives.android.servernotifications.message.MessageStorage
import org.fnives.android.servernotifications.message.Priority
import org.fnives.android.servernotifications.message.Priority.High
import org.fnives.android.servernotifications.message.Priority.Low
import org.fnives.android.servernotifications.message.Priority.Medium
import org.fnives.android.servernotifications.message.Priority.Undefined
import org.fnives.android.servernotifications.token.TokenWebView
import org.fnives.android.servernotifications.ui.theme.ServerNotificationsTheme
import org.fnives.android.servernotifications.url.UrlStorage
class MainActivity : ComponentActivity() {
private val grantedEventFlow = MutableSharedFlow<Unit>(extraBufferCapacity = 1)
val notificationPermission = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
Manifest.permission.POST_NOTIFICATIONS
} else {
null
}
private val grantedFlow = grantedEventFlow.onStart { emit(Unit) }
.map {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
ActivityCompat.checkSelfPermission(
this,
notificationPermission!!
) == PackageManager.PERMISSION_GRANTED
} else {
true
}
}
private val requestPermissionLauncher = registerForActivityResult(
ActivityResultContracts.RequestPermission(),
) { _: Boolean ->
println(grantedEventFlow.tryEmit(Unit))
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val messageStorage = MessageStorage(this)
val urlStorage = UrlStorage(this)
val formatter = DateTimeFormatter.ofPattern("MMM d yyyy hh:mm a")
.withLocale(Locale.getDefault())
.withZone(ZoneId.of("UTC"))
setContent {
ServerNotificationsTheme {
Surface(
modifier = Modifier.fillMaxSize(),
color = MaterialTheme.colorScheme.background
) {
var navigationState by remember { mutableStateOf(Navigation.Home) }
BackHandler(navigationState != Navigation.Home) {
navigationState = Navigation.Home
}
when (navigationState) {
Navigation.Administration -> {
TokenWebView(url = urlStorage.current)
}
Navigation.Home -> {
val grantedState by grantedFlow.collectAsState(initial = null)
if (grantedState == true) {
val scope = rememberCoroutineScope()
Column {
AdministrationNotice(
onShowRegistration = {
navigationState = Navigation.Administration
},
onShowChangeUrl = {
navigationState = Navigation.ChangeURL
},
onClearLogs = { scope.launch { messageStorage.clear() } })
Logs(messageStorage, formatter)
}
} else if (grantedState == false) {
NoPermission()
}
}
Navigation.ChangeURL -> {
ChangeURL(urlStorage)
}
}
}
}
}
}
@Composable
fun NoPermission() {
Box(modifier = Modifier.fillMaxSize()) {
Button(
modifier = Modifier.align(Alignment.Center),
onClick = {
requestPermissionLauncher.launch(notificationPermission)
}) {
Text(text = "Grant notification permission")
}
}
}
@Composable
fun AdministrationNotice(
onShowRegistration: () -> Unit,
onShowChangeUrl: () -> Unit,
onClearLogs: () -> Unit,
) {
Column(
modifier = Modifier
.fillMaxWidth()
.padding(16.dp), Arrangement.Center
) {
Row {
Button(
onClick = { onShowRegistration() },
) {
Text(text = "Administration")
}
Spacer(modifier = Modifier.width(16.dp))
Button(
onClick = { onShowChangeUrl() },
) {
Text(text = "Change URL")
}
}
Spacer(modifier = Modifier.height(8.dp))
Button(
onClick = { onClearLogs() }) {
Text(text = "Clear logs")
}
}
}
@Composable
fun Logs(messageStorage: MessageStorage, formatter: DateTimeFormatter) {
val messages by messageStorage.messages.collectAsState(initial = listOf())
LazyColumn {
messages.forEach {
item {
Text(
modifier = Modifier.padding(horizontal = 24.dp, vertical = 4.dp),
text = "${it.priority.iconText()} ${it.serviceName}: ${it.message} at ${
formatter.format(
it.timestamp
)
}"
)
}
}
}
}
@Composable
fun ChangeURL(urlStorage: UrlStorage) {
val current by urlStorage.currentUrl.collectAsState(initial = "")
val options by urlStorage.urlOptions.collectAsState(initial = emptySet())
var overwrite by remember { mutableStateOf("") }
val keyboardOptions = remember{KeyboardOptions.Default.copy(capitalization = KeyboardCapitalization.None, imeAction = ImeAction.Done)}
Column {
Text(text = "Current", style = MaterialTheme.typography.labelMedium)
Spacer(modifier = Modifier.height(4.dp))
Text(text = current, style = MaterialTheme.typography.bodyLarge)
Spacer(modifier = Modifier.height(8.dp))
Text(text = "Overwrite", style = MaterialTheme.typography.labelMedium)
Spacer(modifier = Modifier.height(4.dp))
TextField(
overwrite,
textStyle = MaterialTheme.typography.bodyLarge,
onValueChange = { overwrite = it },
keyboardActions = KeyboardActions(onDone = {
urlStorage.selectedUrl(overwrite)
defaultKeyboardAction(ImeAction.Done)
}),
keyboardOptions = keyboardOptions
)
Spacer(modifier = Modifier.height(8.dp))
Text(text = "Recent", style = MaterialTheme.typography.labelMedium)
options.forEach {
Button(onClick = {
urlStorage.selectedUrl(it)
}) {
Text(text = it, style = MaterialTheme.typography.bodyMedium)
}
Spacer(modifier = Modifier.height(8.dp))
}
}
}
}
fun Priority.iconText(): String {
return when (this) {
High -> "\uD83D\uDEA8"
Medium -> "\uFE0F"
Low -> "\uFE0F"
Undefined -> "\uD83E\uDD14"
}
}
enum class Navigation {
Administration, Home, ChangeURL
}

View file

@ -0,0 +1,102 @@
package org.fnives.android.servernotifications.message
import android.content.Context
import org.fnives.android.servernotifications.BuildConfig
import java.io.File
import java.nio.charset.StandardCharsets
import java.security.KeyFactory
import java.security.KeyPair
import java.security.KeyPairGenerator
import java.security.spec.PKCS8EncodedKeySpec
import java.security.spec.X509EncodedKeySpec
import javax.crypto.Cipher
import javax.crypto.spec.IvParameterSpec
import javax.crypto.spec.SecretKeySpec
import kotlin.io.encoding.Base64
import kotlin.io.encoding.ExperimentalEncodingApi
interface DecryptMessage {
fun decrypt(message: EncryptedMessage): String?
}
fun DecryptMessage(context: Context): DecryptMessage {
return DecryptMessageImpl(getKeyPair(context))
}
fun getKeyPair(context: Context): KeyPair {
val publicKeyFile = File(context.filesDir, "key.pub")
val privateKeyFile = File(context.filesDir, "key.rsa")
val publicKeyBytes = if (publicKeyFile.exists()) publicKeyFile.readBytes() else ByteArray(0)
val privateKeyBytes = if (privateKeyFile.exists()) privateKeyFile.readBytes() else ByteArray(0)
val keyPair: KeyPair
if (publicKeyBytes.isEmpty() || privateKeyBytes.isEmpty()) {
keyPair = DecryptMessageImpl.generateKeyPair()
publicKeyFile.writeBytes(keyPair.public.encoded)
privateKeyFile.writeBytes(keyPair.private.encoded)
} else {
val publicKey =
KeyFactory.getInstance("RSA").generatePublic(X509EncodedKeySpec(publicKeyBytes))
val privateKey =
KeyFactory.getInstance("RSA").generatePrivate(PKCS8EncodedKeySpec(privateKeyBytes))
keyPair = KeyPair(publicKey, privateKey)
}
return keyPair
}
class DecryptMessageImpl(private val keyPair: KeyPair) : DecryptMessage {
//from Crypto.PublicKey import RSA
//from Crypto.Cipher import AES, PKCS1_OAEP
//
//private_key = RSA.import_key(open("private.pem").read())
//
//with open("encrypted_data.bin", "rb") as f:
// enc_session_key = f.read(private_key.size_in_bytes())
// nonce = f.read(16)
// tag = f.read(16)
// ciphertext = f.read()
//
//# Decrypt the session key with the private RSA key
//cipher_rsa = PKCS1_OAEP.new(private_key)
//session_key = cipher_rsa.decrypt(enc_session_key)
//
//# Decrypt the data with the AES session key
//cipher_aes = AES.new(session_key, AES.MODE_EAX, nonce)
//data = cipher_aes.decrypt_and_verify(ciphertext, tag)
//print(data.decode("utf-8"))
@OptIn(ExperimentalEncodingApi::class)
override fun decrypt(message: EncryptedMessage): String? {
try {
val privateKey = keyPair.private
val rsaCipher = Cipher.getInstance("RSA/NONE/OAEPPadding")
rsaCipher.init(Cipher.DECRYPT_MODE, privateKey)
val sessionKey = rsaCipher.doFinal(Base64.decode(message.sessionKey))
val iv = rsaCipher.doFinal(Base64.decode(message.iv))
val cipher = Cipher.getInstance("AES/CBC/PKCS7Padding")
val aesKey = SecretKeySpec(sessionKey, "AES")
cipher.init(Cipher.DECRYPT_MODE, aesKey, IvParameterSpec(iv))
val decryptedByteArray = cipher.doFinal(Base64.decode(message.data))
return decryptedByteArray.toString(StandardCharsets.UTF_8)
} catch(e: Throwable) {
if (BuildConfig.DEBUG) {
e.printStackTrace()
}
return null
}
}
companion object {
fun generateKeyPair(): KeyPair {
val kpg = KeyPairGenerator.getInstance("RSA")
kpg.initialize(2048)
return kpg.genKeyPair()
}
}
}

View file

@ -0,0 +1,7 @@
package org.fnives.android.servernotifications.message
data class EncryptedMessage(
val iv: String,
val data: String,
val sessionKey: String
)

View file

@ -0,0 +1,78 @@
package org.fnives.android.servernotifications.message
import androidx.annotation.Keep
import com.google.firebase.BuildConfig
import java.time.Instant
import kotlinx.serialization.KSerializer
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import kotlinx.serialization.descriptors.PrimitiveKind
import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor
import kotlinx.serialization.descriptors.SerialDescriptor
import kotlinx.serialization.encodeToString
import kotlinx.serialization.encoding.Decoder
import kotlinx.serialization.encoding.Encoder
import kotlinx.serialization.json.Json
@Serializable
data class Message(
@SerialName("message")
val message: String,
@SerialName("priority")
val priority: Priority,
@SerialName("service")
val serviceName: String,
@SerialName("time")
@Serializable(InstantSerializer::class)
val timestamp: Instant
)
@Keep
enum class Priority {
High, Medium, Low, Undefined
}
@Suppress("FunctionName")
fun PriorityOf(priority: String?): Priority {
return Priority.entries.firstOrNull { it.name.equals(priority, ignoreCase = true) }
?: Priority.Undefined
}
object InstantSerializer : KSerializer<Instant> {
override val descriptor: SerialDescriptor = PrimitiveSerialDescriptor("java.time.Instant", PrimitiveKind.STRING)
override fun serialize(encoder: Encoder, value: Instant) = encoder.encodeString(value.toString())
override fun deserialize(decoder: Decoder): Instant = Instant.parse(decoder.decodeString())
}
interface Converter {
fun serialize(message: Message): String?
fun deserialize(message: String): Message?
}
fun Converter(): Converter {
return SerializerConverter()
}
class SerializerConverter : Converter {
override fun serialize(message: Message): String? =
safeJson {
Json.encodeToString(message)
}
override fun deserialize(message: String): Message? =
safeJson {
Json.decodeFromString<Message>(message)
}
private inline fun <T> safeJson(action: () -> T): T? {
return try {
action()
} catch (parsingException: Throwable) {
if (BuildConfig.DEBUG) {
parsingException.printStackTrace()
}
null
}
}
}

View file

@ -0,0 +1,72 @@
package org.fnives.android.servernotifications.message
import android.content.Context
import java.io.File
import kotlin.coroutines.CoroutineContext
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.MutableSharedFlow
import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.onStart
import kotlinx.coroutines.sync.Mutex
import kotlinx.coroutines.sync.withLock
import kotlinx.coroutines.withContext
fun MessageStorage(context: Context): MessageStorage {
return MessageStorage(
limit = 100,
file = File(context.filesDir, "logs"),
converter = Converter(),
)
}
class MessageStorage(
private val limit: Int,
private val file: File,
private val converter: Converter,
private val context: CoroutineContext = Dispatchers.IO
) {
init {
require(limit > 0)
}
// DO NOT DO THIS: use database in prod
val messages = writeEvent.onStart { emit(Unit) }.map {
fileMutex.withLock {
if (file.exists()) {
file.readLines()
.reversed()
.mapNotNull(converter::deserialize)
} else {
listOf()
}
}
}
suspend fun addMessage(message: Message) {
val serializedMessage = converter.serialize(message) ?: return
withContext(context) {
fileMutex.withLock {
val lines = if (file.exists()) file.readLines() else listOf()
val current = lines.takeLast(limit - 1)
val allLogs = current + serializedMessage
file.writeText(allLogs.joinToString("\n"))
}
}
writeEvent.tryEmit(Unit)
}
suspend fun clear() {
withContext(context) {
fileMutex.withLock {
file.delete()
}
}
writeEvent.tryEmit(Unit)
}
companion object {
val fileMutex = Mutex()
private val writeEvent = MutableSharedFlow<Unit>(extraBufferCapacity = 1)
}
}

View file

@ -0,0 +1,107 @@
package org.fnives.android.servernotifications.token
import android.R.attr.capitalize
import android.annotation.SuppressLint
import android.content.Context
import android.os.Build
import android.view.ViewGroup
import android.view.ViewGroup.LayoutParams.MATCH_PARENT
import android.webkit.JavascriptInterface
import android.webkit.WebView
import android.webkit.WebViewClient
import androidx.annotation.Keep
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material3.CircularProgressIndicator
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.text.capitalize
import androidx.compose.ui.viewinterop.AndroidView
import com.google.firebase.messaging.FirebaseMessaging
import java.util.Locale
import java.util.concurrent.CountDownLatch
import kotlin.io.encoding.Base64
import kotlin.io.encoding.ExperimentalEncodingApi
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.Job
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import org.fnives.android.servernotifications.message.getKeyPair
@SuppressLint("SetJavaScriptEnabled")
@Composable
fun TokenWebView(url: String) {
var showLoading by remember(url) { mutableStateOf(true) }
LaunchedEffect(url) {
// can't be bothered for a real loading indicator
delay(5000L)
showLoading = false
}
Box(Modifier.fillMaxSize()) {
AndroidView(
modifier = Modifier.fillMaxSize(),
factory = { context ->
WebView(context).apply {
setBackgroundColor(0)
layoutParams = ViewGroup.LayoutParams(MATCH_PARENT, MATCH_PARENT)
settings.javaScriptEnabled = true
webViewClient = WebViewClient()
addJavascriptInterface(ReadTokenInterface(context), "Android")
settings.loadWithOverviewMode = true
settings.useWideViewPort = true
settings.setSupportZoom(true)
}
},
update = { webView ->
webView.loadUrl(url)
}
)
if (showLoading) {
CircularProgressIndicator(modifier = Modifier.align(Alignment.Center))
}
}
}
@Keep
class ReadTokenInterface(private val context: Context) {
@OptIn(ExperimentalEncodingApi::class)
@JavascriptInterface
fun publicKey(): String {
val publicKey = getKeyPair(context).public.encoded
return Base64.encode(publicKey)
}
@JavascriptInterface
fun messagingToken(): String {
val latch = CountDownLatch(1)
var token: String? = null
FirebaseMessaging.getInstance().token.addOnSuccessListener {
token = it
latch.countDown()
}
latch.await()
return token!!
}
@JavascriptInterface
fun deviceName(): String {
val manufacturer = Build.MANUFACTURER
val model = Build.MODEL
return if (model.startsWith(manufacturer)) {
model
} else {
"$manufacturer $model"
}
}
}

View file

@ -0,0 +1,11 @@
package org.fnives.android.servernotifications.ui.theme
import androidx.compose.ui.graphics.Color
val Purple80 = Color(0xFFD0BCFF)
val PurpleGrey80 = Color(0xFFCCC2DC)
val Pink80 = Color(0xFFEFB8C8)
val Purple40 = Color(0xFF6650a4)
val PurpleGrey40 = Color(0xFF625b71)
val Pink40 = Color(0xFF7D5260)

View file

@ -0,0 +1,73 @@
package org.fnives.android.servernotifications.ui.theme
import android.app.Activity
import android.os.Build
import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.darkColorScheme
import androidx.compose.material3.dynamicDarkColorScheme
import androidx.compose.material3.dynamicLightColorScheme
import androidx.compose.material3.lightColorScheme
import androidx.compose.runtime.Composable
import androidx.compose.runtime.SideEffect
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.toArgb
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalView
import androidx.core.view.WindowCompat
private val DarkColorScheme = darkColorScheme(
primary = Purple80,
secondary = PurpleGrey80,
tertiary = Pink80,
surface = Color(0xFF2a2a2a),
)
private val LightColorScheme = lightColorScheme(
primary = Purple40,
secondary = PurpleGrey40,
tertiary = Pink40,
surface = Color(0xFFEaEaEa),
/* Other default colors to override
background = Color(0xFFFFFBFE),
surface = Color(0xFFFFFBFE),
onPrimary = Color.White,
onSecondary = Color.White,
onTertiary = Color.White,
onBackground = Color(0xFF1C1B1F),
onSurface = Color(0xFF1C1B1F),
*/
)
@Composable
fun ServerNotificationsTheme(
darkTheme: Boolean = isSystemInDarkTheme(),
// Dynamic color is available on Android 12+
dynamicColor: Boolean = true,
content: @Composable () -> Unit
) {
val colorScheme = when {
dynamicColor && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S -> {
val context = LocalContext.current
if (darkTheme) dynamicDarkColorScheme(context) else dynamicLightColorScheme(context)
}
darkTheme -> DarkColorScheme
else -> LightColorScheme
}
val view = LocalView.current
if (!view.isInEditMode) {
SideEffect {
val window = (view.context as Activity).window
window.statusBarColor = colorScheme.surface.toArgb()
WindowCompat.getInsetsController(window, view).isAppearanceLightStatusBars = !darkTheme
}
}
MaterialTheme(
colorScheme = colorScheme,
typography = Typography,
content = content
)
}

View file

@ -0,0 +1,34 @@
package org.fnives.android.servernotifications.ui.theme
import androidx.compose.material3.Typography
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.sp
// Set of Material typography styles to start with
val Typography = Typography(
bodyLarge = TextStyle(
fontFamily = FontFamily.Default,
fontWeight = FontWeight.Normal,
fontSize = 16.sp,
lineHeight = 24.sp,
letterSpacing = 0.5.sp
)
/* Other default text styles to override
titleLarge = TextStyle(
fontFamily = FontFamily.Default,
fontWeight = FontWeight.Normal,
fontSize = 22.sp,
lineHeight = 28.sp,
letterSpacing = 0.sp
),
labelSmall = TextStyle(
fontFamily = FontFamily.Default,
fontWeight = FontWeight.Medium,
fontSize = 11.sp,
lineHeight = 16.sp,
letterSpacing = 0.5.sp
)
*/
)

View file

@ -0,0 +1,39 @@
package org.fnives.android.servernotifications.url
import android.content.Context
import android.content.SharedPreferences
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.MutableSharedFlow
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.onStart
import org.fnives.android.servernotifications.BuildConfig
fun UrlStorage(context: Context): UrlStorage {
val sharedPref = context.getSharedPreferences("url_storage", Context.MODE_PRIVATE)
return UrlStorage(sharedPref)
}
class UrlStorage(private val sharedPref: SharedPreferences) {
// DO NOT DO THIS: listen to the sharedPref or use DataStore
private val update = MutableSharedFlow<Unit>(extraBufferCapacity = 1, replay = 1).apply {
tryEmit(Unit)
}
private var _current get() = sharedPref.getString("current", null) ?: BuildConfig.BASE_URL
set(value) {
sharedPref.edit().putString("current", value).apply()
}
val currentUrl: Flow<String> = update.map {_current }
val current: String get() = _current
private var _urlOptions get() = sharedPref.getStringSet("all", null) ?: setOf(BuildConfig.BASE_URL)
set(value) {
sharedPref.edit().putStringSet("all", value).apply()
}
val urlOptions: Flow<Set<String>> = update.map {_urlOptions }
fun selectedUrl(url: String) {
_current = url
_urlOptions = _urlOptions + url
update.tryEmit(Unit)
}
}

View file

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:fillColor="#2a2a2a"
android:pathData="M0,0h108v108h-108z" />
</vector>

View file

@ -0,0 +1,18 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:tint="#FF6650a4"
android:viewportWidth="48"
android:viewportHeight="48">
<path
android:fillColor="@android:color/white"
android:pathData="M0,15H17 c-0.55,0 -1,0.45 -1,1v6c0,0.55 0.45,1 1,1h16c0.55,0 1,-0.45 1,-1v-6c0,-0.55 -0.45,-1 -1,-1z
M19,21 c-1.1,0 -2,-0.9 -2,-2s0.9,-2 2,-2 2,0.9 2,2 -0.9,2 -2,2z" />
<path
android:fillColor="@android:color/white"
android:pathData="M0,25H17 c-0.55,0 -1,0.45 -1,1v6c0,0.55 0.45,1 1,1h16c0.55,0 1,-0.45 1,-1v-6c0,-0.55 -0.45,-1 -1,-1z
M19,31 c-1.1,0 -2,-0.9 -2,-2s0.9,-2 2,-2 2,0.9 2,2 -0.9,2 -2,2z" />
</vector>

View file

@ -0,0 +1,18 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:tint="#FF6650a4"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@android:color/white"
android:pathData="M0,2H4 c-0.55,0 -1,0.45 -1,1v6c0,0.55 0.45,1 1,1h16c0.55,0 1,-0.45 1,-1v-6c0,-0.55 -0.45,-1 -1,-1z
M6,8 c-1.1,0 -2,-0.9 -2,-2s0.9,-2 2,-2 2,0.9 2,2 -0.9,2 -2,2z" />
<path
android:fillColor="@android:color/white"
android:pathData="M0,13H4 c-0.55,0 -1,0.45 -1,1v6c0,0.55 0.45,1 1,1h16c0.55,0 1,-0.45 1,-1v-6c0,-0.55 -0.45,-1 -1,-1z
M6,18 c-1.1,0 -2,-0.9 -2,-2s0.9,-2 2,-2 2,0.9 2,2 -0.9,2 -2,2z" />
</vector>

View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>

View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>

View file

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="purple_200">#FFBB86FC</color>
<color name="purple_500">#FF6200EE</color>
<color name="purple_700">#FF3700B3</color>
<color name="teal_200">#FF03DAC5</color>
<color name="teal_700">#FF018786</color>
<color name="black">#FF000000</color>
<color name="white">#FFFFFFFF</color>
</resources>

View file

@ -0,0 +1,3 @@
<resources>
<string name="app_name">Server Notifications</string>
</resources>

View file

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme.ServerNotifications" parent="android:Theme.Material.NoActionBar" >
<item name="android:background">#2a2a2a</item>
<item name="android:windowBackground">#2a2a2a</item>
<item name="android:statusBarColor">#2a2a2a</item>
<item name="android:windowLightStatusBar">false</item>
</style>
</resources>

View file

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?><!--
Sample backup rules file; uncomment and customize as necessary.
See https://developer.android.com/guide/topics/data/autobackup
for details.
Note: This file is ignored for devices older that API 31
See https://developer.android.com/about/versions/12/backup-restore
-->
<full-backup-content>
<!--
<include domain="sharedpref" path="."/>
<exclude domain="sharedpref" path="device.xml"/>
-->
</full-backup-content>

View file

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?><!--
Sample data extraction rules file; uncomment and customize as necessary.
See https://developer.android.com/about/versions/12/backup-restore#xml-changes
for details.
-->
<data-extraction-rules>
<cloud-backup>
<!-- TODO: Use <include> and <exclude> to control what is backed up.
<include .../>
<exclude .../>
-->
</cloud-backup>
<!--
<device-transfer>
<include .../>
<exclude .../>
</device-transfer>
-->
</data-extraction-rules>

View file

@ -0,0 +1,17 @@
package org.fnives.android.servernotifications
import org.junit.Test
import org.junit.Assert.*
/**
* Example local unit test, which will execute on the development machine (host).
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
class ExampleUnitTest {
@Test
fun addition_isCorrect() {
assertEquals(4, 2 + 2)
}
}

6
android/build.gradle.kts Normal file
View file

@ -0,0 +1,6 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
alias(libs.plugins.androidApplication) apply false
alias(libs.plugins.jetbrainsKotlinAndroid) apply false
alias(libs.plugins.googleServices) apply false
}

2
android/fastlane/AppFile Normal file
View file

@ -0,0 +1,2 @@
json_key_file("") # Path to the json secret file - Follow https://docs.fastlane.tools/actions/supply/#setup to get one
package_name("org.fnives.android.servernotifications")

70
android/fastlane/Fastfile Normal file
View file

@ -0,0 +1,70 @@
# This file contains the fastlane.tools configuration
# You can find the documentation at https://docs.fastlane.tools
#
# For a list of all available actions, check out
#
# https://docs.fastlane.tools/actions
#
# For a list of all available plugins, check out
#
# https://docs.fastlane.tools/plugins/available-plugins
#
# Uncomment the line if you want fastlane to automatically update itself
# update_fastlane
default_platform(:android)
platform :android do
before_all do
PROD_APP_IDENTIFIER = "org.fnives.android.servernotifications"
# Environment variable should be the full path to the PlayStore auth .json
PLAY_STORE_AUTH_FILE = ENV['PNS_ANDROID_PLAY_STORE_AUTH_FILE']
end
desc "Submit a new Production Build to Play Store"
desc "By Default it sets the version_code to last from PlayStore + 1."
desc ">Optionally version code increase can be skipped via:"
desc "```sh"
desc "[bundle exec] fastlane deployProdToPlayStore skip_build_number_increase:true"
desc "```"
lane :deployProdToPlayStore do |options|
skip_build_number_increase = options[:skip_build_number_increase] # optional, if not set, it gets the last from PlayStore then adds + 1
package_name = PROD_APP_IDENTIFIER
if skip_build_number_increase.nil? || skip_build_number_increase.empty? || !skip_build_number_increase
last_version_codes = google_play_track_version_codes(
track: 'internal',
json_key: PLAY_STORE_AUTH_FILE,
package_name: package_name
)
last_version_code = last_version_codes[0]
version_code = last_version_code + 1
end
gradle(task: 'clean', flags: "--no-daemon")
gradle(
task: 'bundle',
build_type: 'release',
flags: "--no-daemon",
properties: {
"applicationId" => PROD_APP_IDENTIFIER,
"versionCode" => version_code
}
)
production_aab = lane_context[SharedValues::GRADLE_AAB_OUTPUT_PATH]
mapping_file_path = lane_context[SharedValues::GRADLE_MAPPING_TXT_OUTPUT_PATH]
upload_to_play_store(
track: 'internal',
release_status: 'draft', # can remove once app is released to the public
aab: production_aab,
json_key: PLAY_STORE_AUTH_FILE,
skip_upload_apk: true,
package_name: package_name,
mapping_paths: [mapping_file_path]
)
end
end

View file

@ -0,0 +1,5 @@
# Autogenerated by fastlane
#
# Ensure this file is checked in to source control!
gem 'fastlane-plugin-firebase_app_distribution'

View file

@ -0,0 +1,42 @@
fastlane documentation
----
# Installation
Make sure you have the latest version of the Xcode command line tools installed:
```sh
xcode-select --install
```
For _fastlane_ installation instructions, see [Installing _fastlane_](https://docs.fastlane.tools/#installing-fastlane)
# Available Actions
## Android
### android deployProdToPlayStore
```sh
[bundle exec] fastlane android deployProdToPlayStore
```
Submit a new Production Build to Play Store
By Default it sets the version_code to last from PlayStore + 1.
>Optionally version code increase can be skipped via:
```sh
[bundle exec] fastlane deployProdToPlayStore skip_build_number_increase:true
```
----
This README.md is auto-generated and will be re-generated every time [_fastlane_](https://fastlane.tools) is run.
More information about _fastlane_ can be found on [fastlane.tools](https://fastlane.tools).
The documentation of _fastlane_ can be found on [docs.fastlane.tools](https://docs.fastlane.tools).

View file

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuites>
<testsuite name="fastlane.lanes">
<testcase classname="fastlane.lanes" name="0: default_platform" time="0.000498">
</testcase>
<testcase classname="fastlane.lanes" name="1: google_play_track_version_codes" time="1.653315">
</testcase>
<testcase classname="fastlane.lanes" name="2: clean" time="16.227663">
</testcase>
<testcase classname="fastlane.lanes" name="3: bundlerelease" time="145.845877">
</testcase>
<testcase classname="fastlane.lanes" name="4: upload_to_play_store" time="20.229148">
</testcase>
</testsuite>
</testsuites>

23
android/gradle.properties Normal file
View file

@ -0,0 +1,23 @@
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. For more details, visit
# https://developer.android.com/r/tools/gradle-multi-project-decoupled-projects
# org.gradle.parallel=true
# AndroidX package structure to make it clearer which packages are bundled with the
# Android operating system, and which are packaged with your app's APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
# Kotlin code style for this project: "official" or "obsolete":
kotlin.code.style=official
# Enables namespacing of each library's R class so that its R class includes only the
# resources declared in the library itself and none from the library's dependencies,
# thereby reducing the size of the R class for that library
android.nonTransitiveRClass=true

View file

@ -0,0 +1,41 @@
[versions]
agp = "8.3.0"
kotlin = "1.9.0"
coreKtx = "1.12.0"
junit = "4.13.2"
junitVersion = "1.1.5"
espressoCore = "3.5.1"
lifecycleRuntimeKtx = "2.6.1"
activityCompose = "1.7.0"
composeBom = "2023.08.00"
googleServices = "4.4.1"
firebaseBom = "32.7.4"
serialization = "1.9.22"
serializationJson = "1.6.3"
fragmentx = "1.6.2"
[libraries]
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
junit = { group = "junit", name = "junit", version.ref = "junit" }
androidx-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" }
androidx-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" }
androidx-lifecycle-runtime-ktx = { group = "androidx.lifecycle", name = "lifecycle-runtime-ktx", version.ref = "lifecycleRuntimeKtx" }
androidx-activity-compose = { group = "androidx.activity", name = "activity-compose", version.ref = "activityCompose" }
androidx-compose-bom = { group = "androidx.compose", name = "compose-bom", version.ref = "composeBom" }
androidx-ui = { group = "androidx.compose.ui", name = "ui" }
androidx-ui-graphics = { group = "androidx.compose.ui", name = "ui-graphics" }
androidx-ui-tooling = { group = "androidx.compose.ui", name = "ui-tooling" }
androidx-ui-tooling-preview = { group = "androidx.compose.ui", name = "ui-tooling-preview" }
androidx-ui-test-manifest = { group = "androidx.compose.ui", name = "ui-test-manifest" }
androidx-ui-test-junit4 = { group = "androidx.compose.ui", name = "ui-test-junit4" }
androidx-fragment = { group = "androidx.fragment", name = "fragment", version.ref = "fragmentx" }
androidx-material3 = { group = "androidx.compose.material3", name = "material3" }
firebase-messaging = { group = "com.google.firebase", name = "firebase-messaging" }
firebase-bom = { module = "com.google.firebase:firebase-bom", version.ref = "firebaseBom" }
serialization-json = { group = "org.jetbrains.kotlinx", name = "kotlinx-serialization-json", version.ref = "serializationJson" }
[plugins]
androidApplication = { id = "com.android.application", version.ref = "agp" }
jetbrainsKotlinAndroid = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
googleServices = { id = "com.google.gms.google-services", version.ref = "googleServices" }
serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "serialization" }

Binary file not shown.

View file

@ -0,0 +1,6 @@
#Mon Mar 18 22:22:44 EET 2024
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

185
android/gradlew vendored Executable file
View file

@ -0,0 +1,185 @@
#!/usr/bin/env sh
#
# Copyright 2015 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn () {
echo "$*"
}
die () {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=`expr $i + 1`
done
case $i in
0) set -- ;;
1) set -- "$args0" ;;
2) set -- "$args0" "$args1" ;;
3) set -- "$args0" "$args1" "$args2" ;;
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=`save "$@"`
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
exec "$JAVACMD" "$@"

89
android/gradlew.bat vendored Normal file
View file

@ -0,0 +1,89 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

View file

@ -0,0 +1,26 @@
import java.net.URI
pluginManagement {
repositories {
google {
content {
includeGroupByRegex("com\\.android.*")
includeGroupByRegex("com\\.google.*")
includeGroupByRegex("androidx.*")
}
}
mavenCentral()
gradlePluginPortal()
// maven { url = URI.create("https://kotlin.bintray.com/kotlinx") }
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
}
}
rootProject.name = "ServerNotifications"
include(":app")