diff --git a/ui/build.gradle b/ui/build.gradle index 8fd6dd6..17d4c65 100644 --- a/ui/build.gradle +++ b/ui/build.gradle @@ -35,9 +35,11 @@ android { dependencies { implementation 'androidx.core:core-ktx:1.13.1' - implementation 'androidx.appcompat:appcompat:1.7.0' + implementation 'androidx.appcompat:appcompat:1.6.1' implementation 'com.google.android.material:material:1.12.0' testImplementation 'junit:junit:4.13.2' androidTestImplementation 'androidx.test.ext:junit:1.2.1' androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1' + + implementation("com.github.UnifiedPush:android-connector:2.2.0") } \ No newline at end of file diff --git a/ui/src/main/AndroidManifest.xml b/ui/src/main/AndroidManifest.xml index 0a7e3fe..200ffee 100644 --- a/ui/src/main/AndroidManifest.xml +++ b/ui/src/main/AndroidManifest.xml @@ -7,6 +7,20 @@ android:label="@string/app_name" android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" - android:theme="@style/Theme.Ntfy" /> - + android:theme="@style/Theme.Ntfy"> + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ui/src/main/java/foundation/e/ntefy/ui/MainActivity.kt b/ui/src/main/java/foundation/e/ntefy/ui/MainActivity.kt new file mode 100644 index 0000000..446f169 --- /dev/null +++ b/ui/src/main/java/foundation/e/ntefy/ui/MainActivity.kt @@ -0,0 +1,14 @@ +package foundation.e.ntefy.ui + +import androidx.appcompat.app.AppCompatActivity +import android.os.Bundle +import org.unifiedpush.android.connector.UnifiedPush + +class MainActivity : AppCompatActivity() { + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + setContentView(R.layout.activity_main) + + UnifiedPush.registerAppWithDialog(this) + } +} \ No newline at end of file diff --git a/ui/src/main/java/foundation/e/ntefy/ui/UnifiedPocReceiver.kt b/ui/src/main/java/foundation/e/ntefy/ui/UnifiedPocReceiver.kt new file mode 100644 index 0000000..b04eee7 --- /dev/null +++ b/ui/src/main/java/foundation/e/ntefy/ui/UnifiedPocReceiver.kt @@ -0,0 +1,24 @@ +package foundation.e.ntefy.ui + +import android.content.Context +import android.util.Log +import org.unifiedpush.android.connector.MessagingReceiver + +class UnifiedPocReceiver: MessagingReceiver() { + + companion object { + const val TAG = "UnifiedPocReceiver" + } + + override fun onMessage(context: Context, message: ByteArray, instance: String) { + super.onMessage(context, message, instance) + val utf8Message = String(message) + + Log.i(TAG, "onMessage $utf8Message") + } + + override fun onNewEndpoint(context: Context, endpoint: String, instance: String) { + super.onNewEndpoint(context, endpoint, instance) + Log.i(TAG, "onNewEndpoint $endpoint") + } +} \ No newline at end of file diff --git a/ui/src/main/res/layout/activity_main.xml b/ui/src/main/res/layout/activity_main.xml new file mode 100644 index 0000000..2d681b7 --- /dev/null +++ b/ui/src/main/res/layout/activity_main.xml @@ -0,0 +1,7 @@ + + \ No newline at end of file