Repository navigation
feat: Flutter SDK update for version 27.1.0-rc.0 #333
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
a18cda0
chore: update Flutter SDK to 25.3.0
ChiragAgg5k e50fec6
Commit from GitHub Actions (Format and push)
ChiragAgg5k 1c0fb53
chore: update Flutter SDK to 25.3.0
ChiragAgg5k 4f7e2d4
Commit from GitHub Actions (Format and push)
ChiragAgg5k 7071616
chore: update Flutter SDK to 25.4.0
ChiragAgg5k 4fde2ec
chore: merge main into dev for the 25.4.0 release
ChiragAgg5k 30daa7b
Commit from GitHub Actions (Format and push)
ChiragAgg5k ab4db8c
chore: update Flutter SDK to 25.5.0
ChiragAgg5k 876a6a9
chore: merge main into dev for the 25.5.0 release
ChiragAgg5k 292f2c0
Commit from GitHub Actions (Format and push)
ChiragAgg5k d7f9f6d
chore: update Flutter SDK to 26.0.0
ChiragAgg5k 9c107fb
Commit from GitHub Actions (Format and push)
ChiragAgg5k 11e368f
chore: remove auto-formatting workflow, the generator now emits forma…
ChiragAgg5k 8bab69b
chore: update Flutter SDK to 26.2.0
ChiragAgg5k d72f621
chore: merge main into dev for the 26.2.0 release
ChiragAgg5k 2658391
docs: state the SDK targets Appwrite server version 2.0.x
ChiragAgg5k dc3489f
fix: regenerate with the latest sdk-generator and add auto image gravity
ChiragAgg5k 0b5d558
chore: update Flutter SDK to 27.0.0
ChiragAgg5k 68b413c
chore: merge main into dev for the 27.0.0 release
ChiragAgg5k d67a3e9
Merge remote-tracking branch 'origin/dev' into dev
ArnabChatterjee20k fd1381c
chore: update Flutter SDK to 27.1.0-rc.0
ArnabChatterjee20k a632b3b
Merge remote-tracking branch 'origin/dev' into dev
ArnabChatterjee20k 08faf7a
chore: update Flutter SDK to 27.1.0-rc.0
ArnabChatterjee20k File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| root = true | ||
|
|
||
| [*.{kt,kts}] | ||
| ktlint_code_style = ktlint_official | ||
| ktlint_standard_annotation = disabled | ||
| ktlint_standard_argument-list-wrapping = disabled | ||
| ktlint_standard_blank-line-before-declaration = disabled | ||
| ktlint_standard_blank-line-between-when-conditions = disabled | ||
| ktlint_standard_chain-method-continuation = disabled | ||
| ktlint_standard_class-signature = disabled | ||
| ktlint_standard_function-expression-body = disabled | ||
| ktlint_standard_function-signature = disabled | ||
| ktlint_standard_function-start-of-body-spacing = disabled | ||
| ktlint_standard_if-else-bracing = disabled | ||
| ktlint_standard_if-else-wrapping = disabled | ||
| ktlint_standard_max-line-length = disabled | ||
| ktlint_standard_multiline-expression-wrapping = disabled | ||
| ktlint_standard_multiline-if-else = disabled | ||
| ktlint_standard_no-blank-line-before-rbrace = disabled | ||
| ktlint_standard_no-blank-line-in-list = disabled | ||
| ktlint_standard_no-empty-first-line-in-class-body = disabled | ||
| ktlint_standard_no-line-break-before-assignment = disabled | ||
| ktlint_standard_no-wildcard-imports = disabled | ||
| ktlint_standard_parameter-list-wrapping = disabled | ||
| ktlint_standard_spacing-between-declarations-with-annotations = disabled | ||
| ktlint_standard_spacing-between-declarations-with-comments = disabled | ||
| ktlint_standard_string-template = disabled | ||
| ktlint_standard_trailing-comma-on-call-site = disabled | ||
| ktlint_standard_trailing-comma-on-declaration-site = disabled | ||
| ktlint_standard_when-entry-bracing = disabled | ||
| ktlint_standard_wrapping = disabled | ||
|
|
||
| [**/Channel.kt] | ||
| # Marker types intentionally use leading underscores to distinguish channel states. | ||
| ktlint_standard_class-naming = disabled | ||
|
|
||
| [**/models/*.kt] | ||
| # Model imports follow schema property order so generated declarations stay deterministic. | ||
| ktlint_standard_import-ordering = disabled |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| // The native half of Push on Android: background delivery that survives the process being | ||
| // killed, a reboot and an app update, shared with the Appwrite Android SDK. | ||
| group = "io.appwrite.flutter" | ||
| version = "27.1.0-rc.0" | ||
|
|
||
| buildscript { | ||
| ext.kotlin_version = "2.1.0" | ||
| repositories { | ||
| google() | ||
| mavenCentral() | ||
| } | ||
|
|
||
| dependencies { | ||
| classpath("com.android.tools.build:gradle:8.7.3") | ||
| classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version") | ||
| } | ||
| } | ||
|
|
||
| allprojects { | ||
| repositories { | ||
| google() | ||
| mavenCentral() | ||
| } | ||
| } | ||
|
|
||
| apply plugin: "com.android.library" | ||
| apply plugin: "kotlin-android" | ||
|
|
||
| android { | ||
| namespace = "io.appwrite.flutter" | ||
| compileSdk = 35 | ||
|
|
||
| compileOptions { | ||
| sourceCompatibility = JavaVersion.VERSION_17 | ||
| targetCompatibility = JavaVersion.VERSION_17 | ||
| } | ||
|
|
||
| kotlinOptions { | ||
| jvmTarget = "17" | ||
| } | ||
|
|
||
| sourceSets { | ||
| main.java.srcDirs += "src/main/kotlin" | ||
| } | ||
|
|
||
| defaultConfig { | ||
| minSdk = 24 | ||
| // R8 rules for the bundled MQTT client, applied to the app. | ||
| consumerProguardFiles("consumer-rules.pro") | ||
| } | ||
| } | ||
|
|
||
| dependencies { | ||
| implementation("com.hivemq:hivemq-mqtt-client-shaded:1.3.6") | ||
| implementation("androidx.core:core-ktx:1.13.1") | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| # Push: rules applied to apps that shrink with R8. | ||
| # | ||
| # The shaded HiveMQ MQTT client relocates Netty and JCTools under | ||
| # com.hivemq.client.internal.shaded. Netty references optional classes that are never loaded | ||
| # on Android: native transports, the HTTP/WebSocket codecs, proxy handlers, alternative TLS | ||
| # providers (tcnative, BouncyCastle, Conscrypt, Jetty ALPN) and logging backends. | ||
| -dontwarn com.hivemq.client.internal.shaded.io.netty.channel.epoll.** | ||
| -dontwarn com.hivemq.client.internal.shaded.io.netty.channel.kqueue.** | ||
| -dontwarn com.hivemq.client.internal.shaded.io.netty.handler.codec.http.** | ||
| -dontwarn com.hivemq.client.internal.shaded.io.netty.handler.proxy.** | ||
| -dontwarn com.hivemq.client.internal.shaded.io.netty.internal.tcnative.** | ||
| -dontwarn org.bouncycastle.** | ||
| -dontwarn org.conscrypt.** | ||
| -dontwarn org.eclipse.jetty.** | ||
| -dontwarn org.apache.log4j.** | ||
| -dontwarn org.apache.logging.log4j.** | ||
| -dontwarn org.slf4j.** | ||
| -dontwarn reactor.blockhound.** | ||
|
|
||
| # Netty and JCTools reach their own fields by name, through atomic field updaters and Unsafe offsets. | ||
| -keepclassmembernames class com.hivemq.client.internal.shaded.io.netty.** { <fields>; } | ||
| -keepclassmembers class com.hivemq.client.internal.shaded.org.jctools.** { <fields>; } | ||
|
|
||
| # Netty's leak detector looks these methods up by name when its classes load. | ||
| -keepclassmembers class com.hivemq.client.internal.shaded.io.netty.buffer.AbstractByteBufAllocator { *** toLeakAwareBuffer(...); } | ||
| -keepclassmembers class com.hivemq.client.internal.shaded.io.netty.buffer.AdvancedLeakAwareByteBuf { *** recordLeakNonRefCountingOperation(...); } | ||
| -keepclassmembers class com.hivemq.client.internal.shaded.io.netty.util.ReferenceCountUtil { *** touch(...); } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| rootProject.name = 'appwrite' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <manifest xmlns:android="http://schemas.android.com/apk/res/android"> | ||
|
|
||
| <uses-permission android:name="android.permission.INTERNET" /> | ||
| <uses-permission android:name="android.permission.POST_NOTIFICATIONS" /> | ||
| <!-- Background Push delivery (subscribe(background = true)): scheduled runs that reconnect | ||
| under a short wakelock, on the current network, and resume after a reboot. Apps can also | ||
| declare SCHEDULE_EXACT_ALARM (punctual runs) and REQUEST_IGNORE_BATTERY_OPTIMIZATIONS | ||
| (a direct exemption prompt); both are optional and subject to Google Play policy. --> | ||
| <uses-permission android:name="android.permission.WAKE_LOCK" /> | ||
| <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> | ||
| <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> | ||
| <!-- Foreground-service background Push delivery (Push.setForeground). Apps that never enable it can | ||
| remove PushService and these two permissions with tools:node="remove". --> | ||
| <uses-permission android:name="android.permission.FOREGROUND_SERVICE" /> | ||
| <uses-permission android:name="android.permission.FOREGROUND_SERVICE_REMOTE_MESSAGING" /> | ||
|
|
||
| <application> | ||
| <service | ||
| android:name="io.appwrite.services.PushService" | ||
| android:exported="false" | ||
| android:foregroundServiceType="remoteMessaging" | ||
| android:stopWithTask="false" /> | ||
| <service | ||
| android:name="io.appwrite.services.PushJobService" | ||
| android:exported="false" | ||
| android:permission="android.permission.BIND_JOB_SERVICE" /> | ||
| <receiver | ||
| android:name="io.appwrite.services.PushAlarmReceiver" | ||
| android:exported="false" /> | ||
| <receiver | ||
| android:name="io.appwrite.services.PushBootReceiver" | ||
| android:exported="true"> | ||
| <intent-filter> | ||
| <action android:name="android.intent.action.BOOT_COMPLETED" /> | ||
| <action android:name="android.intent.action.MY_PACKAGE_REPLACED" /> | ||
| </intent-filter> | ||
| </receiver> | ||
| </application> | ||
|
|
||
| </manifest> |
6 changes: 6 additions & 0 deletions
6
android/src/main/kotlin/io/appwrite/exceptions/AppwriteException.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| package io.appwrite.exceptions | ||
|
|
||
| /** A push error. When the broker explained a refusal or a disconnect, that is its message. */ | ||
| class AppwriteException( | ||
| override val message: String? = null, | ||
| ) : Exception(message) |
108 changes: 108 additions & 0 deletions
108
android/src/main/kotlin/io/appwrite/flutter/AppwritePushPlugin.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,108 @@ | ||
| package io.appwrite.flutter | ||
|
|
||
| import android.os.Handler | ||
| import android.os.Looper | ||
| import io.appwrite.services.PushBridge | ||
| import io.appwrite.services.PushMessage | ||
| import io.flutter.embedding.engine.plugins.FlutterPlugin | ||
| import io.flutter.plugin.common.EventChannel | ||
| import io.flutter.plugin.common.MethodCall | ||
| import io.flutter.plugin.common.MethodChannel | ||
|
|
||
| /** | ||
| * The Flutter side of [PushBridge]: the SDK's `Push` hosts its background subscriptions here on | ||
| * Android over a method channel, and receives their messages and errors over an event channel. | ||
| */ | ||
| class AppwritePushPlugin : | ||
| FlutterPlugin, | ||
| MethodChannel.MethodCallHandler, | ||
| EventChannel.StreamHandler { | ||
| private val main = Handler(Looper.getMainLooper()) | ||
| private var methods: MethodChannel? = null | ||
| private var events: EventChannel? = null | ||
| private var sink: EventChannel.EventSink? = null | ||
| private var bridge: PushBridge? = null | ||
|
|
||
| override fun onAttachedToEngine(binding: FlutterPlugin.FlutterPluginBinding) { | ||
| bridge = PushBridge( | ||
| binding.applicationContext, | ||
| object : PushBridge.Events { | ||
| override fun onMessage(subscriptionId: String, message: PushMessage, ackToken: String) = send( | ||
| mapOf( | ||
| "type" to "message", | ||
| "id" to subscriptionId, | ||
| "topic" to message.topic, | ||
| "payload" to message.payload, | ||
| "qos" to message.qos, | ||
| "ackToken" to ackToken, | ||
| ), | ||
| ) | ||
|
|
||
| override fun onError(message: String) = send(mapOf("type" to "error", "message" to message)) | ||
| }, | ||
| ) | ||
| methods = MethodChannel(binding.binaryMessenger, METHOD_CHANNEL).also { it.setMethodCallHandler(this) } | ||
| events = EventChannel(binding.binaryMessenger, EVENT_CHANNEL).also { it.setStreamHandler(this) } | ||
| } | ||
|
|
||
| override fun onDetachedFromEngine(binding: FlutterPlugin.FlutterPluginBinding) { | ||
| methods?.setMethodCallHandler(null) | ||
| events?.setStreamHandler(null) | ||
| methods = null | ||
| events = null | ||
| sink = null | ||
| } | ||
|
|
||
| override fun onMethodCall(call: MethodCall, result: MethodChannel.Result) { | ||
| val bridge = bridge ?: return result.error(ERROR_CODE, "Push plugin is not attached", null) | ||
| try { | ||
| if (call.method == "host") { | ||
| // Replies once the connection is up and every filter is subscribed, or with why not. | ||
| bridge.host(call.argument<String>("config")!!, call.argument<String>("subscriptions")!!) { error -> | ||
| main.post { | ||
| if (error == null) { | ||
| result.success(null) | ||
| } else { | ||
| result.error(ERROR_CODE, error, null) | ||
| } | ||
| } | ||
| } | ||
| return | ||
| } | ||
| result.success( | ||
| when (call.method) { | ||
| "ack" -> bridge.ack(call.argument<String>("token")!!).let { null } | ||
| "release" -> bridge.release().let { null } | ||
| "stop" -> bridge.stop().let { null } | ||
| "setForeground" -> bridge.setForeground(call.argument<Boolean>("enabled") == true).let { null } | ||
| "hasSaved" -> bridge.hasSaved() | ||
| "resume" -> bridge.resume().let { null } | ||
| "setErrorCallback" -> bridge.setErrorCallback(call.argument<Boolean>("registered") == true) | ||
| "defaultClientId" -> bridge.defaultClientId(call.argument<String>("authMethod")!!, call.argument<String>("credential")!!) | ||
| else -> return result.notImplemented() | ||
| }, | ||
| ) | ||
| } catch (e: Exception) { | ||
| result.error(ERROR_CODE, e.message, null) | ||
| } | ||
| } | ||
|
|
||
| override fun onListen(arguments: Any?, events: EventChannel.EventSink?) { | ||
| sink = events | ||
| } | ||
|
|
||
| override fun onCancel(arguments: Any?) { | ||
| sink = null | ||
| } | ||
|
|
||
| // The bridge calls back on background threads; event sinks must be used on the main thread. | ||
| private fun send(event: Map<String, Any?>) { | ||
| main.post { sink?.success(event) } | ||
| } | ||
|
|
||
| private companion object { | ||
| const val METHOD_CHANNEL = "appwrite.push" | ||
| const val EVENT_CHANNEL = "appwrite.push/events" | ||
| const val ERROR_CODE = "appwrite_push" | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.