| @@ -0,0 +1,24 @@ | |||
| --- | |||
| name: Bug report | |||
| about: Create a report to help us improve | |||
| title: '' | |||
| labels: '' | |||
| assignees: chinloyal | |||
| --- | |||
| ### Steps to reproduce | |||
| What must I do to reproduce the bug? | |||
| ### Expected behavior | |||
| What did you expect to happen? | |||
| ### Actual behavior | |||
| What actually happened? Submit stack traces or anything that you think would help. | |||
| ### Any improvements you suggest | |||
| ... | |||
| @@ -0,0 +1,27 @@ | |||
| name: Publish pusher_client to pub.dev | |||
| on: | |||
| release: | |||
| types: | |||
| - published | |||
| jobs: | |||
| build: | |||
| runs-on: ubuntu-latest | |||
| container: | |||
| image: google/dart:latest | |||
| steps: | |||
| - uses: actions/checkout@v1 | |||
| - name: Setup credentials | |||
| run: | | |||
| mkdir -p ~/.pub-cache | |||
| cat <<EOF > ~/.pub-cache/credentials.json | |||
| { | |||
| "accessToken":"${{ secrets.PUB_ACCESS_TOKEN }}", | |||
| "refreshToken":"${{ secrets.PUB_REFRESH_TOKEN }}", | |||
| "tokenEndpoint":"https://accounts.google.com/o/oauth2/token", | |||
| "scopes": [ "openid", "https://www.googleapis.com/auth/userinfo.email" ], | |||
| "expiration": 1604281072748 | |||
| } | |||
| EOF | |||
| - name: Publish package | |||
| run: pub publish -f | |||
| @@ -0,0 +1,9 @@ | |||
| .DS_Store | |||
| .dart_tool/ | |||
| .packages | |||
| .pub/ | |||
| build/ | |||
| .idea/ | |||
| .fvm/** | |||
| @@ -0,0 +1,10 @@ | |||
| # This file tracks properties of this Flutter project. | |||
| # Used by Flutter tool to assess capabilities and perform upgrades etc. | |||
| # | |||
| # This file should be version controlled and should not be manually edited. | |||
| version: | |||
| revision: 84f3d28555368a70270e9ac8390a9441df95e752 | |||
| channel: stable | |||
| project_type: plugin | |||
| @@ -0,0 +1,19 @@ | |||
| { | |||
| // 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": "pusher_client", | |||
| "request": "launch", | |||
| "type": "dart" | |||
| }, | |||
| { | |||
| "name": "example", | |||
| "cwd": "example", | |||
| "request": "launch", | |||
| "type": "dart" | |||
| } | |||
| ] | |||
| } | |||
| @@ -0,0 +1,27 @@ | |||
| ## 2.0.0 - August 31, 2021 | |||
| * Upgraded to null safety [@nizwar](https://github.com/nizwar) | |||
| ## 1.1.3 - January 24, 2021 | |||
| * BUGFIX: Binding to channel events cancels calls to onConnectionStateChange | |||
| * Added a Stream Handler contract to allow multiple classes to listen to the same event channel | |||
| ## 1.1.2 - January 20, 2021 | |||
| * PATCH: Removed log4j dependency for android | |||
| ## 1.1.1 - January 19, 2021 | |||
| * BUGFIX: ConnectionEventListener null safety issue for Android (fixed by [@spiritinlife](https://github.com/spiritinlife)) | |||
| ## 1.1.0 - November 20, 2020 | |||
| * MINOR: Removed json_serializable and build_runner dependencies, this prevents conflict with projects that have to use those libraries at a specific version. | |||
| ## 1.0.2 - November 17, 2020 | |||
| * BUGFIX: Fixes issue #1, Double backslashes in the bind event breaks the JSON encoding. (This issue was only on android, iOS worked fine.) | |||
| ## 1.0.1 - November 7, 2020 | |||
| * BUGFIX: Fixed not being able to bind to multiple types of channels at once. | |||
| ## 1.0.0 - October 26, 2020 | |||
| * This is a complete Pusher Channels client library for flutter that fully supports Android and iOS with all the necessary and newest features such as having private encrypted channels. Triggering client event also works on both Android and iOS | |||
| @@ -0,0 +1,21 @@ | |||
| MIT License | |||
| Copyright (c) 2020 Romario Chinloy | |||
| Permission is hereby granted, free of charge, to any person obtaining a copy | |||
| of this software and associated documentation files (the "Software"), to deal | |||
| in the Software without restriction, including without limitation the rights | |||
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |||
| copies of the Software, and to permit persons to whom the Software is | |||
| furnished to do so, subject to the following conditions: | |||
| The above copyright notice and this permission notice shall be included in all | |||
| copies or substantial portions of the Software. | |||
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |||
| IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |||
| 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. | |||
| @@ -0,0 +1,375 @@ | |||
| # Pusher Channels Flutter Client | |||
| [](https://pub.dartlang.org/packages/pusher_client) | |||
| [](https://raw.githubusercontent.com/chinloyal/pusher_client/master/LICENSE) | |||
|  | |||
| [](https://twitter.com/chinloyal) | |||
| A Pusher Channels client plugin for Flutter targeting Android and iOS. It wraps | |||
| [pusher-websocket-java](https://github.com/pusher/pusher-websocket-java) v2.2.5 and [pusher-websocket-swift](https://github.com/pusher/pusher-websocket-swift) v8.0.0. | |||
| For tutorials and more in-depth information about Pusher Channels, visit the [official docs](https://pusher.com/docs/channels). | |||
| This client works with official pusher servers and laravel self hosted pusher websocket server ([laravel-websockets](https://github.com/beyondcode/laravel-websockets)). | |||
| ## Supported Platforms & Deployment Targets | |||
| - Android API 16 and above | |||
| - iOS 9.0 and above | |||
| ## Table of Contents | |||
| - [Installation](#installation) | |||
| - [Configuration](#configuration) | |||
| - [For iOS](#for-ios) | |||
| - [For Android](#for-android) | |||
| - [API Overview](#api-overview) | |||
| - [The Pusher Constructor](#the-pusher-constructor) | |||
| - [Pusher Options Config](#pusher-options-config) | |||
| - [Reconnecting](#reconnecting) | |||
| - [Disconnecting](#disconnecting) | |||
| - [Subscribing To Channels](#subscribing-to-channels) | |||
| - [Public Channels](#public-channels) | |||
| - [Private Channels](#private-channels) | |||
| - [Private Encrypted Channels](#private-encrypted-channels) | |||
| - [Presence Channels](#presence-channels) | |||
| - [Binding To Events](#bindings-to-events) | |||
| - [Callback Parameters](#callback-parameters) | |||
| - [Unbind Channel Events](#unbind-channel-events) | |||
| - [Triggering Client Events](#triggering-client-events) | |||
| - [Accessing The Connection Socket ID](#accessing-the-connection-socket-id) | |||
| - [Resolve Common Issues](#resolve-common-issues) | |||
| ## Installation | |||
| Add to your pubspec.yaml | |||
| ```yaml | |||
| dependencies: | |||
| pusher_client: ^2.0.0 | |||
| ``` | |||
| ## Configuration | |||
| ### For iOS | |||
| Set the minimum deployment target in the Podfile to 9.0. Go to `ios/Podfile`, then uncomment this line: | |||
| ```Podfile | |||
| # platform :ios, '8.0' | |||
| ``` | |||
| Change it to: | |||
| ```Podfile | |||
| platform :ios, '9.0' | |||
| ``` | |||
| You may have an issue subscribing to private channels if you're using a local pusher server like [laravel-websockets](https://github.com/beyondcode/laravel-websockets), to fix this go to `ios/Runner/Info.plist` and add: | |||
| ```xml | |||
| <key>NSAppTransportSecurity</key> | |||
| <dict> | |||
| <key>NSAllowsArbitraryLoads</key> | |||
| <true/> | |||
| </dict> | |||
| ``` | |||
| If you know which domains you will connect to add: | |||
| ```xml | |||
| <key>NSAppTransportSecurity</key> | |||
| <dict> | |||
| <key>NSExceptionDomains</key> | |||
| <dict> | |||
| <key>example.com</key> | |||
| <dict> | |||
| <key>NSExceptionAllowsInsecureHTTPLoads</key> | |||
| <true/> | |||
| <key>NSIncludesSubdomains</key> | |||
| <true/> | |||
| </dict> | |||
| </dict> | |||
| </dict> | |||
| ``` | |||
| ### For Android | |||
| If you have enabled code obfuscation with R8 or proguard, you need to add the following rule in `android/app/build.gradle`: | |||
| ```gradle | |||
| buildTypes { | |||
| release { | |||
| minifyEnabled true | |||
| proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' | |||
| } | |||
| } | |||
| ``` | |||
| Then in `android/app/proguard-rules.pro`: | |||
| ```pro | |||
| -keep class com.github.chinloyal.pusher_client.** { *; } | |||
| ``` | |||
| ## API Overview | |||
| Here's the API in a nutshell. | |||
| ```dart | |||
| PusherOptions options = PusherOptions( | |||
| host: 'example.com', | |||
| wsPort: 6001, | |||
| encrypted: false, | |||
| auth: PusherAuth( | |||
| 'http://example.com/auth', | |||
| headers: { | |||
| 'Authorization': 'Bearer $token', | |||
| }, | |||
| ), | |||
| ); | |||
| PusherClient pusher = PusherClient( | |||
| YOUR_APP_KEY, | |||
| options, | |||
| autoConnect: false | |||
| ); | |||
| // connect at a later time than at instantiation. | |||
| pusher.connect(); | |||
| pusher.onConnectionStateChange((state) { | |||
| print("previousState: ${state.previousState}, currentState: ${state.currentState}"); | |||
| }); | |||
| pusher.onConnectionError((error) { | |||
| print("error: ${error.message}"); | |||
| }); | |||
| // Subscribe to a private channel | |||
| Channel channel = pusher.subscribe("private-orders"); | |||
| // Bind to listen for events called "order-status-updated" sent to "private-orders" channel | |||
| channel.bind("order-status-updated", (PusherEvent event) { | |||
| print(event.data); | |||
| }); | |||
| // Unsubscribe from channel | |||
| pusher.unsubscribe("private-orders"); | |||
| // Disconnect from pusher service | |||
| pusher.disconnect(); | |||
| ``` | |||
| More information in reference format can be found below. | |||
| ## The Pusher Constructor | |||
| The constructor takes an application key which you can get from the app's API Access section in the Pusher Channels dashboard, and a pusher options object. | |||
| ```dart | |||
| PusherClient pusher = PusherClient(YOUR_APP_KEY, PusherOptions()); | |||
| ``` | |||
| If you are going to use [private](https://pusher.com/docs/channels/using_channels/private-channels), [presence](https://pusher.com/docs/channels/using_channels/presence-channels) or [encrypted](https://pusher.com/docs/channels/using_channels/encrypted-channels) channels then you will need to provide a `PusherAuth` to be used when authenticating subscriptions. In order to do this you need to pass in a `PusherOptions` object which has had an `auth` set. | |||
| ```dart | |||
| PusherAuth auth = PusherAuth( | |||
| // for auth endpoint use full url | |||
| 'http://example.com/auth', | |||
| headers: { | |||
| 'Authorization': 'Bearer $token', | |||
| }, | |||
| ); | |||
| PusherOptions options = PusherOptions( | |||
| auth: auth | |||
| ); | |||
| PusherClient pusher = PusherClient(YOUR_APP_KEY, options); | |||
| ``` | |||
| To disable logging and auto connect do this: | |||
| ```dart | |||
| PusherClient pusher = PusherClient( | |||
| YOUR_APP_KEY, | |||
| options, | |||
| enableLogging: false, | |||
| autoConnect: false, | |||
| ); | |||
| ``` | |||
| If auto connect is disabled then you can manually connect using `connect()` on the pusher instance. | |||
| ## Pusher Options Config | |||
| Most of the functionality of this plugin is configured through the PusherOptions object. You configure it by setting parameters on the object before passing it to the Pusher client. Below is a table containing all of the properties you can set. | |||
| | Method | Parameter | Description | | |||
| |-----------------------------|-------------------|-----------------------------------------------------------------------------------------------------------------------------------------------| | |||
| | encrypted | bool | Whether the connection should be made with TLS or not. | | |||
| | auth | PusherAuth | Sets the authorization options to be used when authenticating private, private-encrypted and presence channels. | | |||
| | host | String | The host to which connections will be made. | | |||
| | wsPort | int | The port to which unencrypted connections will be made. Automatically set correctly. | | |||
| | wssPort | int | The port to which encrypted connections will be made. Automatically set correctly. | | |||
| | cluster | String | Sets the cluster the client will connect to, thereby setting the Host and Port correctly. | | |||
| | activityTimeout | int | The number of milliseconds of inactivity at which a "ping" will be triggered to check the connection. The default value is 120,000. | | |||
| | pongTimeout | int | The number of milliseconds the client waits to receive a "pong" response from the server before disconnecting. The default value is 30,000. | | |||
| | maxReconnectionAttempts | int | Number of reconnection attempts that will be made when `pusher.connect()` is called, after which the client will give up. | | |||
| | maxReconnectGapInSeconds | int | The delay in two reconnection extends exponentially (1, 2, 4, .. seconds) This property sets the maximum inbetween two reconnection attempts. | | |||
| ## Reconnecting | |||
| The `connect()` method is also used to re-connect in case the connection has been lost, for example if a device loses reception. Note that the state of channel subscriptions and event bindings will be preserved while disconnected and re-negotiated with the server once a connection is re-established. | |||
| ## Disconnecting | |||
| ```dart | |||
| pusher.disconnect(); | |||
| ``` | |||
| After disconnection the `PusherClient` instance will release any internally allocated resources (threads and network connections) | |||
| ## Subscribing To Channels | |||
| Channels use the concept of [channels](https://pusher.com/docs/channels/using_channels/channels) as a way of subscribing to data. They are identified and subscribed to by a simple name. Events are bound to a channel and are also identified by name. | |||
| As mentioned above, channel subscriptions need only be registered once by the `PusherClient` instance. They are preserved across disconnection and re-established with the server on reconnect. They should NOT be re-registered. They may, however, be registered with a `PusherClient` instance before the first call to `connect` - they will be completed with the server as soon as a connection becomes available. | |||
| ### Public Channels | |||
| The default method for subscribing to a channel involves invoking the subscribe method of your client object: | |||
| ```dart | |||
| Channel channel = pusher.subscribe("my-channel"); | |||
| ``` | |||
| This returns a `Channel` object, which events can be bound to. | |||
| ### Private Channels | |||
| Private channels are created in exactly the same way as public channels, except that they reside in the _'private-'_ namespace. This means prefixing the channel name: | |||
| ```dart | |||
| Channel privateChannel = pusher.subscribe("private-status-update"); | |||
| ``` | |||
| Subscribing to private channels involves the client being authenticated. See [The Pusher Constructor](#the-pusher-constructor) section for the authenticated channel example for more information. | |||
| ### Private Encrypted Channels | |||
| Similar to Private channels, you can also subscribe to a private encrypted channel. This plugin fully supports end-to-end encryption. This means that only you and your connected clients will be able to read your messages. Pusher cannot decrypt them. These channels must be prefixed with _'private-encrypted-'_ | |||
| Like with private channels, you must provide an authentication endpoint. That endpoint must be using a [server client that supports end-to-end encryption](https://pusher.com/docs/channels/using_channels/encrypted-channels#server). There is a [demonstration endpoint to look at using nodejs](https://github.com/pusher/pusher-channels-auth-example#using-e2e-encryption). | |||
| ### Presence Channels | |||
| Presence channels are channels whose names are prefixed by _'presence-'_. Presence channels also need to be authenticated. | |||
| ```dart | |||
| Channel presenceChannel = pusher.subscribe("presence-another-channel"); | |||
| ``` | |||
| ## Binding To Events | |||
| There are two types of events that occur on channel subscriptions. | |||
| 1. Protocol related events such as those triggered when a subscription succeeds, for example "pusher:subscription_succeeded" | |||
| 2. Application events that have been triggered by code within your app | |||
| ```dart | |||
| Channel channel = pusher.subscribe("private-orders"); | |||
| channel.bind("order-status-updated", (PusherEvent event) { | |||
| print(event.data); | |||
| }); | |||
| ``` | |||
| ### Callback Parameters | |||
| The callbacks you bind receive a `PusherEvent`: | |||
| | Property | Type | Description | | |||
| | ------------------ |--------------| ------------ | |||
| | `eventName` | `String` | The name of the event. | | |||
| | `channelName` | `String` | The name of the channel that the event was triggered on. (Optional) | | |||
| | `data` | `String` | The data that was passed to `trigger`, encoded as a string. If you passed an object then that will have been serialized to a JSON string which you can parse as necessary. (Optional)| | |||
| | `userId` | `String` | The ID of the user who triggered the event. This is only available for client events triggered on presence channels. (Optional)| | |||
| ### Unbind Channel Events | |||
| You can unbind from an event by doing: | |||
| ```dart | |||
| channel.unbind("order-status-updated"); | |||
| ``` | |||
| ## Triggering Client Events | |||
| Once a private or presence subscription has been authorized and the subscription has succeeded, it is possible to trigger events on those channels. | |||
| Events triggered by clients are called [client events](https://pusher.com/docs/channels/using_channels/events#triggering-client-events). Because they are being triggered from a client which may not be trusted there are a number of enforced rules when using them. Some of these rules include: | |||
| - Event names must have a _'client-'_ prefix | |||
| - Rate limits | |||
| - You can only trigger an event when the subscription has succeeded | |||
| ```dart | |||
| channel.bind("pusher:subscription_succeeded", (PusherEvent event) { | |||
| channel.trigger("client-istyping", {"name": "Bob"}); | |||
| }); | |||
| ``` | |||
| For full details see the [client events documentation](https://pusher.com/docs/channels/using_channels/events#triggering-client-events). | |||
| ## Accessing The Connection Socket ID | |||
| Once connected you can access a unique identifier for the current client's connection. This is known as the **socket Id**. You can access the value once the connection has been established as follows: | |||
| ```dart | |||
| String socketId = pusher.getSocketId(); | |||
| ``` | |||
| For more information on how and why there is a socket Id see the documentation on authenticating users and [excluding recipients](https://pusher.com/docs/channels/server_api/excluding-event-recipients). | |||
| ## Resolve Common Issues | |||
| ### iOS doesn't log when enableLogging is set to true | |||
| iOS logging doesn't seem to output to flutter console, however if you run the | |||
| app from Xcode you should be able to see the logs. | |||
| ### Subscribing to private channels with iOS | |||
| If using a local pusher server but are unable to subscribe to a private channel | |||
| then add this to your ios/Runner/Info.plist: | |||
| ```xml | |||
| <key>NSAppTransportSecurity</key> | |||
| <dict> | |||
| <key>NSAllowsArbitraryLoads</key> | |||
| <true/> | |||
| </dict> | |||
| ``` | |||
| If you know which domains you will connect to add: | |||
| ```xml | |||
| <key>NSAppTransportSecurity</key> | |||
| <dict> | |||
| <key>NSExceptionDomains</key> | |||
| <dict> | |||
| <key>example.com</key> | |||
| <dict> | |||
| <key>NSExceptionAllowsInsecureHTTPLoads</key> | |||
| <true/> | |||
| <key>NSIncludesSubdomains</key> | |||
| <true/> | |||
| </dict> | |||
| </dict> | |||
| </dict> | |||
| ``` | |||
| @@ -0,0 +1,8 @@ | |||
| *.iml | |||
| .gradle | |||
| /local.properties | |||
| /.idea/workspace.xml | |||
| /.idea/libraries | |||
| .DS_Store | |||
| /build | |||
| /captures | |||
| @@ -0,0 +1,47 @@ | |||
| group 'com.github.chinloyal.pusher_client' | |||
| version '1.0-SNAPSHOT' | |||
| buildscript { | |||
| ext.kotlin_version = '1.8.0' | |||
| repositories { | |||
| google() | |||
| jcenter() | |||
| } | |||
| dependencies { | |||
| classpath 'com.android.tools.build:gradle:3.5.0' | |||
| classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" | |||
| } | |||
| } | |||
| rootProject.allprojects { | |||
| repositories { | |||
| google() | |||
| jcenter() | |||
| } | |||
| } | |||
| apply plugin: 'com.android.library' | |||
| apply plugin: 'kotlin-android' | |||
| android { | |||
| compileSdkVersion 29 | |||
| sourceSets { | |||
| main.java.srcDirs += 'src/main/kotlin' | |||
| } | |||
| defaultConfig { | |||
| minSdkVersion 16 | |||
| } | |||
| lintOptions { | |||
| disable 'InvalidPackage' | |||
| } | |||
| dependencies { | |||
| implementation "com.pusher:pusher-java-client:2.2.5" | |||
| } | |||
| } | |||
| dependencies { | |||
| implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" | |||
| } | |||
| @@ -0,0 +1,3 @@ | |||
| org.gradle.jvmargs=-Xmx1536M | |||
| android.useAndroidX=true | |||
| android.enableJetifier=true | |||
| @@ -0,0 +1,5 @@ | |||
| distributionBase=GRADLE_USER_HOME | |||
| distributionPath=wrapper/dists | |||
| zipStoreBase=GRADLE_USER_HOME | |||
| zipStorePath=wrapper/dists | |||
| distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip | |||
| @@ -0,0 +1 @@ | |||
| rootProject.name = 'pusher_client' | |||
| @@ -0,0 +1,3 @@ | |||
| <manifest xmlns:android="http://schemas.android.com/apk/res/android" | |||
| package="com.github.chinloyal.pusher_client"> | |||
| </manifest> | |||
| @@ -0,0 +1,23 @@ | |||
| package com.github.chinloyal.pusher_client | |||
| import androidx.annotation.NonNull | |||
| import com.github.chinloyal.pusher_client.pusher.PusherService | |||
| import io.flutter.embedding.engine.plugins.FlutterPlugin | |||
| import io.flutter.plugin.common.MethodCall | |||
| import io.flutter.plugin.common.MethodChannel | |||
| import io.flutter.plugin.common.MethodChannel.MethodCallHandler | |||
| import io.flutter.plugin.common.MethodChannel.Result | |||
| import io.flutter.plugin.common.PluginRegistry.Registrar | |||
| /** PusherClientPlugin */ | |||
| class PusherClientPlugin: FlutterPlugin { | |||
| override fun onAttachedToEngine(@NonNull flutterPluginBinding: FlutterPlugin.FlutterPluginBinding) { | |||
| PusherService().register(flutterPluginBinding.binaryMessenger); | |||
| } | |||
| override fun onDetachedFromEngine(@NonNull binding: FlutterPlugin.FlutterPluginBinding) { | |||
| // channel.setMethodCallHandler(null) | |||
| } | |||
| } | |||
| @@ -0,0 +1,8 @@ | |||
| package com.github.chinloyal.pusher_client.core.contracts | |||
| import androidx.annotation.NonNull | |||
| import io.flutter.plugin.common.BinaryMessenger | |||
| interface MChannel { | |||
| fun register (@NonNull messenger: BinaryMessenger) | |||
| } | |||
| @@ -0,0 +1,12 @@ | |||
| package com.github.chinloyal.pusher_client.core.utils | |||
| enum class Constants(val value: String) { | |||
| CONNECTION_ESTABLISHED("pusher:connection_established"), | |||
| ERROR("pusher:error"), | |||
| SUBSCRIBE("pusher:subscribe"), | |||
| UNSUBSCRIBE("pusher:unsubscribe"), | |||
| SUBSCRIPTION_ERROR("pusher:subscription_error"), | |||
| SUBSCRIPTION_SUCCEEDED("pusher:subscription_succeeded"), | |||
| MEMBER_ADDED("pusher:member_added"), | |||
| MEMBER_REMOVED("pusher:member_removed"), | |||
| } | |||
| @@ -0,0 +1,22 @@ | |||
| package com.github.chinloyal.pusher_client.core.utils | |||
| import com.pusher.client.util.ConnectionFactory | |||
| import org.json.JSONObject | |||
| class JsonEncodedConnectionFactory : ConnectionFactory() { | |||
| override fun getCharset(): String { | |||
| return "UTF-8"; | |||
| } | |||
| override fun getContentType(): String { | |||
| return "application/json"; | |||
| } | |||
| override fun getBody(): String { | |||
| val data: JSONObject = JSONObject(); | |||
| data.put("channel_name", channelName); | |||
| data.put("socket_id", socketId); | |||
| return data.toString(); | |||
| } | |||
| } | |||
| @@ -0,0 +1,296 @@ | |||
| package com.github.chinloyal.pusher_client.pusher | |||
| import android.util.Log | |||
| import com.github.chinloyal.pusher_client.core.contracts.MChannel | |||
| import com.github.chinloyal.pusher_client.core.utils.JsonEncodedConnectionFactory | |||
| import com.github.chinloyal.pusher_client.pusher.listeners.* | |||
| import com.google.gson.Gson | |||
| import com.pusher.client.Pusher | |||
| import com.pusher.client.PusherOptions | |||
| import com.pusher.client.connection.ConnectionState | |||
| import com.pusher.client.util.HttpAuthorizer | |||
| import com.pusher.client.util.UrlEncodedConnectionFactory | |||
| import io.flutter.plugin.common.BinaryMessenger | |||
| import io.flutter.plugin.common.EventChannel | |||
| import io.flutter.plugin.common.EventChannel.EventSink | |||
| import io.flutter.plugin.common.MethodCall | |||
| import io.flutter.plugin.common.MethodChannel | |||
| import io.flutter.plugin.common.MethodChannel.Result | |||
| import org.json.JSONObject | |||
| import java.lang.Exception | |||
| const val CHANNEL_NAME = "com.github.chinloyal/pusher_client" | |||
| const val EVENT_STREAM = "com.github.chinloyal/pusher_client_stream" | |||
| const val LOG_TAG = "PusherClientPlugin" | |||
| const val PRIVATE_PREFIX = "private-" | |||
| const val PRIVATE_ENCRYPTED_PREFIX = "private-encrypted-" | |||
| const val PRESENCE_PREFIX = "presence-" | |||
| class PusherService : MChannel { | |||
| private var _pusherInstance: Pusher? = null | |||
| companion object { | |||
| var enableLogging: Boolean = false | |||
| var eventSink: EventSink? = null | |||
| fun debugLog(msg: String) { | |||
| if(enableLogging) { | |||
| Log.d(LOG_TAG, msg) | |||
| } | |||
| } | |||
| fun errorLog(msg: String) { | |||
| if(enableLogging) { | |||
| Log.e(LOG_TAG, msg) | |||
| } | |||
| } | |||
| } | |||
| override fun register(messenger: BinaryMessenger) { | |||
| MethodChannel(messenger, CHANNEL_NAME).setMethodCallHandler { call, result -> | |||
| when (call.method) { | |||
| "init" -> init(call, result) | |||
| "connect" -> connect(result) | |||
| "disconnect" -> disconnect(result) | |||
| "getSocketId" -> getSocketId(result) | |||
| "subscribe" -> subscribe(call, result) | |||
| "unsubscribe" -> unsubscribe(call, result) | |||
| "bind" -> bind(call, result) | |||
| "unbind" -> unbind(call, result) | |||
| "trigger" -> trigger(call, result) | |||
| else -> result.notImplemented() | |||
| } | |||
| } | |||
| EventChannel(messenger, EVENT_STREAM).setStreamHandler(object : EventChannel.StreamHandler { | |||
| override fun onListen(args: Any?, eventSink: EventSink) { | |||
| PusherService.eventSink = eventSink | |||
| debugLog("Event stream listening...") | |||
| } | |||
| override fun onCancel(args: Any?) { | |||
| debugLog("Event stream cancelled.") | |||
| } | |||
| }) | |||
| } | |||
| private fun init(call: MethodCall, result: Result) { | |||
| // toString works because this is json encoded in dart | |||
| val args = JSONObject(call.arguments.toString()) | |||
| val initArgs: JSONObject = args.getJSONObject("initArgs") | |||
| enableLogging = initArgs.getBoolean("enableLogging") | |||
| if(_pusherInstance == null) { | |||
| val options: JSONObject = args.getJSONObject("pusherOptions") | |||
| val pusherOptions = PusherOptions() | |||
| if (!options.isNull("auth")) { | |||
| val auth: JSONObject = options.getJSONObject("auth") | |||
| val endpoint: String = auth.getString("endpoint") | |||
| val headersMap: Map<String, String> = Gson().fromJson<Map<String, String>>(auth.getString("headers"), Map::class.java) | |||
| val encodedConnectionFactory = if (headersMap.containsValue("application/json")) | |||
| JsonEncodedConnectionFactory() else UrlEncodedConnectionFactory() | |||
| val authorizer = HttpAuthorizer(endpoint, encodedConnectionFactory) | |||
| authorizer.setHeaders(headersMap) | |||
| pusherOptions.authorizer = authorizer | |||
| } | |||
| pusherOptions.setHost(options.getString("host")) | |||
| if(!options.isNull("cluster")) { | |||
| pusherOptions.setCluster(options.getString("cluster")) | |||
| } | |||
| pusherOptions.activityTimeout = options.getLong("activityTimeout") | |||
| pusherOptions.pongTimeout = options.getLong("pongTimeout") | |||
| pusherOptions.maxReconnectionAttempts = options.getInt("maxReconnectionAttempts") | |||
| pusherOptions.maxReconnectGapInSeconds = options.getInt("maxReconnectGapInSeconds") | |||
| pusherOptions.setWsPort(options.getInt("wsPort")) | |||
| pusherOptions.setWssPort(options.getInt("wssPort")) | |||
| pusherOptions.isUseTLS = options.getBoolean("encrypted") | |||
| _pusherInstance = Pusher(args.getString("appKey"), pusherOptions) | |||
| debugLog("Pusher initialized") | |||
| } | |||
| result.success(null) | |||
| } | |||
| private fun connect(result: Result) { | |||
| _pusherInstance?.connect(ConnectionListener(), ConnectionState.ALL) | |||
| result.success(null) | |||
| } | |||
| private fun disconnect(result: Result) { | |||
| _pusherInstance?.disconnect() | |||
| debugLog("Disconnect") | |||
| result.success(null) | |||
| } | |||
| private fun getSocketId(result: Result) { | |||
| result.success(_pusherInstance?.connection?.socketId) | |||
| } | |||
| private fun subscribe(call: MethodCall, result: Result) { | |||
| try { | |||
| val src = call.arguments as Map<String, Any> | |||
| val args = JSONObject(src) | |||
| val channelName: String = args.getString("channelName") | |||
| when { | |||
| channelName.startsWith(PRIVATE_ENCRYPTED_PREFIX) -> { | |||
| val channel = _pusherInstance?.getPrivateEncryptedChannel(channelName) | |||
| if (channel == null || !channel.isSubscribed) | |||
| _pusherInstance?.subscribePrivateEncrypted(channelName, FlutterPrivateEncryptedChannelEventListener.instance) | |||
| } | |||
| channelName.startsWith(PRIVATE_PREFIX) -> { | |||
| val channel = _pusherInstance?.getPrivateChannel(channelName) | |||
| if (channel == null || !channel.isSubscribed) | |||
| _pusherInstance?.subscribePrivate(channelName, FlutterPrivateChannelEventListener.instance) | |||
| } | |||
| channelName.startsWith(PRESENCE_PREFIX) -> { | |||
| val channel = _pusherInstance?.getPresenceChannel(channelName) | |||
| if (channel == null || !channel.isSubscribed) | |||
| _pusherInstance?.subscribePresence(channelName, FlutterPresenceChannelEventListener.instance) | |||
| } | |||
| else -> { | |||
| val channel = _pusherInstance?.getChannel(channelName) | |||
| if (channel == null || !channel.isSubscribed) | |||
| _pusherInstance?.subscribe(channelName, FlutterChannelEventListener.instance) | |||
| } | |||
| } | |||
| result.success(null) | |||
| } catch (e: Exception) { | |||
| e.message?.let { errorLog(it) } | |||
| if (enableLogging) e.printStackTrace() | |||
| result.error("SUBSCRIBE_ERROR", e.message, e) | |||
| } | |||
| } | |||
| private fun unsubscribe(call: MethodCall, result: Result) { | |||
| try { | |||
| val src = call.arguments as Map<String, Any> | |||
| val args = JSONObject(src); | |||
| val channelName = args.getString("channelName") | |||
| _pusherInstance?.unsubscribe(channelName) | |||
| debugLog("Unsubscribed: $channelName") | |||
| result.success(null) | |||
| } catch (e: Exception) { | |||
| e.message?.let { errorLog(it) } | |||
| if (enableLogging) e.printStackTrace() | |||
| result.error("UNSUBSCRIBE_ERROR", e.message, e) | |||
| } | |||
| } | |||
| /** | |||
| * Note binding can happen before the channel has been subscribed to | |||
| */ | |||
| private fun bind(call: MethodCall, result: Result) { | |||
| try { | |||
| val src = call.arguments as Map<String, Any> | |||
| val args = JSONObject(src) | |||
| val channelName: String = args.getString("channelName") | |||
| val eventName: String = args.getString("eventName") | |||
| when { | |||
| channelName.startsWith(PRIVATE_ENCRYPTED_PREFIX) -> { | |||
| val channel = _pusherInstance?.getPrivateEncryptedChannel(channelName) | |||
| channel?.bind(eventName, FlutterPrivateEncryptedChannelEventListener.instance) | |||
| } | |||
| channelName.startsWith(PRIVATE_PREFIX) -> { | |||
| val channel = _pusherInstance?.getPrivateChannel(channelName) | |||
| channel?.bind(eventName, FlutterPrivateChannelEventListener.instance) | |||
| } | |||
| channelName.startsWith(PRESENCE_PREFIX) -> { | |||
| val channel = _pusherInstance?.getPresenceChannel(channelName) | |||
| channel?.bind(eventName, FlutterPresenceChannelEventListener.instance) | |||
| } | |||
| else -> { | |||
| val channel = _pusherInstance?.getChannel(channelName) | |||
| channel?.bind(eventName, FlutterChannelEventListener.instance) | |||
| } | |||
| } | |||
| debugLog("[BIND] $eventName") | |||
| result.success(null) | |||
| } catch (e: Exception) { | |||
| e.message?.let { errorLog(it) } | |||
| if (enableLogging) e.printStackTrace() | |||
| result.error("BIND_ERROR", e.message, e) | |||
| } | |||
| } | |||
| private fun unbind(call: MethodCall, result: Result) { | |||
| try { | |||
| val src = call.arguments as Map<String, Any> | |||
| val args = JSONObject(src) | |||
| val channelName: String = args.getString("channelName") | |||
| val eventName: String = args.getString("eventName") | |||
| when { | |||
| channelName.startsWith(PRIVATE_ENCRYPTED_PREFIX) -> { | |||
| val channel = _pusherInstance?.getPrivateEncryptedChannel(channelName) | |||
| channel?.unbind(eventName, FlutterPrivateEncryptedChannelEventListener.instance) | |||
| } | |||
| channelName.startsWith(PRIVATE_PREFIX) -> { | |||
| val channel = _pusherInstance?.getPrivateChannel(channelName) | |||
| channel?.unbind(eventName, FlutterPrivateChannelEventListener.instance) | |||
| } | |||
| channelName.startsWith(PRESENCE_PREFIX) -> { | |||
| val channel = _pusherInstance?.getPresenceChannel(channelName) | |||
| channel?.unbind(eventName, FlutterPresenceChannelEventListener.instance) | |||
| } | |||
| else -> { | |||
| val channel = _pusherInstance?.getChannel(channelName) | |||
| channel?.unbind(eventName, FlutterChannelEventListener.instance) | |||
| } | |||
| } | |||
| debugLog("[UNBIND] $eventName") | |||
| result.success(null) | |||
| } catch (e: Exception) { | |||
| e.message?.let { errorLog(it) } | |||
| if (enableLogging) e.printStackTrace() | |||
| result.error("UNBIND_ERROR", e.message, e) | |||
| } | |||
| } | |||
| private fun trigger(call: MethodCall, result: Result) { | |||
| try { | |||
| // toString works because this is json encoded in dart | |||
| val args = JSONObject(call.arguments.toString()) | |||
| val eventName: String = args.getString("eventName") | |||
| val data: String = args.getString("data") | |||
| val channelName: String = args.getString("channelName") | |||
| val errorMessage = "Trigger can only be called on private and presence channels." | |||
| when { | |||
| channelName.startsWith(PRIVATE_ENCRYPTED_PREFIX) -> { | |||
| result.error("TRIGGER_ERROR", errorMessage, null) | |||
| } | |||
| channelName.startsWith(PRIVATE_PREFIX) -> { | |||
| val channel = _pusherInstance?.getPrivateChannel(channelName) | |||
| channel?.trigger(eventName, data) | |||
| } | |||
| channelName.startsWith(PRESENCE_PREFIX) -> { | |||
| val channel = _pusherInstance?.getPresenceChannel(channelName) | |||
| channel?.trigger(eventName, data) | |||
| } | |||
| else -> result.error("TRIGGER_ERROR", errorMessage, null) | |||
| } | |||
| debugLog("[TRIGGER] $eventName") | |||
| result.success(null) | |||
| } catch (e: Exception) { | |||
| e.message?.let { errorLog(it) } | |||
| if (enableLogging) e.printStackTrace() | |||
| result.error("TRIGGER_ERROR", e.message, e) | |||
| } | |||
| } | |||
| } | |||
| @@ -0,0 +1,60 @@ | |||
| package com.github.chinloyal.pusher_client.pusher.listeners | |||
| import android.os.Handler | |||
| import android.os.Looper | |||
| import com.github.chinloyal.pusher_client.pusher.PusherService | |||
| import com.github.chinloyal.pusher_client.pusher.PusherService.Companion.debugLog | |||
| import com.github.chinloyal.pusher_client.pusher.PusherService.Companion.enableLogging | |||
| import com.github.chinloyal.pusher_client.pusher.PusherService.Companion.errorLog | |||
| import com.pusher.client.connection.ConnectionEventListener | |||
| import com.pusher.client.connection.ConnectionStateChange | |||
| import org.json.JSONObject | |||
| import java.lang.Exception | |||
| class ConnectionListener: ConnectionEventListener { | |||
| val eventStreamJson = JSONObject(); | |||
| override fun onConnectionStateChange(change: ConnectionStateChange) { | |||
| Handler(Looper.getMainLooper()).post { | |||
| try { | |||
| val connectionStateChange = JSONObject(mapOf( | |||
| "currentState" to change.currentState.toString(), | |||
| "previousState" to change.previousState.toString() | |||
| )) | |||
| debugLog("[${change.currentState.toString()}]") | |||
| eventStreamJson.put("connectionStateChange", connectionStateChange) | |||
| PusherService.eventSink?.success(eventStreamJson.toString()) | |||
| } catch (e: Exception) { | |||
| e.message?.let { errorLog(it) } | |||
| if (enableLogging) { | |||
| e.printStackTrace() | |||
| } | |||
| } | |||
| } | |||
| } | |||
| override fun onError(message: String, code: String?, ex: Exception?) { | |||
| Handler(Looper.getMainLooper()).post { | |||
| try { | |||
| val connectionError = JSONObject(mapOf( | |||
| "message" to message, | |||
| "code" to code, | |||
| "exception" to ex?.message | |||
| )) | |||
| debugLog("[ON_ERROR]: message: $message, code: $code") | |||
| eventStreamJson.put("connectionError", connectionError) | |||
| PusherService.eventSink?.success(eventStreamJson.toString()) | |||
| } catch (e: Exception) { | |||
| e.message?.let { errorLog(it) } | |||
| if (PusherService.enableLogging) { | |||
| e.printStackTrace() | |||
| } | |||
| } | |||
| } | |||
| } | |||
| } | |||
| @@ -0,0 +1,50 @@ | |||
| package com.github.chinloyal.pusher_client.pusher.listeners | |||
| import android.os.Handler | |||
| import android.os.Looper | |||
| import com.github.chinloyal.pusher_client.core.utils.Constants | |||
| import com.github.chinloyal.pusher_client.pusher.PusherService.Companion.debugLog | |||
| import com.github.chinloyal.pusher_client.pusher.PusherService.Companion.eventSink | |||
| import com.pusher.client.channel.ChannelEventListener | |||
| import com.pusher.client.channel.PusherEvent | |||
| import org.json.JSONObject | |||
| import java.lang.Exception | |||
| open class FlutterBaseChannelEventListener: ChannelEventListener { | |||
| private val eventStreamJson = JSONObject(); | |||
| override fun onEvent(event: PusherEvent) { | |||
| Handler(Looper.getMainLooper()).post { | |||
| try { | |||
| val eventJson = JSONObject(mapOf( | |||
| "channelName" to event.channelName, | |||
| "eventName" to event.eventName, | |||
| "userId" to event.userId, | |||
| "data" to event.data | |||
| )) | |||
| eventStreamJson.put("pusherEvent", eventJson) | |||
| eventSink?.success(eventStreamJson.toString()) | |||
| debugLog(""" | |||
| |[ON_EVENT] Channel: ${event.channelName}, EventName: ${event.eventName}, | |||
| |Data: ${event.data}, User Id: ${event.userId} | |||
| """.trimMargin()) | |||
| } catch (e: Exception) { | |||
| eventSink?.error("ON_EVENT_ERROR", e.message, e) | |||
| } | |||
| } | |||
| } | |||
| override fun onSubscriptionSucceeded(channelName: String) { | |||
| this.onEvent(PusherEvent(mapOf( | |||
| "event" to Constants.SUBSCRIPTION_SUCCEEDED.value, | |||
| "channel" to channelName, | |||
| "user_id" to null, | |||
| "data" to null | |||
| ))) | |||
| debugLog("[PUBLIC] Subscribed: $channelName") | |||
| } | |||
| } | |||
| @@ -0,0 +1,7 @@ | |||
| package com.github.chinloyal.pusher_client.pusher.listeners | |||
| class FlutterChannelEventListener: FlutterBaseChannelEventListener() { | |||
| companion object { | |||
| val instance = FlutterChannelEventListener() | |||
| } | |||
| } | |||
| @@ -0,0 +1,57 @@ | |||
| package com.github.chinloyal.pusher_client.pusher.listeners | |||
| import com.github.chinloyal.pusher_client.core.utils.Constants | |||
| import com.github.chinloyal.pusher_client.pusher.PusherService | |||
| import com.pusher.client.channel.PresenceChannelEventListener | |||
| import com.pusher.client.channel.PusherEvent | |||
| import com.pusher.client.channel.User | |||
| import java.lang.Exception | |||
| class FlutterPresenceChannelEventListener: FlutterBaseChannelEventListener(), PresenceChannelEventListener { | |||
| companion object { | |||
| val instance = FlutterPresenceChannelEventListener() | |||
| } | |||
| override fun onUsersInformationReceived(channelName: String, users: MutableSet<User>) { | |||
| this.onEvent(PusherEvent(mapOf( | |||
| "event" to Constants.SUBSCRIPTION_SUCCEEDED.value, | |||
| "channel" to channelName, | |||
| "user_id" to null, | |||
| "data" to users.toString() | |||
| ))) | |||
| } | |||
| override fun userUnsubscribed(channelName: String, user: User) { | |||
| this.onEvent(PusherEvent(mapOf( | |||
| "event" to Constants.MEMBER_REMOVED.value, | |||
| "channel" to channelName, | |||
| "user_id" to user.id, | |||
| "data" to null | |||
| ))) | |||
| } | |||
| override fun userSubscribed(channelName: String, user: User) { | |||
| this.onEvent(PusherEvent(mapOf( | |||
| "event" to Constants.MEMBER_ADDED.value, | |||
| "channel" to channelName, | |||
| "user_id" to user.id, | |||
| "data" to null | |||
| ))) | |||
| } | |||
| override fun onAuthenticationFailure(message: String, e: Exception) { | |||
| PusherService.errorLog(message) | |||
| if(PusherService.enableLogging) e.printStackTrace() | |||
| } | |||
| override fun onSubscriptionSucceeded(channelName: String) { | |||
| PusherService.debugLog("[PRESENCE] Subscribed: $channelName") | |||
| this.onEvent(PusherEvent(mapOf( | |||
| "event" to Constants.SUBSCRIPTION_SUCCEEDED.value, | |||
| "channel" to channelName, | |||
| "user_id" to null, | |||
| "data" to null | |||
| ))) | |||
| } | |||
| } | |||
| @@ -0,0 +1,30 @@ | |||
| package com.github.chinloyal.pusher_client.pusher.listeners | |||
| import com.github.chinloyal.pusher_client.core.utils.Constants | |||
| import com.github.chinloyal.pusher_client.pusher.PusherService | |||
| import com.github.chinloyal.pusher_client.pusher.PusherService.Companion.enableLogging | |||
| import com.github.chinloyal.pusher_client.pusher.PusherService.Companion.errorLog | |||
| import com.pusher.client.channel.PrivateChannelEventListener | |||
| import com.pusher.client.channel.PusherEvent | |||
| import java.lang.Exception | |||
| class FlutterPrivateChannelEventListener: FlutterBaseChannelEventListener(), PrivateChannelEventListener { | |||
| companion object { | |||
| val instance = FlutterPrivateChannelEventListener() | |||
| } | |||
| override fun onAuthenticationFailure(message: String, e: Exception) { | |||
| errorLog(message) | |||
| if(enableLogging) e.printStackTrace() | |||
| } | |||
| override fun onSubscriptionSucceeded(channelName: String) { | |||
| this.onEvent(PusherEvent(mapOf( | |||
| "event" to Constants.SUBSCRIPTION_SUCCEEDED.value, | |||
| "channel" to channelName, | |||
| "user_id" to null, | |||
| "data" to null | |||
| ))) | |||
| PusherService.debugLog("[PRIVATE] Subscribed: $channelName") | |||
| } | |||
| } | |||
| @@ -0,0 +1,34 @@ | |||
| package com.github.chinloyal.pusher_client.pusher.listeners | |||
| import com.github.chinloyal.pusher_client.core.utils.Constants | |||
| import com.github.chinloyal.pusher_client.pusher.PusherService | |||
| import com.github.chinloyal.pusher_client.pusher.PusherService.Companion.enableLogging | |||
| import com.github.chinloyal.pusher_client.pusher.PusherService.Companion.errorLog | |||
| import com.pusher.client.channel.PrivateEncryptedChannelEventListener | |||
| import com.pusher.client.channel.PusherEvent | |||
| import java.lang.Exception | |||
| class FlutterPrivateEncryptedChannelEventListener: FlutterBaseChannelEventListener(), PrivateEncryptedChannelEventListener { | |||
| companion object { | |||
| val instance = FlutterPrivateEncryptedChannelEventListener() | |||
| } | |||
| override fun onDecryptionFailure(event: String, reason: String) { | |||
| errorLog("[PRIVATE-ENCRYPTED] Reason: $reason, Event: $event") | |||
| } | |||
| override fun onAuthenticationFailure(message: String, e: Exception) { | |||
| errorLog(message) | |||
| if(enableLogging) e.printStackTrace() | |||
| } | |||
| override fun onSubscriptionSucceeded(channelName: String) { | |||
| this.onEvent(PusherEvent(mapOf( | |||
| "event" to Constants.SUBSCRIPTION_SUCCEEDED.value, | |||
| "channel" to channelName, | |||
| "user_id" to null, | |||
| "data" to null | |||
| ))) | |||
| PusherService.debugLog("[PRIVATE-ENCRYPTED] Subscribed: $channelName") | |||
| } | |||
| } | |||
| @@ -0,0 +1,42 @@ | |||
| # Miscellaneous | |||
| *.class | |||
| *.log | |||
| *.pyc | |||
| *.swp | |||
| .DS_Store | |||
| .atom/ | |||
| .buildlog/ | |||
| .history | |||
| .svn/ | |||
| # IntelliJ related | |||
| *.iml | |||
| *.ipr | |||
| *.iws | |||
| .idea/ | |||
| # The .vscode folder contains launch configuration and tasks you configure in | |||
| # VS Code which you may wish to be included in version control, so this line | |||
| # is commented out by default. | |||
| #.vscode/ | |||
| # Flutter/Dart/Pub related | |||
| **/doc/api/ | |||
| **/ios/Flutter/.last_build_id | |||
| .dart_tool/ | |||
| .flutter-plugins | |||
| .flutter-plugins-dependencies | |||
| .packages | |||
| .pub-cache/ | |||
| .pub/ | |||
| /build/ | |||
| # Web related | |||
| lib/generated_plugin_registrant.dart | |||
| # Symbolication related | |||
| app.*.symbols | |||
| # Obfuscation related | |||
| app.*.map.json | |||
| testdata.txt | |||
| @@ -0,0 +1,10 @@ | |||
| # This file tracks properties of this Flutter project. | |||
| # Used by Flutter tool to assess capabilities and perform upgrades etc. | |||
| # | |||
| # This file should be version controlled and should not be manually edited. | |||
| version: | |||
| revision: 84f3d28555368a70270e9ac8390a9441df95e752 | |||
| channel: stable | |||
| project_type: app | |||
| @@ -0,0 +1,16 @@ | |||
| # pusher_client_example | |||
| Demonstrates how to use the pusher_client plugin. | |||
| ## Getting Started | |||
| This project is a starting point for a Flutter application. | |||
| A few resources to get you started if this is your first Flutter project: | |||
| - [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab) | |||
| - [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook) | |||
| For help getting started with Flutter, view our | |||
| [online documentation](https://flutter.dev/docs), which offers tutorials, | |||
| samples, guidance on mobile development, and a full API reference. | |||
| @@ -0,0 +1,11 @@ | |||
| gradle-wrapper.jar | |||
| /.gradle | |||
| /captures/ | |||
| /gradlew | |||
| /gradlew.bat | |||
| /local.properties | |||
| GeneratedPluginRegistrant.java | |||
| # Remember to never publicly share your keystore. | |||
| # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app | |||
| key.properties | |||
| @@ -0,0 +1,63 @@ | |||
| def localProperties = new Properties() | |||
| def localPropertiesFile = rootProject.file('local.properties') | |||
| if (localPropertiesFile.exists()) { | |||
| localPropertiesFile.withReader('UTF-8') { reader -> | |||
| localProperties.load(reader) | |||
| } | |||
| } | |||
| def flutterRoot = localProperties.getProperty('flutter.sdk') | |||
| if (flutterRoot == null) { | |||
| throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") | |||
| } | |||
| def flutterVersionCode = localProperties.getProperty('flutter.versionCode') | |||
| if (flutterVersionCode == null) { | |||
| flutterVersionCode = '1' | |||
| } | |||
| def flutterVersionName = localProperties.getProperty('flutter.versionName') | |||
| if (flutterVersionName == null) { | |||
| flutterVersionName = '1.0' | |||
| } | |||
| apply plugin: 'com.android.application' | |||
| apply plugin: 'kotlin-android' | |||
| apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" | |||
| android { | |||
| compileSdkVersion 29 | |||
| sourceSets { | |||
| main.java.srcDirs += 'src/main/kotlin' | |||
| } | |||
| lintOptions { | |||
| disable 'InvalidPackage' | |||
| } | |||
| defaultConfig { | |||
| // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). | |||
| applicationId "com.github.chinloyal.pusher_client_example" | |||
| minSdkVersion 16 | |||
| targetSdkVersion 29 | |||
| versionCode flutterVersionCode.toInteger() | |||
| versionName flutterVersionName | |||
| } | |||
| buildTypes { | |||
| release { | |||
| // TODO: Add your own signing config for the release build. | |||
| // Signing with the debug keys for now, so `flutter run --release` works. | |||
| signingConfig signingConfigs.debug | |||
| } | |||
| } | |||
| } | |||
| flutter { | |||
| source '../..' | |||
| } | |||
| dependencies { | |||
| implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" | |||
| } | |||
| @@ -0,0 +1,7 @@ | |||
| <manifest xmlns:android="http://schemas.android.com/apk/res/android" | |||
| package="com.github.chinloyal.pusher_client_example"> | |||
| <!-- Flutter needs it to communicate with the running application | |||
| to allow setting breakpoints, to provide hot reload, etc. | |||
| --> | |||
| <uses-permission android:name="android.permission.INTERNET"/> | |||
| </manifest> | |||
| @@ -0,0 +1,47 @@ | |||
| <manifest xmlns:android="http://schemas.android.com/apk/res/android" | |||
| package="com.github.chinloyal.pusher_client_example"> | |||
| <!-- io.flutter.app.FlutterApplication is an android.app.Application that | |||
| calls FlutterMain.startInitialization(this); in its onCreate method. | |||
| In most cases you can leave this as-is, but you if you want to provide | |||
| additional functionality it is fine to subclass or reimplement | |||
| FlutterApplication and put your custom class here. --> | |||
| <application | |||
| android:name="io.flutter.app.FlutterApplication" | |||
| android:label="pusher_client_example" | |||
| android:icon="@mipmap/ic_launcher"> | |||
| <activity | |||
| android:name=".MainActivity" | |||
| android:launchMode="singleTop" | |||
| android:theme="@style/LaunchTheme" | |||
| android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode" | |||
| android:hardwareAccelerated="true" | |||
| android:windowSoftInputMode="adjustResize"> | |||
| <!-- Specifies an Android theme to apply to this Activity as soon as | |||
| the Android process has started. This theme is visible to the user | |||
| while the Flutter UI initializes. After that, this theme continues | |||
| to determine the Window background behind the Flutter UI. --> | |||
| <meta-data | |||
| android:name="io.flutter.embedding.android.NormalTheme" | |||
| android:resource="@style/NormalTheme" | |||
| /> | |||
| <!-- Displays an Android View that continues showing the launch screen | |||
| Drawable until Flutter paints its first frame, then this splash | |||
| screen fades out. A splash screen is useful to avoid any visual | |||
| gap between the end of Android's launch screen and the painting of | |||
| Flutter's first frame. --> | |||
| <meta-data | |||
| android:name="io.flutter.embedding.android.SplashScreenDrawable" | |||
| android:resource="@drawable/launch_background" | |||
| /> | |||
| <intent-filter> | |||
| <action android:name="android.intent.action.MAIN"/> | |||
| <category android:name="android.intent.category.LAUNCHER"/> | |||
| </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" /> | |||
| </application> | |||
| </manifest> | |||
| @@ -0,0 +1,8 @@ | |||
| package com.github.chinloyal.pusher_client_example | |||
| import androidx.annotation.NonNull | |||
| import io.flutter.embedding.android.FlutterActivity | |||
| import io.flutter.embedding.engine.FlutterEngine | |||
| class MainActivity: FlutterActivity() { | |||
| } | |||
| @@ -0,0 +1,12 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <!-- Modify this file to customize your launch splash screen --> | |||
| <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> | |||
| <item android:drawable="@android:color/white" /> | |||
| <!-- You can insert your own image assets here --> | |||
| <!-- <item> | |||
| <bitmap | |||
| android:gravity="center" | |||
| android:src="@mipmap/launch_image" /> | |||
| </item> --> | |||
| </layer-list> | |||
| @@ -0,0 +1,18 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <resources> | |||
| <!-- Theme applied to the Android Window while the process is starting --> | |||
| <style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar"> | |||
| <!-- Show a splash screen on the activity. Automatically removed when | |||
| Flutter draws its first frame --> | |||
| <item name="android:windowBackground">@drawable/launch_background</item> | |||
| </style> | |||
| <!-- Theme applied to the Android Window as soon as the process has started. | |||
| This theme determines the color of the Android Window while your | |||
| Flutter UI initializes, as well as behind your Flutter UI while its | |||
| running. | |||
| This Theme is only used starting with V2 of Flutter's Android embedding. --> | |||
| <style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar"> | |||
| <item name="android:windowBackground">@android:color/white</item> | |||
| </style> | |||
| </resources> | |||
| @@ -0,0 +1,7 @@ | |||
| <manifest xmlns:android="http://schemas.android.com/apk/res/android" | |||
| package="com.github.chinloyal.pusher_client_example"> | |||
| <!-- Flutter needs it to communicate with the running application | |||
| to allow setting breakpoints, to provide hot reload, etc. | |||
| --> | |||
| <uses-permission android:name="android.permission.INTERNET"/> | |||
| </manifest> | |||
| @@ -0,0 +1,31 @@ | |||
| buildscript { | |||
| ext.kotlin_version = '1.3.50' | |||
| repositories { | |||
| google() | |||
| jcenter() | |||
| } | |||
| dependencies { | |||
| classpath 'com.android.tools.build:gradle:4.1.0' | |||
| classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" | |||
| } | |||
| } | |||
| allprojects { | |||
| repositories { | |||
| google() | |||
| jcenter() | |||
| } | |||
| } | |||
| rootProject.buildDir = '../build' | |||
| subprojects { | |||
| project.buildDir = "${rootProject.buildDir}/${project.name}" | |||
| } | |||
| subprojects { | |||
| project.evaluationDependsOn(':app') | |||
| } | |||
| task clean(type: Delete) { | |||
| delete rootProject.buildDir | |||
| } | |||
| @@ -0,0 +1,4 @@ | |||
| org.gradle.jvmargs=-Xmx1536M | |||
| android.useAndroidX=true | |||
| android.enableJetifier=true | |||
| android.enableR8=true | |||
| @@ -0,0 +1,6 @@ | |||
| #Sat Oct 24 14:05:31 EST 2020 | |||
| distributionBase=GRADLE_USER_HOME | |||
| distributionPath=wrapper/dists | |||
| zipStoreBase=GRADLE_USER_HOME | |||
| zipStorePath=wrapper/dists | |||
| distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip | |||
| @@ -0,0 +1,11 @@ | |||
| include ':app' | |||
| def localPropertiesFile = new File(rootProject.projectDir, "local.properties") | |||
| def properties = new Properties() | |||
| assert localPropertiesFile.exists() | |||
| localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } | |||
| def flutterSdkPath = properties.getProperty("flutter.sdk") | |||
| assert flutterSdkPath != null, "flutter.sdk not set in local.properties" | |||
| apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" | |||
| @@ -0,0 +1,32 @@ | |||
| *.mode1v3 | |||
| *.mode2v3 | |||
| *.moved-aside | |||
| *.pbxuser | |||
| *.perspectivev3 | |||
| **/*sync/ | |||
| .sconsign.dblite | |||
| .tags* | |||
| **/.vagrant/ | |||
| **/DerivedData/ | |||
| Icon? | |||
| **/Pods/ | |||
| **/.symlinks/ | |||
| profile | |||
| xcuserdata | |||
| **/.generated/ | |||
| Flutter/App.framework | |||
| Flutter/Flutter.framework | |||
| Flutter/Flutter.podspec | |||
| Flutter/Generated.xcconfig | |||
| Flutter/app.flx | |||
| Flutter/app.zip | |||
| Flutter/flutter_assets/ | |||
| Flutter/flutter_export_environment.sh | |||
| ServiceDefinitions.json | |||
| Runner/GeneratedPluginRegistrant.* | |||
| # Exceptions to above rules. | |||
| !default.mode1v3 | |||
| !default.mode2v3 | |||
| !default.pbxuser | |||
| !default.perspectivev3 | |||
| @@ -0,0 +1,26 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |||
| <plist version="1.0"> | |||
| <dict> | |||
| <key>CFBundleDevelopmentRegion</key> | |||
| <string>$(DEVELOPMENT_LANGUAGE)</string> | |||
| <key>CFBundleExecutable</key> | |||
| <string>App</string> | |||
| <key>CFBundleIdentifier</key> | |||
| <string>io.flutter.flutter.app</string> | |||
| <key>CFBundleInfoDictionaryVersion</key> | |||
| <string>6.0</string> | |||
| <key>CFBundleName</key> | |||
| <string>App</string> | |||
| <key>CFBundlePackageType</key> | |||
| <string>FMWK</string> | |||
| <key>CFBundleShortVersionString</key> | |||
| <string>1.0</string> | |||
| <key>CFBundleSignature</key> | |||
| <string>????</string> | |||
| <key>CFBundleVersion</key> | |||
| <string>1.0</string> | |||
| <key>MinimumOSVersion</key> | |||
| <string>9.0</string> | |||
| </dict> | |||
| </plist> | |||
| @@ -0,0 +1,2 @@ | |||
| #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" | |||
| #include "Generated.xcconfig" | |||
| @@ -0,0 +1,2 @@ | |||
| #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" | |||
| #include "Generated.xcconfig" | |||
| @@ -0,0 +1,41 @@ | |||
| # Uncomment this line to define a global platform for your project | |||
| platform :ios, '9.0' | |||
| # CocoaPods analytics sends network stats synchronously affecting flutter build latency. | |||
| ENV['COCOAPODS_DISABLE_STATS'] = 'true' | |||
| project 'Runner', { | |||
| 'Debug' => :debug, | |||
| 'Profile' => :release, | |||
| 'Release' => :release, | |||
| } | |||
| def flutter_root | |||
| generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__) | |||
| unless File.exist?(generated_xcode_build_settings_path) | |||
| raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first" | |||
| end | |||
| File.foreach(generated_xcode_build_settings_path) do |line| | |||
| matches = line.match(/FLUTTER_ROOT\=(.*)/) | |||
| return matches[1].strip if matches | |||
| end | |||
| raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get" | |||
| end | |||
| require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) | |||
| flutter_ios_podfile_setup | |||
| target 'Runner' do | |||
| use_frameworks! | |||
| use_modular_headers! | |||
| flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) | |||
| end | |||
| post_install do |installer| | |||
| installer.pods_project.targets.each do |target| | |||
| flutter_additional_ios_build_settings(target) | |||
| end | |||
| end | |||
| @@ -0,0 +1,41 @@ | |||
| PODS: | |||
| - Flutter (1.0.0) | |||
| - pusher_client (1.0.0): | |||
| - Flutter | |||
| - PusherSwiftWithEncryption (~> 8.0.0) | |||
| - PusherSwiftWithEncryption (8.0.0): | |||
| - ReachabilitySwift (~> 5.0) | |||
| - Sodium (= 0.8.0) | |||
| - Starscream (~> 3.1) | |||
| - ReachabilitySwift (5.0.0) | |||
| - Sodium (0.8.0) | |||
| - Starscream (3.1.1) | |||
| DEPENDENCIES: | |||
| - Flutter (from `Flutter`) | |||
| - pusher_client (from `.symlinks/plugins/pusher_client/ios`) | |||
| SPEC REPOS: | |||
| trunk: | |||
| - PusherSwiftWithEncryption | |||
| - ReachabilitySwift | |||
| - Sodium | |||
| - Starscream | |||
| EXTERNAL SOURCES: | |||
| Flutter: | |||
| :path: Flutter | |||
| pusher_client: | |||
| :path: ".symlinks/plugins/pusher_client/ios" | |||
| SPEC CHECKSUMS: | |||
| Flutter: 0e3d915762c693b495b44d77113d4970485de6ec | |||
| pusher_client: 98d16b50f0ebb4d67d3f61b29723142c03179da9 | |||
| PusherSwiftWithEncryption: 8ed9c9cf743b0530aa3a8c60de6734475f1aa67d | |||
| ReachabilitySwift: 985039c6f7b23a1da463388634119492ff86c825 | |||
| Sodium: 63c0ca312a932e6da481689537d4b35568841bdc | |||
| Starscream: 4bb2f9942274833f7b4d296a55504dcfc7edb7b0 | |||
| PODFILE CHECKSUM: a75497545d4391e2d394c3668e20cfb1c2bbd4aa | |||
| COCOAPODS: 1.9.3 | |||
| @@ -0,0 +1,575 @@ | |||
| // !$*UTF8*$! | |||
| { | |||
| archiveVersion = 1; | |||
| classes = { | |||
| }; | |||
| objectVersion = 50; | |||
| objects = { | |||
| /* Begin PBXBuildFile section */ | |||
| 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; | |||
| 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; | |||
| 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; | |||
| 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; | |||
| 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; | |||
| 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; | |||
| 97F131E2C83FBF01E22B026A /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A3B8EFF3B144BD3E0F2EBA3A /* Pods_Runner.framework */; }; | |||
| /* End PBXBuildFile section */ | |||
| /* Begin PBXCopyFilesBuildPhase section */ | |||
| 9705A1C41CF9048500538489 /* Embed Frameworks */ = { | |||
| isa = PBXCopyFilesBuildPhase; | |||
| buildActionMask = 2147483647; | |||
| dstPath = ""; | |||
| dstSubfolderSpec = 10; | |||
| files = ( | |||
| ); | |||
| name = "Embed Frameworks"; | |||
| runOnlyForDeploymentPostprocessing = 0; | |||
| }; | |||
| /* End PBXCopyFilesBuildPhase section */ | |||
| /* Begin PBXFileReference section */ | |||
| 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; }; | |||
| 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; }; | |||
| 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; }; | |||
| 4E31BE8264BCB21079612752 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; }; | |||
| 586BC06C935CDA1810AF478C /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; }; | |||
| 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = "<group>"; }; | |||
| 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; }; | |||
| 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; }; | |||
| 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = "<group>"; }; | |||
| 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = "<group>"; }; | |||
| 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; | |||
| 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; }; | |||
| 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; }; | |||
| 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; }; | |||
| 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; | |||
| A3B8EFF3B144BD3E0F2EBA3A /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; | |||
| A43B87E7D061F4DC292BA84B /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; }; | |||
| /* End PBXFileReference section */ | |||
| /* Begin PBXFrameworksBuildPhase section */ | |||
| 97C146EB1CF9000F007C117D /* Frameworks */ = { | |||
| isa = PBXFrameworksBuildPhase; | |||
| buildActionMask = 2147483647; | |||
| files = ( | |||
| 97F131E2C83FBF01E22B026A /* Pods_Runner.framework in Frameworks */, | |||
| ); | |||
| runOnlyForDeploymentPostprocessing = 0; | |||
| }; | |||
| /* End PBXFrameworksBuildPhase section */ | |||
| /* Begin PBXGroup section */ | |||
| 228725705900A23A2E532A52 /* Frameworks */ = { | |||
| isa = PBXGroup; | |||
| children = ( | |||
| A3B8EFF3B144BD3E0F2EBA3A /* Pods_Runner.framework */, | |||
| ); | |||
| name = Frameworks; | |||
| sourceTree = "<group>"; | |||
| }; | |||
| 3785AD25C8DE0DDC8BBCB2E4 /* Pods */ = { | |||
| isa = PBXGroup; | |||
| children = ( | |||
| 4E31BE8264BCB21079612752 /* Pods-Runner.debug.xcconfig */, | |||
| A43B87E7D061F4DC292BA84B /* Pods-Runner.release.xcconfig */, | |||
| 586BC06C935CDA1810AF478C /* Pods-Runner.profile.xcconfig */, | |||
| ); | |||
| path = Pods; | |||
| sourceTree = "<group>"; | |||
| }; | |||
| 9740EEB11CF90186004384FC /* Flutter */ = { | |||
| isa = PBXGroup; | |||
| children = ( | |||
| 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, | |||
| 9740EEB21CF90195004384FC /* Debug.xcconfig */, | |||
| 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, | |||
| 9740EEB31CF90195004384FC /* Generated.xcconfig */, | |||
| ); | |||
| name = Flutter; | |||
| sourceTree = "<group>"; | |||
| }; | |||
| 97C146E51CF9000F007C117D = { | |||
| isa = PBXGroup; | |||
| children = ( | |||
| 9740EEB11CF90186004384FC /* Flutter */, | |||
| 97C146F01CF9000F007C117D /* Runner */, | |||
| 97C146EF1CF9000F007C117D /* Products */, | |||
| 3785AD25C8DE0DDC8BBCB2E4 /* Pods */, | |||
| 228725705900A23A2E532A52 /* Frameworks */, | |||
| ); | |||
| sourceTree = "<group>"; | |||
| }; | |||
| 97C146EF1CF9000F007C117D /* Products */ = { | |||
| isa = PBXGroup; | |||
| children = ( | |||
| 97C146EE1CF9000F007C117D /* Runner.app */, | |||
| ); | |||
| name = Products; | |||
| sourceTree = "<group>"; | |||
| }; | |||
| 97C146F01CF9000F007C117D /* Runner */ = { | |||
| isa = PBXGroup; | |||
| children = ( | |||
| 97C146FA1CF9000F007C117D /* Main.storyboard */, | |||
| 97C146FD1CF9000F007C117D /* Assets.xcassets */, | |||
| 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, | |||
| 97C147021CF9000F007C117D /* Info.plist */, | |||
| 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, | |||
| 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, | |||
| 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, | |||
| 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, | |||
| ); | |||
| path = Runner; | |||
| sourceTree = "<group>"; | |||
| }; | |||
| /* End PBXGroup section */ | |||
| /* Begin PBXNativeTarget section */ | |||
| 97C146ED1CF9000F007C117D /* Runner */ = { | |||
| isa = PBXNativeTarget; | |||
| buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; | |||
| buildPhases = ( | |||
| DC132D9F9284A0E5E9F02590 /* [CP] Check Pods Manifest.lock */, | |||
| 9740EEB61CF901F6004384FC /* Run Script */, | |||
| 97C146EA1CF9000F007C117D /* Sources */, | |||
| 97C146EB1CF9000F007C117D /* Frameworks */, | |||
| 97C146EC1CF9000F007C117D /* Resources */, | |||
| 9705A1C41CF9048500538489 /* Embed Frameworks */, | |||
| 3B06AD1E1E4923F5004D2608 /* Thin Binary */, | |||
| C3B00070C266A1CE0C53ECC3 /* [CP] Embed Pods Frameworks */, | |||
| ); | |||
| buildRules = ( | |||
| ); | |||
| dependencies = ( | |||
| ); | |||
| name = Runner; | |||
| productName = Runner; | |||
| productReference = 97C146EE1CF9000F007C117D /* Runner.app */; | |||
| productType = "com.apple.product-type.application"; | |||
| }; | |||
| /* End PBXNativeTarget section */ | |||
| /* Begin PBXProject section */ | |||
| 97C146E61CF9000F007C117D /* Project object */ = { | |||
| isa = PBXProject; | |||
| attributes = { | |||
| LastUpgradeCheck = 1200; | |||
| ORGANIZATIONNAME = ""; | |||
| TargetAttributes = { | |||
| 97C146ED1CF9000F007C117D = { | |||
| CreatedOnToolsVersion = 7.3.1; | |||
| LastSwiftMigration = 1100; | |||
| }; | |||
| }; | |||
| }; | |||
| buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; | |||
| compatibilityVersion = "Xcode 9.3"; | |||
| developmentRegion = en; | |||
| hasScannedForEncodings = 0; | |||
| knownRegions = ( | |||
| en, | |||
| Base, | |||
| ); | |||
| mainGroup = 97C146E51CF9000F007C117D; | |||
| productRefGroup = 97C146EF1CF9000F007C117D /* Products */; | |||
| projectDirPath = ""; | |||
| projectRoot = ""; | |||
| targets = ( | |||
| 97C146ED1CF9000F007C117D /* Runner */, | |||
| ); | |||
| }; | |||
| /* End PBXProject section */ | |||
| /* Begin PBXResourcesBuildPhase section */ | |||
| 97C146EC1CF9000F007C117D /* Resources */ = { | |||
| isa = PBXResourcesBuildPhase; | |||
| buildActionMask = 2147483647; | |||
| files = ( | |||
| 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, | |||
| 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, | |||
| 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, | |||
| 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, | |||
| ); | |||
| runOnlyForDeploymentPostprocessing = 0; | |||
| }; | |||
| /* End PBXResourcesBuildPhase section */ | |||
| /* Begin PBXShellScriptBuildPhase section */ | |||
| 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { | |||
| isa = PBXShellScriptBuildPhase; | |||
| buildActionMask = 2147483647; | |||
| files = ( | |||
| ); | |||
| inputPaths = ( | |||
| ); | |||
| name = "Thin Binary"; | |||
| outputPaths = ( | |||
| ); | |||
| runOnlyForDeploymentPostprocessing = 0; | |||
| shellPath = /bin/sh; | |||
| shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; | |||
| }; | |||
| 9740EEB61CF901F6004384FC /* Run Script */ = { | |||
| isa = PBXShellScriptBuildPhase; | |||
| buildActionMask = 2147483647; | |||
| files = ( | |||
| ); | |||
| inputPaths = ( | |||
| ); | |||
| name = "Run Script"; | |||
| outputPaths = ( | |||
| ); | |||
| runOnlyForDeploymentPostprocessing = 0; | |||
| shellPath = /bin/sh; | |||
| shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; | |||
| }; | |||
| C3B00070C266A1CE0C53ECC3 /* [CP] Embed Pods Frameworks */ = { | |||
| isa = PBXShellScriptBuildPhase; | |||
| buildActionMask = 2147483647; | |||
| files = ( | |||
| ); | |||
| inputFileListPaths = ( | |||
| "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist", | |||
| ); | |||
| name = "[CP] Embed Pods Frameworks"; | |||
| outputFileListPaths = ( | |||
| "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist", | |||
| ); | |||
| runOnlyForDeploymentPostprocessing = 0; | |||
| shellPath = /bin/sh; | |||
| shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; | |||
| showEnvVarsInLog = 0; | |||
| }; | |||
| DC132D9F9284A0E5E9F02590 /* [CP] Check Pods Manifest.lock */ = { | |||
| isa = PBXShellScriptBuildPhase; | |||
| buildActionMask = 2147483647; | |||
| files = ( | |||
| ); | |||
| inputFileListPaths = ( | |||
| ); | |||
| inputPaths = ( | |||
| "${PODS_PODFILE_DIR_PATH}/Podfile.lock", | |||
| "${PODS_ROOT}/Manifest.lock", | |||
| ); | |||
| name = "[CP] Check Pods Manifest.lock"; | |||
| outputFileListPaths = ( | |||
| ); | |||
| outputPaths = ( | |||
| "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", | |||
| ); | |||
| runOnlyForDeploymentPostprocessing = 0; | |||
| shellPath = /bin/sh; | |||
| shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; | |||
| showEnvVarsInLog = 0; | |||
| }; | |||
| /* End PBXShellScriptBuildPhase section */ | |||
| /* Begin PBXSourcesBuildPhase section */ | |||
| 97C146EA1CF9000F007C117D /* Sources */ = { | |||
| isa = PBXSourcesBuildPhase; | |||
| buildActionMask = 2147483647; | |||
| files = ( | |||
| 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, | |||
| 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, | |||
| ); | |||
| runOnlyForDeploymentPostprocessing = 0; | |||
| }; | |||
| /* End PBXSourcesBuildPhase section */ | |||
| /* Begin PBXVariantGroup section */ | |||
| 97C146FA1CF9000F007C117D /* Main.storyboard */ = { | |||
| isa = PBXVariantGroup; | |||
| children = ( | |||
| 97C146FB1CF9000F007C117D /* Base */, | |||
| ); | |||
| name = Main.storyboard; | |||
| sourceTree = "<group>"; | |||
| }; | |||
| 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { | |||
| isa = PBXVariantGroup; | |||
| children = ( | |||
| 97C147001CF9000F007C117D /* Base */, | |||
| ); | |||
| name = LaunchScreen.storyboard; | |||
| sourceTree = "<group>"; | |||
| }; | |||
| /* End PBXVariantGroup section */ | |||
| /* Begin XCBuildConfiguration section */ | |||
| 249021D3217E4FDB00AE95B9 /* Profile */ = { | |||
| isa = XCBuildConfiguration; | |||
| buildSettings = { | |||
| ALWAYS_SEARCH_USER_PATHS = NO; | |||
| CLANG_ANALYZER_NONNULL = YES; | |||
| CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; | |||
| CLANG_CXX_LIBRARY = "libc++"; | |||
| CLANG_ENABLE_MODULES = YES; | |||
| CLANG_ENABLE_OBJC_ARC = YES; | |||
| CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; | |||
| CLANG_WARN_BOOL_CONVERSION = YES; | |||
| CLANG_WARN_COMMA = YES; | |||
| CLANG_WARN_CONSTANT_CONVERSION = YES; | |||
| CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; | |||
| CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; | |||
| CLANG_WARN_EMPTY_BODY = YES; | |||
| CLANG_WARN_ENUM_CONVERSION = YES; | |||
| CLANG_WARN_INFINITE_RECURSION = YES; | |||
| CLANG_WARN_INT_CONVERSION = YES; | |||
| CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; | |||
| CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; | |||
| CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; | |||
| CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; | |||
| CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; | |||
| CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; | |||
| CLANG_WARN_STRICT_PROTOTYPES = YES; | |||
| CLANG_WARN_SUSPICIOUS_MOVE = YES; | |||
| CLANG_WARN_UNREACHABLE_CODE = YES; | |||
| CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; | |||
| "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; | |||
| COPY_PHASE_STRIP = NO; | |||
| DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; | |||
| ENABLE_NS_ASSERTIONS = NO; | |||
| ENABLE_STRICT_OBJC_MSGSEND = YES; | |||
| GCC_C_LANGUAGE_STANDARD = gnu99; | |||
| GCC_NO_COMMON_BLOCKS = YES; | |||
| GCC_WARN_64_TO_32_BIT_CONVERSION = YES; | |||
| GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; | |||
| GCC_WARN_UNDECLARED_SELECTOR = YES; | |||
| GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; | |||
| GCC_WARN_UNUSED_FUNCTION = YES; | |||
| GCC_WARN_UNUSED_VARIABLE = YES; | |||
| IPHONEOS_DEPLOYMENT_TARGET = 12.0; | |||
| MTL_ENABLE_DEBUG_INFO = NO; | |||
| SDKROOT = iphoneos; | |||
| SUPPORTED_PLATFORMS = iphoneos; | |||
| TARGETED_DEVICE_FAMILY = "1,2"; | |||
| VALIDATE_PRODUCT = YES; | |||
| }; | |||
| name = Profile; | |||
| }; | |||
| 249021D4217E4FDB00AE95B9 /* Profile */ = { | |||
| isa = XCBuildConfiguration; | |||
| baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; | |||
| buildSettings = { | |||
| ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; | |||
| CLANG_ENABLE_MODULES = YES; | |||
| CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; | |||
| ENABLE_BITCODE = NO; | |||
| FRAMEWORK_SEARCH_PATHS = ( | |||
| "$(inherited)", | |||
| "$(PROJECT_DIR)/Flutter", | |||
| ); | |||
| INFOPLIST_FILE = Runner/Info.plist; | |||
| LD_RUNPATH_SEARCH_PATHS = ( | |||
| "$(inherited)", | |||
| "@executable_path/Frameworks", | |||
| ); | |||
| LIBRARY_SEARCH_PATHS = ( | |||
| "$(inherited)", | |||
| "$(PROJECT_DIR)/Flutter", | |||
| ); | |||
| PRODUCT_BUNDLE_IDENTIFIER = com.github.chinloyal.pusherClientExample; | |||
| PRODUCT_NAME = "$(TARGET_NAME)"; | |||
| SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; | |||
| SWIFT_VERSION = 5.0; | |||
| VERSIONING_SYSTEM = "apple-generic"; | |||
| }; | |||
| name = Profile; | |||
| }; | |||
| 97C147031CF9000F007C117D /* Debug */ = { | |||
| isa = XCBuildConfiguration; | |||
| buildSettings = { | |||
| ALWAYS_SEARCH_USER_PATHS = NO; | |||
| CLANG_ANALYZER_NONNULL = YES; | |||
| CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; | |||
| CLANG_CXX_LIBRARY = "libc++"; | |||
| CLANG_ENABLE_MODULES = YES; | |||
| CLANG_ENABLE_OBJC_ARC = YES; | |||
| CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; | |||
| CLANG_WARN_BOOL_CONVERSION = YES; | |||
| CLANG_WARN_COMMA = YES; | |||
| CLANG_WARN_CONSTANT_CONVERSION = YES; | |||
| CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; | |||
| CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; | |||
| CLANG_WARN_EMPTY_BODY = YES; | |||
| CLANG_WARN_ENUM_CONVERSION = YES; | |||
| CLANG_WARN_INFINITE_RECURSION = YES; | |||
| CLANG_WARN_INT_CONVERSION = YES; | |||
| CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; | |||
| CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; | |||
| CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; | |||
| CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; | |||
| CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; | |||
| CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; | |||
| CLANG_WARN_STRICT_PROTOTYPES = YES; | |||
| CLANG_WARN_SUSPICIOUS_MOVE = YES; | |||
| CLANG_WARN_UNREACHABLE_CODE = YES; | |||
| CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; | |||
| "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; | |||
| COPY_PHASE_STRIP = NO; | |||
| DEBUG_INFORMATION_FORMAT = dwarf; | |||
| ENABLE_STRICT_OBJC_MSGSEND = YES; | |||
| ENABLE_TESTABILITY = YES; | |||
| GCC_C_LANGUAGE_STANDARD = gnu99; | |||
| GCC_DYNAMIC_NO_PIC = NO; | |||
| GCC_NO_COMMON_BLOCKS = YES; | |||
| GCC_OPTIMIZATION_LEVEL = 0; | |||
| GCC_PREPROCESSOR_DEFINITIONS = ( | |||
| "DEBUG=1", | |||
| "$(inherited)", | |||
| ); | |||
| GCC_WARN_64_TO_32_BIT_CONVERSION = YES; | |||
| GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; | |||
| GCC_WARN_UNDECLARED_SELECTOR = YES; | |||
| GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; | |||
| GCC_WARN_UNUSED_FUNCTION = YES; | |||
| GCC_WARN_UNUSED_VARIABLE = YES; | |||
| IPHONEOS_DEPLOYMENT_TARGET = 12.0; | |||
| MTL_ENABLE_DEBUG_INFO = YES; | |||
| ONLY_ACTIVE_ARCH = YES; | |||
| SDKROOT = iphoneos; | |||
| TARGETED_DEVICE_FAMILY = "1,2"; | |||
| }; | |||
| name = Debug; | |||
| }; | |||
| 97C147041CF9000F007C117D /* Release */ = { | |||
| isa = XCBuildConfiguration; | |||
| buildSettings = { | |||
| ALWAYS_SEARCH_USER_PATHS = NO; | |||
| CLANG_ANALYZER_NONNULL = YES; | |||
| CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; | |||
| CLANG_CXX_LIBRARY = "libc++"; | |||
| CLANG_ENABLE_MODULES = YES; | |||
| CLANG_ENABLE_OBJC_ARC = YES; | |||
| CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; | |||
| CLANG_WARN_BOOL_CONVERSION = YES; | |||
| CLANG_WARN_COMMA = YES; | |||
| CLANG_WARN_CONSTANT_CONVERSION = YES; | |||
| CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; | |||
| CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; | |||
| CLANG_WARN_EMPTY_BODY = YES; | |||
| CLANG_WARN_ENUM_CONVERSION = YES; | |||
| CLANG_WARN_INFINITE_RECURSION = YES; | |||
| CLANG_WARN_INT_CONVERSION = YES; | |||
| CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; | |||
| CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; | |||
| CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; | |||
| CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; | |||
| CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; | |||
| CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; | |||
| CLANG_WARN_STRICT_PROTOTYPES = YES; | |||
| CLANG_WARN_SUSPICIOUS_MOVE = YES; | |||
| CLANG_WARN_UNREACHABLE_CODE = YES; | |||
| CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; | |||
| "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; | |||
| COPY_PHASE_STRIP = NO; | |||
| DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; | |||
| ENABLE_NS_ASSERTIONS = NO; | |||
| ENABLE_STRICT_OBJC_MSGSEND = YES; | |||
| GCC_C_LANGUAGE_STANDARD = gnu99; | |||
| GCC_NO_COMMON_BLOCKS = YES; | |||
| GCC_WARN_64_TO_32_BIT_CONVERSION = YES; | |||
| GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; | |||
| GCC_WARN_UNDECLARED_SELECTOR = YES; | |||
| GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; | |||
| GCC_WARN_UNUSED_FUNCTION = YES; | |||
| GCC_WARN_UNUSED_VARIABLE = YES; | |||
| IPHONEOS_DEPLOYMENT_TARGET = 12.0; | |||
| MTL_ENABLE_DEBUG_INFO = NO; | |||
| SDKROOT = iphoneos; | |||
| SUPPORTED_PLATFORMS = iphoneos; | |||
| SWIFT_COMPILATION_MODE = wholemodule; | |||
| SWIFT_OPTIMIZATION_LEVEL = "-O"; | |||
| TARGETED_DEVICE_FAMILY = "1,2"; | |||
| VALIDATE_PRODUCT = YES; | |||
| }; | |||
| name = Release; | |||
| }; | |||
| 97C147061CF9000F007C117D /* Debug */ = { | |||
| isa = XCBuildConfiguration; | |||
| baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; | |||
| buildSettings = { | |||
| ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; | |||
| CLANG_ENABLE_MODULES = YES; | |||
| CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; | |||
| ENABLE_BITCODE = NO; | |||
| FRAMEWORK_SEARCH_PATHS = ( | |||
| "$(inherited)", | |||
| "$(PROJECT_DIR)/Flutter", | |||
| ); | |||
| INFOPLIST_FILE = Runner/Info.plist; | |||
| LD_RUNPATH_SEARCH_PATHS = ( | |||
| "$(inherited)", | |||
| "@executable_path/Frameworks", | |||
| ); | |||
| LIBRARY_SEARCH_PATHS = ( | |||
| "$(inherited)", | |||
| "$(PROJECT_DIR)/Flutter", | |||
| ); | |||
| PRODUCT_BUNDLE_IDENTIFIER = com.github.chinloyal.pusherClientExample; | |||
| PRODUCT_NAME = "$(TARGET_NAME)"; | |||
| SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; | |||
| SWIFT_OPTIMIZATION_LEVEL = "-Onone"; | |||
| SWIFT_VERSION = 5.0; | |||
| VERSIONING_SYSTEM = "apple-generic"; | |||
| }; | |||
| name = Debug; | |||
| }; | |||
| 97C147071CF9000F007C117D /* Release */ = { | |||
| isa = XCBuildConfiguration; | |||
| baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; | |||
| buildSettings = { | |||
| ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; | |||
| CLANG_ENABLE_MODULES = YES; | |||
| CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; | |||
| ENABLE_BITCODE = NO; | |||
| FRAMEWORK_SEARCH_PATHS = ( | |||
| "$(inherited)", | |||
| "$(PROJECT_DIR)/Flutter", | |||
| ); | |||
| INFOPLIST_FILE = Runner/Info.plist; | |||
| LD_RUNPATH_SEARCH_PATHS = ( | |||
| "$(inherited)", | |||
| "@executable_path/Frameworks", | |||
| ); | |||
| LIBRARY_SEARCH_PATHS = ( | |||
| "$(inherited)", | |||
| "$(PROJECT_DIR)/Flutter", | |||
| ); | |||
| PRODUCT_BUNDLE_IDENTIFIER = com.github.chinloyal.pusherClientExample; | |||
| PRODUCT_NAME = "$(TARGET_NAME)"; | |||
| SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; | |||
| SWIFT_VERSION = 5.0; | |||
| VERSIONING_SYSTEM = "apple-generic"; | |||
| }; | |||
| name = Release; | |||
| }; | |||
| /* End XCBuildConfiguration section */ | |||
| /* Begin XCConfigurationList section */ | |||
| 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { | |||
| isa = XCConfigurationList; | |||
| buildConfigurations = ( | |||
| 97C147031CF9000F007C117D /* Debug */, | |||
| 97C147041CF9000F007C117D /* Release */, | |||
| 249021D3217E4FDB00AE95B9 /* Profile */, | |||
| ); | |||
| defaultConfigurationIsVisible = 0; | |||
| defaultConfigurationName = Release; | |||
| }; | |||
| 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { | |||
| isa = XCConfigurationList; | |||
| buildConfigurations = ( | |||
| 97C147061CF9000F007C117D /* Debug */, | |||
| 97C147071CF9000F007C117D /* Release */, | |||
| 249021D4217E4FDB00AE95B9 /* Profile */, | |||
| ); | |||
| defaultConfigurationIsVisible = 0; | |||
| defaultConfigurationName = Release; | |||
| }; | |||
| /* End XCConfigurationList section */ | |||
| }; | |||
| rootObject = 97C146E61CF9000F007C117D /* Project object */; | |||
| } | |||
| @@ -0,0 +1,7 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <Workspace | |||
| version = "1.0"> | |||
| <FileRef | |||
| location = "group:Runner.xcodeproj"> | |||
| </FileRef> | |||
| </Workspace> | |||
| @@ -0,0 +1,8 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |||
| <plist version="1.0"> | |||
| <dict> | |||
| <key>IDEDidComputeMac32BitWarning</key> | |||
| <true/> | |||
| </dict> | |||
| </plist> | |||
| @@ -0,0 +1,8 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |||
| <plist version="1.0"> | |||
| <dict> | |||
| <key>PreviewsEnabled</key> | |||
| <false/> | |||
| </dict> | |||
| </plist> | |||
| @@ -0,0 +1,87 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <Scheme | |||
| LastUpgradeVersion = "1200" | |||
| version = "1.3"> | |||
| <BuildAction | |||
| parallelizeBuildables = "YES" | |||
| buildImplicitDependencies = "YES"> | |||
| <BuildActionEntries> | |||
| <BuildActionEntry | |||
| buildForTesting = "YES" | |||
| buildForRunning = "YES" | |||
| buildForProfiling = "YES" | |||
| buildForArchiving = "YES" | |||
| buildForAnalyzing = "YES"> | |||
| <BuildableReference | |||
| BuildableIdentifier = "primary" | |||
| BlueprintIdentifier = "97C146ED1CF9000F007C117D" | |||
| BuildableName = "Runner.app" | |||
| BlueprintName = "Runner" | |||
| ReferencedContainer = "container:Runner.xcodeproj"> | |||
| </BuildableReference> | |||
| </BuildActionEntry> | |||
| </BuildActionEntries> | |||
| </BuildAction> | |||
| <TestAction | |||
| buildConfiguration = "Debug" | |||
| selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" | |||
| selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" | |||
| shouldUseLaunchSchemeArgsEnv = "YES"> | |||
| <MacroExpansion> | |||
| <BuildableReference | |||
| BuildableIdentifier = "primary" | |||
| BlueprintIdentifier = "97C146ED1CF9000F007C117D" | |||
| BuildableName = "Runner.app" | |||
| BlueprintName = "Runner" | |||
| ReferencedContainer = "container:Runner.xcodeproj"> | |||
| </BuildableReference> | |||
| </MacroExpansion> | |||
| <Testables> | |||
| </Testables> | |||
| </TestAction> | |||
| <LaunchAction | |||
| buildConfiguration = "Debug" | |||
| selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" | |||
| selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" | |||
| launchStyle = "0" | |||
| useCustomWorkingDirectory = "NO" | |||
| ignoresPersistentStateOnLaunch = "NO" | |||
| debugDocumentVersioning = "YES" | |||
| debugServiceExtension = "internal" | |||
| allowLocationSimulation = "YES"> | |||
| <BuildableProductRunnable | |||
| runnableDebuggingMode = "0"> | |||
| <BuildableReference | |||
| BuildableIdentifier = "primary" | |||
| BlueprintIdentifier = "97C146ED1CF9000F007C117D" | |||
| BuildableName = "Runner.app" | |||
| BlueprintName = "Runner" | |||
| ReferencedContainer = "container:Runner.xcodeproj"> | |||
| </BuildableReference> | |||
| </BuildableProductRunnable> | |||
| </LaunchAction> | |||
| <ProfileAction | |||
| buildConfiguration = "Profile" | |||
| shouldUseLaunchSchemeArgsEnv = "YES" | |||
| savedToolIdentifier = "" | |||
| useCustomWorkingDirectory = "NO" | |||
| debugDocumentVersioning = "YES"> | |||
| <BuildableProductRunnable | |||
| runnableDebuggingMode = "0"> | |||
| <BuildableReference | |||
| BuildableIdentifier = "primary" | |||
| BlueprintIdentifier = "97C146ED1CF9000F007C117D" | |||
| BuildableName = "Runner.app" | |||
| BlueprintName = "Runner" | |||
| ReferencedContainer = "container:Runner.xcodeproj"> | |||
| </BuildableReference> | |||
| </BuildableProductRunnable> | |||
| </ProfileAction> | |||
| <AnalyzeAction | |||
| buildConfiguration = "Debug"> | |||
| </AnalyzeAction> | |||
| <ArchiveAction | |||
| buildConfiguration = "Release" | |||
| revealArchiveInOrganizer = "YES"> | |||
| </ArchiveAction> | |||
| </Scheme> | |||
| @@ -0,0 +1,10 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <Workspace | |||
| version = "1.0"> | |||
| <FileRef | |||
| location = "group:Runner.xcodeproj"> | |||
| </FileRef> | |||
| <FileRef | |||
| location = "group:Pods/Pods.xcodeproj"> | |||
| </FileRef> | |||
| </Workspace> | |||
| @@ -0,0 +1,8 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |||
| <plist version="1.0"> | |||
| <dict> | |||
| <key>IDEDidComputeMac32BitWarning</key> | |||
| <true/> | |||
| </dict> | |||
| </plist> | |||
| @@ -0,0 +1,8 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |||
| <plist version="1.0"> | |||
| <dict> | |||
| <key>PreviewsEnabled</key> | |||
| <false/> | |||
| </dict> | |||
| </plist> | |||
| @@ -0,0 +1,13 @@ | |||
| import UIKit | |||
| import Flutter | |||
| @UIApplicationMain | |||
| @objc class AppDelegate: FlutterAppDelegate { | |||
| override func application( | |||
| _ application: UIApplication, | |||
| didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? | |||
| ) -> Bool { | |||
| GeneratedPluginRegistrant.register(with: self) | |||
| return super.application(application, didFinishLaunchingWithOptions: launchOptions) | |||
| } | |||
| } | |||
| @@ -0,0 +1,122 @@ | |||
| { | |||
| "images" : [ | |||
| { | |||
| "size" : "20x20", | |||
| "idiom" : "iphone", | |||
| "filename" : "Icon-App-20x20@2x.png", | |||
| "scale" : "2x" | |||
| }, | |||
| { | |||
| "size" : "20x20", | |||
| "idiom" : "iphone", | |||
| "filename" : "Icon-App-20x20@3x.png", | |||
| "scale" : "3x" | |||
| }, | |||
| { | |||
| "size" : "29x29", | |||
| "idiom" : "iphone", | |||
| "filename" : "Icon-App-29x29@1x.png", | |||
| "scale" : "1x" | |||
| }, | |||
| { | |||
| "size" : "29x29", | |||
| "idiom" : "iphone", | |||
| "filename" : "Icon-App-29x29@2x.png", | |||
| "scale" : "2x" | |||
| }, | |||
| { | |||
| "size" : "29x29", | |||
| "idiom" : "iphone", | |||
| "filename" : "Icon-App-29x29@3x.png", | |||
| "scale" : "3x" | |||
| }, | |||
| { | |||
| "size" : "40x40", | |||
| "idiom" : "iphone", | |||
| "filename" : "Icon-App-40x40@2x.png", | |||
| "scale" : "2x" | |||
| }, | |||
| { | |||
| "size" : "40x40", | |||
| "idiom" : "iphone", | |||
| "filename" : "Icon-App-40x40@3x.png", | |||
| "scale" : "3x" | |||
| }, | |||
| { | |||
| "size" : "60x60", | |||
| "idiom" : "iphone", | |||
| "filename" : "Icon-App-60x60@2x.png", | |||
| "scale" : "2x" | |||
| }, | |||
| { | |||
| "size" : "60x60", | |||
| "idiom" : "iphone", | |||
| "filename" : "Icon-App-60x60@3x.png", | |||
| "scale" : "3x" | |||
| }, | |||
| { | |||
| "size" : "20x20", | |||
| "idiom" : "ipad", | |||
| "filename" : "Icon-App-20x20@1x.png", | |||
| "scale" : "1x" | |||
| }, | |||
| { | |||
| "size" : "20x20", | |||
| "idiom" : "ipad", | |||
| "filename" : "Icon-App-20x20@2x.png", | |||
| "scale" : "2x" | |||
| }, | |||
| { | |||
| "size" : "29x29", | |||
| "idiom" : "ipad", | |||
| "filename" : "Icon-App-29x29@1x.png", | |||
| "scale" : "1x" | |||
| }, | |||
| { | |||
| "size" : "29x29", | |||
| "idiom" : "ipad", | |||
| "filename" : "Icon-App-29x29@2x.png", | |||
| "scale" : "2x" | |||
| }, | |||
| { | |||
| "size" : "40x40", | |||
| "idiom" : "ipad", | |||
| "filename" : "Icon-App-40x40@1x.png", | |||
| "scale" : "1x" | |||
| }, | |||
| { | |||
| "size" : "40x40", | |||
| "idiom" : "ipad", | |||
| "filename" : "Icon-App-40x40@2x.png", | |||
| "scale" : "2x" | |||
| }, | |||
| { | |||
| "size" : "76x76", | |||
| "idiom" : "ipad", | |||
| "filename" : "Icon-App-76x76@1x.png", | |||
| "scale" : "1x" | |||
| }, | |||
| { | |||
| "size" : "76x76", | |||
| "idiom" : "ipad", | |||
| "filename" : "Icon-App-76x76@2x.png", | |||
| "scale" : "2x" | |||
| }, | |||
| { | |||
| "size" : "83.5x83.5", | |||
| "idiom" : "ipad", | |||
| "filename" : "Icon-App-83.5x83.5@2x.png", | |||
| "scale" : "2x" | |||
| }, | |||
| { | |||
| "size" : "1024x1024", | |||
| "idiom" : "ios-marketing", | |||
| "filename" : "Icon-App-1024x1024@1x.png", | |||
| "scale" : "1x" | |||
| } | |||
| ], | |||
| "info" : { | |||
| "version" : 1, | |||
| "author" : "xcode" | |||
| } | |||
| } | |||
| @@ -0,0 +1,23 @@ | |||
| { | |||
| "images" : [ | |||
| { | |||
| "idiom" : "universal", | |||
| "filename" : "LaunchImage.png", | |||
| "scale" : "1x" | |||
| }, | |||
| { | |||
| "idiom" : "universal", | |||
| "filename" : "LaunchImage@2x.png", | |||
| "scale" : "2x" | |||
| }, | |||
| { | |||
| "idiom" : "universal", | |||
| "filename" : "LaunchImage@3x.png", | |||
| "scale" : "3x" | |||
| } | |||
| ], | |||
| "info" : { | |||
| "version" : 1, | |||
| "author" : "xcode" | |||
| } | |||
| } | |||
| @@ -0,0 +1,5 @@ | |||
| # Launch Screen Assets | |||
| You can customize the launch screen with your own desired assets by replacing the image files in this directory. | |||
| You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. | |||
| @@ -0,0 +1,37 @@ | |||
| <?xml version="1.0" encoding="UTF-8" standalone="no"?> | |||
| <document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="12121" systemVersion="16G29" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" colorMatched="YES" initialViewController="01J-lp-oVM"> | |||
| <dependencies> | |||
| <deployment identifier="iOS"/> | |||
| <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12089"/> | |||
| </dependencies> | |||
| <scenes> | |||
| <!--View Controller--> | |||
| <scene sceneID="EHf-IW-A2E"> | |||
| <objects> | |||
| <viewController id="01J-lp-oVM" sceneMemberID="viewController"> | |||
| <layoutGuides> | |||
| <viewControllerLayoutGuide type="top" id="Ydg-fD-yQy"/> | |||
| <viewControllerLayoutGuide type="bottom" id="xbc-2k-c8Z"/> | |||
| </layoutGuides> | |||
| <view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3"> | |||
| <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> | |||
| <subviews> | |||
| <imageView opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" image="LaunchImage" translatesAutoresizingMaskIntoConstraints="NO" id="YRO-k0-Ey4"> | |||
| </imageView> | |||
| </subviews> | |||
| <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> | |||
| <constraints> | |||
| <constraint firstItem="YRO-k0-Ey4" firstAttribute="centerX" secondItem="Ze5-6b-2t3" secondAttribute="centerX" id="1a2-6s-vTC"/> | |||
| <constraint firstItem="YRO-k0-Ey4" firstAttribute="centerY" secondItem="Ze5-6b-2t3" secondAttribute="centerY" id="4X2-HB-R7a"/> | |||
| </constraints> | |||
| </view> | |||
| </viewController> | |||
| <placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/> | |||
| </objects> | |||
| <point key="canvasLocation" x="53" y="375"/> | |||
| </scene> | |||
| </scenes> | |||
| <resources> | |||
| <image name="LaunchImage" width="168" height="185"/> | |||
| </resources> | |||
| </document> | |||
| @@ -0,0 +1,26 @@ | |||
| <?xml version="1.0" encoding="UTF-8" standalone="no"?> | |||
| <document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10117" systemVersion="15F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r"> | |||
| <dependencies> | |||
| <deployment identifier="iOS"/> | |||
| <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/> | |||
| </dependencies> | |||
| <scenes> | |||
| <!--Flutter View Controller--> | |||
| <scene sceneID="tne-QT-ifu"> | |||
| <objects> | |||
| <viewController id="BYZ-38-t0r" customClass="FlutterViewController" sceneMemberID="viewController"> | |||
| <layoutGuides> | |||
| <viewControllerLayoutGuide type="top" id="y3c-jy-aDJ"/> | |||
| <viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/> | |||
| </layoutGuides> | |||
| <view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC"> | |||
| <rect key="frame" x="0.0" y="0.0" width="600" height="600"/> | |||
| <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> | |||
| <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/> | |||
| </view> | |||
| </viewController> | |||
| <placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/> | |||
| </objects> | |||
| </scene> | |||
| </scenes> | |||
| </document> | |||
| @@ -0,0 +1,50 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |||
| <plist version="1.0"> | |||
| <dict> | |||
| <key>CFBundleDevelopmentRegion</key> | |||
| <string>$(DEVELOPMENT_LANGUAGE)</string> | |||
| <key>CFBundleExecutable</key> | |||
| <string>$(EXECUTABLE_NAME)</string> | |||
| <key>CFBundleIdentifier</key> | |||
| <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> | |||
| <key>CFBundleInfoDictionaryVersion</key> | |||
| <string>6.0</string> | |||
| <key>CFBundleName</key> | |||
| <string>pusher_client_example</string> | |||
| <key>CFBundlePackageType</key> | |||
| <string>APPL</string> | |||
| <key>CFBundleShortVersionString</key> | |||
| <string>$(FLUTTER_BUILD_NAME)</string> | |||
| <key>CFBundleSignature</key> | |||
| <string>????</string> | |||
| <key>CFBundleVersion</key> | |||
| <string>$(FLUTTER_BUILD_NUMBER)</string> | |||
| <key>LSRequiresIPhoneOS</key> | |||
| <true/> | |||
| <key>UILaunchStoryboardName</key> | |||
| <string>LaunchScreen</string> | |||
| <key>UIMainStoryboardFile</key> | |||
| <string>Main</string> | |||
| <key>UISupportedInterfaceOrientations</key> | |||
| <array> | |||
| <string>UIInterfaceOrientationPortrait</string> | |||
| <string>UIInterfaceOrientationLandscapeLeft</string> | |||
| <string>UIInterfaceOrientationLandscapeRight</string> | |||
| </array> | |||
| <key>UISupportedInterfaceOrientations~ipad</key> | |||
| <array> | |||
| <string>UIInterfaceOrientationPortrait</string> | |||
| <string>UIInterfaceOrientationPortraitUpsideDown</string> | |||
| <string>UIInterfaceOrientationLandscapeLeft</string> | |||
| <string>UIInterfaceOrientationLandscapeRight</string> | |||
| </array> | |||
| <key>UIViewControllerBasedStatusBarAppearance</key> | |||
| <false/> | |||
| <key>NSAppTransportSecurity</key> | |||
| <dict> | |||
| <key>NSAllowsArbitraryLoads</key> | |||
| <true/> | |||
| </dict> | |||
| </dict> | |||
| </plist> | |||
| @@ -0,0 +1 @@ | |||
| #import "GeneratedPluginRegistrant.h" | |||
| @@ -0,0 +1,109 @@ | |||
| import 'dart:developer'; | |||
| import 'package:flutter/material.dart'; | |||
| import 'package:pusher_client/pusher_client.dart'; | |||
| void main() { | |||
| runApp(MyApp()); | |||
| } | |||
| class MyApp extends StatefulWidget { | |||
| @override | |||
| _MyAppState createState() => _MyAppState(); | |||
| } | |||
| class _MyAppState extends State<MyApp> { | |||
| PusherClient pusher; | |||
| Channel channel; | |||
| @override | |||
| void initState() { | |||
| super.initState(); | |||
| String token = getToken(); | |||
| pusher = new PusherClient( | |||
| "app-key", | |||
| PusherOptions( | |||
| // if local on android use 10.0.2.2 | |||
| host: 'localhost', | |||
| encrypted: false, | |||
| auth: PusherAuth( | |||
| 'http://example.com/broadcasting/auth', | |||
| headers: { | |||
| 'Authorization': 'Bearer $token', | |||
| }, | |||
| ), | |||
| ), | |||
| enableLogging: true, | |||
| ); | |||
| channel = pusher.subscribe("private-orders"); | |||
| pusher.onConnectionStateChange((state) { | |||
| log("previousState: ${state.previousState}, currentState: ${state.currentState}"); | |||
| }); | |||
| pusher.onConnectionError((error) { | |||
| log("error: ${error.message}"); | |||
| }); | |||
| channel.bind('status-update', (event) { | |||
| log(event.data); | |||
| }); | |||
| channel.bind('order-filled', (event) { | |||
| log("Order Filled Event" + event.data.toString()); | |||
| }); | |||
| } | |||
| String getToken() => "super-secret-token"; | |||
| @override | |||
| Widget build(BuildContext context) { | |||
| return MaterialApp( | |||
| home: Scaffold( | |||
| appBar: AppBar( | |||
| title: const Text('Example Pusher App'), | |||
| ), | |||
| body: Center( | |||
| child: Column( | |||
| children: [ | |||
| ElevatedButton( | |||
| child: Text('Unsubscribe Private Orders'), | |||
| onPressed: () { | |||
| pusher.unsubscribe('private-orders'); | |||
| }, | |||
| ), | |||
| ElevatedButton( | |||
| child: Text('Unbind Status Update'), | |||
| onPressed: () { | |||
| channel.unbind('status-update'); | |||
| }, | |||
| ), | |||
| ElevatedButton( | |||
| child: Text('Unbind Order Filled'), | |||
| onPressed: () { | |||
| channel.unbind('order-filled'); | |||
| }, | |||
| ), | |||
| ElevatedButton( | |||
| child: Text('Bind Status Update'), | |||
| onPressed: () { | |||
| channel.bind('status-update', (PusherEvent event) { | |||
| log("Status Update Event" + event.data.toString()); | |||
| }); | |||
| }, | |||
| ), | |||
| ElevatedButton( | |||
| child: Text('Trigger Client Typing'), | |||
| onPressed: () { | |||
| channel.trigger('client-istyping', {'name': 'Bob'}); | |||
| }, | |||
| ), | |||
| ], | |||
| )), | |||
| ), | |||
| ); | |||
| } | |||
| } | |||
| @@ -0,0 +1,71 @@ | |||
| name: pusher_client_example | |||
| description: Demonstrates how to use the pusher_client plugin. | |||
| # The following line prevents the package from being accidentally published to | |||
| # pub.dev using `pub publish`. This is preferred for private packages. | |||
| publish_to: 'none' # Remove this line if you wish to publish to pub.dev | |||
| environment: | |||
| sdk: ">=2.7.0 <3.0.0" | |||
| dependencies: | |||
| flutter: | |||
| sdk: flutter | |||
| pusher_client: | |||
| # When depending on this package from a real application you should use: | |||
| # pusher_client: ^x.y.z | |||
| # See https://dart.dev/tools/pub/dependencies#version-constraints | |||
| # The example app is bundled with the plugin so we use a path dependency on | |||
| # the parent directory to use the current plugin's version. | |||
| path: ../ | |||
| # The following adds the Cupertino Icons font to your application. | |||
| # Use with the CupertinoIcons class for iOS style icons. | |||
| cupertino_icons: ^1.0.0 | |||
| dev_dependencies: | |||
| flutter_test: | |||
| sdk: flutter | |||
| # For information on the generic Dart part of this file, see the | |||
| # following page: https://dart.dev/tools/pub/pubspec | |||
| # The following section is specific to Flutter. | |||
| flutter: | |||
| # The following line ensures that the Material Icons font is | |||
| # included with your application, so that you can use the icons in | |||
| # the material Icons class. | |||
| uses-material-design: true | |||
| # To add assets to your application, add an assets section, like this: | |||
| # assets: | |||
| # - images/a_dot_burr.jpeg | |||
| # - images/a_dot_ham.jpeg | |||
| # An image asset can refer to one or more resolution-specific "variants", see | |||
| # https://flutter.dev/assets-and-images/#resolution-aware. | |||
| # For details regarding adding assets from package dependencies, see | |||
| # https://flutter.dev/assets-and-images/#from-packages | |||
| # To add custom fonts to your application, add a fonts section here, | |||
| # in this "flutter" section. Each entry in this list should have a | |||
| # "family" key with the font family name, and a "fonts" key with a | |||
| # list giving the asset and other descriptors for the font. For | |||
| # example: | |||
| # fonts: | |||
| # - family: Schyler | |||
| # fonts: | |||
| # - asset: fonts/Schyler-Regular.ttf | |||
| # - asset: fonts/Schyler-Italic.ttf | |||
| # style: italic | |||
| # - family: Trajan Pro | |||
| # fonts: | |||
| # - asset: fonts/TrajanPro.ttf | |||
| # - asset: fonts/TrajanPro_Bold.ttf | |||
| # weight: 700 | |||
| # | |||
| # For details regarding fonts from package dependencies, | |||
| # see https://flutter.dev/custom-fonts/#from-packages | |||
| @@ -0,0 +1,27 @@ | |||
| // This is a basic Flutter widget test. | |||
| // | |||
| // To perform an interaction with a widget in your test, use the WidgetTester | |||
| // utility that Flutter provides. For example, you can send tap and scroll | |||
| // gestures. You can also use WidgetTester to find child widgets in the widget | |||
| // tree, read text, and verify that the values of widget properties are correct. | |||
| import 'package:flutter/material.dart'; | |||
| import 'package:flutter_test/flutter_test.dart'; | |||
| import 'package:pusher_client_example/main.dart'; | |||
| void main() { | |||
| testWidgets('Verify Platform version', (WidgetTester tester) async { | |||
| // Build our app and trigger a frame. | |||
| await tester.pumpWidget(MyApp()); | |||
| // Verify that platform version is retrieved. | |||
| expect( | |||
| find.byWidgetPredicate( | |||
| (Widget widget) => widget is Text && | |||
| widget.data.startsWith('Running on:'), | |||
| ), | |||
| findsOneWidget, | |||
| ); | |||
| }); | |||
| } | |||
| @@ -0,0 +1,37 @@ | |||
| .idea/ | |||
| .vagrant/ | |||
| .sconsign.dblite | |||
| .svn/ | |||
| .DS_Store | |||
| *.swp | |||
| profile | |||
| DerivedData/ | |||
| build/ | |||
| GeneratedPluginRegistrant.h | |||
| GeneratedPluginRegistrant.m | |||
| .generated/ | |||
| *.pbxuser | |||
| *.mode1v3 | |||
| *.mode2v3 | |||
| *.perspectivev3 | |||
| !default.pbxuser | |||
| !default.mode1v3 | |||
| !default.mode2v3 | |||
| !default.perspectivev3 | |||
| xcuserdata | |||
| *.moved-aside | |||
| *.pyc | |||
| *sync/ | |||
| Icon? | |||
| .tags* | |||
| /Flutter/Generated.xcconfig | |||
| /Flutter/flutter_export_environment.sh | |||
| @@ -0,0 +1,37 @@ | |||
| // | |||
| // AuthRequestBuilder.swift | |||
| // pusher_client | |||
| // | |||
| // Created by Romario Chinloy on 10/27/20. | |||
| // | |||
| import PusherSwiftWithEncryption | |||
| class AuthRequestBuilder: AuthRequestBuilderProtocol { | |||
| let pusherAuth: PusherAuth | |||
| init(pusherAuth: PusherAuth) { | |||
| self.pusherAuth = pusherAuth | |||
| } | |||
| func requestFor(socketID: String, channelName: String) -> URLRequest? { | |||
| var request = URLRequest(url: URL(string: pusherAuth.endpoint)!) | |||
| request.httpMethod = "POST" | |||
| do { | |||
| let authRequest = AuthRequest(socket_id: socketID, channel_name: channelName) | |||
| if(pusherAuth.headers.values.contains("application/json")) { | |||
| request.httpBody = try JSONEncoder().encode(authRequest) | |||
| } else { | |||
| request.httpBody = authRequest.valueUrlEncoded!.data(using: String.Encoding.utf8) | |||
| } | |||
| pusherAuth.headers.forEach { (key: String, value: String) in | |||
| request.addValue(value, forHTTPHeaderField: key) | |||
| } | |||
| return request | |||
| } catch { | |||
| return nil | |||
| } | |||
| } | |||
| } | |||
| @@ -0,0 +1,28 @@ | |||
| // | |||
| // ChannelEventListener.swift | |||
| // pusher_client | |||
| // | |||
| // Created by Romario Chinloy on 10/31/20. | |||
| // | |||
| import Foundation | |||
| import PusherSwiftWithEncryption | |||
| class ChannelEventListener { | |||
| static let `default`: ChannelEventListener = ChannelEventListener() | |||
| private init(){} | |||
| func onEvent(event: PusherEvent) -> Void { | |||
| let pusherEvent = Event(eventName: event.eventName, channelName: event.channelName, userId: event.userId, data: event.data) | |||
| do { | |||
| let data = try JSONEncoder().encode(EventStreamResult(pusherEvent: pusherEvent)) | |||
| StreamHandler.Utils.eventSink!(String(data: data, encoding: .utf8)) | |||
| PusherService.Utils.debugLog(msg: "[ON_EVENT] Channel: \(event.channelName ?? ""), EventName: \(event.eventName), Data: \(event.data ?? ""), User Id: \(event.userId ?? "")") | |||
| } catch let err { | |||
| StreamHandler.Utils.eventSink!(FlutterError(code: "ON_EVENT_ERROR", message: err.localizedDescription, details: err)) | |||
| } | |||
| } | |||
| } | |||
| @@ -0,0 +1,45 @@ | |||
| // | |||
| // ConnectionListener.swift | |||
| // pusher_client | |||
| // | |||
| // Created by Romario Chinloy on 10/27/20. | |||
| // | |||
| import PusherSwiftWithEncryption | |||
| class ConnectionListener: PusherDelegate { | |||
| static let `default`: ConnectionListener = ConnectionListener() | |||
| private init(){} | |||
| func changedConnectionState(from old: ConnectionState, to new: ConnectionState) { | |||
| do { | |||
| let connectionStateChange = ConnectionStateChange(currentState: new.stringValue(), previousState: old.stringValue()) | |||
| PusherService.Utils.debugLog(msg: "[\(new.stringValue())]") | |||
| let data = try JSONEncoder().encode(EventStreamResult(connectionStateChange: connectionStateChange)) | |||
| StreamHandler.Utils.eventSink!(String(data: data, encoding: .utf8)) | |||
| } catch let err { | |||
| PusherService.Utils.errorLog(msg: err.localizedDescription) | |||
| } | |||
| } | |||
| func receivedError(error: PusherError) { | |||
| do { | |||
| let connectionError = ConnectionError(message: error.message, code: String(describing: error.code), exception: error.description) | |||
| PusherService.Utils.debugLog(msg: "[ON_ERROR]: message: \(error.message), code: \(String(describing: error.code))") | |||
| let data = try JSONEncoder().encode(EventStreamResult(connectionError: connectionError)) | |||
| StreamHandler.Utils.eventSink!(String(data: data, encoding: .utf8)) | |||
| } catch let err { | |||
| PusherService.Utils.errorLog(msg: err.localizedDescription) | |||
| } | |||
| } | |||
| // func debugLog(message: String) { | |||
| // PusherService.Utils.debugLog(msg: message) | |||
| // } | |||
| } | |||
| @@ -0,0 +1,24 @@ | |||
| // | |||
| // Constants.swift | |||
| // pusher_client | |||
| // | |||
| // Created by Romario Chinloy on 10/31/20. | |||
| // | |||
| import Foundation | |||
| public enum Constants { | |||
| enum Events: String, CaseIterable { | |||
| case connectionEstablished = "pusher:connection_established" | |||
| case error = "pusher:error" | |||
| case subscribe = "pusher:subscribe" | |||
| case unsubscribe = "pusher:unsubscribe" | |||
| case subscriptionError = "pusher:subscription_error" | |||
| case subscriptionSucceeded = "pusher:subscription_succeeded" | |||
| } | |||
| enum PresenceEvents: String, CaseIterable { | |||
| case memberAdded = "pusher:member_added" | |||
| case memberRemoved = "pusher:member_removed" | |||
| } | |||
| } | |||
| @@ -0,0 +1,12 @@ | |||
| // | |||
| // MChannel.swift | |||
| // pusher_client | |||
| // | |||
| // Created by Romario Chinloy on 10/26/20. | |||
| // | |||
| import Foundation | |||
| protocol MChannel { | |||
| func register(messenger: FlutterBinaryMessenger) -> Void | |||
| } | |||
| @@ -0,0 +1,102 @@ | |||
| // | |||
| // Models.swift | |||
| // pusher_client | |||
| // | |||
| // Created by Romario Chinloy on 10/27/20. | |||
| // | |||
| struct PusherArgs: Codable { | |||
| var appKey: String | |||
| var pusherOptions: PusherOptions | |||
| var initArgs: InitArgs | |||
| } | |||
| struct PusherOptions: Codable { | |||
| var auth: PusherAuth? | |||
| var cluster: String? | |||
| var host: String | |||
| var encrypted: Bool | |||
| var activityTimeout: Int | |||
| var pongTimeout: Int | |||
| var wsPort: Int | |||
| var wssPort: Int | |||
| var maxReconnectionAttempts: Int | |||
| var maxReconnectGapInSeconds: Int | |||
| } | |||
| struct PusherAuth: Codable { | |||
| var endpoint: String | |||
| var headers: [String: String] | |||
| } | |||
| struct InitArgs: Codable { | |||
| var enableLogging: Bool | |||
| } | |||
| struct AuthRequest: Codable { | |||
| var socket_id: String | |||
| var channel_name: String | |||
| var valueUrlEncoded: String? | |||
| init(socket_id: String, channel_name: String) { | |||
| self.socket_id = socket_id | |||
| self.channel_name = channel_name | |||
| self.valueUrlEncoded = "socket_id=\(socket_id)&channel_name=\(channel_name)" | |||
| } | |||
| private enum CodingKeys: String, CodingKey { | |||
| case socket_id, channel_name | |||
| } | |||
| } | |||
| struct EventStreamResult: Codable { | |||
| var connectionStateChange: ConnectionStateChange? | |||
| var connectionError: ConnectionError? | |||
| var pusherEvent: Event? | |||
| init(connectionStateChange: ConnectionStateChange) { | |||
| self.connectionStateChange = connectionStateChange | |||
| } | |||
| init(connectionError: ConnectionError) { | |||
| self.connectionError = connectionError | |||
| } | |||
| init(pusherEvent: Event) { | |||
| self.pusherEvent = pusherEvent | |||
| } | |||
| } | |||
| struct ConnectionStateChange: Codable { | |||
| var currentState: String | |||
| var previousState: String | |||
| init(currentState: String, previousState: String) { | |||
| self.currentState = currentState | |||
| self.previousState = previousState | |||
| } | |||
| } | |||
| struct ConnectionError: Codable { | |||
| var message: String | |||
| var code: String | |||
| var exception: String | |||
| init(message: String, code: String, exception: String) { | |||
| self.message = message | |||
| self.code = code | |||
| self.exception = exception | |||
| } | |||
| } | |||
| struct Event: Codable { | |||
| var eventName: String | |||
| var channelName: String? | |||
| var userId: String?; | |||
| var data: String?; | |||
| } | |||
| struct ClientEvent: Codable { | |||
| var eventName: String | |||
| var channelName: String | |||
| var data: String?; | |||
| } | |||
| @@ -0,0 +1,4 @@ | |||
| #import <Flutter/Flutter.h> | |||
| @interface PusherClientPlugin : NSObject<FlutterPlugin> | |||
| @end | |||
| @@ -0,0 +1,15 @@ | |||
| #import "PusherClientPlugin.h" | |||
| #if __has_include(<pusher_client/pusher_client-Swift.h>) | |||
| #import <pusher_client/pusher_client-Swift.h> | |||
| #else | |||
| // Support project import fallback if the generated compatibility header | |||
| // is not copied when this plugin is created as a library. | |||
| // https://forums.swift.org/t/swift-static-libraries-dont-copy-generated-objective-c-header/19816 | |||
| #import "pusher_client-Swift.h" | |||
| #endif | |||
| @implementation PusherClientPlugin | |||
| + (void)registerWithRegistrar:(NSObject<FlutterPluginRegistrar>*)registrar { | |||
| [SwiftPusherClientPlugin registerWithRegistrar:registrar]; | |||
| } | |||
| @end | |||
| @@ -0,0 +1,221 @@ | |||
| // | |||
| // PusherService.swift | |||
| // pusher_client | |||
| // | |||
| // Created by Romario Chinloy on 10/26/20. | |||
| // | |||
| import Flutter | |||
| import PusherSwiftWithEncryption | |||
| class PusherService: MChannel { | |||
| static let CHANNEL_NAME = "com.github.chinloyal/pusher_client" | |||
| static let EVENT_STREAM = "com.github.chinloyal/pusher_client_stream" | |||
| static let LOG_TAG = "PusherClientPlugin" | |||
| static let PRIVATE_PREFIX = "private-" | |||
| static let PRIVATE_ENCRYPTED_PREFIX = "private-encrypted-" | |||
| static let PRESENCE_PREFIX = "presence-" | |||
| private var _pusherInstance: Pusher! | |||
| private var bindedEvents = Dictionary<String, String>() | |||
| struct Utils { | |||
| static var enableLogging = true | |||
| static func debugLog(msg: String) { | |||
| if(enableLogging) { | |||
| debugPrint("D/\(PusherService.LOG_TAG): \(msg)") | |||
| } | |||
| } | |||
| static func errorLog(msg: String) { | |||
| if(enableLogging) { | |||
| debugPrint("E/\(PusherService.LOG_TAG): \(msg)") | |||
| } | |||
| } | |||
| } | |||
| func register(messenger: FlutterBinaryMessenger) { | |||
| let methodChannel = FlutterMethodChannel(name: PusherService.CHANNEL_NAME, binaryMessenger: messenger) | |||
| methodChannel.setMethodCallHandler { (_ call:FlutterMethodCall, result:@escaping FlutterResult) in | |||
| switch call.method { | |||
| case "init": | |||
| self.`init`(call, result: result) | |||
| case "connect": | |||
| self.connect(result: result) | |||
| case "disconnect": | |||
| self.disconnect(result: result) | |||
| case "getSocketId": | |||
| self.getSocketId(result: result) | |||
| case "subscribe": | |||
| self.subscribe(call, result: result) | |||
| case "unsubscribe": | |||
| self.unsubscribe(call, result: result) | |||
| case "bind": | |||
| self.bind(call, result: result) | |||
| case "unbind": | |||
| self.unbind(call, result: result) | |||
| case "trigger": | |||
| self.trigger(call, result: result) | |||
| default: | |||
| result(FlutterMethodNotImplemented) | |||
| } | |||
| } | |||
| let eventChannel = FlutterEventChannel(name: PusherService.EVENT_STREAM, binaryMessenger: messenger) | |||
| eventChannel.setStreamHandler(StreamHandler.default) | |||
| } | |||
| func `init`(_ call:FlutterMethodCall, result:@escaping FlutterResult) { | |||
| do { | |||
| let json = call.arguments as! String | |||
| let pusherArgs: PusherArgs = try JSONDecoder().decode(PusherArgs.self, from: json.data(using: .utf8)!) | |||
| Utils.enableLogging = pusherArgs.initArgs.enableLogging | |||
| if(_pusherInstance == nil) { | |||
| let pusherOptions = PusherClientOptions( | |||
| authMethod: pusherArgs.pusherOptions.auth == nil ? .noMethod : AuthMethod.authRequestBuilder(authRequestBuilder: AuthRequestBuilder(pusherAuth: pusherArgs.pusherOptions.auth!)), | |||
| host: pusherArgs.pusherOptions.cluster != nil ? .cluster(pusherArgs.pusherOptions.cluster!) : .host(pusherArgs.pusherOptions.host), | |||
| port: pusherArgs.pusherOptions.encrypted ? pusherArgs.pusherOptions.wssPort : pusherArgs.pusherOptions.wsPort, | |||
| useTLS: pusherArgs.pusherOptions.encrypted, | |||
| activityTimeout: Double(pusherArgs.pusherOptions.activityTimeout) / 1000 | |||
| ) | |||
| _pusherInstance = Pusher(key: pusherArgs.appKey, options: pusherOptions) | |||
| _pusherInstance.connection.reconnectAttemptsMax = pusherArgs.pusherOptions.maxReconnectionAttempts | |||
| _pusherInstance.connection.maxReconnectGapInSeconds = Double(pusherArgs.pusherOptions.maxReconnectGapInSeconds) | |||
| _pusherInstance.connection.pongResponseTimeoutInterval = Double(pusherArgs.pusherOptions.pongTimeout) / 1000 | |||
| _pusherInstance.connection.delegate = ConnectionListener.default | |||
| Utils.debugLog(msg: "Pusher initialized") | |||
| result(nil) | |||
| } | |||
| } catch let err { | |||
| Utils.errorLog(msg: err.localizedDescription) | |||
| result(FlutterError(code: "INIT_ERROR", message: err.localizedDescription, details: err)) | |||
| } | |||
| } | |||
| func connect(result:@escaping FlutterResult) { | |||
| _pusherInstance.connect() | |||
| result(nil) | |||
| } | |||
| func disconnect(result:@escaping FlutterResult) { | |||
| _pusherInstance.disconnect() | |||
| Utils.debugLog(msg: "Disconnect") | |||
| result(nil) | |||
| } | |||
| func getSocketId(result:@escaping FlutterResult) { | |||
| result(_pusherInstance.connection.socketId) | |||
| } | |||
| func subscribe(_ call:FlutterMethodCall, result:@escaping FlutterResult) { | |||
| let channelMap = call.arguments as! [String: String] | |||
| let channelName: String = channelMap["channelName"]! | |||
| var channel: PusherChannel | |||
| if(!channelName.starts(with: PusherService.PRESENCE_PREFIX)) { | |||
| channel = _pusherInstance.subscribe(channelName) | |||
| } else { | |||
| channel = _pusherInstance.subscribeToPresenceChannel(channelName: channelName) | |||
| for pEvent in Constants.PresenceEvents.allCases { | |||
| channel.bind(eventName: pEvent.rawValue, eventCallback: ChannelEventListener.default.onEvent) | |||
| } | |||
| } | |||
| for pEvent in Constants.Events.allCases { | |||
| channel.bind(eventName: pEvent.rawValue, eventCallback: ChannelEventListener.default.onEvent) | |||
| } | |||
| Utils.debugLog(msg: "Subscribed: \(channelName)") | |||
| result(nil) | |||
| } | |||
| func unsubscribe(_ call:FlutterMethodCall, result:@escaping FlutterResult) { | |||
| let channelMap = call.arguments as! [String: String] | |||
| let channelName: String = channelMap["channelName"]! | |||
| _pusherInstance.unsubscribe(channelName) | |||
| Utils.debugLog(msg: "Unsubscribed: \(channelName)") | |||
| result(nil) | |||
| } | |||
| /** | |||
| * Note binding can happen before the channel has been subscribed to | |||
| */ | |||
| func bind(_ call:FlutterMethodCall, result:@escaping FlutterResult) { | |||
| let map = call.arguments as! [String: String] | |||
| let channelName: String = map["channelName"]! | |||
| let eventName: String = map["eventName"]! | |||
| var channel: PusherChannel | |||
| if(!channelName.starts(with: PusherService.PRESENCE_PREFIX)) { | |||
| channel = _pusherInstance.connection.channels.find(name: channelName)! | |||
| bindedEvents[channelName + eventName] = channel.bind(eventName: eventName, eventCallback: ChannelEventListener.default.onEvent) | |||
| } else { | |||
| channel = _pusherInstance.connection.channels.findPresence(name: channelName)! | |||
| bindedEvents[channelName + eventName] = channel.bind(eventName: eventName, eventCallback: ChannelEventListener.default.onEvent) | |||
| } | |||
| Utils.debugLog(msg: "[BIND] \(eventName)") | |||
| result(nil) | |||
| } | |||
| func unbind(_ call:FlutterMethodCall, result:@escaping FlutterResult) { | |||
| let map = call.arguments as! [String: String] | |||
| let channelName: String = map["channelName"]! | |||
| let eventName: String = map["eventName"]! | |||
| var channel: PusherChannel | |||
| let callBackId = bindedEvents[channelName + eventName] | |||
| if(callBackId != nil) { | |||
| if(!channelName.starts(with: PusherService.PRESENCE_PREFIX)) { | |||
| channel = _pusherInstance.connection.channels.find(name: channelName)! | |||
| channel.unbind(eventName: eventName, callbackId: callBackId!) | |||
| } else { | |||
| channel = _pusherInstance.connection.channels.findPresence(name: channelName)! | |||
| channel.unbind(eventName: eventName, callbackId: callBackId!) | |||
| } | |||
| } | |||
| Utils.debugLog(msg: "[UNBIND] \(eventName)") | |||
| result(nil) | |||
| } | |||
| func trigger(_ call:FlutterMethodCall, result:@escaping FlutterResult) { | |||
| do { | |||
| let json = call.arguments as! String | |||
| let clientEvent: ClientEvent = try JSONDecoder().decode(ClientEvent.self, from: json.data(using: .utf8)!) | |||
| let channelName = clientEvent.channelName | |||
| let eventName = clientEvent.eventName | |||
| let data: String = clientEvent.data ?? "" | |||
| let errorMessage = "Trigger can only be called on private and presence channels." | |||
| switch clientEvent.channelName { | |||
| case _ where channelName.starts(with: PusherService.PRIVATE_ENCRYPTED_PREFIX): | |||
| result(FlutterError(code: "TRIGGER_ERROR", message: errorMessage, details: nil)) | |||
| case _ where channelName.starts(with: PusherService.PRIVATE_PREFIX): | |||
| let channel: PusherChannel = _pusherInstance.connection.channels.find(name: channelName)! | |||
| channel.trigger(eventName: eventName, data: data) | |||
| case _ where channelName.starts(with: PusherService.PRESENCE_PREFIX): | |||
| let channel: PusherPresenceChannel = _pusherInstance.connection.channels.findPresence(name: channelName)! | |||
| channel.trigger(eventName: eventName, data: data) | |||
| default: | |||
| result(FlutterError(code: "TRIGGER_ERROR", message: errorMessage, details: nil)) | |||
| } | |||
| Utils.debugLog(msg: "[TRIGGER] \(eventName)") | |||
| result(nil) | |||
| } catch let err { | |||
| Utils.errorLog(msg: err.localizedDescription) | |||
| result(FlutterError(code: "TRIGGER_ERROR", message: err.localizedDescription, details: err)) | |||
| } | |||
| } | |||
| } | |||
| @@ -0,0 +1,29 @@ | |||
| // | |||
| // StreamHandler.swift | |||
| // pusher_client | |||
| // | |||
| // Created by Romario Chinloy on 10/29/20. | |||
| // | |||
| class StreamHandler: NSObject, FlutterStreamHandler { | |||
| static let `default`: StreamHandler = StreamHandler() | |||
| private override init(){} | |||
| struct Utils { | |||
| static var eventSink: FlutterEventSink? | |||
| } | |||
| func onListen(withArguments arguments: Any?, eventSink events: @escaping FlutterEventSink) -> FlutterError? { | |||
| Utils.eventSink = events | |||
| PusherService.Utils.debugLog(msg: "Event stream listening...") | |||
| return nil | |||
| } | |||
| func onCancel(withArguments arguments: Any?) -> FlutterError? { | |||
| PusherService.Utils.debugLog(msg: "Event stream cancelled.") | |||
| return nil | |||
| } | |||
| } | |||