nowser add contentresolver support

This commit is contained in:
DASHU
2024-10-09 02:05:05 +08:00
parent a0c0ec78b8
commit 6660cb2805
13 changed files with 310 additions and 27 deletions

View File

@@ -30,11 +30,15 @@ if (flutterVersionName == null) {
android {
namespace = "com.github.haorendashu.nowser"
compileSdk = flutter.compileSdkVersion
ndkVersion = flutter.ndkVersion
ndkVersion = "26.1.10909125"
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = "17"
}
defaultConfig {

View File

@@ -39,11 +39,17 @@
<data android:scheme="nostrsigner" />
</intent-filter>
</activity>
<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
<meta-data
android:name="flutterEmbedding"
android:value="2" />
<provider
android:name="com.github.haorendashu.nowser.NowserSignerProvider"
android:authorities="com.github.haorendashu.nowser.SIGN_EVENT;com.github.haorendashu.nowser.NIP04_ENCRYPT;com.github.haorendashu.nowser.NIP04_DECRYPT;com.github.haorendashu.nowser.NIP44_ENCRYPT;com.github.haorendashu.nowser.NIP44_DECRYPT;com.github.haorendashu.nowser.GET_PUBLIC_KEY"
android:exported="true" />
</application>
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />

View File

@@ -0,0 +1,20 @@
package com.github.haorendashu.nowser;
import com.nt4f04und.android_content_provider.AndroidContentProvider;
import org.jetbrains.annotations.NotNull;
public class NowserSignerProvider extends AndroidContentProvider {
@NotNull
@Override
public String getAuthority() {
return "com.github.haorendashu.nowser.SIGN_EVENT;com.github.haorendashu.nowser.NIP04_ENCRYPT;com.github.haorendashu.nowser.NIP04_DECRYPT;com.github.haorendashu.nowser.NIP44_ENCRYPT;com.github.haorendashu.nowser.NIP44_DECRYPT;com.github.haorendashu.nowser.GET_PUBLIC_KEY";
}
@NotNull
@Override
public String getEntrypointName() {
return "nowserSignerProviderEntrypoint";
}
}

View File

@@ -1,5 +1,13 @@
package com.github.haorendashu.nowser
import android.content.Context
import com.nt4f04und.android_content_provider.AndroidContentProvider
import io.flutter.embedding.android.FlutterActivity
import io.flutter.embedding.engine.FlutterEngine
class MainActivity: FlutterActivity()
class MainActivity: FlutterActivity() {
override fun provideFlutterEngine(context: Context): FlutterEngine? {
return AndroidContentProvider.getFlutterEngineGroup(this)
.createAndRunDefaultEngine(this)
}
}

View File

@@ -6,6 +6,17 @@ allprojects {
}
rootProject.buildDir = "../build"
subprojects {
afterEvaluate { project ->
if (project.hasProperty('android')) {
project.android {
if (namespace == null) {
namespace project.group
}
}
}
}
}
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}

View File

@@ -1,3 +1,7 @@
org.gradle.jvmargs=-Xmx4G -XX:+HeapDumpOnOutOfMemoryError
android.useAndroidX=true
android.enableJetifier=true
android.defaults.buildfeatures.buildconfig=true
android.nonTransitiveRClass=false
android.nonFinalResIds=false
kotlin.jvm.target.validation.mode = IGNORE

View File

@@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.3-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-all.zip

View File

@@ -18,8 +18,8 @@ pluginManagement {
plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version "7.3.0" apply false
id "org.jetbrains.kotlin.android" version "1.7.10" apply false
id "com.android.application" version '8.1.1' apply false
id "org.jetbrains.kotlin.android" version "1.8.10" apply false
}
include ":app"