diff --git a/.metadata b/.metadata
index cae5295..5bed526 100644
--- a/.metadata
+++ b/.metadata
@@ -4,7 +4,7 @@
# This file should be version controlled and should not be manually edited.
version:
- revision: bbfbf1770cca2da7c82e887e4e4af910034800b6
+ revision: 18116933e77adc82f80866c928266a5b4f1ed645
channel: stable
project_type: plugin
diff --git a/.vscode/launch.json b/.vscode/launch.json
deleted file mode 100644
index 8e58131..0000000
--- a/.vscode/launch.json
+++ /dev/null
@@ -1,33 +0,0 @@
-{
- // Use IntelliSense to learn about possible attributes.
- // Hover to view descriptions of existing attributes.
- // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
- "version": "0.2.0",
- "configurations": [
- {
- "name": "signalr_flutter",
- "request": "launch",
- "type": "dart"
- },
- {
- "name": "example",
- "cwd": "example",
- "request": "launch",
- "type": "dart"
- },
- {
- "name": "example-release",
- "cwd": "example",
- "request": "launch",
- "type": "dart",
- "flutterMode": "release"
- },
- {
- "name": "example-profile",
- "cwd": "example",
- "request": "launch",
- "type": "dart",
- "flutterMode": "profile"
- }
- ]
-}
\ No newline at end of file
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 4a9d2ec..0f276b7 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -55,4 +55,41 @@
## 0.1.2
-* IsConnected Method Added
\ No newline at end of file
+* IsConnected Method Added
+
+## 0.2.0-dev.1
+
+* Rewrote the plugin using pigeon
+* **Breaking Changes**:
+ * `invokeMethod` now take only strings as arguments instead of dynamic.
+ * `invokeMethod` now returns only string as result.
+ * `hubCallback` now also returns string as message instead of dynamic.
+
+## 0.2.0-dev.2
+
+* Fix for invokeMethod calls having no return value.
+
+## 0.2.0-dev.3
+
+* Updated signalr for iOS.
+* Transport fallback properly added for iOS.
+
+## 0.2.0-dev.4
+
+* App bundle build issue fix.
+
+## 0.2.0-dev.5
+
+* Removed unnecessary platform exceptions.
+* Updated dependencies.
+
+## 0.2.0
+
+* Rewrote the plugin using pigeon.
+* Removed unnecessary platform exceptions.
+* Updated signalr for iOS.
+* Updated all dependencies to the latest.
+* **Breaking Changes**:
+ * `invokeMethod` now take only strings as arguments instead of dynamic.
+ * `invokeMethod` now returns only string as result.
+ * `hubCallback` now also returns string as message instead of dynamic.
\ No newline at end of file
diff --git a/LICENSE b/LICENSE
index bb5d2b9..9a96069 100644
--- a/LICENSE
+++ b/LICENSE
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
\ No newline at end of file
+SOFTWARE.
diff --git a/README.md b/README.md
index d85f9cb..01603ea 100644
--- a/README.md
+++ b/README.md
@@ -49,3 +49,4 @@ R8 may strip away some SignalR classes for the Android in Release Builds. Add th
For more info check example.
Any issue or PR is always welcome.
+
diff --git a/analysis_options.yaml b/analysis_options.yaml
new file mode 100644
index 0000000..a5744c1
--- /dev/null
+++ b/analysis_options.yaml
@@ -0,0 +1,4 @@
+include: package:flutter_lints/flutter.yaml
+
+# Additional information about this file can be found at
+# https://dart.dev/guides/language/analysis-options
diff --git a/android/.idea/.name b/android/.idea/.name
deleted file mode 100644
index 124c49d..0000000
--- a/android/.idea/.name
+++ /dev/null
@@ -1 +0,0 @@
-signalr_flutter
\ No newline at end of file
diff --git a/android/.idea/caches/build_file_checksums.ser b/android/.idea/caches/build_file_checksums.ser
deleted file mode 100644
index 004c910..0000000
Binary files a/android/.idea/caches/build_file_checksums.ser and /dev/null differ
diff --git a/android/.idea/codeStyles/Project.xml b/android/.idea/codeStyles/Project.xml
deleted file mode 100644
index 0d15693..0000000
--- a/android/.idea/codeStyles/Project.xml
+++ /dev/null
@@ -1,134 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- xmlns:android
-
- ^$
-
-
-
-
-
-
-
-
- xmlns:.*
-
- ^$
-
-
- BY_NAME
-
-
-
-
-
-
- .*:id
-
- http://schemas.android.com/apk/res/android
-
-
-
-
-
-
-
-
- .*:name
-
- http://schemas.android.com/apk/res/android
-
-
-
-
-
-
-
-
- name
-
- ^$
-
-
-
-
-
-
-
-
- style
-
- ^$
-
-
-
-
-
-
-
-
- .*
-
- ^$
-
-
- BY_NAME
-
-
-
-
-
-
- .*
-
- http://schemas.android.com/apk/res/android
-
-
- ANDROID_ATTRIBUTE_ORDER
-
-
-
-
-
-
- .*
-
- .*
-
-
- BY_NAME
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/android/.idea/gradle.xml b/android/.idea/gradle.xml
deleted file mode 100644
index 5a9f2bf..0000000
--- a/android/.idea/gradle.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/android/.idea/jarRepositories.xml b/android/.idea/jarRepositories.xml
deleted file mode 100644
index a5f05cd..0000000
--- a/android/.idea/jarRepositories.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/android/.idea/misc.xml b/android/.idea/misc.xml
deleted file mode 100644
index 37a7509..0000000
--- a/android/.idea/misc.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/android/.idea/modules.xml b/android/.idea/modules.xml
deleted file mode 100644
index ccb2972..0000000
--- a/android/.idea/modules.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/android/.idea/runConfigurations.xml b/android/.idea/runConfigurations.xml
deleted file mode 100644
index 7f68460..0000000
--- a/android/.idea/runConfigurations.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/android/build.gradle b/android/build.gradle
index 03b523b..41cd8d2 100644
--- a/android/build.gradle
+++ b/android/build.gradle
@@ -2,14 +2,14 @@ group 'dev.asdevs.signalr_flutter'
version '1.0-SNAPSHOT'
buildscript {
- ext.kotlin_version = '1.4.21'
+ ext.kotlin_version = '1.7.20'
repositories {
google()
- jcenter()
+ mavenCentral()
}
dependencies {
- classpath 'com.android.tools.build:gradle:4.1.2'
+ classpath 'com.android.tools.build:gradle:7.3.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
@@ -17,7 +17,7 @@ buildscript {
rootProject.allprojects {
repositories {
google()
- jcenter()
+ mavenCentral()
}
}
@@ -25,22 +25,29 @@ apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
android {
- compileSdkVersion 30
+ compileSdkVersion 33
+
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_1_8
+ targetCompatibility JavaVersion.VERSION_1_8
+ }
+
+ kotlinOptions {
+ jvmTarget = '1.8'
+ }
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
+
defaultConfig {
minSdkVersion 16
}
- lintOptions {
- disable 'InvalidPackage'
- }
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
- implementation 'com.google.code.gson:gson:2.8.6'
- compile files('libs/signalr-client-sdk.jar')
- compile files('libs/signalr-client-sdk-android.jar')
+ implementation 'com.google.code.gson:gson:2.8.9'
+ implementation files('libraries/signalr-client-sdk.jar')
+ implementation files('libraries/signalr-client-sdk-android.jar')
}
diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties
index 735acdd..3c9d085 100644
--- a/android/gradle/wrapper/gradle-wrapper.properties
+++ b/android/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,5 @@
-#Sun Aug 23 12:49:17 IST 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip
diff --git a/android/libs/signalr-client-sdk-android.jar b/android/libraries/signalr-client-sdk-android.jar
similarity index 100%
rename from android/libs/signalr-client-sdk-android.jar
rename to android/libraries/signalr-client-sdk-android.jar
diff --git a/android/libs/signalr-client-sdk.jar b/android/libraries/signalr-client-sdk.jar
similarity index 77%
rename from android/libs/signalr-client-sdk.jar
rename to android/libraries/signalr-client-sdk.jar
index f736f64..cc52b84 100644
Binary files a/android/libs/signalr-client-sdk.jar and b/android/libraries/signalr-client-sdk.jar differ
diff --git a/android/src/main/java/dev/asdevs/signalr_flutter/SignalrApi.java b/android/src/main/java/dev/asdevs/signalr_flutter/SignalrApi.java
new file mode 100644
index 0000000..74b1c24
--- /dev/null
+++ b/android/src/main/java/dev/asdevs/signalr_flutter/SignalrApi.java
@@ -0,0 +1,491 @@
+// Autogenerated from Pigeon (v4.2.5), do not edit directly.
+// See also: https://pub.dev/packages/pigeon
+
+package dev.asdevs.signalr_flutter;
+
+import android.util.Log;
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import io.flutter.plugin.common.BasicMessageChannel;
+import io.flutter.plugin.common.BinaryMessenger;
+import io.flutter.plugin.common.MessageCodec;
+import io.flutter.plugin.common.StandardMessageCodec;
+import java.io.ByteArrayOutputStream;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.HashMap;
+
+/**Generated class from Pigeon. */
+@SuppressWarnings({"unused", "unchecked", "CodeBlock2Expr", "RedundantSuppression"})
+public class SignalrApi {
+
+ /** Transport method of the signalr connection. */
+ public enum Transport {
+ AUTO(0),
+ SERVER_SENT_EVENTS(1),
+ LONG_POLLING(2);
+
+ private int index;
+ private Transport(final int index) {
+ this.index = index;
+ }
+ }
+
+ /** SignalR connection status */
+ public enum ConnectionStatus {
+ CONNECTING(0),
+ CONNECTED(1),
+ RECONNECTING(2),
+ DISCONNECTED(3),
+ CONNECTION_SLOW(4),
+ CONNECTION_ERROR(5);
+
+ private int index;
+ private ConnectionStatus(final int index) {
+ this.index = index;
+ }
+ }
+
+ /** Generated class from Pigeon that represents data sent in messages. */
+ public static class ConnectionOptions {
+ private @Nullable String baseUrl;
+ public @Nullable String getBaseUrl() { return baseUrl; }
+ public void setBaseUrl(@Nullable String setterArg) {
+ this.baseUrl = setterArg;
+ }
+
+ private @Nullable String hubName;
+ public @Nullable String getHubName() { return hubName; }
+ public void setHubName(@Nullable String setterArg) {
+ this.hubName = setterArg;
+ }
+
+ private @Nullable String queryString;
+ public @Nullable String getQueryString() { return queryString; }
+ public void setQueryString(@Nullable String setterArg) {
+ this.queryString = setterArg;
+ }
+
+ private @Nullable List hubMethods;
+ public @Nullable List getHubMethods() { return hubMethods; }
+ public void setHubMethods(@Nullable List setterArg) {
+ this.hubMethods = setterArg;
+ }
+
+ private @Nullable Map headers;
+ public @Nullable Map getHeaders() { return headers; }
+ public void setHeaders(@Nullable Map setterArg) {
+ this.headers = setterArg;
+ }
+
+ private @Nullable Transport transport;
+ public @Nullable Transport getTransport() { return transport; }
+ public void setTransport(@Nullable Transport setterArg) {
+ this.transport = setterArg;
+ }
+
+ public static final class Builder {
+ private @Nullable String baseUrl;
+ public @NonNull Builder setBaseUrl(@Nullable String setterArg) {
+ this.baseUrl = setterArg;
+ return this;
+ }
+ private @Nullable String hubName;
+ public @NonNull Builder setHubName(@Nullable String setterArg) {
+ this.hubName = setterArg;
+ return this;
+ }
+ private @Nullable String queryString;
+ public @NonNull Builder setQueryString(@Nullable String setterArg) {
+ this.queryString = setterArg;
+ return this;
+ }
+ private @Nullable List hubMethods;
+ public @NonNull Builder setHubMethods(@Nullable List setterArg) {
+ this.hubMethods = setterArg;
+ return this;
+ }
+ private @Nullable Map headers;
+ public @NonNull Builder setHeaders(@Nullable Map setterArg) {
+ this.headers = setterArg;
+ return this;
+ }
+ private @Nullable Transport transport;
+ public @NonNull Builder setTransport(@Nullable Transport setterArg) {
+ this.transport = setterArg;
+ return this;
+ }
+ public @NonNull ConnectionOptions build() {
+ ConnectionOptions pigeonReturn = new ConnectionOptions();
+ pigeonReturn.setBaseUrl(baseUrl);
+ pigeonReturn.setHubName(hubName);
+ pigeonReturn.setQueryString(queryString);
+ pigeonReturn.setHubMethods(hubMethods);
+ pigeonReturn.setHeaders(headers);
+ pigeonReturn.setTransport(transport);
+ return pigeonReturn;
+ }
+ }
+ @NonNull Map toMap() {
+ Map toMapResult = new HashMap<>();
+ toMapResult.put("baseUrl", baseUrl);
+ toMapResult.put("hubName", hubName);
+ toMapResult.put("queryString", queryString);
+ toMapResult.put("hubMethods", hubMethods);
+ toMapResult.put("headers", headers);
+ toMapResult.put("transport", transport == null ? null : transport.index);
+ return toMapResult;
+ }
+ static @NonNull ConnectionOptions fromMap(@NonNull Map map) {
+ ConnectionOptions pigeonResult = new ConnectionOptions();
+ Object baseUrl = map.get("baseUrl");
+ pigeonResult.setBaseUrl((String)baseUrl);
+ Object hubName = map.get("hubName");
+ pigeonResult.setHubName((String)hubName);
+ Object queryString = map.get("queryString");
+ pigeonResult.setQueryString((String)queryString);
+ Object hubMethods = map.get("hubMethods");
+ pigeonResult.setHubMethods((List)hubMethods);
+ Object headers = map.get("headers");
+ pigeonResult.setHeaders((Map)headers);
+ Object transport = map.get("transport");
+ pigeonResult.setTransport(transport == null ? null : Transport.values()[(int)transport]);
+ return pigeonResult;
+ }
+ }
+
+ /** Generated class from Pigeon that represents data sent in messages. */
+ public static class StatusChangeResult {
+ private @Nullable String connectionId;
+ public @Nullable String getConnectionId() { return connectionId; }
+ public void setConnectionId(@Nullable String setterArg) {
+ this.connectionId = setterArg;
+ }
+
+ private @Nullable ConnectionStatus status;
+ public @Nullable ConnectionStatus getStatus() { return status; }
+ public void setStatus(@Nullable ConnectionStatus setterArg) {
+ this.status = setterArg;
+ }
+
+ private @Nullable String errorMessage;
+ public @Nullable String getErrorMessage() { return errorMessage; }
+ public void setErrorMessage(@Nullable String setterArg) {
+ this.errorMessage = setterArg;
+ }
+
+ public static final class Builder {
+ private @Nullable String connectionId;
+ public @NonNull Builder setConnectionId(@Nullable String setterArg) {
+ this.connectionId = setterArg;
+ return this;
+ }
+ private @Nullable ConnectionStatus status;
+ public @NonNull Builder setStatus(@Nullable ConnectionStatus setterArg) {
+ this.status = setterArg;
+ return this;
+ }
+ private @Nullable String errorMessage;
+ public @NonNull Builder setErrorMessage(@Nullable String setterArg) {
+ this.errorMessage = setterArg;
+ return this;
+ }
+ public @NonNull StatusChangeResult build() {
+ StatusChangeResult pigeonReturn = new StatusChangeResult();
+ pigeonReturn.setConnectionId(connectionId);
+ pigeonReturn.setStatus(status);
+ pigeonReturn.setErrorMessage(errorMessage);
+ return pigeonReturn;
+ }
+ }
+ @NonNull Map toMap() {
+ Map toMapResult = new HashMap<>();
+ toMapResult.put("connectionId", connectionId);
+ toMapResult.put("status", status == null ? null : status.index);
+ toMapResult.put("errorMessage", errorMessage);
+ return toMapResult;
+ }
+ static @NonNull StatusChangeResult fromMap(@NonNull Map map) {
+ StatusChangeResult pigeonResult = new StatusChangeResult();
+ Object connectionId = map.get("connectionId");
+ pigeonResult.setConnectionId((String)connectionId);
+ Object status = map.get("status");
+ pigeonResult.setStatus(status == null ? null : ConnectionStatus.values()[(int)status]);
+ Object errorMessage = map.get("errorMessage");
+ pigeonResult.setErrorMessage((String)errorMessage);
+ return pigeonResult;
+ }
+ }
+
+ public interface Result {
+ void success(T result);
+ void error(Throwable error);
+ }
+ private static class SignalRHostApiCodec extends StandardMessageCodec {
+ public static final SignalRHostApiCodec INSTANCE = new SignalRHostApiCodec();
+ private SignalRHostApiCodec() {}
+ @Override
+ protected Object readValueOfType(byte type, @NonNull ByteBuffer buffer) {
+ switch (type) {
+ case (byte)128:
+ return ConnectionOptions.fromMap((Map) readValue(buffer));
+
+ default:
+ return super.readValueOfType(type, buffer);
+
+ }
+ }
+ @Override
+ protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) {
+ if (value instanceof ConnectionOptions) {
+ stream.write(128);
+ writeValue(stream, ((ConnectionOptions) value).toMap());
+ } else
+{
+ super.writeValue(stream, value);
+ }
+ }
+ }
+
+ /** Generated interface from Pigeon that represents a handler of messages from Flutter. */
+ public interface SignalRHostApi {
+ void connect(@NonNull ConnectionOptions connectionOptions, Result result);
+ void reconnect(Result result);
+ void stop(Result result);
+ void isConnected(Result result);
+ void invokeMethod(@NonNull String methodName, @NonNull List arguments, Result result);
+
+ /** The codec used by SignalRHostApi. */
+ static MessageCodec