├── .gitignore ├── LICENSE ├── Makefile ├── README.md └── packages ├── pusher_beams ├── .gitignore ├── .metadata ├── CHANGELOG.md ├── LICENSE ├── README.md ├── analysis_options.yaml ├── example │ ├── .gitignore │ ├── .metadata │ ├── README.md │ ├── analysis_options.yaml │ ├── android │ │ ├── .gitignore │ │ ├── app │ │ │ ├── .gitignore │ │ │ ├── build.gradle │ │ │ └── src │ │ │ │ ├── debug │ │ │ │ └── AndroidManifest.xml │ │ │ │ ├── main │ │ │ │ ├── AndroidManifest.xml │ │ │ │ ├── kotlin │ │ │ │ │ └── com │ │ │ │ │ │ └── pusher │ │ │ │ │ │ ├── example │ │ │ │ │ │ └── MainActivity.kt │ │ │ │ │ │ └── pusher_beams_example │ │ │ │ │ │ └── MainActivity.kt │ │ │ │ └── res │ │ │ │ │ ├── drawable-v21 │ │ │ │ │ └── launch_background.xml │ │ │ │ │ ├── drawable │ │ │ │ │ └── launch_background.xml │ │ │ │ │ ├── mipmap-hdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── mipmap-mdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── mipmap-xhdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── mipmap-xxxhdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── values-night │ │ │ │ │ └── styles.xml │ │ │ │ │ └── values │ │ │ │ │ └── styles.xml │ │ │ │ └── profile │ │ │ │ └── AndroidManifest.xml │ │ ├── build.gradle │ │ ├── gradle.properties │ │ ├── gradle │ │ │ └── wrapper │ │ │ │ └── gradle-wrapper.properties │ │ └── settings.gradle │ ├── integration_test │ │ └── pusher_beams_test.dart │ ├── ios │ │ ├── .gitignore │ │ ├── Flutter │ │ │ ├── AppFrameworkInfo.plist │ │ │ ├── Debug.xcconfig │ │ │ └── Release.xcconfig │ │ ├── Podfile │ │ ├── Podfile.lock │ │ ├── Runner.xcodeproj │ │ │ ├── project.pbxproj │ │ │ ├── project.xcworkspace │ │ │ │ ├── contents.xcworkspacedata │ │ │ │ └── xcshareddata │ │ │ │ │ ├── IDEWorkspaceChecks.plist │ │ │ │ │ └── WorkspaceSettings.xcsettings │ │ │ └── xcshareddata │ │ │ │ └── xcschemes │ │ │ │ └── Runner.xcscheme │ │ ├── Runner.xcworkspace │ │ │ ├── contents.xcworkspacedata │ │ │ └── xcshareddata │ │ │ │ ├── IDEWorkspaceChecks.plist │ │ │ │ └── WorkspaceSettings.xcsettings │ │ └── Runner │ │ │ ├── AppDelegate.swift │ │ │ ├── Assets.xcassets │ │ │ ├── AppIcon.appiconset │ │ │ │ ├── Contents.json │ │ │ │ ├── Icon-App-1024x1024@1x.png │ │ │ │ ├── Icon-App-20x20@1x.png │ │ │ │ ├── Icon-App-20x20@2x.png │ │ │ │ ├── Icon-App-20x20@3x.png │ │ │ │ ├── Icon-App-29x29@1x.png │ │ │ │ ├── Icon-App-29x29@2x.png │ │ │ │ ├── Icon-App-29x29@3x.png │ │ │ │ ├── Icon-App-40x40@1x.png │ │ │ │ ├── Icon-App-40x40@2x.png │ │ │ │ ├── Icon-App-40x40@3x.png │ │ │ │ ├── Icon-App-60x60@2x.png │ │ │ │ ├── Icon-App-60x60@3x.png │ │ │ │ ├── Icon-App-76x76@1x.png │ │ │ │ ├── Icon-App-76x76@2x.png │ │ │ │ └── Icon-App-83.5x83.5@2x.png │ │ │ └── LaunchImage.imageset │ │ │ │ ├── Contents.json │ │ │ │ ├── LaunchImage.png │ │ │ │ ├── LaunchImage@2x.png │ │ │ │ ├── LaunchImage@3x.png │ │ │ │ └── README.md │ │ │ ├── Base.lproj │ │ │ ├── LaunchScreen.storyboard │ │ │ └── Main.storyboard │ │ │ ├── Info.plist │ │ │ ├── Runner-Bridging-Header.h │ │ │ └── Runner.entitlements │ ├── lib │ │ └── main.dart │ ├── pubspec.lock │ ├── pubspec.yaml │ ├── test │ │ └── widget_test.dart │ ├── test_driver │ │ └── integration_test.dart │ └── web │ │ ├── favicon.png │ │ ├── icons │ │ ├── Icon-192.png │ │ ├── Icon-512.png │ │ ├── Icon-maskable-192.png │ │ └── Icon-maskable-512.png │ │ ├── index.html │ │ ├── manifest.json │ │ └── service-worker.js ├── lib │ └── pusher_beams.dart ├── pubspec.lock ├── pubspec.yaml └── pusher_beams.iml ├── pusher_beams_android ├── .gitignore ├── .metadata ├── CHANGELOG.md ├── LICENSE ├── README.md ├── analysis_options.yaml ├── android │ ├── .gitignore │ ├── build.gradle │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ └── gradle-wrapper.properties │ ├── settings.gradle │ └── src │ │ └── main │ │ ├── AndroidManifest.xml │ │ ├── java │ │ └── com │ │ │ └── pusher │ │ │ └── pusher_beams │ │ │ └── Messages.java │ │ └── kotlin │ │ └── com │ │ └── pusher │ │ └── pusher_beams │ │ └── PusherBeamsPlugin.kt ├── pubspec.lock ├── pubspec.yaml └── pusher_beams_android.iml ├── pusher_beams_ios ├── .gitignore ├── .metadata ├── CHANGELOG.md ├── LICENSE ├── README.md ├── analysis_options.yaml ├── ios │ ├── .gitignore │ ├── Assets │ │ └── .gitkeep │ ├── Classes │ │ ├── PusherBeamsPlugin.h │ │ ├── PusherBeamsPlugin.m │ │ ├── SwiftPusherBeamsPlugin.swift │ │ ├── messages.h │ │ ├── messages.m │ │ └── pusher_beams_ios.h │ └── pusher_beams_ios.podspec ├── pubspec.lock ├── pubspec.yaml └── pusher_beams_ios.iml ├── pusher_beams_platform_interface ├── .gitignore ├── .metadata ├── CHANGELOG.md ├── LICENSE ├── Makefile ├── README.md ├── analysis_options.yaml ├── lib │ ├── method_channel_pusher_beams.dart │ └── pusher_beams_platform_interface.dart ├── pigeons │ └── messages.dart ├── pubspec.lock ├── pubspec.yaml └── test │ └── pusher_beams_platform_interface_test.dart └── pusher_beams_web ├── .gitignore ├── .metadata ├── CHANGELOG.md ├── LICENSE ├── README.md ├── analysis_options.yaml ├── lib ├── pusher_beams.dart └── pusher_beams_web.dart ├── pubspec.lock ├── pubspec.yaml └── pusher_beams_web.iml /.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015 Pusher Ltd. 2 | 3 | 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: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | 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. -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | 2 | replicate_readme: 3 | cp README.md packages/pusher_beams/README.md 4 | -------------------------------------------------------------------------------- /packages/pusher_beams/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .dart_tool/ 3 | 4 | .packages 5 | .pub/ 6 | 7 | build/ 8 | .idea/ -------------------------------------------------------------------------------- /packages/pusher_beams/.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: ffb2ecea5223acdd139a5039be2f9c796962833d 8 | channel: stable 9 | 10 | project_type: plugin 11 | -------------------------------------------------------------------------------- /packages/pusher_beams/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 1.1.2 2 | - Upgrade dependency versions 3 | 4 | ## 1.1.1 5 | - Fix `PusherBeamsPlugin.kt` `onNewIntent` null safety 6 | 7 | ## 1.1.0 8 | - Add a `getInitialMessage` method to accomplish deep-linking from a Push Notification 9 | 10 | ## 1.0.2 11 | - Foreground incoming push notifications handling support for Android and iOS 12 | 13 | ## 1.0.2-dev.3 14 | - Bump all dependencies 15 | 16 | ## 1.0.2-dev.2 17 | - Update iOS package to `1.0.3-dev.2` 18 | 19 | ## 1.0.2-dev.1 20 | - Update interface package to `1.0.4-dev.1`. 21 | - Updating platform packages. 22 | - Foreground incoming push notifications handling support for Android and iOS 23 | 24 | ## 1.0.1 25 | - Updating platform packages. 26 | - Update interface package to `1.0.3`. 27 | - Bug fixes. 28 | 29 | ## 1.0.0 30 | First official release of Pusher Beams for Flutter 🎉 31 | -------------------------------------------------------------------------------- /packages/pusher_beams/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015 Pusher Ltd. 2 | 3 | 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: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | 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. -------------------------------------------------------------------------------- /packages/pusher_beams/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | include: package:flutter_lints/flutter.yaml 2 | 3 | # Additional information about this file can be found at 4 | # https://dart.dev/guides/language/analysis-options 5 | -------------------------------------------------------------------------------- /packages/pusher_beams/example/.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | 12 | # IntelliJ related 13 | *.iml 14 | *.ipr 15 | *.iws 16 | .idea/ 17 | 18 | # The .vscode folder contains launch configuration and tasks you configure in 19 | # VS Code which you may wish to be included in version control, so this line 20 | # is commented out by default. 21 | #.vscode/ 22 | 23 | # Flutter/Dart/Pub related 24 | **/doc/api/ 25 | **/ios/Flutter/.last_build_id 26 | .dart_tool/ 27 | .flutter-plugins 28 | .flutter-plugins-dependencies 29 | .packages 30 | .pub-cache/ 31 | .pub/ 32 | /build/ 33 | 34 | # Web related 35 | lib/generated_plugin_registrant.dart 36 | 37 | # Symbolication related 38 | app.*.symbols 39 | 40 | # Obfuscation related 41 | app.*.map.json 42 | 43 | # Android Studio will place build artifacts here 44 | /android/app/debug 45 | /android/app/profile 46 | /android/app/release 47 | -------------------------------------------------------------------------------- /packages/pusher_beams/example/.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: ffb2ecea5223acdd139a5039be2f9c796962833d 8 | channel: stable 9 | 10 | project_type: app 11 | -------------------------------------------------------------------------------- /packages/pusher_beams/example/README.md: -------------------------------------------------------------------------------- 1 | # pusher_beams_example 2 | 3 | Demonstrates how to use the pusher_beams plugin. 4 | 5 | ## Getting Started 6 | 7 | This project is a starting point for a Flutter application. 8 | 9 | A few resources to get you started if this is your first Flutter project: 10 | 11 | - [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab) 12 | - [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook) 13 | 14 | For help getting started with Flutter, view our 15 | [online documentation](https://flutter.dev/docs), which offers tutorials, 16 | samples, guidance on mobile development, and a full API reference. 17 | -------------------------------------------------------------------------------- /packages/pusher_beams/example/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | # This file configures the analyzer, which statically analyzes Dart code to 2 | # check for errors, warnings, and lints. 3 | # 4 | # The issues identified by the analyzer are surfaced in the UI of Dart-enabled 5 | # IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be 6 | # invoked from the command line by running `flutter analyze`. 7 | 8 | # The following line activates a set of recommended lints for Flutter apps, 9 | # packages, and plugins designed to encourage good coding practices. 10 | include: package:flutter_lints/flutter.yaml 11 | 12 | linter: 13 | # The lint rules applied to this project can be customized in the 14 | # section below to disable rules from the `package:flutter_lints/flutter.yaml` 15 | # included above or to enable additional rules. A list of all available lints 16 | # and their documentation is published at 17 | # https://dart-lang.github.io/linter/lints/index.html. 18 | # 19 | # Instead of disabling a lint rule for the entire project in the 20 | # section below, it can also be suppressed for a single line of code 21 | # or a specific dart file by using the `// ignore: name_of_lint` and 22 | # `// ignore_for_file: name_of_lint` syntax on the line or in the file 23 | # producing the lint. 24 | rules: 25 | # avoid_print: false # Uncomment to disable the `avoid_print` rule 26 | # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule 27 | 28 | # Additional information about this file can be found at 29 | # https://dart.dev/guides/language/analysis-options 30 | -------------------------------------------------------------------------------- /packages/pusher_beams/example/android/.gitignore: -------------------------------------------------------------------------------- 1 | gradle-wrapper.jar 2 | /.gradle 3 | /captures/ 4 | /gradlew 5 | /gradlew.bat 6 | /local.properties 7 | GeneratedPluginRegistrant.java 8 | 9 | # Remember to never publicly share your keystore. 10 | # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app 11 | key.properties 12 | **/*.keystore 13 | **/*.jks 14 | -------------------------------------------------------------------------------- /packages/pusher_beams/example/android/app/.gitignore: -------------------------------------------------------------------------------- 1 | google-services.json -------------------------------------------------------------------------------- /packages/pusher_beams/example/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | def localProperties = new Properties() 2 | def localPropertiesFile = rootProject.file('local.properties') 3 | if (localPropertiesFile.exists()) { 4 | localPropertiesFile.withReader('UTF-8') { reader -> 5 | localProperties.load(reader) 6 | } 7 | } 8 | 9 | def flutterRoot = localProperties.getProperty('flutter.sdk') 10 | if (flutterRoot == null) { 11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") 12 | } 13 | 14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode') 15 | if (flutterVersionCode == null) { 16 | flutterVersionCode = '1' 17 | } 18 | 19 | def flutterVersionName = localProperties.getProperty('flutter.versionName') 20 | if (flutterVersionName == null) { 21 | flutterVersionName = '1.0' 22 | } 23 | 24 | apply plugin: 'com.android.application' 25 | apply plugin: 'kotlin-android' 26 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 27 | 28 | // Add this line (Flutter Pusher Beams) 29 | apply plugin: 'com.google.gms.google-services' 30 | 31 | android { 32 | compileSdkVersion 31 33 | 34 | compileOptions { 35 | sourceCompatibility JavaVersion.VERSION_1_8 36 | targetCompatibility JavaVersion.VERSION_1_8 37 | } 38 | 39 | kotlinOptions { 40 | jvmTarget = '1.8' 41 | } 42 | 43 | sourceSets { 44 | main.java.srcDirs += 'src/main/kotlin' 45 | } 46 | 47 | defaultConfig { 48 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 49 | applicationId "com.pusher.pusher_beams_example" 50 | minSdkVersion 19 51 | targetSdkVersion 31 52 | versionCode flutterVersionCode.toInteger() 53 | versionName flutterVersionName 54 | multiDexEnabled true 55 | } 56 | 57 | buildTypes { 58 | release { 59 | // TODO: Add your own signing config for the release build. 60 | // Signing with the debug keys for now, so `flutter run --release` works. 61 | signingConfig signingConfigs.debug 62 | } 63 | } 64 | } 65 | 66 | flutter { 67 | source '../..' 68 | } 69 | 70 | dependencies { 71 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 72 | implementation 'com.android.support:multidex:1.0.3' 73 | } 74 | -------------------------------------------------------------------------------- /packages/pusher_beams/example/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /packages/pusher_beams/example/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 14 | 18 | 22 | 27 | 31 | 32 | 33 | 34 | 35 | 36 | 38 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /packages/pusher_beams/example/android/app/src/main/kotlin/com/pusher/example/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.pusher.example 2 | 3 | import io.flutter.embedding.android.FlutterActivity 4 | 5 | class MainActivity: FlutterActivity() { 6 | } 7 | -------------------------------------------------------------------------------- /packages/pusher_beams/example/android/app/src/main/kotlin/com/pusher/pusher_beams_example/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.pusher.pusher_beams_example 2 | 3 | import io.flutter.embedding.android.FlutterActivity 4 | 5 | class MainActivity: FlutterActivity() { 6 | } 7 | -------------------------------------------------------------------------------- /packages/pusher_beams/example/android/app/src/main/res/drawable-v21/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /packages/pusher_beams/example/android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /packages/pusher_beams/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pusher/push-notifications-flutter/1f77be1871e822d1608743b02e06fc6916b82495/packages/pusher_beams/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /packages/pusher_beams/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pusher/push-notifications-flutter/1f77be1871e822d1608743b02e06fc6916b82495/packages/pusher_beams/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /packages/pusher_beams/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pusher/push-notifications-flutter/1f77be1871e822d1608743b02e06fc6916b82495/packages/pusher_beams/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /packages/pusher_beams/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pusher/push-notifications-flutter/1f77be1871e822d1608743b02e06fc6916b82495/packages/pusher_beams/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /packages/pusher_beams/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pusher/push-notifications-flutter/1f77be1871e822d1608743b02e06fc6916b82495/packages/pusher_beams/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /packages/pusher_beams/example/android/app/src/main/res/values-night/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /packages/pusher_beams/example/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /packages/pusher_beams/example/android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /packages/pusher_beams/example/android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext.kotlin_version = '1.5.30' 3 | repositories { 4 | google() 5 | mavenCentral() 6 | } 7 | 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:4.1.0' 10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 11 | 12 | // Add this line (Flutter Pusher Beams) 13 | classpath 'com.google.gms:google-services:4.3.8' 14 | } 15 | } 16 | 17 | allprojects { 18 | repositories { 19 | google() 20 | mavenCentral() 21 | } 22 | } 23 | 24 | rootProject.buildDir = '../build' 25 | subprojects { 26 | project.buildDir = "${rootProject.buildDir}/${project.name}" 27 | project.evaluationDependsOn(':app') 28 | } 29 | 30 | task clean(type: Delete) { 31 | delete rootProject.buildDir 32 | } 33 | -------------------------------------------------------------------------------- /packages/pusher_beams/example/android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.useAndroidX=true 3 | android.enableJetifier=true 4 | -------------------------------------------------------------------------------- /packages/pusher_beams/example/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Jun 23 08:50:38 CEST 2017 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip 7 | -------------------------------------------------------------------------------- /packages/pusher_beams/example/android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | 3 | def localPropertiesFile = new File(rootProject.projectDir, "local.properties") 4 | def properties = new Properties() 5 | 6 | assert localPropertiesFile.exists() 7 | localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } 8 | 9 | def flutterSdkPath = properties.getProperty("flutter.sdk") 10 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties" 11 | apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" 12 | -------------------------------------------------------------------------------- /packages/pusher_beams/example/integration_test/pusher_beams_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_test/flutter_test.dart'; 2 | import 'package:integration_test/integration_test.dart'; 3 | import 'package:pusher_beams/pusher_beams.dart'; 4 | 5 | const instanceId = 'your-instance-id'; 6 | 7 | void main() { 8 | IntegrationTestWidgetsFlutterBinding.ensureInitialized(); 9 | 10 | const List interestToTest = ['test-1', 'test-2', 'test-3']; 11 | 12 | const String individualInterest = 'test-4'; 13 | 14 | group('$PusherBeams', () { 15 | tearDown(() { 16 | PusherBeams.instance.stop(); 17 | }); 18 | 19 | testWidgets('start', (WidgetTester tester) async { 20 | await PusherBeams.instance.start(instanceId); 21 | }); 22 | 23 | testWidgets('setDeviceInterests', (WidgetTester tester) async { 24 | await PusherBeams.instance.setDeviceInterests(interestToTest); 25 | 26 | final List interests = await PusherBeams.instance.getDeviceInterests(); 27 | 28 | expect(interests.length, interestToTest.length); 29 | }); 30 | 31 | testWidgets('getDeviceInterests', (WidgetTester tester) async { 32 | final List interests = 33 | await PusherBeams.instance.getDeviceInterests(); 34 | 35 | expect(interests, []); 36 | }); 37 | 38 | testWidgets('clearDeviceInterests', (WidgetTester tester) async { 39 | await PusherBeams.instance.clearDeviceInterests(); 40 | 41 | final List interests = 42 | await PusherBeams.instance.getDeviceInterests(); 43 | 44 | expect(interests.length, 0); 45 | }); 46 | 47 | testWidgets('addDeviceInterest', (WidgetTester tester) async { 48 | await PusherBeams.instance.addDeviceInterest(individualInterest); 49 | 50 | final List interests = await PusherBeams.instance.getDeviceInterests(); 51 | 52 | expect(interests, [individualInterest]); 53 | }); 54 | 55 | testWidgets('clearAllState', (WidgetTester tester) async { 56 | await PusherBeams.instance.clearAllState(); 57 | }); 58 | }); 59 | } 60 | -------------------------------------------------------------------------------- /packages/pusher_beams/example/ios/.gitignore: -------------------------------------------------------------------------------- 1 | *.mode1v3 2 | *.mode2v3 3 | *.moved-aside 4 | *.pbxuser 5 | *.perspectivev3 6 | **/*sync/ 7 | .sconsign.dblite 8 | .tags* 9 | **/.vagrant/ 10 | **/DerivedData/ 11 | Icon? 12 | **/Pods/ 13 | **/.symlinks/ 14 | profile 15 | xcuserdata 16 | **/.generated/ 17 | Flutter/App.framework 18 | Flutter/Flutter.framework 19 | Flutter/Flutter.podspec 20 | Flutter/Generated.xcconfig 21 | Flutter/ephemeral/ 22 | Flutter/app.flx 23 | Flutter/app.zip 24 | Flutter/flutter_assets/ 25 | Flutter/flutter_export_environment.sh 26 | ServiceDefinitions.json 27 | Runner/GeneratedPluginRegistrant.* 28 | 29 | # Exceptions to above rules. 30 | !default.mode1v3 31 | !default.mode2v3 32 | !default.pbxuser 33 | !default.perspectivev3 34 | 35 | GoogleService-Info.plist 36 | -------------------------------------------------------------------------------- /packages/pusher_beams/example/ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 9.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /packages/pusher_beams/example/ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /packages/pusher_beams/example/ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /packages/pusher_beams/example/ios/Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment this line to define a global platform for your project 2 | # platform :ios, '9.0' 3 | 4 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency. 5 | ENV['COCOAPODS_DISABLE_STATS'] = 'true' 6 | 7 | project 'Runner', { 8 | 'Debug' => :debug, 9 | 'Profile' => :release, 10 | 'Release' => :release, 11 | } 12 | 13 | def flutter_root 14 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__) 15 | unless File.exist?(generated_xcode_build_settings_path) 16 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first" 17 | end 18 | 19 | File.foreach(generated_xcode_build_settings_path) do |line| 20 | matches = line.match(/FLUTTER_ROOT\=(.*)/) 21 | return matches[1].strip if matches 22 | end 23 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get" 24 | end 25 | 26 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) 27 | 28 | flutter_ios_podfile_setup 29 | 30 | target 'Runner' do 31 | use_frameworks! 32 | use_modular_headers! 33 | 34 | flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) 35 | end 36 | 37 | post_install do |installer| 38 | installer.pods_project.targets.each do |target| 39 | flutter_additional_ios_build_settings(target) 40 | end 41 | end 42 | -------------------------------------------------------------------------------- /packages/pusher_beams/example/ios/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - Firebase/CoreOnly (8.9.0): 3 | - FirebaseCore (= 8.9.0) 4 | - Firebase/Messaging (8.9.0): 5 | - Firebase/CoreOnly 6 | - FirebaseMessaging (~> 8.9.0) 7 | - firebase_core (1.10.1): 8 | - Firebase/CoreOnly (= 8.9.0) 9 | - Flutter 10 | - firebase_messaging (11.2.0): 11 | - Firebase/Messaging (= 8.9.0) 12 | - firebase_core 13 | - Flutter 14 | - FirebaseCore (8.9.0): 15 | - FirebaseCoreDiagnostics (~> 8.0) 16 | - GoogleUtilities/Environment (~> 7.6) 17 | - GoogleUtilities/Logger (~> 7.6) 18 | - FirebaseCoreDiagnostics (8.10.0): 19 | - GoogleDataTransport (~> 9.1) 20 | - GoogleUtilities/Environment (~> 7.6) 21 | - GoogleUtilities/Logger (~> 7.6) 22 | - nanopb (~> 2.30908.0) 23 | - FirebaseInstallations (8.10.0): 24 | - FirebaseCore (~> 8.0) 25 | - GoogleUtilities/Environment (~> 7.6) 26 | - GoogleUtilities/UserDefaults (~> 7.6) 27 | - PromisesObjC (< 3.0, >= 1.2) 28 | - FirebaseMessaging (8.9.0): 29 | - FirebaseCore (~> 8.0) 30 | - FirebaseInstallations (~> 8.0) 31 | - GoogleDataTransport (~> 9.1) 32 | - GoogleUtilities/AppDelegateSwizzler (~> 7.6) 33 | - GoogleUtilities/Environment (~> 7.6) 34 | - GoogleUtilities/Reachability (~> 7.6) 35 | - GoogleUtilities/UserDefaults (~> 7.6) 36 | - nanopb (~> 2.30908.0) 37 | - Flutter (1.0.0) 38 | - GoogleDataTransport (9.1.2): 39 | - GoogleUtilities/Environment (~> 7.2) 40 | - nanopb (~> 2.30908.0) 41 | - PromisesObjC (< 3.0, >= 1.2) 42 | - GoogleUtilities/AppDelegateSwizzler (7.6.0): 43 | - GoogleUtilities/Environment 44 | - GoogleUtilities/Logger 45 | - GoogleUtilities/Network 46 | - GoogleUtilities/Environment (7.6.0): 47 | - PromisesObjC (< 3.0, >= 1.2) 48 | - GoogleUtilities/Logger (7.6.0): 49 | - GoogleUtilities/Environment 50 | - GoogleUtilities/Network (7.6.0): 51 | - GoogleUtilities/Logger 52 | - "GoogleUtilities/NSData+zlib" 53 | - GoogleUtilities/Reachability 54 | - "GoogleUtilities/NSData+zlib (7.6.0)" 55 | - GoogleUtilities/Reachability (7.6.0): 56 | - GoogleUtilities/Logger 57 | - GoogleUtilities/UserDefaults (7.6.0): 58 | - GoogleUtilities/Logger 59 | - integration_test (0.0.1): 60 | - Flutter 61 | - nanopb (2.30908.0): 62 | - nanopb/decode (= 2.30908.0) 63 | - nanopb/encode (= 2.30908.0) 64 | - nanopb/decode (2.30908.0) 65 | - nanopb/encode (2.30908.0) 66 | - PromisesObjC (2.0.0) 67 | - pusher_beams_ios (0.0.1): 68 | - Flutter 69 | - PushNotifications (~> 4.0) 70 | - PushNotifications (4.0.0) 71 | 72 | DEPENDENCIES: 73 | - firebase_core (from `.symlinks/plugins/firebase_core/ios`) 74 | - firebase_messaging (from `.symlinks/plugins/firebase_messaging/ios`) 75 | - Flutter (from `Flutter`) 76 | - integration_test (from `.symlinks/plugins/integration_test/ios`) 77 | - pusher_beams_ios (from `.symlinks/plugins/pusher_beams_ios/ios`) 78 | 79 | SPEC REPOS: 80 | trunk: 81 | - Firebase 82 | - FirebaseCore 83 | - FirebaseCoreDiagnostics 84 | - FirebaseInstallations 85 | - FirebaseMessaging 86 | - GoogleDataTransport 87 | - GoogleUtilities 88 | - nanopb 89 | - PromisesObjC 90 | - PushNotifications 91 | 92 | EXTERNAL SOURCES: 93 | firebase_core: 94 | :path: ".symlinks/plugins/firebase_core/ios" 95 | firebase_messaging: 96 | :path: ".symlinks/plugins/firebase_messaging/ios" 97 | Flutter: 98 | :path: Flutter 99 | integration_test: 100 | :path: ".symlinks/plugins/integration_test/ios" 101 | pusher_beams_ios: 102 | :path: ".symlinks/plugins/pusher_beams_ios/ios" 103 | 104 | SPEC CHECKSUMS: 105 | Firebase: 13d8d96499e2635428d5bf0ec675df21f95d9a95 106 | firebase_core: a54a31c48d516674649f419aea823585c4652ae0 107 | firebase_messaging: 4f7eab3f100c30d0544f5a6f6ca549f7f8c12705 108 | FirebaseCore: 599ee609343eaf4941bd188f85e3aa077ffe325b 109 | FirebaseCoreDiagnostics: 56fb7216d87e0e6ec2feddefa9d8a392fe8b2c18 110 | FirebaseInstallations: 830327b45345ffc859eaa9c17bcd5ae893fd5425 111 | FirebaseMessaging: 82c4a48638f53f7b184f3cc9f6cd2cbe533ab316 112 | Flutter: 50d75fe2f02b26cc09d224853bb45737f8b3214a 113 | GoogleDataTransport: 629c20a4d363167143f30ea78320d5a7eb8bd940 114 | GoogleUtilities: 684ee790a24f73ebb2d1d966e9711c203f2a4237 115 | integration_test: a1e7d09bd98eca2fc37aefd79d4f41ad37bdbbe5 116 | nanopb: a0ba3315591a9ae0a16a309ee504766e90db0c96 117 | PromisesObjC: 68159ce6952d93e17b2dfe273b8c40907db5ba58 118 | pusher_beams_ios: ffa40d5980ffba3ecddabab52477b340d208130e 119 | PushNotifications: 2b2174b28bf48b1fe552686d1f95c53d62a4781d 120 | 121 | PODFILE CHECKSUM: aafe91acc616949ddb318b77800a7f51bffa2a4c 122 | 123 | COCOAPODS: 1.11.2 124 | -------------------------------------------------------------------------------- /packages/pusher_beams/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /packages/pusher_beams/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /packages/pusher_beams/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /packages/pusher_beams/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /packages/pusher_beams/example/ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /packages/pusher_beams/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /packages/pusher_beams/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /packages/pusher_beams/example/ios/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | import Flutter 3 | 4 | @UIApplicationMain 5 | @objc class AppDelegate: FlutterAppDelegate { 6 | override func application( 7 | _ application: UIApplication, 8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? 9 | ) -> Bool { 10 | GeneratedPluginRegistrant.register(with: self) 11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /packages/pusher_beams/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "20x20", 5 | "idiom" : "iphone", 6 | "filename" : "Icon-App-20x20@2x.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "20x20", 11 | "idiom" : "iphone", 12 | "filename" : "Icon-App-20x20@3x.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "Icon-App-29x29@1x.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "29x29", 23 | "idiom" : "iphone", 24 | "filename" : "Icon-App-29x29@2x.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "29x29", 29 | "idiom" : "iphone", 30 | "filename" : "Icon-App-29x29@3x.png", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "size" : "40x40", 35 | "idiom" : "iphone", 36 | "filename" : "Icon-App-40x40@2x.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "40x40", 41 | "idiom" : "iphone", 42 | "filename" : "Icon-App-40x40@3x.png", 43 | "scale" : "3x" 44 | }, 45 | { 46 | "size" : "60x60", 47 | "idiom" : "iphone", 48 | "filename" : "Icon-App-60x60@2x.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "60x60", 53 | "idiom" : "iphone", 54 | "filename" : "Icon-App-60x60@3x.png", 55 | "scale" : "3x" 56 | }, 57 | { 58 | "size" : "20x20", 59 | "idiom" : "ipad", 60 | "filename" : "Icon-App-20x20@1x.png", 61 | "scale" : "1x" 62 | }, 63 | { 64 | "size" : "20x20", 65 | "idiom" : "ipad", 66 | "filename" : "Icon-App-20x20@2x.png", 67 | "scale" : "2x" 68 | }, 69 | { 70 | "size" : "29x29", 71 | "idiom" : "ipad", 72 | "filename" : "Icon-App-29x29@1x.png", 73 | "scale" : "1x" 74 | }, 75 | { 76 | "size" : "29x29", 77 | "idiom" : "ipad", 78 | "filename" : "Icon-App-29x29@2x.png", 79 | "scale" : "2x" 80 | }, 81 | { 82 | "size" : "40x40", 83 | "idiom" : "ipad", 84 | "filename" : "Icon-App-40x40@1x.png", 85 | "scale" : "1x" 86 | }, 87 | { 88 | "size" : "40x40", 89 | "idiom" : "ipad", 90 | "filename" : "Icon-App-40x40@2x.png", 91 | "scale" : "2x" 92 | }, 93 | { 94 | "size" : "76x76", 95 | "idiom" : "ipad", 96 | "filename" : "Icon-App-76x76@1x.png", 97 | "scale" : "1x" 98 | }, 99 | { 100 | "size" : "76x76", 101 | "idiom" : "ipad", 102 | "filename" : "Icon-App-76x76@2x.png", 103 | "scale" : "2x" 104 | }, 105 | { 106 | "size" : "83.5x83.5", 107 | "idiom" : "ipad", 108 | "filename" : "Icon-App-83.5x83.5@2x.png", 109 | "scale" : "2x" 110 | }, 111 | { 112 | "size" : "1024x1024", 113 | "idiom" : "ios-marketing", 114 | "filename" : "Icon-App-1024x1024@1x.png", 115 | "scale" : "1x" 116 | } 117 | ], 118 | "info" : { 119 | "version" : 1, 120 | "author" : "xcode" 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /packages/pusher_beams/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pusher/push-notifications-flutter/1f77be1871e822d1608743b02e06fc6916b82495/packages/pusher_beams/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /packages/pusher_beams/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pusher/push-notifications-flutter/1f77be1871e822d1608743b02e06fc6916b82495/packages/pusher_beams/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /packages/pusher_beams/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pusher/push-notifications-flutter/1f77be1871e822d1608743b02e06fc6916b82495/packages/pusher_beams/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /packages/pusher_beams/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pusher/push-notifications-flutter/1f77be1871e822d1608743b02e06fc6916b82495/packages/pusher_beams/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /packages/pusher_beams/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pusher/push-notifications-flutter/1f77be1871e822d1608743b02e06fc6916b82495/packages/pusher_beams/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /packages/pusher_beams/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pusher/push-notifications-flutter/1f77be1871e822d1608743b02e06fc6916b82495/packages/pusher_beams/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /packages/pusher_beams/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pusher/push-notifications-flutter/1f77be1871e822d1608743b02e06fc6916b82495/packages/pusher_beams/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /packages/pusher_beams/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pusher/push-notifications-flutter/1f77be1871e822d1608743b02e06fc6916b82495/packages/pusher_beams/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /packages/pusher_beams/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pusher/push-notifications-flutter/1f77be1871e822d1608743b02e06fc6916b82495/packages/pusher_beams/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /packages/pusher_beams/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pusher/push-notifications-flutter/1f77be1871e822d1608743b02e06fc6916b82495/packages/pusher_beams/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /packages/pusher_beams/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pusher/push-notifications-flutter/1f77be1871e822d1608743b02e06fc6916b82495/packages/pusher_beams/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /packages/pusher_beams/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pusher/push-notifications-flutter/1f77be1871e822d1608743b02e06fc6916b82495/packages/pusher_beams/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /packages/pusher_beams/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pusher/push-notifications-flutter/1f77be1871e822d1608743b02e06fc6916b82495/packages/pusher_beams/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /packages/pusher_beams/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pusher/push-notifications-flutter/1f77be1871e822d1608743b02e06fc6916b82495/packages/pusher_beams/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /packages/pusher_beams/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pusher/push-notifications-flutter/1f77be1871e822d1608743b02e06fc6916b82495/packages/pusher_beams/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /packages/pusher_beams/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchImage.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchImage@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "LaunchImage@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /packages/pusher_beams/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pusher/push-notifications-flutter/1f77be1871e822d1608743b02e06fc6916b82495/packages/pusher_beams/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /packages/pusher_beams/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pusher/push-notifications-flutter/1f77be1871e822d1608743b02e06fc6916b82495/packages/pusher_beams/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /packages/pusher_beams/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pusher/push-notifications-flutter/1f77be1871e822d1608743b02e06fc6916b82495/packages/pusher_beams/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /packages/pusher_beams/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md: -------------------------------------------------------------------------------- 1 | # Launch Screen Assets 2 | 3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory. 4 | 5 | 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. -------------------------------------------------------------------------------- /packages/pusher_beams/example/ios/Runner/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /packages/pusher_beams/example/ios/Runner/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /packages/pusher_beams/example/ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | pusher_beams_example 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | $(FLUTTER_BUILD_NAME) 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(FLUTTER_BUILD_NUMBER) 23 | LSRequiresIPhoneOS 24 | 25 | NSAppTransportSecurity 26 | 27 | NSAllowsLocalNetworking 28 | 29 | 30 | UIBackgroundModes 31 | 32 | fetch 33 | remote-notification 34 | 35 | UILaunchStoryboardName 36 | LaunchScreen 37 | UIMainStoryboardFile 38 | Main 39 | UISupportedInterfaceOrientations 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationLandscapeLeft 43 | UIInterfaceOrientationLandscapeRight 44 | 45 | UISupportedInterfaceOrientations~ipad 46 | 47 | UIInterfaceOrientationPortrait 48 | UIInterfaceOrientationPortraitUpsideDown 49 | UIInterfaceOrientationLandscapeLeft 50 | UIInterfaceOrientationLandscapeRight 51 | 52 | UIViewControllerBasedStatusBarAppearance 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /packages/pusher_beams/example/ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" 2 | -------------------------------------------------------------------------------- /packages/pusher_beams/example/ios/Runner/Runner.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | aps-environment 6 | development 7 | 8 | 9 | -------------------------------------------------------------------------------- /packages/pusher_beams/example/lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/foundation.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:pusher_beams/pusher_beams.dart'; 4 | 5 | void main() async { 6 | WidgetsFlutterBinding.ensureInitialized(); 7 | 8 | await PusherBeams.instance.start( 9 | 'your-instance-id'); // Supply your own instanceId 10 | 11 | runApp(const MyApp()); 12 | } 13 | 14 | class MyApp extends StatelessWidget { 15 | const MyApp({Key? key}) : super(key: key); 16 | 17 | @override 18 | Widget build(BuildContext context) { 19 | return MaterialApp( 20 | title: 'Pusher Beams Flutter Example', 21 | theme: ThemeData(primarySwatch: Colors.blue), 22 | home: const MyHomePage(title: 'Pusher Beams Flutter Example'), 23 | ); 24 | } 25 | } 26 | 27 | class MyHomePage extends StatefulWidget { 28 | const MyHomePage({Key? key, required this.title}) : super(key: key); 29 | final String title; 30 | 31 | @override 32 | State createState() => _MyHomePageState(); 33 | } 34 | 35 | class _MyHomePageState extends State { 36 | @override 37 | initState() { 38 | super.initState(); 39 | 40 | initPusherBeams(); 41 | } 42 | 43 | getSecure() async { 44 | final BeamsAuthProvider provider = BeamsAuthProvider() 45 | ..authUrl = 'https://some-auth-url.com/secure' 46 | ..headers = {'Content-Type': 'application/json'} 47 | ..queryParams = {'page': '1'} 48 | ..credentials = 'omit'; 49 | 50 | await PusherBeams.instance.setUserId( 51 | 'user-id', 52 | provider, 53 | (error) => { 54 | if (error != null) {print(error)} 55 | 56 | // Success! Do something... 57 | }); 58 | } 59 | 60 | initPusherBeams() async { 61 | // Let's see our current interests 62 | print(await PusherBeams.instance.getDeviceInterests()); 63 | 64 | // This is not intented to use in web 65 | if (!kIsWeb) { 66 | await PusherBeams.instance 67 | .onInterestChanges((interests) => {print('Interests: $interests')}); 68 | 69 | await PusherBeams.instance 70 | .onMessageReceivedInTheForeground(_onMessageReceivedInTheForeground); 71 | } 72 | await _checkForInitialMessage(); 73 | } 74 | 75 | Future _checkForInitialMessage() async { 76 | final initialMessage = await PusherBeams.instance.getInitialMessage(); 77 | if (initialMessage != null) { 78 | _showAlert('Initial Message Is:', initialMessage.toString()); 79 | } 80 | } 81 | 82 | void _onMessageReceivedInTheForeground(Map data) { 83 | _showAlert(data["title"].toString(), data["body"].toString()); 84 | } 85 | 86 | void _showAlert(String title, String message) { 87 | AlertDialog alert = AlertDialog( 88 | title: Text(title), content: Text(message), actions: const []); 89 | 90 | showDialog( 91 | context: context, 92 | builder: (BuildContext context) { 93 | return alert; 94 | }, 95 | ); 96 | } 97 | 98 | @override 99 | Widget build(BuildContext context) { 100 | return MaterialApp( 101 | home: Scaffold( 102 | appBar: AppBar( 103 | title: const Text('Plugin example app'), 104 | ), 105 | body: Column( 106 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 107 | crossAxisAlignment: CrossAxisAlignment.center, 108 | children: [ 109 | OutlinedButton( 110 | onPressed: () async { 111 | await PusherBeams.instance.addDeviceInterest('bananas'); 112 | }, 113 | child: const Text('I like bananas')), 114 | OutlinedButton( 115 | onPressed: () async { 116 | await PusherBeams.instance.removeDeviceInterest('bananas'); 117 | }, 118 | child: const Text("I don't like banana anymore")), 119 | OutlinedButton( 120 | onPressed: () async { 121 | await PusherBeams.instance.addDeviceInterest('apples'); 122 | }, 123 | child: const Text('I like apples')), 124 | OutlinedButton( 125 | onPressed: () async { 126 | await PusherBeams.instance.addDeviceInterest('garlic'); 127 | }, 128 | child: const Text('I like garlic')), 129 | OutlinedButton( 130 | onPressed: getSecure, child: const Text('Get Secure')), 131 | OutlinedButton( 132 | onPressed: () async { 133 | await PusherBeams.instance.clearDeviceInterests(); 134 | }, 135 | child: const Text('Clear my interests')) 136 | ], 137 | ), 138 | ), 139 | ); 140 | } 141 | } 142 | -------------------------------------------------------------------------------- /packages/pusher_beams/example/pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | archive: 5 | dependency: transitive 6 | description: 7 | name: archive 8 | url: "https://pub.dartlang.org" 9 | source: hosted 10 | version: "3.1.6" 11 | async: 12 | dependency: transitive 13 | description: 14 | name: async 15 | url: "https://pub.dartlang.org" 16 | source: hosted 17 | version: "2.8.2" 18 | boolean_selector: 19 | dependency: transitive 20 | description: 21 | name: boolean_selector 22 | url: "https://pub.dartlang.org" 23 | source: hosted 24 | version: "2.1.0" 25 | characters: 26 | dependency: transitive 27 | description: 28 | name: characters 29 | url: "https://pub.dartlang.org" 30 | source: hosted 31 | version: "1.2.0" 32 | charcode: 33 | dependency: transitive 34 | description: 35 | name: charcode 36 | url: "https://pub.dartlang.org" 37 | source: hosted 38 | version: "1.3.1" 39 | clock: 40 | dependency: transitive 41 | description: 42 | name: clock 43 | url: "https://pub.dartlang.org" 44 | source: hosted 45 | version: "1.1.0" 46 | collection: 47 | dependency: transitive 48 | description: 49 | name: collection 50 | url: "https://pub.dartlang.org" 51 | source: hosted 52 | version: "1.15.0" 53 | crypto: 54 | dependency: transitive 55 | description: 56 | name: crypto 57 | url: "https://pub.dartlang.org" 58 | source: hosted 59 | version: "3.0.1" 60 | cupertino_icons: 61 | dependency: "direct main" 62 | description: 63 | name: cupertino_icons 64 | url: "https://pub.dartlang.org" 65 | source: hosted 66 | version: "1.0.3" 67 | fake_async: 68 | dependency: transitive 69 | description: 70 | name: fake_async 71 | url: "https://pub.dartlang.org" 72 | source: hosted 73 | version: "1.2.0" 74 | file: 75 | dependency: transitive 76 | description: 77 | name: file 78 | url: "https://pub.dartlang.org" 79 | source: hosted 80 | version: "6.1.2" 81 | flutter: 82 | dependency: "direct main" 83 | description: flutter 84 | source: sdk 85 | version: "0.0.0" 86 | flutter_driver: 87 | dependency: transitive 88 | description: flutter 89 | source: sdk 90 | version: "0.0.0" 91 | flutter_lints: 92 | dependency: "direct dev" 93 | description: 94 | name: flutter_lints 95 | url: "https://pub.dartlang.org" 96 | source: hosted 97 | version: "1.0.4" 98 | flutter_test: 99 | dependency: "direct dev" 100 | description: flutter 101 | source: sdk 102 | version: "0.0.0" 103 | flutter_web_plugins: 104 | dependency: transitive 105 | description: flutter 106 | source: sdk 107 | version: "0.0.0" 108 | fuchsia_remote_debug_protocol: 109 | dependency: transitive 110 | description: flutter 111 | source: sdk 112 | version: "0.0.0" 113 | integration_test: 114 | dependency: "direct dev" 115 | description: flutter 116 | source: sdk 117 | version: "0.0.0" 118 | js: 119 | dependency: transitive 120 | description: 121 | name: js 122 | url: "https://pub.dartlang.org" 123 | source: hosted 124 | version: "0.6.3" 125 | lints: 126 | dependency: transitive 127 | description: 128 | name: lints 129 | url: "https://pub.dartlang.org" 130 | source: hosted 131 | version: "1.0.1" 132 | matcher: 133 | dependency: transitive 134 | description: 135 | name: matcher 136 | url: "https://pub.dartlang.org" 137 | source: hosted 138 | version: "0.12.11" 139 | meta: 140 | dependency: transitive 141 | description: 142 | name: meta 143 | url: "https://pub.dartlang.org" 144 | source: hosted 145 | version: "1.7.0" 146 | path: 147 | dependency: transitive 148 | description: 149 | name: path 150 | url: "https://pub.dartlang.org" 151 | source: hosted 152 | version: "1.8.0" 153 | platform: 154 | dependency: transitive 155 | description: 156 | name: platform 157 | url: "https://pub.dartlang.org" 158 | source: hosted 159 | version: "3.0.2" 160 | plugin_platform_interface: 161 | dependency: transitive 162 | description: 163 | name: plugin_platform_interface 164 | url: "https://pub.dartlang.org" 165 | source: hosted 166 | version: "2.0.2" 167 | process: 168 | dependency: transitive 169 | description: 170 | name: process 171 | url: "https://pub.dartlang.org" 172 | source: hosted 173 | version: "4.2.4" 174 | pusher_beams: 175 | dependency: "direct main" 176 | description: 177 | path: ".." 178 | relative: true 179 | source: path 180 | version: "1.0.2-dev.3" 181 | pusher_beams_android: 182 | dependency: transitive 183 | description: 184 | name: pusher_beams_android 185 | url: "https://pub.dartlang.org" 186 | source: hosted 187 | version: "1.0.2-dev.1" 188 | pusher_beams_ios: 189 | dependency: transitive 190 | description: 191 | name: pusher_beams_ios 192 | url: "https://pub.dartlang.org" 193 | source: hosted 194 | version: "1.0.3-dev.2" 195 | pusher_beams_platform_interface: 196 | dependency: transitive 197 | description: 198 | name: pusher_beams_platform_interface 199 | url: "https://pub.dartlang.org" 200 | source: hosted 201 | version: "1.0.4-dev.1" 202 | pusher_beams_web: 203 | dependency: transitive 204 | description: 205 | name: pusher_beams_web 206 | url: "https://pub.dartlang.org" 207 | source: hosted 208 | version: "1.0.2-dev.1" 209 | sky_engine: 210 | dependency: transitive 211 | description: flutter 212 | source: sdk 213 | version: "0.0.99" 214 | source_span: 215 | dependency: transitive 216 | description: 217 | name: source_span 218 | url: "https://pub.dartlang.org" 219 | source: hosted 220 | version: "1.8.1" 221 | stack_trace: 222 | dependency: transitive 223 | description: 224 | name: stack_trace 225 | url: "https://pub.dartlang.org" 226 | source: hosted 227 | version: "1.10.0" 228 | stream_channel: 229 | dependency: transitive 230 | description: 231 | name: stream_channel 232 | url: "https://pub.dartlang.org" 233 | source: hosted 234 | version: "2.1.0" 235 | string_scanner: 236 | dependency: transitive 237 | description: 238 | name: string_scanner 239 | url: "https://pub.dartlang.org" 240 | source: hosted 241 | version: "1.1.0" 242 | sync_http: 243 | dependency: transitive 244 | description: 245 | name: sync_http 246 | url: "https://pub.dartlang.org" 247 | source: hosted 248 | version: "0.3.0" 249 | term_glyph: 250 | dependency: transitive 251 | description: 252 | name: term_glyph 253 | url: "https://pub.dartlang.org" 254 | source: hosted 255 | version: "1.2.0" 256 | test_api: 257 | dependency: transitive 258 | description: 259 | name: test_api 260 | url: "https://pub.dartlang.org" 261 | source: hosted 262 | version: "0.4.3" 263 | typed_data: 264 | dependency: transitive 265 | description: 266 | name: typed_data 267 | url: "https://pub.dartlang.org" 268 | source: hosted 269 | version: "1.3.0" 270 | uuid: 271 | dependency: transitive 272 | description: 273 | name: uuid 274 | url: "https://pub.dartlang.org" 275 | source: hosted 276 | version: "3.0.5" 277 | vector_math: 278 | dependency: transitive 279 | description: 280 | name: vector_math 281 | url: "https://pub.dartlang.org" 282 | source: hosted 283 | version: "2.1.1" 284 | vm_service: 285 | dependency: transitive 286 | description: 287 | name: vm_service 288 | url: "https://pub.dartlang.org" 289 | source: hosted 290 | version: "7.3.0" 291 | webdriver: 292 | dependency: transitive 293 | description: 294 | name: webdriver 295 | url: "https://pub.dartlang.org" 296 | source: hosted 297 | version: "3.0.0" 298 | sdks: 299 | dart: ">=2.14.0 <3.0.0" 300 | flutter: ">=1.20.0" 301 | -------------------------------------------------------------------------------- /packages/pusher_beams/example/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: pusher_beams_example 2 | description: Demonstrates how to use the pusher_beams plugin. 3 | 4 | # The following line prevents the package from being accidentally published to 5 | # pub.dev using `flutter pub publish`. This is preferred for private packages. 6 | publish_to: 'none' # Remove this line if you wish to publish to pub.dev 7 | 8 | environment: 9 | sdk: ">=2.12.0 <3.0.0" 10 | 11 | # Dependencies specify other packages that your package needs in order to work. 12 | # To automatically upgrade your package dependencies to the latest versions 13 | # consider running `flutter pub upgrade --major-versions`. Alternatively, 14 | # dependencies can be manually updated by changing the version numbers below to 15 | # the latest version available on pub.dev. To see which dependencies have newer 16 | # versions available, run `flutter pub outdated`. 17 | dependencies: 18 | flutter: 19 | sdk: flutter 20 | 21 | pusher_beams: 22 | # When depending on this package from a real application you should use: 23 | # pusher_beams: ^x.y.z 24 | # See https://dart.dev/tools/pub/dependencies#version-constraints 25 | # The example app is bundled with the plugin so we use a path dependency on 26 | # the parent directory to use the current plugin's version. 27 | path: ../ 28 | 29 | # The following adds the Cupertino Icons font to your application. 30 | # Use with the CupertinoIcons class for iOS style icons. 31 | cupertino_icons: ^1.0.2 32 | 33 | dev_dependencies: 34 | integration_test: 35 | sdk: flutter 36 | flutter_test: 37 | sdk: flutter 38 | 39 | # The "flutter_lints" package below contains a set of recommended lints to 40 | # encourage good coding practices. The lint set provided by the package is 41 | # activated in the `analysis_options.yaml` file located at the root of your 42 | # package. See that file for information about deactivating specific lint 43 | # rules and activating additional ones. 44 | flutter_lints: ^1.0.0 45 | 46 | # For information on the generic Dart part of this file, see the 47 | # following page: https://dart.dev/tools/pub/pubspec 48 | 49 | # The following section is specific to Flutter. 50 | flutter: 51 | 52 | # The following line ensures that the Material Icons font is 53 | # included with your application, so that you can use the icons in 54 | # the material Icons class. 55 | uses-material-design: true 56 | 57 | # To add assets to your application, add an assets section, like this: 58 | # assets: 59 | # - images/a_dot_burr.jpeg 60 | # - images/a_dot_ham.jpeg 61 | 62 | # An image asset can refer to one or more resolution-specific "variants", see 63 | # https://flutter.dev/assets-and-images/#resolution-aware. 64 | 65 | # For details regarding adding assets from package dependencies, see 66 | # https://flutter.dev/assets-and-images/#from-packages 67 | 68 | # To add custom fonts to your application, add a fonts section here, 69 | # in this "flutter" section. Each entry in this list should have a 70 | # "family" key with the font family name, and a "fonts" key with a 71 | # list giving the asset and other descriptors for the font. For 72 | # example: 73 | # fonts: 74 | # - family: Schyler 75 | # fonts: 76 | # - asset: fonts/Schyler-Regular.ttf 77 | # - asset: fonts/Schyler-Italic.ttf 78 | # style: italic 79 | # - family: Trajan Pro 80 | # fonts: 81 | # - asset: fonts/TrajanPro.ttf 82 | # - asset: fonts/TrajanPro_Bold.ttf 83 | # weight: 700 84 | # 85 | # For details regarding fonts from package dependencies, 86 | # see https://flutter.dev/custom-fonts/#from-packages 87 | -------------------------------------------------------------------------------- /packages/pusher_beams/example/test/widget_test.dart: -------------------------------------------------------------------------------- 1 | // This is a basic Flutter widget test. 2 | // 3 | // To perform an interaction with a widget in your test, use the WidgetTester 4 | // utility that Flutter provides. For example, you can send tap and scroll 5 | // gestures. You can also use WidgetTester to find child widgets in the widget 6 | // tree, read text, and verify that the values of widget properties are correct. 7 | 8 | import 'package:flutter/material.dart'; 9 | import 'package:flutter_test/flutter_test.dart'; 10 | 11 | import 'package:pusher_beams_example/main.dart'; 12 | 13 | void main() { 14 | testWidgets('Verify Platform version', (WidgetTester tester) async { 15 | // Build our app and trigger a frame. 16 | await tester.pumpWidget(const MyApp()); 17 | 18 | // Verify that platform version is retrieved. 19 | expect( 20 | find.byWidgetPredicate( 21 | (Widget widget) => 22 | widget is Text && widget.data!.startsWith('Running on:'), 23 | ), 24 | findsOneWidget, 25 | ); 26 | }); 27 | } 28 | -------------------------------------------------------------------------------- /packages/pusher_beams/example/test_driver/integration_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:integration_test/integration_test_driver.dart'; 2 | 3 | Future main() => integrationDriver(); 4 | -------------------------------------------------------------------------------- /packages/pusher_beams/example/web/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pusher/push-notifications-flutter/1f77be1871e822d1608743b02e06fc6916b82495/packages/pusher_beams/example/web/favicon.png -------------------------------------------------------------------------------- /packages/pusher_beams/example/web/icons/Icon-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pusher/push-notifications-flutter/1f77be1871e822d1608743b02e06fc6916b82495/packages/pusher_beams/example/web/icons/Icon-192.png -------------------------------------------------------------------------------- /packages/pusher_beams/example/web/icons/Icon-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pusher/push-notifications-flutter/1f77be1871e822d1608743b02e06fc6916b82495/packages/pusher_beams/example/web/icons/Icon-512.png -------------------------------------------------------------------------------- /packages/pusher_beams/example/web/icons/Icon-maskable-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pusher/push-notifications-flutter/1f77be1871e822d1608743b02e06fc6916b82495/packages/pusher_beams/example/web/icons/Icon-maskable-192.png -------------------------------------------------------------------------------- /packages/pusher_beams/example/web/icons/Icon-maskable-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pusher/push-notifications-flutter/1f77be1871e822d1608743b02e06fc6916b82495/packages/pusher_beams/example/web/icons/Icon-maskable-512.png -------------------------------------------------------------------------------- /packages/pusher_beams/example/web/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | example 30 | 31 | 32 | 33 | 34 | 37 | 101 | 102 | 103 | -------------------------------------------------------------------------------- /packages/pusher_beams/example/web/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "example", 3 | "short_name": "example", 4 | "start_url": ".", 5 | "display": "standalone", 6 | "background_color": "#0175C2", 7 | "theme_color": "#0175C2", 8 | "description": "A new Flutter project.", 9 | "orientation": "portrait-primary", 10 | "prefer_related_applications": false, 11 | "icons": [ 12 | { 13 | "src": "icons/Icon-192.png", 14 | "sizes": "192x192", 15 | "type": "image/png" 16 | }, 17 | { 18 | "src": "icons/Icon-512.png", 19 | "sizes": "512x512", 20 | "type": "image/png" 21 | }, 22 | { 23 | "src": "icons/Icon-maskable-192.png", 24 | "sizes": "192x192", 25 | "type": "image/png", 26 | "purpose": "maskable" 27 | }, 28 | { 29 | "src": "icons/Icon-maskable-512.png", 30 | "sizes": "512x512", 31 | "type": "image/png", 32 | "purpose": "maskable" 33 | } 34 | ] 35 | } 36 | -------------------------------------------------------------------------------- /packages/pusher_beams/example/web/service-worker.js: -------------------------------------------------------------------------------- 1 | importScripts("https://js.pusher.com/beams/service-worker.js"); 2 | -------------------------------------------------------------------------------- /packages/pusher_beams/lib/pusher_beams.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | 3 | import 'package:flutter/foundation.dart'; 4 | import 'package:pusher_beams_platform_interface/method_channel_pusher_beams.dart'; 5 | import 'package:pusher_beams_platform_interface/pusher_beams_platform_interface.dart'; 6 | import 'package:uuid/uuid.dart'; 7 | 8 | export 'package:pusher_beams_platform_interface/method_channel_pusher_beams.dart' 9 | show BeamsAuthProvider; 10 | 11 | const _uuid = Uuid(); 12 | 13 | /// App-facing Implementation for [PusherBeamsPlatform] plugin. 14 | /// It's designed to be a singleton and must be consumed with [PusherBeams.instance]. 15 | class PusherBeams extends PusherBeamsPlatform with CallbackHandlerApi { 16 | /// Stores the ids and the [Function]s to call back. 17 | static final Map _callbacks = {}; 18 | 19 | static final dynamic _pusherBeamsApi = PusherBeamsPlatform.instance; 20 | 21 | PusherBeams._privateConstructor() { 22 | if (!kIsWeb) { 23 | CallbackHandlerApi.setup(this); 24 | } 25 | } 26 | 27 | static final PusherBeams _instance = PusherBeams._privateConstructor(); 28 | 29 | /// The instance of [PusherBeams]. 30 | /// This is intended to be a singleton 31 | static PusherBeams get instance => _instance; 32 | 33 | /// Reads the [info] key included in a Push Notification when opening the app 34 | /// by tapping on it. 35 | /// 36 | /// ## Example Usage 37 | /// 38 | /// ```dart 39 | /// function someAsyncFunction() async { 40 | /// final message = await PusherBeams.instance.getInitialMessage(); 41 | /// } 42 | /// ``` 43 | /// 44 | /// In order to receive data the published payload must contain an [info] key 45 | /// in the [data] key: 46 | /// 47 | /// ```json 48 | /// { 49 | /// "interests":["hello"], 50 | /// "apns": { 51 | /// "aps": { 52 | /// "alert": {"title":"Hello", "body":"Hello, world!"}, 53 | /// }, 54 | /// "data": { 55 | /// "info": { "name": "george" } 56 | /// } 57 | /// }, 58 | /// "fcm": { 59 | /// "notification": {"title":"Hello", "body":"Hello, world!"}, 60 | /// "data": { 61 | /// "info": { "name": "george" } 62 | /// } 63 | /// } 64 | /// } 65 | /// ``` 66 | /// Throws an [Exception] in case of failure. 67 | @override 68 | Future?> getInitialMessage() async { 69 | return await _pusherBeamsApi.getInitialMessage(); 70 | } 71 | 72 | /// Adds an [interest] in this device. 73 | /// 74 | /// ## Example Usage 75 | /// 76 | /// ```dart 77 | /// function someAsyncFunction() async { 78 | /// await PusherBeams.instance.addDeviceInterest('apple'); 79 | /// } 80 | /// ``` 81 | /// 82 | /// Throws an [Exception] in case of failure. 83 | @override 84 | Future addDeviceInterest(String interest) async { 85 | await _pusherBeamsApi.addDeviceInterest(interest); 86 | } 87 | 88 | /// Clear all the state from [PusherBeams] library, leaving an empty state. 89 | /// 90 | /// ## Example Usage 91 | /// 92 | /// ```dart 93 | /// function someAsyncFunction() async { 94 | /// await PusherBeams.instance.clearAllState(); 95 | /// } 96 | /// ``` 97 | /// 98 | /// Throws an [Exception] in case of failure. 99 | @override 100 | Future clearAllState() async { 101 | await _pusherBeamsApi.clearAllState(); 102 | 103 | if (!kIsWeb) { 104 | _callbacks.clear(); 105 | } 106 | } 107 | 108 | /// Unsubscribes all interests from this device. 109 | /// 110 | /// ## Example Usage 111 | /// 112 | /// ```dart 113 | /// function someAsyncFunction() async { 114 | /// await PusherBeams.instance.clearDeviceInterests(); 115 | /// } 116 | /// ``` 117 | /// 118 | /// Throws an [Exception] in case of failure. 119 | @override 120 | Future clearDeviceInterests() async { 121 | await _pusherBeamsApi.clearDeviceInterests(); 122 | } 123 | 124 | /// Get the interests registered in this device. Returns a [List] containing the interests as [String]. 125 | /// 126 | /// ## Example Usage 127 | /// 128 | /// ```dart 129 | /// function someAsyncFunction() async { 130 | /// print(await PusherBeams.instance.getDeviceInterests()); // Prints: ['banana', 'apple'] 131 | /// } 132 | /// ``` 133 | /// 134 | /// Throws an [Exception] in case of failure. 135 | @override 136 | Future> getDeviceInterests() { 137 | return _pusherBeamsApi.getDeviceInterests(); 138 | } 139 | 140 | /// Registers a listener which calls back the [OnInterestsChange] function on interests modifications within this device. 141 | /// **This is not implemented on web.** 142 | /// 143 | /// ## Example Usage 144 | /// 145 | /// ```dart 146 | /// function someAsyncFunction() async { 147 | /// await PusherBeams.instance.onInterestChanges((interests) => { 148 | /// print('Interests: $interests') // This prints Interests: ['banana', 'apple', ...] 149 | /// }); 150 | /// } 151 | /// ``` 152 | /// 153 | /// Throws an [Exception] in case of failure. 154 | @override 155 | Future onInterestChanges(OnInterestsChange callback) async { 156 | final callbackId = _uuid.v4(); 157 | 158 | if (!kIsWeb) { 159 | _callbacks[callbackId] = callback; 160 | } 161 | 162 | await _pusherBeamsApi.onInterestChanges(kIsWeb ? callback : callbackId); 163 | } 164 | 165 | /// Removes an [interest] in this device. 166 | /// 167 | /// ## Example Usage 168 | /// 169 | /// ```dart 170 | /// function someAsyncFunction() async { 171 | /// await PusherBeams.instance.removeDeviceInterest('banana'); 172 | /// } 173 | /// ``` 174 | /// 175 | /// Throws an [Exception] in case of failure. 176 | @override 177 | Future removeDeviceInterest(String interest) async { 178 | await _pusherBeamsApi.removeDeviceInterest(interest); 179 | } 180 | 181 | /// Sets the [interests] provided with a [List]. 182 | /// This overrides and unsubscribe any interests not listed in [interests]. 183 | /// 184 | /// ## Example Usage 185 | /// 186 | /// ```dart 187 | /// function someAsyncFunction() async { 188 | /// await PusherBeams.instance.setDeviceInterests(['banana', 'apple', 'garlic']); 189 | /// } 190 | /// ``` 191 | /// 192 | /// Throws an [Exception] in case of failure. 193 | @override 194 | Future setDeviceInterests(List interests) async { 195 | await _pusherBeamsApi.setDeviceInterests(interests); 196 | } 197 | 198 | /// Sets authentication for this device, so you can send notifications specifically for this device. 199 | /// You must create a [BeamsAuthProvider] in order to pass the [provider] argument. 200 | /// 201 | /// ## Example Usage 202 | /// 203 | /// ```dart 204 | /// function someAsyncFunction() async { 205 | /// final BeamsAuthProvider provider = BeamsAuthProvider() 206 | /// ..authUrl = 'https://some-auth-url.com/secure' 207 | /// ..headers = { 208 | /// 'Content-Type': 'application/json' 209 | /// } 210 | /// ..queryParams = { 211 | /// 'page': '1' 212 | /// } 213 | /// ..credentials = 'omit'; 214 | /// 215 | /// await PusherBeams.instance.setUserId('THIS IS AN USER ID', provider, (error) => { 216 | /// if (error != null) { 217 | /// print(error) 218 | /// } 219 | /// 220 | /// // Success! Do something... 221 | /// }); 222 | /// } 223 | /// ``` 224 | /// 225 | /// ## [BeamsAuthProvider] 226 | /// This is the list parameters table which describes the class to creates a provider. 227 | /// 228 | /// | Parameter | Description | Required | 229 | /// |-------------|-----------------------------------------------------------|----------| 230 | /// | authUrl | An HTTP url where Pusher Beams will try to authenticate. | Yes | 231 | /// | headers | A Map which represents Headers sent to `authUrl` | No | 232 | /// | queryParams | A Map which represents URL Query Params sent to `authUrl` | No | 233 | /// | credentials | [More information](https://pusher.com/docs/beams/reference/web/#credentials-1585702178) | No | 234 | /// 235 | /// Throws an [Exception] in case of failure. 236 | @override 237 | Future setUserId(String userId, BeamsAuthProvider provider, 238 | OnUserCallback callback) async { 239 | final callbackId = _uuid.v4(); 240 | 241 | if (!kIsWeb) { 242 | _callbacks[callbackId] = callback; 243 | } 244 | 245 | await _pusherBeamsApi.setUserId( 246 | userId, provider, kIsWeb ? callback : callbackId); 247 | } 248 | 249 | /// This function register this device to *Pusher Beams* service with the given [instanceId]. 250 | /// 251 | /// You must call this method as soon as possible in your application (Preferable inside the `main` function). 252 | /// 253 | /// ## Example Usage 254 | /// 255 | /// ```dart 256 | /// void main() async { 257 | /// // Some code... 258 | /// await PusherBeams.instance.start('YOUR INSTANCE ID'); 259 | /// ] 260 | /// ``` 261 | /// 262 | /// Throws an [Exception] in case of failure. 263 | @override 264 | Future start(String instanceId) async { 265 | await _pusherBeamsApi.start(UuidValue(instanceId).toString()); 266 | } 267 | 268 | /// Stops by deleting all the state, remotely and locally. 269 | /// You must call [PusherBeams.instance.start()] again if you want to receive notifications. 270 | /// 271 | /// ## Example Usage 272 | /// 273 | /// ```dart 274 | /// function someAsyncFunction() async { 275 | /// await PusherBeams.instance.stop(); 276 | /// } 277 | /// ``` 278 | /// 279 | /// Throws an [Exception] in case of failure. 280 | @override 281 | Future stop() async { 282 | await _pusherBeamsApi.stop(); 283 | 284 | if (!kIsWeb) { 285 | _callbacks.clear(); 286 | } 287 | } 288 | 289 | /// Registers a listener which calls back the [OnMessageReceivedInTheForeground] function when the app receives a push notification in the foreground. 290 | /// **This is not implemented on web.** 291 | /// 292 | /// Notification is a map containing the following keys: 293 | /// * title 294 | /// * body 295 | /// * data 296 | /// 297 | /// ## Example Usage 298 | /// 299 | /// ```dart 300 | /// function someAsyncFunction() async { 301 | /// await PusherBeams.instance.onMessageReceivedInTheForeground((notification) => { 302 | /// print('Message received in the foreground: $notification') 303 | /// }); 304 | /// } 305 | /// ``` 306 | /// 307 | /// Throws an [Exception] in case of failure. 308 | 309 | @override 310 | Future onMessageReceivedInTheForeground( 311 | OnMessageReceivedInTheForeground callback) async { 312 | final callbackId = _uuid.v4(); 313 | 314 | if (!kIsWeb) { 315 | _callbacks[callbackId] = callback; 316 | } 317 | 318 | await _pusherBeamsApi 319 | .onMessageReceivedInTheForeground(kIsWeb ? callback : callbackId); 320 | } 321 | 322 | /// Handler which receives callbacks from the native platforms. 323 | /// This currently supports [onInterestChanges] and [setUserId] callbacks 324 | /// but by default it just call the [Function] set. 325 | /// 326 | /// **You're not supposed to use this** 327 | @override 328 | void handleCallback(String callbackId, String callbackName, List args) { 329 | final callback = _callbacks[callbackId]!; 330 | 331 | switch (callbackName) { 332 | case "onInterestChanges": 333 | callback((args[0] as List).cast()); 334 | return; 335 | case "setUserId": 336 | callback(args[0] as String?); 337 | return; 338 | case "onMessageReceivedInTheForeground": 339 | callback((args[0] as Map)); 340 | return; 341 | default: 342 | callback(); 343 | return; 344 | } 345 | } 346 | } 347 | -------------------------------------------------------------------------------- /packages/pusher_beams/pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | _fe_analyzer_shared: 5 | dependency: transitive 6 | description: 7 | name: _fe_analyzer_shared 8 | sha256: "16e298750b6d0af7ce8a3ba7c18c69c3785d11b15ec83f6dcd0ad2a0009b3cab" 9 | url: "https://pub.dev" 10 | source: hosted 11 | version: "76.0.0" 12 | _macros: 13 | dependency: transitive 14 | description: dart 15 | source: sdk 16 | version: "0.3.3" 17 | analyzer: 18 | dependency: transitive 19 | description: 20 | name: analyzer 21 | sha256: "1f14db053a8c23e260789e9b0980fa27f2680dd640932cae5e1137cce0e46e1e" 22 | url: "https://pub.dev" 23 | source: hosted 24 | version: "6.11.0" 25 | args: 26 | dependency: transitive 27 | description: 28 | name: args 29 | sha256: "0bd9a99b6eb96f07af141f0eb53eace8983e8e5aa5de59777aca31684680ef22" 30 | url: "https://pub.dev" 31 | source: hosted 32 | version: "2.3.0" 33 | async: 34 | dependency: transitive 35 | description: 36 | name: async 37 | sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" 38 | url: "https://pub.dev" 39 | source: hosted 40 | version: "2.11.0" 41 | boolean_selector: 42 | dependency: transitive 43 | description: 44 | name: boolean_selector 45 | sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" 46 | url: "https://pub.dev" 47 | source: hosted 48 | version: "2.1.1" 49 | build: 50 | dependency: transitive 51 | description: 52 | name: build 53 | sha256: "80184af8b6cb3e5c1c4ec6d8544d27711700bc3e6d2efad04238c7b5290889f0" 54 | url: "https://pub.dev" 55 | source: hosted 56 | version: "2.4.1" 57 | built_collection: 58 | dependency: transitive 59 | description: 60 | name: built_collection 61 | sha256: "376e3dd27b51ea877c28d525560790aee2e6fbb5f20e2f85d5081027d94e2100" 62 | url: "https://pub.dev" 63 | source: hosted 64 | version: "5.1.1" 65 | built_value: 66 | dependency: transitive 67 | description: 68 | name: built_value 69 | sha256: "0ef2d0947df2804424d9f23e5349d210350dd3c7d39ab53845ecabb2db996f64" 70 | url: "https://pub.dev" 71 | source: hosted 72 | version: "8.1.3" 73 | characters: 74 | dependency: transitive 75 | description: 76 | name: characters 77 | sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" 78 | url: "https://pub.dev" 79 | source: hosted 80 | version: "1.3.0" 81 | clock: 82 | dependency: transitive 83 | description: 84 | name: clock 85 | sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf 86 | url: "https://pub.dev" 87 | source: hosted 88 | version: "1.1.1" 89 | code_builder: 90 | dependency: transitive 91 | description: 92 | name: code_builder 93 | sha256: "0ec10bf4a89e4c613960bf1e8b42c64127021740fb21640c29c909826a5eea3e" 94 | url: "https://pub.dev" 95 | source: hosted 96 | version: "4.10.1" 97 | collection: 98 | dependency: transitive 99 | description: 100 | name: collection 101 | sha256: a1ace0a119f20aabc852d165077c036cd864315bd99b7eaa10a60100341941bf 102 | url: "https://pub.dev" 103 | source: hosted 104 | version: "1.19.0" 105 | convert: 106 | dependency: transitive 107 | description: 108 | name: convert 109 | sha256: f08428ad63615f96a27e34221c65e1a451439b5f26030f78d790f461c686d65d 110 | url: "https://pub.dev" 111 | source: hosted 112 | version: "3.0.1" 113 | crypto: 114 | dependency: transitive 115 | description: 116 | name: crypto 117 | sha256: cf75650c66c0316274e21d7c43d3dea246273af5955bd94e8184837cd577575c 118 | url: "https://pub.dev" 119 | source: hosted 120 | version: "3.0.1" 121 | dart_style: 122 | dependency: transitive 123 | description: 124 | name: dart_style 125 | sha256: "7856d364b589d1f08986e140938578ed36ed948581fbc3bc9aef1805039ac5ab" 126 | url: "https://pub.dev" 127 | source: hosted 128 | version: "2.3.7" 129 | fake_async: 130 | dependency: transitive 131 | description: 132 | name: fake_async 133 | sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" 134 | url: "https://pub.dev" 135 | source: hosted 136 | version: "1.3.1" 137 | file: 138 | dependency: transitive 139 | description: 140 | name: file 141 | sha256: b69516f2c26a5bcac4eee2e32512e1a5205ab312b3536c1c1227b2b942b5f9ad 142 | url: "https://pub.dev" 143 | source: hosted 144 | version: "6.1.2" 145 | fixnum: 146 | dependency: transitive 147 | description: 148 | name: fixnum 149 | sha256: "6a2ef17156f4dc49684f9d99aaf4a93aba8ac49f5eac861755f5730ddf6e2e4e" 150 | url: "https://pub.dev" 151 | source: hosted 152 | version: "1.0.0" 153 | flutter: 154 | dependency: "direct main" 155 | description: flutter 156 | source: sdk 157 | version: "0.0.0" 158 | flutter_lints: 159 | dependency: "direct dev" 160 | description: 161 | name: flutter_lints 162 | sha256: b543301ad291598523947dc534aaddc5aaad597b709d2426d3a0e0d44c5cb493 163 | url: "https://pub.dev" 164 | source: hosted 165 | version: "1.0.4" 166 | flutter_test: 167 | dependency: "direct dev" 168 | description: flutter 169 | source: sdk 170 | version: "0.0.0" 171 | flutter_web_plugins: 172 | dependency: transitive 173 | description: flutter 174 | source: sdk 175 | version: "0.0.0" 176 | glob: 177 | dependency: transitive 178 | description: 179 | name: glob 180 | sha256: "8321dd2c0ab0683a91a51307fa844c6db4aa8e3981219b78961672aaab434658" 181 | url: "https://pub.dev" 182 | source: hosted 183 | version: "2.0.2" 184 | js: 185 | dependency: transitive 186 | description: 187 | name: js 188 | sha256: d9bdfd70d828eeb352390f81b18d6a354ef2044aa28ef25682079797fa7cd174 189 | url: "https://pub.dev" 190 | source: hosted 191 | version: "0.6.3" 192 | leak_tracker: 193 | dependency: transitive 194 | description: 195 | name: leak_tracker 196 | sha256: "7bb2830ebd849694d1ec25bf1f44582d6ac531a57a365a803a6034ff751d2d06" 197 | url: "https://pub.dev" 198 | source: hosted 199 | version: "10.0.7" 200 | leak_tracker_flutter_testing: 201 | dependency: transitive 202 | description: 203 | name: leak_tracker_flutter_testing 204 | sha256: "9491a714cca3667b60b5c420da8217e6de0d1ba7a5ec322fab01758f6998f379" 205 | url: "https://pub.dev" 206 | source: hosted 207 | version: "3.0.8" 208 | leak_tracker_testing: 209 | dependency: transitive 210 | description: 211 | name: leak_tracker_testing 212 | sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" 213 | url: "https://pub.dev" 214 | source: hosted 215 | version: "3.0.1" 216 | lints: 217 | dependency: transitive 218 | description: 219 | name: lints 220 | sha256: a2c3d198cb5ea2e179926622d433331d8b58374ab8f29cdda6e863bd62fd369c 221 | url: "https://pub.dev" 222 | source: hosted 223 | version: "1.0.1" 224 | logging: 225 | dependency: transitive 226 | description: 227 | name: logging 228 | sha256: "293ae2d49fd79d4c04944c3a26dfd313382d5f52e821ec57119230ae16031ad4" 229 | url: "https://pub.dev" 230 | source: hosted 231 | version: "1.0.2" 232 | macros: 233 | dependency: transitive 234 | description: 235 | name: macros 236 | sha256: "1d9e801cd66f7ea3663c45fc708450db1fa57f988142c64289142c9b7ee80656" 237 | url: "https://pub.dev" 238 | source: hosted 239 | version: "0.1.3-main.0" 240 | matcher: 241 | dependency: transitive 242 | description: 243 | name: matcher 244 | sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb 245 | url: "https://pub.dev" 246 | source: hosted 247 | version: "0.12.16+1" 248 | material_color_utilities: 249 | dependency: transitive 250 | description: 251 | name: material_color_utilities 252 | sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec 253 | url: "https://pub.dev" 254 | source: hosted 255 | version: "0.11.1" 256 | meta: 257 | dependency: transitive 258 | description: 259 | name: meta 260 | sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7 261 | url: "https://pub.dev" 262 | source: hosted 263 | version: "1.15.0" 264 | mockito: 265 | dependency: "direct dev" 266 | description: 267 | name: mockito 268 | sha256: "6841eed20a7befac0ce07df8116c8b8233ed1f4486a7647c7fc5a02ae6163917" 269 | url: "https://pub.dev" 270 | source: hosted 271 | version: "5.4.4" 272 | package_config: 273 | dependency: transitive 274 | description: 275 | name: package_config 276 | sha256: "92d4488434b520a62570293fbd33bb556c7d49230791c1b4bbd973baf6d2dc67" 277 | url: "https://pub.dev" 278 | source: hosted 279 | version: "2.1.1" 280 | path: 281 | dependency: transitive 282 | description: 283 | name: path 284 | sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" 285 | url: "https://pub.dev" 286 | source: hosted 287 | version: "1.9.0" 288 | plugin_platform_interface: 289 | dependency: transitive 290 | description: 291 | name: plugin_platform_interface 292 | sha256: f843e0027496f0d841166707029237a0bef39cfc0c79b93b1bb1a10beae73244 293 | url: "https://pub.dev" 294 | source: hosted 295 | version: "2.0.2" 296 | pub_semver: 297 | dependency: transitive 298 | description: 299 | name: pub_semver 300 | sha256: "7b3cfbf654f3edd0c6298ecd5be782ce997ddf0e00531b9464b55245185bbbbd" 301 | url: "https://pub.dev" 302 | source: hosted 303 | version: "2.1.5" 304 | pusher_beams_android: 305 | dependency: "direct main" 306 | description: 307 | name: pusher_beams_android 308 | sha256: b60f9f4b2b83cd4b02d6de6e28ef8daf0f9a67493c5ff796da1387239b1a25bd 309 | url: "https://pub.dev" 310 | source: hosted 311 | version: "1.1.1" 312 | pusher_beams_ios: 313 | dependency: "direct main" 314 | description: 315 | name: pusher_beams_ios 316 | sha256: "09871ce8ce5a64d43ed5bed3b3816a9dfa507e492bfe4bd0d3168a094c7d500c" 317 | url: "https://pub.dev" 318 | source: hosted 319 | version: "1.1.1" 320 | pusher_beams_platform_interface: 321 | dependency: "direct main" 322 | description: 323 | name: pusher_beams_platform_interface 324 | sha256: "90645da247512f080a29d95b23a46998d2f81c37c849376288debf9625457731" 325 | url: "https://pub.dev" 326 | source: hosted 327 | version: "1.1.1" 328 | pusher_beams_web: 329 | dependency: "direct main" 330 | description: 331 | name: pusher_beams_web 332 | sha256: f95a14e497263a75f7025fc3c5471fe315f36fb85b113022ca1ac579e10bbe38 333 | url: "https://pub.dev" 334 | source: hosted 335 | version: "1.1.1" 336 | sky_engine: 337 | dependency: transitive 338 | description: flutter 339 | source: sdk 340 | version: "0.0.0" 341 | source_gen: 342 | dependency: transitive 343 | description: 344 | name: source_gen 345 | sha256: "14658ba5f669685cd3d63701d01b31ea748310f7ab854e471962670abcf57832" 346 | url: "https://pub.dev" 347 | source: hosted 348 | version: "1.5.0" 349 | source_span: 350 | dependency: transitive 351 | description: 352 | name: source_span 353 | sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" 354 | url: "https://pub.dev" 355 | source: hosted 356 | version: "1.10.0" 357 | stack_trace: 358 | dependency: transitive 359 | description: 360 | name: stack_trace 361 | sha256: "9f47fd3630d76be3ab26f0ee06d213679aa425996925ff3feffdec504931c377" 362 | url: "https://pub.dev" 363 | source: hosted 364 | version: "1.12.0" 365 | stream_channel: 366 | dependency: transitive 367 | description: 368 | name: stream_channel 369 | sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 370 | url: "https://pub.dev" 371 | source: hosted 372 | version: "2.1.2" 373 | string_scanner: 374 | dependency: transitive 375 | description: 376 | name: string_scanner 377 | sha256: "688af5ed3402a4bde5b3a6c15fd768dbf2621a614950b17f04626c431ab3c4c3" 378 | url: "https://pub.dev" 379 | source: hosted 380 | version: "1.3.0" 381 | term_glyph: 382 | dependency: transitive 383 | description: 384 | name: term_glyph 385 | sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 386 | url: "https://pub.dev" 387 | source: hosted 388 | version: "1.2.1" 389 | test_api: 390 | dependency: transitive 391 | description: 392 | name: test_api 393 | sha256: "664d3a9a64782fcdeb83ce9c6b39e78fd2971d4e37827b9b06c3aa1edc5e760c" 394 | url: "https://pub.dev" 395 | source: hosted 396 | version: "0.7.3" 397 | typed_data: 398 | dependency: transitive 399 | description: 400 | name: typed_data 401 | sha256: "53bdf7e979cfbf3e28987552fd72f637e63f3c8724c9e56d9246942dc2fa36ee" 402 | url: "https://pub.dev" 403 | source: hosted 404 | version: "1.3.0" 405 | uuid: 406 | dependency: "direct main" 407 | description: 408 | name: uuid 409 | sha256: "00ba1241ff12e77d8059eeb1f102b35235df01661a6110afd165ab52a0fc7714" 410 | url: "https://pub.dev" 411 | source: hosted 412 | version: "3.0.5" 413 | vector_math: 414 | dependency: transitive 415 | description: 416 | name: vector_math 417 | sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" 418 | url: "https://pub.dev" 419 | source: hosted 420 | version: "2.1.4" 421 | vm_service: 422 | dependency: transitive 423 | description: 424 | name: vm_service 425 | sha256: f6be3ed8bd01289b34d679c2b62226f63c0e69f9fd2e50a6b3c1c729a961041b 426 | url: "https://pub.dev" 427 | source: hosted 428 | version: "14.3.0" 429 | watcher: 430 | dependency: transitive 431 | description: 432 | name: watcher 433 | sha256: "3d2ad6751b3c16cf07c7fca317a1413b3f26530319181b37e3b9039b84fc01d8" 434 | url: "https://pub.dev" 435 | source: hosted 436 | version: "1.1.0" 437 | yaml: 438 | dependency: transitive 439 | description: 440 | name: yaml 441 | sha256: "3cee79b1715110341012d27756d9bae38e650588acd38d3f3c610822e1337ace" 442 | url: "https://pub.dev" 443 | source: hosted 444 | version: "3.1.0" 445 | sdks: 446 | dart: ">=3.5.0 <4.0.0" 447 | flutter: ">=3.18.0-18.0.pre.54" 448 | -------------------------------------------------------------------------------- /packages/pusher_beams/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: pusher_beams 2 | description: Official Flutter Plugin for Pusher Beams, receive notifications easily on your Flutter application with Pusher Beams. 3 | version: 1.1.2 4 | repository: https://github.com/pusher/push-notifications-flutter 5 | issue_tracker: https://github.com/pusher/push-notifications-flutter/issues 6 | 7 | environment: 8 | sdk: ">=2.12.0 <3.0.0" 9 | flutter: ">=1.20.0" 10 | 11 | dependencies: 12 | flutter: 13 | sdk: flutter 14 | pusher_beams_platform_interface: ^1.1.1 15 | pusher_beams_web: ^1.1.1 16 | pusher_beams_android: ^1.1.2 17 | pusher_beams_ios: ^1.1.1 18 | uuid: ^3.0.5 19 | 20 | dev_dependencies: 21 | flutter_test: 22 | sdk: flutter 23 | flutter_lints: ^1.0.0 24 | mockito: ^5.0.16 25 | 26 | # For information on the generic Dart part of this file, see the 27 | # following page: https://dart.dev/tools/pub/pubspec 28 | 29 | # The following section is specific to Flutter. 30 | flutter: 31 | # This section identifies this Flutter project as a plugin project. 32 | # The 'pluginClass' and Android 'package' identifiers should not ordinarily 33 | # be modified. They are used by the tooling to maintain consistency when 34 | # adding or updating assets for this project. 35 | plugin: 36 | platforms: 37 | android: 38 | default_package: pusher_beams_android 39 | ios: 40 | default_package: pusher_beams_ios 41 | web: 42 | default_package: pusher_beams_web 43 | 44 | # To add assets to your plugin package, add an assets section, like this: 45 | # assets: 46 | # - images/a_dot_burr.jpeg 47 | # - images/a_dot_ham.jpeg 48 | # 49 | # For details regarding assets in packages, see 50 | # https://flutter.dev/assets-and-images/#from-packages 51 | # 52 | # An image asset can refer to one or more resolution-specific "variants", see 53 | # https://flutter.dev/assets-and-images/#resolution-aware. 54 | 55 | # To add custom fonts to your plugin package, add a fonts section here, 56 | # in this "flutter" section. Each entry in this list should have a 57 | # "family" key with the font family name, and a "fonts" key with a 58 | # list giving the asset and other descriptors for the font. For 59 | # example: 60 | # fonts: 61 | # - family: Schyler 62 | # fonts: 63 | # - asset: fonts/Schyler-Regular.ttf 64 | # - asset: fonts/Schyler-Italic.ttf 65 | # style: italic 66 | # - family: Trajan Pro 67 | # fonts: 68 | # - asset: fonts/TrajanPro.ttf 69 | # - asset: fonts/TrajanPro_Bold.ttf 70 | # weight: 700 71 | # 72 | # For details regarding fonts in packages, see 73 | # https://flutter.dev/custom-fonts/#from-packages 74 | -------------------------------------------------------------------------------- /packages/pusher_beams/pusher_beams.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /packages/pusher_beams_android/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .dart_tool/ 3 | 4 | .packages 5 | .pub/ 6 | 7 | build/ 8 | .idea/ -------------------------------------------------------------------------------- /packages/pusher_beams_android/.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: 18116933e77adc82f80866c928266a5b4f1ed645 8 | channel: stable 9 | 10 | project_type: plugin 11 | -------------------------------------------------------------------------------- /packages/pusher_beams_android/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 1.1.2 2 | - Upgrade dependency versions 3 | 4 | ## 1.1.1 5 | - Fix `PusherBeamsPlugin.kt` `onNewIntent` null safety 6 | 7 | ## 1.1.0 8 | - Add a `getInitialMessage` method to accomplish deep-linking from a Push Notification 9 | 10 | ## 1.0.2 11 | - Promote `1.0.2-dev.2` to stable version 12 | 13 | ## 1.0.2-dev.2 14 | - Updating `platform_interface` package to `1.0.4-dev.2` 15 | 16 | ## 1.0.2-dev.1 17 | - Foreground incoming push notifications handling support for Android 18 | - Updating `platform_interface` package to `1.0.4-dev.1` 19 | 20 | ## 1.0.1 21 | - Updating _PusherBeams_ Android library to `1.8.0` 22 | - Android 12 support 23 | - Updating `platform_interface` package to 1.0.3. 24 | 25 | ## 1.0.0 26 | 27 | First official release of Pusher Beams for Flutter 🎉 28 | -------------------------------------------------------------------------------- /packages/pusher_beams_android/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015 Pusher Ltd. 2 | 3 | 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: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | 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. -------------------------------------------------------------------------------- /packages/pusher_beams_android/README.md: -------------------------------------------------------------------------------- 1 | # pusher\_beams\_android 2 | 3 | The Android implementation of [`pusher_beams`][1]. 4 | 5 | ## Usage 6 | 7 | This package is [endorsed][2], which means you can simply use `pusher_beams` 8 | normally. This package will be automatically included in your app when you do. 9 | 10 | [1]: https://pub.dev/packages/pusher_beams 11 | [2]: https://flutter.dev/docs/development/packages-and-plugins/developing-packages#endorsed-federated-plugin 12 | 13 | -------------------------------------------------------------------------------- /packages/pusher_beams_android/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | include: package:flutter_lints/flutter.yaml 2 | 3 | # Additional information about this file can be found at 4 | # https://dart.dev/guides/language/analysis-options 5 | -------------------------------------------------------------------------------- /packages/pusher_beams_android/android/.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | -------------------------------------------------------------------------------- /packages/pusher_beams_android/android/build.gradle: -------------------------------------------------------------------------------- 1 | group 'com.pusher.pusher_beams' 2 | version '1.0-SNAPSHOT' 3 | 4 | buildscript { 5 | ext.kotlin_version = '1.5.30' 6 | repositories { 7 | google() 8 | mavenCentral() 9 | } 10 | 11 | dependencies { 12 | classpath 'com.android.tools.build:gradle:4.1.0' 13 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 14 | } 15 | } 16 | 17 | rootProject.allprojects { 18 | repositories { 19 | google() 20 | mavenCentral() 21 | } 22 | } 23 | 24 | apply plugin: 'com.android.library' 25 | apply plugin: 'kotlin-android' 26 | 27 | android { 28 | compileSdkVersion 31 29 | 30 | compileOptions { 31 | sourceCompatibility JavaVersion.VERSION_1_8 32 | targetCompatibility JavaVersion.VERSION_1_8 33 | } 34 | 35 | kotlinOptions { 36 | jvmTarget = '1.8' 37 | } 38 | 39 | sourceSets { 40 | main.java.srcDirs += 'src/main/kotlin' 41 | } 42 | 43 | defaultConfig { 44 | minSdkVersion 16 45 | } 46 | } 47 | 48 | dependencies { 49 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 50 | implementation("com.google.firebase:firebase-messaging:22.0.0") 51 | implementation("com.google.firebase:firebase-iid:21.1.0") 52 | implementation("com.pusher:push-notifications-android:1.10.0") 53 | testImplementation 'junit:junit:4.12' 54 | } 55 | -------------------------------------------------------------------------------- /packages/pusher_beams_android/android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.useAndroidX=true 3 | android.enableJetifier=true 4 | -------------------------------------------------------------------------------- /packages/pusher_beams_android/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | zipStoreBase=GRADLE_USER_HOME 4 | zipStorePath=wrapper/dists 5 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip 6 | -------------------------------------------------------------------------------- /packages/pusher_beams_android/android/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'pusher_beams_android' 2 | -------------------------------------------------------------------------------- /packages/pusher_beams_android/android/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | -------------------------------------------------------------------------------- /packages/pusher_beams_android/android/src/main/kotlin/com/pusher/pusher_beams/PusherBeamsPlugin.kt: -------------------------------------------------------------------------------- 1 | package com.pusher.pusher_beams 2 | 3 | import android.app.Activity 4 | import android.content.Context 5 | import android.content.Intent 6 | import androidx.annotation.NonNull 7 | import com.google.firebase.messaging.RemoteMessage 8 | import com.pusher.pushnotifications.* 9 | import com.pusher.pushnotifications.auth.AuthData 10 | import com.pusher.pushnotifications.auth.AuthDataGetter 11 | import com.pusher.pushnotifications.auth.BeamsTokenProvider 12 | import io.flutter.Log 13 | 14 | import io.flutter.embedding.engine.plugins.FlutterPlugin 15 | import io.flutter.embedding.engine.plugins.activity.ActivityAware 16 | import io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding 17 | 18 | import io.flutter.plugin.common.PluginRegistry.NewIntentListener 19 | import org.json.JSONObject 20 | import org.json.JSONTokener 21 | 22 | /** PusherBeamsPlugin */ 23 | class PusherBeamsPlugin : FlutterPlugin, Messages.PusherBeamsApi, ActivityAware, NewIntentListener { 24 | private lateinit var context: Context 25 | private var alreadyInterestsListener: Boolean = false 26 | private var currentActivity: Activity? = null 27 | 28 | private var data: kotlin.collections.Map? = null 29 | private var initialIntent = true 30 | 31 | private lateinit var callbackHandlerApi: Messages.CallbackHandlerApi 32 | 33 | override fun onAttachedToEngine(@NonNull flutterPluginBinding: FlutterPlugin.FlutterPluginBinding) { 34 | Messages.PusherBeamsApi.setup(flutterPluginBinding.binaryMessenger, this) 35 | 36 | context = flutterPluginBinding.applicationContext 37 | callbackHandlerApi = Messages.CallbackHandlerApi(flutterPluginBinding.binaryMessenger) 38 | } 39 | 40 | override fun onDetachedFromEngine(@NonNull binding: FlutterPlugin.FlutterPluginBinding) { 41 | Messages.PusherBeamsApi.setup(binding.binaryMessenger, null) 42 | callbackHandlerApi = Messages.CallbackHandlerApi(binding.binaryMessenger) 43 | } 44 | 45 | override fun onNewIntent(intent: Intent): Boolean { 46 | handleIntent(context, intent!!) 47 | return false 48 | } 49 | 50 | override fun onAttachedToActivity(binding: ActivityPluginBinding) { 51 | this.currentActivity = binding.activity; 52 | binding.addOnNewIntentListener(this) 53 | handleIntent(context, binding.activity.intent) 54 | } 55 | 56 | override fun onReattachedToActivityForConfigChanges(binding: ActivityPluginBinding) { 57 | binding.addOnNewIntentListener(this) 58 | handleIntent(context, binding.activity.intent) 59 | } 60 | 61 | override fun onDetachedFromActivityForConfigChanges() {} 62 | 63 | override fun onDetachedFromActivity() { 64 | this.currentActivity = null; 65 | } 66 | 67 | private fun handleIntent(context: Context, intent: Intent) { 68 | val extras = intent.extras 69 | if (extras != null) { 70 | if (initialIntent) { 71 | Log.d(this.toString(), "Got extras: $extras") 72 | data = bundleToMap(extras.getString("info")) 73 | Log.d(this.toString(), "Got initial data: $data") 74 | initialIntent = false 75 | } 76 | } 77 | } 78 | 79 | override fun start(instanceId: kotlin.String) { 80 | PushNotifications.start(this.context, instanceId) 81 | Log.d(this.toString(), "PusherBeams started with $instanceId instanceId") 82 | } 83 | 84 | override fun getInitialMessage(result: Messages.Result>) { 85 | Log.d(this.toString(), "Returning initial data: $data") 86 | result.success(data) 87 | } 88 | 89 | override fun addDeviceInterest(interest: kotlin.String) { 90 | PushNotifications.addDeviceInterest(interest) 91 | Log.d(this.toString(), "Added device to interest: $interest") 92 | } 93 | 94 | override fun removeDeviceInterest(interest: String) { 95 | PushNotifications.removeDeviceInterest(interest) 96 | Log.d(this.toString(), "Removed device to interest: $interest") 97 | } 98 | 99 | override fun getDeviceInterests(): kotlin.collections.List { 100 | return PushNotifications.getDeviceInterests().toList() 101 | } 102 | 103 | override fun setDeviceInterests(interests: kotlin.collections.List) { 104 | PushNotifications.setDeviceInterests(interests.toSet()) 105 | Log.d(this.toString(), "$interests added to device") 106 | } 107 | 108 | override fun clearDeviceInterests() { 109 | PushNotifications.clearDeviceInterests() 110 | Log.d(this.toString(), "Cleared device interests") 111 | } 112 | 113 | override fun onInterestChanges(callbackId: String) { 114 | if (!alreadyInterestsListener) { 115 | PushNotifications.setOnDeviceInterestsChangedListener(object : 116 | SubscriptionsChangedListener { 117 | override fun onSubscriptionsChanged(interests: Set) { 118 | callbackHandlerApi.handleCallback( 119 | callbackId, 120 | "onInterestChanges", 121 | listOf(interests.toList()), 122 | Messages.CallbackHandlerApi.Reply { 123 | Log.d(this.toString(), "interests changed $interests") 124 | }) 125 | } 126 | }) 127 | } 128 | } 129 | 130 | override fun setUserId( 131 | userId: String, 132 | provider: Messages.BeamsAuthProvider, 133 | callbackId: String 134 | ) { 135 | val tokenProvider = BeamsTokenProvider( 136 | provider.authUrl, 137 | object : AuthDataGetter { 138 | override fun getAuthData(): AuthData { 139 | return AuthData( 140 | headers = provider.headers, 141 | queryParams = provider.queryParams 142 | ) 143 | } 144 | } 145 | ) 146 | 147 | PushNotifications.setUserId( 148 | userId, 149 | tokenProvider, 150 | object : BeamsCallback { 151 | override fun onFailure(error: PusherCallbackError) { 152 | callbackHandlerApi.handleCallback( 153 | callbackId, 154 | "setUserId", 155 | listOf(error.message), 156 | Messages.CallbackHandlerApi.Reply { 157 | Log.d(this.toString(), "Failed to set Authentication to device") 158 | }) 159 | } 160 | 161 | override fun onSuccess(vararg values: Void) { 162 | callbackHandlerApi.handleCallback( 163 | callbackId, 164 | "setUserId", 165 | listOf(null), 166 | Messages.CallbackHandlerApi.Reply { 167 | Log.d(this.toString(), "Device authenticated with $userId") 168 | }) 169 | } 170 | } 171 | ) 172 | } 173 | 174 | override fun clearAllState() { 175 | PushNotifications.clearAllState() 176 | } 177 | 178 | override fun onMessageReceivedInTheForeground(callbackId: String) { 179 | currentActivity?.let { activity -> 180 | PushNotifications.setOnMessageReceivedListenerForVisibleActivity( 181 | activity, 182 | object : PushNotificationReceivedListener { 183 | override fun onMessageReceived(remoteMessage: RemoteMessage) { 184 | activity.runOnUiThread { 185 | val pusherMessage = remoteMessage.toPusherMessage() 186 | callbackHandlerApi.handleCallback( 187 | callbackId, 188 | "onMessageReceivedInTheForeground", 189 | listOf(pusherMessage) 190 | ) { 191 | Log.d(this.toString(), "Message received: $pusherMessage") 192 | } 193 | } 194 | } 195 | }) 196 | } 197 | } 198 | 199 | override fun stop() { 200 | PushNotifications.stop() 201 | } 202 | 203 | private fun bundleToMap(info: kotlin.String?): kotlin.collections.Map? { 204 | if (info == null) 205 | return null 206 | 207 | val map: MutableMap = HashMap() 208 | val infoJson = JSONTokener(info).nextValue() as JSONObject 209 | 210 | val iterator = infoJson.keys() 211 | while (iterator.hasNext()) { 212 | val key = iterator.next() 213 | map[key] = infoJson.get(key) 214 | } 215 | return map 216 | } 217 | } 218 | 219 | fun RemoteMessage.toPusherMessage() = mapOf( 220 | "title" to notification?.title, 221 | "body" to notification?.body, 222 | "data" to data 223 | ) 224 | -------------------------------------------------------------------------------- /packages/pusher_beams_android/pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | async: 5 | dependency: transitive 6 | description: 7 | name: async 8 | sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" 9 | url: "https://pub.dev" 10 | source: hosted 11 | version: "2.11.0" 12 | boolean_selector: 13 | dependency: transitive 14 | description: 15 | name: boolean_selector 16 | sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" 17 | url: "https://pub.dev" 18 | source: hosted 19 | version: "2.1.1" 20 | characters: 21 | dependency: transitive 22 | description: 23 | name: characters 24 | sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" 25 | url: "https://pub.dev" 26 | source: hosted 27 | version: "1.3.0" 28 | clock: 29 | dependency: transitive 30 | description: 31 | name: clock 32 | sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf 33 | url: "https://pub.dev" 34 | source: hosted 35 | version: "1.1.1" 36 | collection: 37 | dependency: transitive 38 | description: 39 | name: collection 40 | sha256: a1ace0a119f20aabc852d165077c036cd864315bd99b7eaa10a60100341941bf 41 | url: "https://pub.dev" 42 | source: hosted 43 | version: "1.19.0" 44 | fake_async: 45 | dependency: transitive 46 | description: 47 | name: fake_async 48 | sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" 49 | url: "https://pub.dev" 50 | source: hosted 51 | version: "1.3.1" 52 | flutter: 53 | dependency: "direct main" 54 | description: flutter 55 | source: sdk 56 | version: "0.0.0" 57 | flutter_lints: 58 | dependency: "direct dev" 59 | description: 60 | name: flutter_lints 61 | sha256: b543301ad291598523947dc534aaddc5aaad597b709d2426d3a0e0d44c5cb493 62 | url: "https://pub.dev" 63 | source: hosted 64 | version: "1.0.4" 65 | flutter_test: 66 | dependency: "direct dev" 67 | description: flutter 68 | source: sdk 69 | version: "0.0.0" 70 | leak_tracker: 71 | dependency: transitive 72 | description: 73 | name: leak_tracker 74 | sha256: "7bb2830ebd849694d1ec25bf1f44582d6ac531a57a365a803a6034ff751d2d06" 75 | url: "https://pub.dev" 76 | source: hosted 77 | version: "10.0.7" 78 | leak_tracker_flutter_testing: 79 | dependency: transitive 80 | description: 81 | name: leak_tracker_flutter_testing 82 | sha256: "9491a714cca3667b60b5c420da8217e6de0d1ba7a5ec322fab01758f6998f379" 83 | url: "https://pub.dev" 84 | source: hosted 85 | version: "3.0.8" 86 | leak_tracker_testing: 87 | dependency: transitive 88 | description: 89 | name: leak_tracker_testing 90 | sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" 91 | url: "https://pub.dev" 92 | source: hosted 93 | version: "3.0.1" 94 | lints: 95 | dependency: transitive 96 | description: 97 | name: lints 98 | sha256: a2c3d198cb5ea2e179926622d433331d8b58374ab8f29cdda6e863bd62fd369c 99 | url: "https://pub.dev" 100 | source: hosted 101 | version: "1.0.1" 102 | matcher: 103 | dependency: transitive 104 | description: 105 | name: matcher 106 | sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb 107 | url: "https://pub.dev" 108 | source: hosted 109 | version: "0.12.16+1" 110 | material_color_utilities: 111 | dependency: transitive 112 | description: 113 | name: material_color_utilities 114 | sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec 115 | url: "https://pub.dev" 116 | source: hosted 117 | version: "0.11.1" 118 | meta: 119 | dependency: transitive 120 | description: 121 | name: meta 122 | sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7 123 | url: "https://pub.dev" 124 | source: hosted 125 | version: "1.15.0" 126 | path: 127 | dependency: transitive 128 | description: 129 | name: path 130 | sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" 131 | url: "https://pub.dev" 132 | source: hosted 133 | version: "1.9.0" 134 | plugin_platform_interface: 135 | dependency: transitive 136 | description: 137 | name: plugin_platform_interface 138 | sha256: f843e0027496f0d841166707029237a0bef39cfc0c79b93b1bb1a10beae73244 139 | url: "https://pub.dev" 140 | source: hosted 141 | version: "2.0.2" 142 | pusher_beams_platform_interface: 143 | dependency: "direct main" 144 | description: 145 | name: pusher_beams_platform_interface 146 | sha256: "90645da247512f080a29d95b23a46998d2f81c37c849376288debf9625457731" 147 | url: "https://pub.dev" 148 | source: hosted 149 | version: "1.1.1" 150 | sky_engine: 151 | dependency: transitive 152 | description: flutter 153 | source: sdk 154 | version: "0.0.0" 155 | source_span: 156 | dependency: transitive 157 | description: 158 | name: source_span 159 | sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" 160 | url: "https://pub.dev" 161 | source: hosted 162 | version: "1.10.0" 163 | stack_trace: 164 | dependency: transitive 165 | description: 166 | name: stack_trace 167 | sha256: "9f47fd3630d76be3ab26f0ee06d213679aa425996925ff3feffdec504931c377" 168 | url: "https://pub.dev" 169 | source: hosted 170 | version: "1.12.0" 171 | stream_channel: 172 | dependency: transitive 173 | description: 174 | name: stream_channel 175 | sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 176 | url: "https://pub.dev" 177 | source: hosted 178 | version: "2.1.2" 179 | string_scanner: 180 | dependency: transitive 181 | description: 182 | name: string_scanner 183 | sha256: "688af5ed3402a4bde5b3a6c15fd768dbf2621a614950b17f04626c431ab3c4c3" 184 | url: "https://pub.dev" 185 | source: hosted 186 | version: "1.3.0" 187 | term_glyph: 188 | dependency: transitive 189 | description: 190 | name: term_glyph 191 | sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 192 | url: "https://pub.dev" 193 | source: hosted 194 | version: "1.2.1" 195 | test_api: 196 | dependency: transitive 197 | description: 198 | name: test_api 199 | sha256: "664d3a9a64782fcdeb83ce9c6b39e78fd2971d4e37827b9b06c3aa1edc5e760c" 200 | url: "https://pub.dev" 201 | source: hosted 202 | version: "0.7.3" 203 | vector_math: 204 | dependency: transitive 205 | description: 206 | name: vector_math 207 | sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" 208 | url: "https://pub.dev" 209 | source: hosted 210 | version: "2.1.4" 211 | vm_service: 212 | dependency: transitive 213 | description: 214 | name: vm_service 215 | sha256: f6be3ed8bd01289b34d679c2b62226f63c0e69f9fd2e50a6b3c1c729a961041b 216 | url: "https://pub.dev" 217 | source: hosted 218 | version: "14.3.0" 219 | sdks: 220 | dart: ">=3.4.0 <4.0.0" 221 | flutter: ">=3.18.0-18.0.pre.54" 222 | -------------------------------------------------------------------------------- /packages/pusher_beams_android/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: pusher_beams_android 2 | description: The Android implementation from Pusher Beams for Flutter, intended to be a platform-specific package. 3 | version: 1.1.2 4 | repository: https://github.com/pusher/push-notifications-flutter 5 | issue_tracker: https://github.com/pusher/push-notifications-flutter/issues?q=is%3Aissue+is%3Aopen+label%3Aandroid 6 | 7 | environment: 8 | sdk: ">=2.12.0 <3.0.0" 9 | flutter: ">=1.20.0" 10 | 11 | dependencies: 12 | flutter: 13 | sdk: flutter 14 | pusher_beams_platform_interface: ^1.1.1 15 | 16 | dev_dependencies: 17 | flutter_test: 18 | sdk: flutter 19 | flutter_lints: ^1.0.0 20 | 21 | # For information on the generic Dart part of this file, see the 22 | # following page: https://dart.dev/tools/pub/pubspec 23 | 24 | # The following section is specific to Flutter. 25 | flutter: 26 | plugin: 27 | implements: pusher_beams 28 | platforms: 29 | android: 30 | package: com.pusher.pusher_beams 31 | pluginClass: PusherBeamsPlugin 32 | 33 | # To add assets to your plugin package, add an assets section, like this: 34 | # assets: 35 | # - images/a_dot_burr.jpeg 36 | # - images/a_dot_ham.jpeg 37 | # 38 | # For details regarding assets in packages, see 39 | # https://flutter.dev/assets-and-images/#from-packages 40 | # 41 | # An image asset can refer to one or more resolution-specific "variants", see 42 | # https://flutter.dev/assets-and-images/#resolution-aware. 43 | 44 | # To add custom fonts to your plugin package, add a fonts section here, 45 | # in this "flutter" section. Each entry in this list should have a 46 | # "family" key with the font family name, and a "fonts" key with a 47 | # list giving the asset and other descriptors for the font. For 48 | # example: 49 | # fonts: 50 | # - family: Schyler 51 | # fonts: 52 | # - asset: fonts/Schyler-Regular.ttf 53 | # - asset: fonts/Schyler-Italic.ttf 54 | # style: italic 55 | # - family: Trajan Pro 56 | # fonts: 57 | # - asset: fonts/TrajanPro.ttf 58 | # - asset: fonts/TrajanPro_Bold.ttf 59 | # weight: 700 60 | # 61 | # For details regarding fonts in packages, see 62 | # https://flutter.dev/custom-fonts/#from-packages 63 | -------------------------------------------------------------------------------- /packages/pusher_beams_android/pusher_beams_android.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /packages/pusher_beams_ios/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .dart_tool/ 3 | 4 | .packages 5 | .pub/ 6 | 7 | build/ 8 | .idea/ -------------------------------------------------------------------------------- /packages/pusher_beams_ios/.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: 18116933e77adc82f80866c928266a5b4f1ed645 8 | channel: stable 9 | 10 | project_type: plugin 11 | -------------------------------------------------------------------------------- /packages/pusher_beams_ios/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 1.1.1 2 | - Fix `PusherBeamsPlugin.kt` `onNewIntent` null safety 3 | 4 | ## 1.1.0 5 | - Add a `getInitialMessage` method to accomplish deep-linking from a Push Notification 6 | 7 | ## 1.0.3 8 | - Promote `1.0.3-dev.3` to stable version 9 | 10 | ## 1.0.3-dev.3 11 | - Updating `platform_interface` package to `1.0.4-dev.2` 12 | 13 | ## 1.0.3-dev.2 14 | - Updating old references to the new repository name. 15 | - Updating `platform_interface` package to `1.0.4-dev.1` 16 | 17 | ## 1.0.3-dev.1 18 | - Foreground incoming push notifications handling support for Android 19 | - Updating `platform_interface` package to `1.0.4` 20 | 21 | ## 1.0.2 22 | - Fixes error con `start` due to `registerDeviceToken`. Thanks to [esarbanis](https://github.com/esarbanis) ([#15](https://github.com/pusher/flutter_pusher_beams/pull/15)) 23 | 24 | ## 1.0.1 25 | Updating `platform_interface` package to `1.0.3`. 26 | 27 | ## 1.0.0 28 | 29 | First official release of Pusher Beams for Flutter 🎉 -------------------------------------------------------------------------------- /packages/pusher_beams_ios/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015 Pusher Ltd. 2 | 3 | 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: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | 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. -------------------------------------------------------------------------------- /packages/pusher_beams_ios/README.md: -------------------------------------------------------------------------------- 1 | # pusher\_beams\_ios 2 | 3 | The iOS implementation of [`pusher_beams`][1]. 4 | 5 | ## Usage 6 | 7 | This package is [endorsed][2], which means you can simply use `pusher_beams` 8 | normally. This package will be automatically included in your app when you do. 9 | 10 | [1]: https://pub.dev/packages/pusher_beams 11 | [2]: https://flutter.dev/docs/development/packages-and-plugins/developing-packages#endorsed-federated-plugin 12 | 13 | -------------------------------------------------------------------------------- /packages/pusher_beams_ios/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | include: package:flutter_lints/flutter.yaml 2 | 3 | # Additional information about this file can be found at 4 | # https://dart.dev/guides/language/analysis-options 5 | -------------------------------------------------------------------------------- /packages/pusher_beams_ios/ios/.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | .vagrant/ 3 | .sconsign.dblite 4 | .svn/ 5 | 6 | .DS_Store 7 | *.swp 8 | profile 9 | 10 | DerivedData/ 11 | build/ 12 | GeneratedPluginRegistrant.h 13 | GeneratedPluginRegistrant.m 14 | 15 | .generated/ 16 | 17 | *.pbxuser 18 | *.mode1v3 19 | *.mode2v3 20 | *.perspectivev3 21 | 22 | !default.pbxuser 23 | !default.mode1v3 24 | !default.mode2v3 25 | !default.perspectivev3 26 | 27 | xcuserdata 28 | 29 | *.moved-aside 30 | 31 | *.pyc 32 | *sync/ 33 | Icon? 34 | .tags* 35 | 36 | /Flutter/Generated.xcconfig 37 | /Flutter/ephemeral/ 38 | /Flutter/flutter_export_environment.sh -------------------------------------------------------------------------------- /packages/pusher_beams_ios/ios/Assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pusher/push-notifications-flutter/1f77be1871e822d1608743b02e06fc6916b82495/packages/pusher_beams_ios/ios/Assets/.gitkeep -------------------------------------------------------------------------------- /packages/pusher_beams_ios/ios/Classes/PusherBeamsPlugin.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @interface PusherBeamsPlugin : NSObject 4 | @end 5 | -------------------------------------------------------------------------------- /packages/pusher_beams_ios/ios/Classes/PusherBeamsPlugin.m: -------------------------------------------------------------------------------- 1 | #import "PusherBeamsPlugin.h" 2 | #if __has_include() 3 | #import 4 | #else 5 | // Support project import fallback if the generated compatibility header 6 | // is not copied when this plugin is created as a library. 7 | // https://forums.swift.org/t/swift-static-libraries-dont-copy-generated-objective-c-header/19816 8 | #import "pusher_beams_ios-Swift.h" 9 | #endif 10 | 11 | @implementation PusherBeamsPlugin 12 | + (void)registerWithRegistrar:(NSObject*)registrar { 13 | [SwiftPusherBeamsPlugin registerWithRegistrar:registrar]; 14 | } 15 | @end 16 | -------------------------------------------------------------------------------- /packages/pusher_beams_ios/ios/Classes/SwiftPusherBeamsPlugin.swift: -------------------------------------------------------------------------------- 1 | import Flutter 2 | import UIKit 3 | import PushNotifications 4 | 5 | public class SwiftPusherBeamsPlugin: FlutterPluginAppLifeCycleDelegate, FlutterPlugin, PusherBeamsApi, InterestsChangedDelegate { 6 | 7 | static var callbackHandler : CallbackHandlerApi? = nil 8 | 9 | var interestsDidChangeCallback : String? = nil 10 | var messageDidReceiveInTheForegroundCallback : String? = nil 11 | 12 | var beamsClient : PushNotifications? 13 | var started : Bool = false 14 | var deviceToken : Data? = nil 15 | var data: [String: NSObject]? 16 | 17 | 18 | public static func register(with registrar: FlutterPluginRegistrar) { 19 | let messenger : FlutterBinaryMessenger = registrar.messenger() 20 | let instance : SwiftPusherBeamsPlugin = SwiftPusherBeamsPlugin() 21 | 22 | callbackHandler = CallbackHandlerApi(binaryMessenger: messenger) 23 | PusherBeamsApiSetup(messenger, instance) 24 | 25 | UNUserNotificationCenter.current().delegate = instance 26 | registrar.addApplicationDelegate(instance) 27 | } 28 | 29 | override public func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) { 30 | if(started) { 31 | beamsClient?.registerDeviceToken(deviceToken) 32 | print("SwiftPusherBeamsPlugin: registerDeviceToken with token: \(String(describing: deviceToken))") 33 | 34 | } else { 35 | self.deviceToken = deviceToken 36 | } 37 | } 38 | 39 | @nonobjc public override func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable: Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) { 40 | print("application.didReceiveRemoteNotification: \(userInfo)") 41 | beamsClient?.handleNotification(userInfo: userInfo) 42 | } 43 | 44 | public override func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [AnyHashable: Any] = [:]) -> Bool { 45 | print("SwiftPusherBeamsPlugin: didFinishLaunchingWithOptions with options: \(String(describing: launchOptions))") 46 | 47 | if launchOptions[UIApplication.LaunchOptionsKey.remoteNotification] != nil { 48 | let remoteNotif = launchOptions[UIApplication.LaunchOptionsKey.remoteNotification] as! [String: Any] 49 | let extraData = remoteNotif["data"] as? [String: Any] 50 | data = extraData?["info"] as? [String: NSObject] 51 | print("SwiftPusherBeamsPlugin: got initial data: \(String(describing: data))") 52 | } else { 53 | data = nil 54 | } 55 | 56 | return super.application(application, didFinishLaunchingWithOptions: launchOptions) 57 | } 58 | 59 | public func startInstanceId(_ instanceId: String, error: AutoreleasingUnsafeMutablePointer) { 60 | beamsClient = PushNotifications(instanceId: instanceId) 61 | beamsClient?.delegate = self 62 | beamsClient?.start() 63 | 64 | if(deviceToken != nil) { 65 | beamsClient?.registerDeviceToken(deviceToken!) 66 | print("SwiftPusherBeamsPlugin: registerDeviceToken with token: \(String(describing: deviceToken))") 67 | deviceToken = nil 68 | } 69 | started = true 70 | 71 | beamsClient?.registerForRemoteNotifications() 72 | } 73 | 74 | public func addDeviceInterestInterest(_ interest: String, error: AutoreleasingUnsafeMutablePointer) { 75 | try? beamsClient!.addDeviceInterest(interest: interest) 76 | } 77 | 78 | public func removeDeviceInterestInterest(_ interest: String, error: AutoreleasingUnsafeMutablePointer) { 79 | try? beamsClient!.removeDeviceInterest(interest: interest) 80 | } 81 | 82 | public func getInitialMessage(completion: @escaping ([String : NSObject]?, FlutterError?) -> Void) { 83 | completion(data, nil) 84 | } 85 | 86 | public func getDeviceInterestsWithError(_ error: AutoreleasingUnsafeMutablePointer) -> [String]? { 87 | return beamsClient!.getDeviceInterests() 88 | } 89 | 90 | public func setDeviceInterestsInterests(_ interests: [String], error: AutoreleasingUnsafeMutablePointer) { 91 | try? beamsClient!.setDeviceInterests(interests: interests) 92 | } 93 | 94 | public func clearDeviceInterestsWithError(_ error: AutoreleasingUnsafeMutablePointer) { 95 | try? beamsClient!.clearDeviceInterests() 96 | } 97 | 98 | public func interestsSetOnDeviceDidChange(interests: [String]) { 99 | if (interestsDidChangeCallback != nil && (SwiftPusherBeamsPlugin.callbackHandler != nil)) { 100 | SwiftPusherBeamsPlugin.callbackHandler?.handleCallbackCallbackId(interestsDidChangeCallback!, callbackName: "onInterestChanges", args: [interests], completion: {_ in 101 | print("SwiftPusherBeamsPlugin: interests changed: \(interests)") 102 | }) 103 | } 104 | } 105 | 106 | public func onInterestChangesCallbackId(_ callbackId: String, error: AutoreleasingUnsafeMutablePointer) { 107 | interestsDidChangeCallback = callbackId 108 | } 109 | 110 | public func setUserIdUserId(_ userId: String, provider: BeamsAuthProvider, callbackId: String, error: AutoreleasingUnsafeMutablePointer) { 111 | let tokenProvider = BeamsTokenProvider(authURL: provider.authUrl!) { () -> AuthData in 112 | let headers = provider.headers ?? [:] 113 | let queryParams: [String: String] = provider.queryParams ?? [:] 114 | return AuthData(headers: headers, queryParams: queryParams) 115 | } 116 | 117 | beamsClient!.setUserId(userId, tokenProvider: tokenProvider, completion: { error in 118 | guard error == nil else { 119 | SwiftPusherBeamsPlugin.callbackHandler?.handleCallbackCallbackId(callbackId, callbackName: "setUserId", args: [error.debugDescription], completion: {_ in 120 | print("SwiftPusherBeamsPlugin: callback \(callbackId) handled with error") 121 | }) 122 | return 123 | } 124 | 125 | SwiftPusherBeamsPlugin.callbackHandler?.handleCallbackCallbackId(callbackId, callbackName: "setUserId", args: [], completion: {_ in 126 | print("SwiftPusherBeamsPlugin: callback \(callbackId) handled") 127 | }) 128 | }) 129 | } 130 | 131 | public func clearAllStateWithError(_ error: AutoreleasingUnsafeMutablePointer) { 132 | beamsClient!.clearAllState { 133 | print("SwiftPusherBeamsPlugin: state cleared") 134 | } 135 | } 136 | 137 | public func stopWithError(_ error: AutoreleasingUnsafeMutablePointer) { 138 | beamsClient!.stop { 139 | print("SwiftPusherBeamsPlugin: stopped") 140 | } 141 | started = false 142 | } 143 | 144 | public func onMessageReceived(inTheForegroundCallbackId callbackId: String, error: AutoreleasingUnsafeMutablePointer) { 145 | messageDidReceiveInTheForegroundCallback = callbackId 146 | } 147 | 148 | public override func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) { 149 | if (messageDidReceiveInTheForegroundCallback != nil && SwiftPusherBeamsPlugin.callbackHandler != nil) { 150 | let pusherMessage: [String : Any] = [ 151 | "title": notification.request.content.title, 152 | "body": notification.request.content.body, 153 | "data": notification.request.content.userInfo["data"] 154 | ] 155 | 156 | SwiftPusherBeamsPlugin.callbackHandler?.handleCallbackCallbackId(messageDidReceiveInTheForegroundCallback!, callbackName: "onMessageReceivedInTheForeground", args: [pusherMessage], completion: {_ in 157 | print("SwiftPusherBeamsPlugin: message received: \(pusherMessage)") 158 | }) 159 | } 160 | } 161 | 162 | public override func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) { 163 | // Handle the user interaction with the notification 164 | // Not Implemented yet 165 | } 166 | 167 | } 168 | -------------------------------------------------------------------------------- /packages/pusher_beams_ios/ios/Classes/messages.h: -------------------------------------------------------------------------------- 1 | // Autogenerated from Pigeon (v1.0.14), do not edit directly. 2 | // See also: https://pub.dev/packages/pigeon 3 | #import 4 | @protocol FlutterBinaryMessenger; 5 | @protocol FlutterMessageCodec; 6 | @class FlutterError; 7 | @class FlutterStandardTypedData; 8 | 9 | NS_ASSUME_NONNULL_BEGIN 10 | 11 | @class BeamsAuthProvider; 12 | 13 | @interface BeamsAuthProvider : NSObject 14 | @property(nonatomic, copy, nullable) NSString * authUrl; 15 | @property(nonatomic, strong, nullable) NSDictionary * headers; 16 | @property(nonatomic, strong, nullable) NSDictionary * queryParams; 17 | @property(nonatomic, copy, nullable) NSString * credentials; 18 | @end 19 | 20 | /// The codec used by PusherBeamsApi. 21 | NSObject *PusherBeamsApiGetCodec(void); 22 | 23 | @protocol PusherBeamsApi 24 | - (void)startInstanceId:(NSString *)instanceId error:(FlutterError *_Nullable *_Nonnull)error; 25 | - (void)getInitialMessageWithCompletion:(void(^)(NSDictionary *_Nullable, FlutterError *_Nullable))completion; 26 | - (void)addDeviceInterestInterest:(NSString *)interest error:(FlutterError *_Nullable *_Nonnull)error; 27 | - (void)removeDeviceInterestInterest:(NSString *)interest error:(FlutterError *_Nullable *_Nonnull)error; 28 | - (nullable NSArray *)getDeviceInterestsWithError:(FlutterError *_Nullable *_Nonnull)error; 29 | - (void)setDeviceInterestsInterests:(NSArray *)interests error:(FlutterError *_Nullable *_Nonnull)error; 30 | - (void)clearDeviceInterestsWithError:(FlutterError *_Nullable *_Nonnull)error; 31 | - (void)onInterestChangesCallbackId:(NSString *)callbackId error:(FlutterError *_Nullable *_Nonnull)error; 32 | - (void)setUserIdUserId:(NSString *)userId provider:(BeamsAuthProvider *)provider callbackId:(NSString *)callbackId error:(FlutterError *_Nullable *_Nonnull)error; 33 | - (void)clearAllStateWithError:(FlutterError *_Nullable *_Nonnull)error; 34 | - (void)onMessageReceivedInTheForegroundCallbackId:(NSString *)callbackId error:(FlutterError *_Nullable *_Nonnull)error; 35 | - (void)stopWithError:(FlutterError *_Nullable *_Nonnull)error; 36 | @end 37 | 38 | extern void PusherBeamsApiSetup(id binaryMessenger, NSObject *_Nullable api); 39 | 40 | /// The codec used by CallbackHandlerApi. 41 | NSObject *CallbackHandlerApiGetCodec(void); 42 | 43 | @interface CallbackHandlerApi : NSObject 44 | - (instancetype)initWithBinaryMessenger:(id)binaryMessenger; 45 | - (void)handleCallbackCallbackId:(NSString *)callbackId callbackName:(NSString *)callbackName args:(NSArray *)args completion:(void(^)(NSError *_Nullable))completion; 46 | @end 47 | NS_ASSUME_NONNULL_END 48 | -------------------------------------------------------------------------------- /packages/pusher_beams_ios/ios/Classes/pusher_beams_ios.h: -------------------------------------------------------------------------------- 1 | #import "messages.h" 2 | -------------------------------------------------------------------------------- /packages/pusher_beams_ios/ios/pusher_beams_ios.podspec: -------------------------------------------------------------------------------- 1 | # 2 | # To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html. 3 | # Run `pod lib lint pusher_beams.podspec` to validate before publishing. 4 | # 5 | Pod::Spec.new do |s| 6 | s.name = 'pusher_beams_ios' 7 | s.version = '0.0.1' 8 | s.summary = 'The iOS implementation from Pusher Beams for Flutter, intended to be a platform-specific package.' 9 | s.description = <<-DESC 10 | Beams Flutter Plugin for iOS 11 | DESC 12 | s.homepage = 'http://pusher.com' 13 | s.license = { :file => '../LICENSE' } 14 | s.author = { 'Pusher' => 'services@pusher.com' } 15 | s.source = { :path => '.' } 16 | s.source_files = 'Classes/**/*' 17 | s.dependency 'Flutter' 18 | s.platform = :ios, '10.0' 19 | 20 | # Flutter.framework does not contain a i386 slice. 21 | s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386' } 22 | s.swift_version = '5.0' 23 | 24 | s.dependency 'PushNotifications', '~> 4.0' 25 | end 26 | -------------------------------------------------------------------------------- /packages/pusher_beams_ios/pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | async: 5 | dependency: transitive 6 | description: 7 | name: async 8 | url: "https://pub.dartlang.org" 9 | source: hosted 10 | version: "2.8.2" 11 | boolean_selector: 12 | dependency: transitive 13 | description: 14 | name: boolean_selector 15 | url: "https://pub.dartlang.org" 16 | source: hosted 17 | version: "2.1.0" 18 | characters: 19 | dependency: transitive 20 | description: 21 | name: characters 22 | url: "https://pub.dartlang.org" 23 | source: hosted 24 | version: "1.2.0" 25 | charcode: 26 | dependency: transitive 27 | description: 28 | name: charcode 29 | url: "https://pub.dartlang.org" 30 | source: hosted 31 | version: "1.3.1" 32 | clock: 33 | dependency: transitive 34 | description: 35 | name: clock 36 | url: "https://pub.dartlang.org" 37 | source: hosted 38 | version: "1.1.0" 39 | collection: 40 | dependency: transitive 41 | description: 42 | name: collection 43 | url: "https://pub.dartlang.org" 44 | source: hosted 45 | version: "1.15.0" 46 | fake_async: 47 | dependency: transitive 48 | description: 49 | name: fake_async 50 | url: "https://pub.dartlang.org" 51 | source: hosted 52 | version: "1.2.0" 53 | flutter: 54 | dependency: "direct main" 55 | description: flutter 56 | source: sdk 57 | version: "0.0.0" 58 | flutter_lints: 59 | dependency: "direct dev" 60 | description: 61 | name: flutter_lints 62 | url: "https://pub.dartlang.org" 63 | source: hosted 64 | version: "1.0.4" 65 | flutter_test: 66 | dependency: "direct dev" 67 | description: flutter 68 | source: sdk 69 | version: "0.0.0" 70 | lints: 71 | dependency: transitive 72 | description: 73 | name: lints 74 | url: "https://pub.dartlang.org" 75 | source: hosted 76 | version: "1.0.1" 77 | matcher: 78 | dependency: transitive 79 | description: 80 | name: matcher 81 | url: "https://pub.dartlang.org" 82 | source: hosted 83 | version: "0.12.11" 84 | meta: 85 | dependency: transitive 86 | description: 87 | name: meta 88 | url: "https://pub.dartlang.org" 89 | source: hosted 90 | version: "1.7.0" 91 | path: 92 | dependency: transitive 93 | description: 94 | name: path 95 | url: "https://pub.dartlang.org" 96 | source: hosted 97 | version: "1.8.0" 98 | plugin_platform_interface: 99 | dependency: transitive 100 | description: 101 | name: plugin_platform_interface 102 | url: "https://pub.dartlang.org" 103 | source: hosted 104 | version: "2.0.2" 105 | pusher_beams_platform_interface: 106 | dependency: "direct main" 107 | description: 108 | name: pusher_beams_platform_interface 109 | url: "https://pub.dartlang.org" 110 | source: hosted 111 | version: "1.0.4-dev.1" 112 | sky_engine: 113 | dependency: transitive 114 | description: flutter 115 | source: sdk 116 | version: "0.0.99" 117 | source_span: 118 | dependency: transitive 119 | description: 120 | name: source_span 121 | url: "https://pub.dartlang.org" 122 | source: hosted 123 | version: "1.8.1" 124 | stack_trace: 125 | dependency: transitive 126 | description: 127 | name: stack_trace 128 | url: "https://pub.dartlang.org" 129 | source: hosted 130 | version: "1.10.0" 131 | stream_channel: 132 | dependency: transitive 133 | description: 134 | name: stream_channel 135 | url: "https://pub.dartlang.org" 136 | source: hosted 137 | version: "2.1.0" 138 | string_scanner: 139 | dependency: transitive 140 | description: 141 | name: string_scanner 142 | url: "https://pub.dartlang.org" 143 | source: hosted 144 | version: "1.1.0" 145 | term_glyph: 146 | dependency: transitive 147 | description: 148 | name: term_glyph 149 | url: "https://pub.dartlang.org" 150 | source: hosted 151 | version: "1.2.0" 152 | test_api: 153 | dependency: transitive 154 | description: 155 | name: test_api 156 | url: "https://pub.dartlang.org" 157 | source: hosted 158 | version: "0.4.3" 159 | typed_data: 160 | dependency: transitive 161 | description: 162 | name: typed_data 163 | url: "https://pub.dartlang.org" 164 | source: hosted 165 | version: "1.3.0" 166 | vector_math: 167 | dependency: transitive 168 | description: 169 | name: vector_math 170 | url: "https://pub.dartlang.org" 171 | source: hosted 172 | version: "2.1.1" 173 | sdks: 174 | dart: ">=2.14.0 <3.0.0" 175 | flutter: ">=1.20.0" 176 | -------------------------------------------------------------------------------- /packages/pusher_beams_ios/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: pusher_beams_ios 2 | description: The iOS implementation from Pusher Beams for Flutter, intended to be a platform-specific package. 3 | version: 1.1.1 4 | repository: https://github.com/pusher/push-notifications-flutter 5 | issue_tracker: https://github.com/pusher/push-notifications-flutter/issues?q=is%3Aissue+is%3Aopen+label%3Aios 6 | 7 | environment: 8 | sdk: ">=2.12.0 <3.0.0" 9 | flutter: ">=1.20.0" 10 | 11 | dependencies: 12 | flutter: 13 | sdk: flutter 14 | pusher_beams_platform_interface: ^1.1.1 15 | 16 | dev_dependencies: 17 | flutter_test: 18 | sdk: flutter 19 | flutter_lints: ^1.0.0 20 | 21 | # For information on the generic Dart part of this file, see the 22 | # following page: https://dart.dev/tools/pub/pubspec 23 | 24 | # The following section is specific to Flutter. 25 | flutter: 26 | # This section identifies this Flutter project as a plugin project. 27 | # The 'pluginClass' and Android 'package' identifiers should not ordinarily 28 | # be modified. They are used by the tooling to maintain consistency when 29 | # adding or updating assets for this project. 30 | plugin: 31 | platforms: 32 | implements: pusher_beams 33 | ios: 34 | pluginClass: PusherBeamsPlugin 35 | 36 | # To add assets to your plugin package, add an assets section, like this: 37 | # assets: 38 | # - images/a_dot_burr.jpeg 39 | # - images/a_dot_ham.jpeg 40 | # 41 | # For details regarding assets in packages, see 42 | # https://flutter.dev/assets-and-images/#from-packages 43 | # 44 | # An image asset can refer to one or more resolution-specific "variants", see 45 | # https://flutter.dev/assets-and-images/#resolution-aware. 46 | 47 | # To add custom fonts to your plugin package, add a fonts section here, 48 | # in this "flutter" section. Each entry in this list should have a 49 | # "family" key with the font family name, and a "fonts" key with a 50 | # list giving the asset and other descriptors for the font. For 51 | # example: 52 | # fonts: 53 | # - family: Schyler 54 | # fonts: 55 | # - asset: fonts/Schyler-Regular.ttf 56 | # - asset: fonts/Schyler-Italic.ttf 57 | # style: italic 58 | # - family: Trajan Pro 59 | # fonts: 60 | # - asset: fonts/TrajanPro.ttf 61 | # - asset: fonts/TrajanPro_Bold.ttf 62 | # weight: 700 63 | # 64 | # For details regarding fonts in packages, see 65 | # https://flutter.dev/custom-fonts/#from-packages 66 | -------------------------------------------------------------------------------- /packages/pusher_beams_ios/pusher_beams_ios.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /packages/pusher_beams_platform_interface/.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | 12 | # IntelliJ related 13 | *.iml 14 | *.ipr 15 | *.iws 16 | .idea/ 17 | 18 | # The .vscode folder contains launch configuration and tasks you configure in 19 | # VS Code which you may wish to be included in version control, so this line 20 | # is commented out by default. 21 | #.vscode/ 22 | 23 | # Flutter/Dart/Pub related 24 | **/doc/api/ 25 | .dart_tool/ 26 | .flutter-plugins 27 | .flutter-plugins-dependencies 28 | .packages 29 | .pub-cache/ 30 | .pub/ 31 | build/ 32 | 33 | # Android related 34 | **/android/**/gradle-wrapper.jar 35 | **/android/.gradle 36 | **/android/captures/ 37 | **/android/gradlew 38 | **/android/gradlew.bat 39 | **/android/local.properties 40 | **/android/**/GeneratedPluginRegistrant.java 41 | 42 | # iOS/XCode related 43 | **/ios/**/*.mode1v3 44 | **/ios/**/*.mode2v3 45 | **/ios/**/*.moved-aside 46 | **/ios/**/*.pbxuser 47 | **/ios/**/*.perspectivev3 48 | **/ios/**/*sync/ 49 | **/ios/**/.sconsign.dblite 50 | **/ios/**/.tags* 51 | **/ios/**/.vagrant/ 52 | **/ios/**/DerivedData/ 53 | **/ios/**/Icon? 54 | **/ios/**/Pods/ 55 | **/ios/**/.symlinks/ 56 | **/ios/**/profile 57 | **/ios/**/xcuserdata 58 | **/ios/.generated/ 59 | **/ios/Flutter/App.framework 60 | **/ios/Flutter/Flutter.framework 61 | **/ios/Flutter/Flutter.podspec 62 | **/ios/Flutter/Generated.xcconfig 63 | **/ios/Flutter/ephemeral 64 | **/ios/Flutter/app.flx 65 | **/ios/Flutter/app.zip 66 | **/ios/Flutter/flutter_assets/ 67 | **/ios/Flutter/flutter_export_environment.sh 68 | **/ios/ServiceDefinitions.json 69 | **/ios/Runner/GeneratedPluginRegistrant.* 70 | 71 | # Exceptions to above rules. 72 | !**/ios/**/default.mode1v3 73 | !**/ios/**/default.mode2v3 74 | !**/ios/**/default.pbxuser 75 | !**/ios/**/default.perspectivev3 76 | -------------------------------------------------------------------------------- /packages/pusher_beams_platform_interface/.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: ffb2ecea5223acdd139a5039be2f9c796962833d 8 | channel: stable 9 | 10 | project_type: package 11 | -------------------------------------------------------------------------------- /packages/pusher_beams_platform_interface/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 1.1.1 2 | - Fix `PusherBeamsPlugin.kt` `onNewIntent` null safety 3 | 4 | ## 1.1.0 5 | - Add a `getInitialMessage` method to accomplish deep-linking from a Push Notification 6 | 7 | ## 1.0.4 8 | - Promotion `1.0.4-dev.2` to stable version 9 | 10 | ## 1.0.4-dev.2 11 | - Update old repository references to the new one 12 | 13 | ## 1.0.4-dev.1 14 | - Foreground incoming push notifications handling support 15 | 16 | ## 1.0.3 17 | - Fix null errors due to flutter latest versions 18 | 19 | ## 1.0.2 20 | - Improvements on package details 21 | - improvements for score 22 | 23 | ## 1.0.1 24 | - Improvements on package details 25 | - improvements for score 26 | 27 | ## 1.0.0 28 | 29 | First official release of Pusher Beams for Flutter 🎉 -------------------------------------------------------------------------------- /packages/pusher_beams_platform_interface/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015 Pusher Ltd. 2 | 3 | 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: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | 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. -------------------------------------------------------------------------------- /packages/pusher_beams_platform_interface/Makefile: -------------------------------------------------------------------------------- 1 | all: generate_interface 2 | 3 | generate_interface: 4 | flutter pub run pigeon \ 5 | --input pigeons/messages.dart \ 6 | --dart_out lib/method_channel_pusher_beams.dart \ 7 | --objc_header_out ../pusher_beams_ios/ios/Classes/messages.h \ 8 | --objc_source_out ../pusher_beams_ios/ios/Classes/messages.m \ 9 | --java_out ../pusher_beams_android/android/src/main/java/com/pusher/pusher_beams/Messages.java \ 10 | --java_package "com.pusher.pusher_beams" 11 | -------------------------------------------------------------------------------- /packages/pusher_beams_platform_interface/README.md: -------------------------------------------------------------------------------- 1 | # pusher_beams_platform_interface 2 | 3 | A common platform interface for the [`pusher_beams`][1] plugin. 4 | 5 | This interface allows platform-specific implementations of the `pusher_beams` 6 | plugin, as well as the plugin itself, to ensure they are supporting the 7 | same interface. 8 | 9 | # Usage 10 | 11 | To implement a new platform-specific implementation of `pusher_beams`, extend 12 | [`PusherBeamsPlatform`][2] with an implementation that performs the 13 | platform-specific behavior, and when you register your plugin, set the default 14 | `PusherBeamsPlatform` by calling 15 | `PusherBeamsPlatform.instance = MyPusherBeamsLauncher()`. 16 | 17 | # Note on breaking changes 18 | 19 | Strongly prefer non-breaking changes (such as adding a method to the interface) 20 | over breaking changes for this package. 21 | 22 | See https://flutter.dev/go/platform-interface-breaking-changes for a discussion 23 | on why a less-clean interface is preferable to a breaking change. 24 | 25 | [1]: ../pusher_beams 26 | [2]: lib/pusher_beams_platform_interface.dart -------------------------------------------------------------------------------- /packages/pusher_beams_platform_interface/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | include: package:flutter_lints/flutter.yaml 2 | 3 | # Additional information about this file can be found at 4 | # https://dart.dev/guides/language/analysis-options 5 | -------------------------------------------------------------------------------- /packages/pusher_beams_platform_interface/lib/pusher_beams_platform_interface.dart: -------------------------------------------------------------------------------- 1 | library pusher_beams_platform_interface; 2 | 3 | import 'package:plugin_platform_interface/plugin_platform_interface.dart'; 4 | import 'package:pusher_beams_platform_interface/method_channel_pusher_beams.dart'; 5 | 6 | typedef OnUserCallback = Function(String? error); 7 | typedef OnInterestsChange = Function(List interests); 8 | typedef OnMessageReceivedInTheForeground = Function(Map data); 9 | 10 | abstract class PusherBeamsPlatform extends PlatformInterface { 11 | PusherBeamsPlatform() : super(token: _token); 12 | 13 | static final Object _token = Object(); 14 | 15 | // NOTE: Remember to change .onInterestChanges and .setUserId last argument 16 | // and .getInitialMessage return type to dynamic on MethodChannel 17 | static PusherBeamsPlatform _instance = PusherBeamsApi(); 18 | 19 | /// The default instance of [PusherBeamsPlatform] to use. 20 | /// 21 | /// Defaults to [DefaultPlatform]. 22 | static PusherBeamsPlatform get instance => _instance; 23 | 24 | /// Platform-specific plugins should set this with their own platform-specific 25 | /// class that extends [PusherBeamsPlatform] when they register themselves. 26 | // https://github.com/flutter/flutter/issues/43368 27 | static set instance(PusherBeamsPlatform instance) { 28 | PlatformInterface.verifyToken(instance, _token); 29 | _instance = instance; 30 | } 31 | 32 | Future start(String instanceId) { 33 | throw UnimplementedError('start() has not been implemented.'); 34 | } 35 | 36 | Future getInitialMessage() { 37 | throw UnimplementedError('getInitialMessage() has not been implemented.'); 38 | } 39 | 40 | Future addDeviceInterest(String interest) { 41 | throw UnimplementedError('addDeviceInterest() has not been implemented.'); 42 | } 43 | 44 | Future removeDeviceInterest(String interest) { 45 | throw UnimplementedError( 46 | 'removeDeviceInterest() has not been implemented.'); 47 | } 48 | 49 | Future> getDeviceInterests() { 50 | throw UnimplementedError('getDeviceInterests() has not been implemented.'); 51 | } 52 | 53 | Future setDeviceInterests(List interests) { 54 | throw UnimplementedError('setDeviceInterests() has not been implemented.'); 55 | } 56 | 57 | Future clearDeviceInterests() { 58 | throw UnimplementedError( 59 | 'clearDeviceInterests() has not been implemented.'); 60 | } 61 | 62 | Future onInterestChanges(OnInterestsChange callback) { 63 | throw UnimplementedError('onInterestChanges() has not been implemented.'); 64 | } 65 | 66 | Future setUserId( 67 | String userId, BeamsAuthProvider provider, OnUserCallback callback) { 68 | throw UnimplementedError('setUserId() has not been implemented.'); 69 | } 70 | 71 | Future clearAllState() { 72 | throw UnimplementedError('clearAllState() has not been implemented.'); 73 | } 74 | 75 | Future stop() { 76 | throw UnimplementedError('stop() has not been implemented.'); 77 | } 78 | 79 | Future onMessageReceivedInTheForeground( 80 | OnMessageReceivedInTheForeground callback) { 81 | throw UnimplementedError( 82 | 'onMessageReceivedInTheForeground() has not been implemented.'); 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /packages/pusher_beams_platform_interface/pigeons/messages.dart: -------------------------------------------------------------------------------- 1 | import 'package:pigeon/pigeon.dart'; 2 | 3 | class BeamsAuthProvider { 4 | String? authUrl; 5 | Map? headers; 6 | Map? queryParams; 7 | String? credentials; // web-only 8 | } 9 | 10 | @HostApi() 11 | abstract class PusherBeamsApi { 12 | void start(String instanceId); 13 | 14 | @async 15 | Map getInitialMessage(); 16 | 17 | void addDeviceInterest(String interest); 18 | 19 | void removeDeviceInterest(String interest); 20 | 21 | List getDeviceInterests(); 22 | 23 | void setDeviceInterests(List interests); 24 | 25 | void clearDeviceInterests(); 26 | 27 | void onInterestChanges(String callbackId); 28 | 29 | void setUserId(String userId, BeamsAuthProvider provider, String callbackId); 30 | 31 | void clearAllState(); 32 | 33 | void onMessageReceivedInTheForeground(String callbackId); 34 | 35 | void stop(); 36 | } 37 | 38 | @FlutterApi() 39 | abstract class CallbackHandlerApi { 40 | void handleCallback(String callbackId, String callbackName, List args); 41 | } 42 | -------------------------------------------------------------------------------- /packages/pusher_beams_platform_interface/pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | _fe_analyzer_shared: 5 | dependency: transitive 6 | description: 7 | name: _fe_analyzer_shared 8 | url: "https://pub.dartlang.org" 9 | source: hosted 10 | version: "31.0.0" 11 | analyzer: 12 | dependency: transitive 13 | description: 14 | name: analyzer 15 | url: "https://pub.dartlang.org" 16 | source: hosted 17 | version: "2.8.0" 18 | args: 19 | dependency: transitive 20 | description: 21 | name: args 22 | url: "https://pub.dartlang.org" 23 | source: hosted 24 | version: "2.3.0" 25 | async: 26 | dependency: transitive 27 | description: 28 | name: async 29 | url: "https://pub.dartlang.org" 30 | source: hosted 31 | version: "2.8.2" 32 | boolean_selector: 33 | dependency: transitive 34 | description: 35 | name: boolean_selector 36 | url: "https://pub.dartlang.org" 37 | source: hosted 38 | version: "2.1.0" 39 | build: 40 | dependency: transitive 41 | description: 42 | name: build 43 | url: "https://pub.dartlang.org" 44 | source: hosted 45 | version: "2.2.0" 46 | built_collection: 47 | dependency: transitive 48 | description: 49 | name: built_collection 50 | url: "https://pub.dartlang.org" 51 | source: hosted 52 | version: "5.1.1" 53 | built_value: 54 | dependency: transitive 55 | description: 56 | name: built_value 57 | url: "https://pub.dartlang.org" 58 | source: hosted 59 | version: "8.1.3" 60 | characters: 61 | dependency: transitive 62 | description: 63 | name: characters 64 | url: "https://pub.dartlang.org" 65 | source: hosted 66 | version: "1.2.0" 67 | charcode: 68 | dependency: transitive 69 | description: 70 | name: charcode 71 | url: "https://pub.dartlang.org" 72 | source: hosted 73 | version: "1.3.1" 74 | cli_util: 75 | dependency: transitive 76 | description: 77 | name: cli_util 78 | url: "https://pub.dartlang.org" 79 | source: hosted 80 | version: "0.3.4" 81 | clock: 82 | dependency: transitive 83 | description: 84 | name: clock 85 | url: "https://pub.dartlang.org" 86 | source: hosted 87 | version: "1.1.0" 88 | code_builder: 89 | dependency: transitive 90 | description: 91 | name: code_builder 92 | url: "https://pub.dartlang.org" 93 | source: hosted 94 | version: "4.1.0" 95 | collection: 96 | dependency: transitive 97 | description: 98 | name: collection 99 | url: "https://pub.dartlang.org" 100 | source: hosted 101 | version: "1.15.0" 102 | convert: 103 | dependency: transitive 104 | description: 105 | name: convert 106 | url: "https://pub.dartlang.org" 107 | source: hosted 108 | version: "3.0.1" 109 | crypto: 110 | dependency: transitive 111 | description: 112 | name: crypto 113 | url: "https://pub.dartlang.org" 114 | source: hosted 115 | version: "3.0.1" 116 | dart_style: 117 | dependency: transitive 118 | description: 119 | name: dart_style 120 | url: "https://pub.dartlang.org" 121 | source: hosted 122 | version: "2.2.1" 123 | fake_async: 124 | dependency: transitive 125 | description: 126 | name: fake_async 127 | url: "https://pub.dartlang.org" 128 | source: hosted 129 | version: "1.2.0" 130 | file: 131 | dependency: transitive 132 | description: 133 | name: file 134 | url: "https://pub.dartlang.org" 135 | source: hosted 136 | version: "6.1.2" 137 | fixnum: 138 | dependency: transitive 139 | description: 140 | name: fixnum 141 | url: "https://pub.dartlang.org" 142 | source: hosted 143 | version: "1.0.0" 144 | flutter: 145 | dependency: "direct main" 146 | description: flutter 147 | source: sdk 148 | version: "0.0.0" 149 | flutter_lints: 150 | dependency: "direct dev" 151 | description: 152 | name: flutter_lints 153 | url: "https://pub.dartlang.org" 154 | source: hosted 155 | version: "1.0.4" 156 | flutter_test: 157 | dependency: "direct dev" 158 | description: flutter 159 | source: sdk 160 | version: "0.0.0" 161 | glob: 162 | dependency: transitive 163 | description: 164 | name: glob 165 | url: "https://pub.dartlang.org" 166 | source: hosted 167 | version: "2.0.2" 168 | lints: 169 | dependency: transitive 170 | description: 171 | name: lints 172 | url: "https://pub.dartlang.org" 173 | source: hosted 174 | version: "1.0.1" 175 | logging: 176 | dependency: transitive 177 | description: 178 | name: logging 179 | url: "https://pub.dartlang.org" 180 | source: hosted 181 | version: "1.0.2" 182 | matcher: 183 | dependency: transitive 184 | description: 185 | name: matcher 186 | url: "https://pub.dartlang.org" 187 | source: hosted 188 | version: "0.12.11" 189 | meta: 190 | dependency: transitive 191 | description: 192 | name: meta 193 | url: "https://pub.dartlang.org" 194 | source: hosted 195 | version: "1.7.0" 196 | mockito: 197 | dependency: "direct dev" 198 | description: 199 | name: mockito 200 | url: "https://pub.dartlang.org" 201 | source: hosted 202 | version: "5.0.16" 203 | package_config: 204 | dependency: transitive 205 | description: 206 | name: package_config 207 | url: "https://pub.dartlang.org" 208 | source: hosted 209 | version: "2.0.2" 210 | path: 211 | dependency: transitive 212 | description: 213 | name: path 214 | url: "https://pub.dartlang.org" 215 | source: hosted 216 | version: "1.8.0" 217 | pigeon: 218 | dependency: "direct dev" 219 | description: 220 | name: pigeon 221 | url: "https://pub.dartlang.org" 222 | source: hosted 223 | version: "1.0.14" 224 | plugin_platform_interface: 225 | dependency: "direct main" 226 | description: 227 | name: plugin_platform_interface 228 | url: "https://pub.dartlang.org" 229 | source: hosted 230 | version: "2.0.2" 231 | pub_semver: 232 | dependency: transitive 233 | description: 234 | name: pub_semver 235 | url: "https://pub.dartlang.org" 236 | source: hosted 237 | version: "2.1.0" 238 | sky_engine: 239 | dependency: transitive 240 | description: flutter 241 | source: sdk 242 | version: "0.0.99" 243 | source_gen: 244 | dependency: transitive 245 | description: 246 | name: source_gen 247 | url: "https://pub.dartlang.org" 248 | source: hosted 249 | version: "1.2.1" 250 | source_span: 251 | dependency: transitive 252 | description: 253 | name: source_span 254 | url: "https://pub.dartlang.org" 255 | source: hosted 256 | version: "1.8.1" 257 | stack_trace: 258 | dependency: transitive 259 | description: 260 | name: stack_trace 261 | url: "https://pub.dartlang.org" 262 | source: hosted 263 | version: "1.10.0" 264 | stream_channel: 265 | dependency: transitive 266 | description: 267 | name: stream_channel 268 | url: "https://pub.dartlang.org" 269 | source: hosted 270 | version: "2.1.0" 271 | string_scanner: 272 | dependency: transitive 273 | description: 274 | name: string_scanner 275 | url: "https://pub.dartlang.org" 276 | source: hosted 277 | version: "1.1.0" 278 | term_glyph: 279 | dependency: transitive 280 | description: 281 | name: term_glyph 282 | url: "https://pub.dartlang.org" 283 | source: hosted 284 | version: "1.2.0" 285 | test_api: 286 | dependency: transitive 287 | description: 288 | name: test_api 289 | url: "https://pub.dartlang.org" 290 | source: hosted 291 | version: "0.4.3" 292 | typed_data: 293 | dependency: transitive 294 | description: 295 | name: typed_data 296 | url: "https://pub.dartlang.org" 297 | source: hosted 298 | version: "1.3.0" 299 | vector_math: 300 | dependency: transitive 301 | description: 302 | name: vector_math 303 | url: "https://pub.dartlang.org" 304 | source: hosted 305 | version: "2.1.1" 306 | watcher: 307 | dependency: transitive 308 | description: 309 | name: watcher 310 | url: "https://pub.dartlang.org" 311 | source: hosted 312 | version: "1.0.1" 313 | yaml: 314 | dependency: transitive 315 | description: 316 | name: yaml 317 | url: "https://pub.dartlang.org" 318 | source: hosted 319 | version: "3.1.0" 320 | sdks: 321 | dart: ">=2.14.0 <3.0.0" 322 | flutter: ">=1.17.0" 323 | -------------------------------------------------------------------------------- /packages/pusher_beams_platform_interface/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: pusher_beams_platform_interface 2 | description: A common platform interface from Pusher Beams for Flutter, intended to be the platform interface package. 3 | version: 1.1.1 4 | repository: https://github.com/pusher/push-notifications-flutter 5 | issue_tracker: https://github.com/pusher/push-notifications-flutter/issues?q=is%3Aissue+is%3Aopen+label%3Ainterface 6 | 7 | environment: 8 | sdk: ">=2.12.0 <3.0.0" 9 | flutter: ">=1.17.0" 10 | 11 | dependencies: 12 | flutter: 13 | sdk: flutter 14 | plugin_platform_interface: ^2.0.2 15 | 16 | dev_dependencies: 17 | flutter_test: 18 | sdk: flutter 19 | flutter_lints: ^1.0.0 20 | pigeon: ^1.0.14 21 | mockito: ^5.0.16 22 | 23 | # For information on the generic Dart part of this file, see the 24 | # following page: https://dart.dev/tools/pub/pubspec 25 | 26 | # The following section is specific to Flutter. 27 | flutter: 28 | 29 | # To add assets to your package, add an assets section, like this: 30 | # assets: 31 | # - images/a_dot_burr.jpeg 32 | # - images/a_dot_ham.jpeg 33 | # 34 | # For details regarding assets in packages, see 35 | # https://flutter.dev/assets-and-images/#from-packages 36 | # 37 | # An image asset can refer to one or more resolution-specific "variants", see 38 | # https://flutter.dev/assets-and-images/#resolution-aware. 39 | 40 | # To add custom fonts to your package, add a fonts section here, 41 | # in this "flutter" section. Each entry in this list should have a 42 | # "family" key with the font family name, and a "fonts" key with a 43 | # list giving the asset and other descriptors for the font. For 44 | # example: 45 | # fonts: 46 | # - family: Schyler 47 | # fonts: 48 | # - asset: fonts/Schyler-Regular.ttf 49 | # - asset: fonts/Schyler-Italic.ttf 50 | # style: italic 51 | # - family: Trajan Pro 52 | # fonts: 53 | # - asset: fonts/TrajanPro.ttf 54 | # - asset: fonts/TrajanPro_Bold.ttf 55 | # weight: 700 56 | # 57 | # For details regarding fonts in packages, see 58 | # https://flutter.dev/custom-fonts/#from-packages 59 | -------------------------------------------------------------------------------- /packages/pusher_beams_platform_interface/test/pusher_beams_platform_interface_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/services.dart'; 2 | import 'package:flutter_test/flutter_test.dart'; 3 | import 'package:mockito/mockito.dart'; 4 | import 'package:plugin_platform_interface/plugin_platform_interface.dart'; 5 | import 'package:pusher_beams_platform_interface/method_channel_pusher_beams.dart'; 6 | import 'package:pusher_beams_platform_interface/pusher_beams_platform_interface.dart'; 7 | 8 | void main() { 9 | TestWidgetsFlutterBinding.ensureInitialized(); 10 | 11 | final PusherBeamsPlatform initialInstance = PusherBeamsPlatform.instance; 12 | 13 | group('$PusherBeamsPlatform', () { 14 | test('$PusherBeamsApi is the default instance', () { 15 | expect(initialInstance, isInstanceOf()); 16 | }); 17 | 18 | test('Cannot be implemented with `implements`', () { 19 | expect(() { 20 | PusherBeamsPlatform.instance = ImplementsPusherBeamsPlatform(); 21 | }, throwsA(isInstanceOf())); 22 | }); 23 | 24 | test('Can be mocked with `implements`', () { 25 | final PusherBeamsPlatformMock mock = PusherBeamsPlatformMock(); 26 | PusherBeamsPlatform.instance = mock; 27 | }); 28 | 29 | test('Can be extended', () { 30 | PusherBeamsPlatform.instance = IllegalImplementation(); 31 | }); 32 | }); 33 | 34 | group('$PusherBeamsApi', () { 35 | print( 36 | 'Pigeon Generated Platform API not tested in favor of integration tests'); 37 | }); 38 | } 39 | 40 | class PusherBeamsPlatformMock extends Mock 41 | with MockPlatformInterfaceMixin 42 | implements PusherBeamsPlatform {} 43 | 44 | class ImplementsPusherBeamsPlatform extends Mock 45 | implements PusherBeamsPlatform {} 46 | 47 | class IllegalImplementation extends PusherBeamsPlatform { 48 | @override 49 | Future addDeviceInterest(String interest) { 50 | throw UnimplementedError(); 51 | } 52 | 53 | @override 54 | Future clearAllState() { 55 | throw UnimplementedError(); 56 | } 57 | 58 | @override 59 | Future clearDeviceInterests() { 60 | throw UnimplementedError(); 61 | } 62 | 63 | @override 64 | Future> getDeviceInterests() { 65 | throw UnimplementedError(); 66 | } 67 | 68 | @override 69 | Future onInterestChanges(OnInterestsChange callback) { 70 | throw UnimplementedError(); 71 | } 72 | 73 | @override 74 | Future removeDeviceInterest(String interest) { 75 | throw UnimplementedError(); 76 | } 77 | 78 | @override 79 | Future setDeviceInterests(List interests) { 80 | throw UnimplementedError(); 81 | } 82 | 83 | @override 84 | Future setUserId( 85 | String userId, BeamsAuthProvider provider, OnUserCallback callback) { 86 | throw UnimplementedError(); 87 | } 88 | 89 | @override 90 | Future start(String instanceId) { 91 | throw UnimplementedError(); 92 | } 93 | 94 | @override 95 | Future stop() { 96 | throw UnimplementedError(); 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /packages/pusher_beams_web/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .dart_tool/ 3 | 4 | .packages 5 | .pub/ 6 | 7 | build/ 8 | -------------------------------------------------------------------------------- /packages/pusher_beams_web/.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: ffb2ecea5223acdd139a5039be2f9c796962833d 8 | channel: stable 9 | 10 | project_type: plugin 11 | -------------------------------------------------------------------------------- /packages/pusher_beams_web/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 1.1.1 2 | - Fix `PusherBeamsPlugin.kt` `onNewIntent` null safety 3 | 4 | ## 1.1.0 5 | - Add a `getInitialMessage` method to accomplish deep-linking from a Push Notification 6 | 7 | ## 1.0.2 8 | - Promote `1.0.2-dev.2` to a stable version 9 | 10 | ## 1.0.2-dev.2 11 | - Updating `platform_interface` package to 1.0.4-dev.2. 12 | 13 | ## 1.0.2-dev.1 14 | - Updating `platform_interface` package to 1.0.4-dev.1. 15 | 16 | ## 1.0.1 17 | - Updating `platform_interface` package to 1.0.3. 18 | 19 | ## 1.0.0 20 | - First official release of Pusher Beams for Flutter 🎉 21 | -------------------------------------------------------------------------------- /packages/pusher_beams_web/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015 Pusher Ltd. 2 | 3 | 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: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | 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. -------------------------------------------------------------------------------- /packages/pusher_beams_web/README.md: -------------------------------------------------------------------------------- 1 | # pusher\_beams\_web 2 | 3 | The web implementation of [`pusher_beams`][1]. 4 | 5 | ## Usage 6 | 7 | This package is [endorsed][2], which means you can simply use `pusher_beams` 8 | normally. This package will be automatically included in your app when you do. 9 | 10 | [1]: https://pub.dev/packages/pusher_beams 11 | [2]: https://flutter.dev/docs/development/packages-and-plugins/developing-packages#endorsed-federated-plugin 12 | 13 | -------------------------------------------------------------------------------- /packages/pusher_beams_web/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | include: package:flutter_lints/flutter.yaml 2 | 3 | # Additional information about this file can be found at 4 | # https://dart.dev/guides/language/analysis-options 5 | -------------------------------------------------------------------------------- /packages/pusher_beams_web/lib/pusher_beams.dart: -------------------------------------------------------------------------------- 1 | @JS('PusherPushNotifications') 2 | library pusher_beams; 3 | 4 | import 'dart:html'; 5 | 6 | import 'package:js/js.dart'; 7 | 8 | @JS() 9 | @anonymous 10 | class PusherBeamsClientOptions { 11 | external String get instanceId; 12 | external ServiceWorkerRegistration? get serviceWorkerRegistration; 13 | 14 | // Must have an unnamed factory constructor with named arguments. 15 | external factory PusherBeamsClientOptions( 16 | {String instanceId, 17 | ServiceWorkerRegistration? serviceWorkerRegistration}); 18 | } 19 | 20 | @JS('Client') 21 | class PusherBeamsClient { 22 | external PusherBeamsClient(PusherBeamsClientOptions options); 23 | 24 | external Future start(); 25 | external Future addDeviceInterest(String interest); 26 | external Future removeDeviceInterest(String interest); 27 | external Future getDeviceInterests(); 28 | external Future setDeviceInterests(List interests); 29 | external Future clearDeviceInterests(); 30 | external Future setUserId(String userId, TokenProvider provider); 31 | external Future clearAllState(); 32 | external Future stop(); 33 | external Future onMessageReceivedInTheForeground(String callbackId); 34 | } 35 | 36 | @JS() 37 | @anonymous 38 | class TokenProviderOptions { 39 | external String get url; 40 | external Map? get queryParams; 41 | external Map? get headers; 42 | external String? get credentials; 43 | 44 | external factory TokenProviderOptions( 45 | {String url, Map? queryParams, Map? headers, String? credentials}); 46 | } 47 | 48 | @JS('TokenProvider') 49 | class TokenProvider { 50 | external TokenProvider(TokenProviderOptions options); 51 | } 52 | -------------------------------------------------------------------------------- /packages/pusher_beams_web/lib/pusher_beams_web.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | import 'dart:html' as html; 3 | 4 | import 'package:flutter_web_plugins/flutter_web_plugins.dart'; 5 | import 'package:js/js_util.dart'; 6 | import 'package:pusher_beams_platform_interface/method_channel_pusher_beams.dart'; 7 | import 'package:pusher_beams_platform_interface/pusher_beams_platform_interface.dart'; 8 | import 'package:pusher_beams_web/pusher_beams.dart'; 9 | import 'package:uuid/uuid.dart'; 10 | 11 | const uuid = Uuid(); 12 | 13 | /// A web implementation for [PusherBeamsPlatform] plugin. 14 | /// This is designed to be a singleton and must be consumed with [PusherBeams.instance]. 15 | class PusherBeams extends PusherBeamsPlatform { 16 | PusherBeams._privateConstructor(); 17 | 18 | static final PusherBeams _instance = PusherBeams._privateConstructor(); 19 | 20 | /// The instance of [PusherBeams]. 21 | static PusherBeams get instance => _instance; 22 | 23 | static PusherBeamsClient? _beamsClient; 24 | 25 | static void registerWith(Registrar registrar) { 26 | PusherBeamsPlatform.instance = PusherBeams.instance; 27 | } 28 | 29 | /// Adds an [interest] in this device. 30 | /// Throws [NullRejectionException] or [Exception] in case the JS promise fails. 31 | @override 32 | Future addDeviceInterest(String interest) async { 33 | await promiseToFuture(_beamsClient!.addDeviceInterest(interest)); 34 | } 35 | 36 | /// Clear all the state from [PusherBeams] library, leaving an empty state. 37 | /// Throws [NullRejectionException] or [Exception] in case the JS promise fails. 38 | @override 39 | Future clearAllState() async { 40 | await promiseToFuture(_beamsClient!.clearAllState()); 41 | } 42 | 43 | /// Unsubscribes all interests from this device. 44 | /// Throws [NullRejectionException] or [Exception] in case the JS promise fails. 45 | @override 46 | Future clearDeviceInterests() async { 47 | await promiseToFuture(_beamsClient!.clearDeviceInterests()); 48 | } 49 | 50 | /// Get the interests registered in this device. Returns a [List] containing the interests as [String]. 51 | /// Throws [NullRejectionException] or [Exception] in case the JS promise fails. 52 | @override 53 | Future> getDeviceInterests() async { 54 | final List interests = 55 | await promiseToFuture(_beamsClient!.getDeviceInterests()); 56 | 57 | return interests.cast(); 58 | } 59 | 60 | /// This is not implemented on web platform 61 | @override 62 | Future onInterestChanges(OnInterestsChange callback) async { 63 | // Just ignore 64 | return; 65 | } 66 | 67 | /// Removes an [interest] in this device. 68 | /// Throws [NullRejectionException] or [Exception] in case the JS promise fails. 69 | @override 70 | Future removeDeviceInterest(String interest) async { 71 | await promiseToFuture(_beamsClient!.removeDeviceInterest(interest)); 72 | } 73 | 74 | /// Sets the [interests] provided with a [List]. 75 | /// This overrides and unsubscribe any interests not listed in [interests]. 76 | /// Throws [NullRejectionException] or [Exception] in case the JS promise fails. 77 | @override 78 | Future setDeviceInterests(List interests) async { 79 | await promiseToFuture(_beamsClient!.setDeviceInterests(interests)); 80 | } 81 | 82 | /// Sets authentication for this device, so you can send notifications specifically for this device. 83 | /// You must create a [BeamsAuthProvider] in order to pass the [provider] argument. 84 | /// Throws [NullRejectionException] or [Exception] in case the JS promise fails. 85 | @override 86 | Future setUserId(String userId, BeamsAuthProvider provider, 87 | OnUserCallback callback) async { 88 | try { 89 | final TokenProvider tokenProvider = TokenProvider(TokenProviderOptions( 90 | url: provider.authUrl!, 91 | queryParams: provider.queryParams, 92 | headers: provider.headers, 93 | credentials: provider.credentials)); 94 | 95 | await promiseToFuture(_beamsClient!.setUserId(userId, tokenProvider)); 96 | 97 | callback(null); 98 | } catch (err) { 99 | callback(err.toString()); 100 | } 101 | } 102 | 103 | /// Register this device to Pusher Beams service with the given [instanceId]. 104 | /// 105 | /// You must call this method as soon as possible in your application. 106 | /// 107 | /// ```dart 108 | /// void main() { 109 | /// // Some code... 110 | /// PusherBeams.instance.start('This is an instanceId') 111 | /// ] 112 | /// ``` 113 | /// 114 | /// Throws [NullRejectionException] or [Exception] in case the JS promise fails. 115 | @override 116 | Future start(String instanceId) async { 117 | final instanceUuid = UuidValue(instanceId).toString(); 118 | 119 | _beamsClient ??= 120 | PusherBeamsClient(PusherBeamsClientOptions(instanceId: instanceUuid)); 121 | 122 | await promiseToFuture(_beamsClient!.start()); 123 | } 124 | 125 | /// Stops by deleting all the state, remotely and locally. 126 | /// You must call [PusherBeams.instance.start()] again if you want to receive notifications. 127 | /// Throws [NullRejectionException] or [Exception] in case the JS promise fails. 128 | @override 129 | Future stop() async { 130 | await promiseToFuture(_beamsClient!.stop()); 131 | _beamsClient = null; 132 | } 133 | 134 | @override 135 | Future onMessageReceivedInTheForeground( 136 | OnMessageReceivedInTheForeground callback) async { 137 | // Currently, we're not supporting foreground incoming message handling due to 138 | // platform limitations on communication between Web Service Workers and Flutter ecossystem 139 | return; 140 | } 141 | } 142 | -------------------------------------------------------------------------------- /packages/pusher_beams_web/pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | async: 5 | dependency: transitive 6 | description: 7 | name: async 8 | url: "https://pub.dartlang.org" 9 | source: hosted 10 | version: "2.8.2" 11 | boolean_selector: 12 | dependency: transitive 13 | description: 14 | name: boolean_selector 15 | url: "https://pub.dartlang.org" 16 | source: hosted 17 | version: "2.1.0" 18 | characters: 19 | dependency: transitive 20 | description: 21 | name: characters 22 | url: "https://pub.dartlang.org" 23 | source: hosted 24 | version: "1.2.0" 25 | charcode: 26 | dependency: transitive 27 | description: 28 | name: charcode 29 | url: "https://pub.dartlang.org" 30 | source: hosted 31 | version: "1.3.1" 32 | clock: 33 | dependency: transitive 34 | description: 35 | name: clock 36 | url: "https://pub.dartlang.org" 37 | source: hosted 38 | version: "1.1.0" 39 | collection: 40 | dependency: transitive 41 | description: 42 | name: collection 43 | url: "https://pub.dartlang.org" 44 | source: hosted 45 | version: "1.15.0" 46 | crypto: 47 | dependency: transitive 48 | description: 49 | name: crypto 50 | url: "https://pub.dartlang.org" 51 | source: hosted 52 | version: "3.0.1" 53 | fake_async: 54 | dependency: transitive 55 | description: 56 | name: fake_async 57 | url: "https://pub.dartlang.org" 58 | source: hosted 59 | version: "1.2.0" 60 | flutter: 61 | dependency: "direct main" 62 | description: flutter 63 | source: sdk 64 | version: "0.0.0" 65 | flutter_lints: 66 | dependency: "direct dev" 67 | description: 68 | name: flutter_lints 69 | url: "https://pub.dartlang.org" 70 | source: hosted 71 | version: "1.0.4" 72 | flutter_test: 73 | dependency: "direct dev" 74 | description: flutter 75 | source: sdk 76 | version: "0.0.0" 77 | flutter_web_plugins: 78 | dependency: "direct main" 79 | description: flutter 80 | source: sdk 81 | version: "0.0.0" 82 | js: 83 | dependency: "direct main" 84 | description: 85 | name: js 86 | url: "https://pub.dartlang.org" 87 | source: hosted 88 | version: "0.6.3" 89 | lints: 90 | dependency: transitive 91 | description: 92 | name: lints 93 | url: "https://pub.dartlang.org" 94 | source: hosted 95 | version: "1.0.1" 96 | matcher: 97 | dependency: transitive 98 | description: 99 | name: matcher 100 | url: "https://pub.dartlang.org" 101 | source: hosted 102 | version: "0.12.11" 103 | meta: 104 | dependency: transitive 105 | description: 106 | name: meta 107 | url: "https://pub.dartlang.org" 108 | source: hosted 109 | version: "1.7.0" 110 | path: 111 | dependency: transitive 112 | description: 113 | name: path 114 | url: "https://pub.dartlang.org" 115 | source: hosted 116 | version: "1.8.0" 117 | plugin_platform_interface: 118 | dependency: transitive 119 | description: 120 | name: plugin_platform_interface 121 | url: "https://pub.dartlang.org" 122 | source: hosted 123 | version: "2.0.2" 124 | pusher_beams_platform_interface: 125 | dependency: "direct main" 126 | description: 127 | name: pusher_beams_platform_interface 128 | url: "https://pub.dartlang.org" 129 | source: hosted 130 | version: "1.0.4-dev.1" 131 | sky_engine: 132 | dependency: transitive 133 | description: flutter 134 | source: sdk 135 | version: "0.0.99" 136 | source_span: 137 | dependency: transitive 138 | description: 139 | name: source_span 140 | url: "https://pub.dartlang.org" 141 | source: hosted 142 | version: "1.8.1" 143 | stack_trace: 144 | dependency: transitive 145 | description: 146 | name: stack_trace 147 | url: "https://pub.dartlang.org" 148 | source: hosted 149 | version: "1.10.0" 150 | stream_channel: 151 | dependency: transitive 152 | description: 153 | name: stream_channel 154 | url: "https://pub.dartlang.org" 155 | source: hosted 156 | version: "2.1.0" 157 | string_scanner: 158 | dependency: transitive 159 | description: 160 | name: string_scanner 161 | url: "https://pub.dartlang.org" 162 | source: hosted 163 | version: "1.1.0" 164 | term_glyph: 165 | dependency: transitive 166 | description: 167 | name: term_glyph 168 | url: "https://pub.dartlang.org" 169 | source: hosted 170 | version: "1.2.0" 171 | test_api: 172 | dependency: transitive 173 | description: 174 | name: test_api 175 | url: "https://pub.dartlang.org" 176 | source: hosted 177 | version: "0.4.3" 178 | typed_data: 179 | dependency: transitive 180 | description: 181 | name: typed_data 182 | url: "https://pub.dartlang.org" 183 | source: hosted 184 | version: "1.3.0" 185 | uuid: 186 | dependency: "direct main" 187 | description: 188 | name: uuid 189 | url: "https://pub.dartlang.org" 190 | source: hosted 191 | version: "3.0.5" 192 | vector_math: 193 | dependency: transitive 194 | description: 195 | name: vector_math 196 | url: "https://pub.dartlang.org" 197 | source: hosted 198 | version: "2.1.1" 199 | sdks: 200 | dart: ">=2.14.0 <3.0.0" 201 | flutter: ">=1.20.0" 202 | -------------------------------------------------------------------------------- /packages/pusher_beams_web/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: pusher_beams_web 2 | description: The Web implementation from Pusher Beams for Flutter, intended to be a platform-specific package. 3 | version: 1.1.1 4 | repository: https://github.com/pusher/push-notifications-flutter 5 | issue_tracker: https://github.com/pusher/push-notifications-flutter/issues?q=is%3Aissue+is%3Aopen+label%3Aweb 6 | 7 | environment: 8 | sdk: ">=2.12.0 <3.0.0" 9 | flutter: ">=1.20.0" 10 | 11 | dependencies: 12 | flutter: 13 | sdk: flutter 14 | flutter_web_plugins: 15 | sdk: flutter 16 | pusher_beams_platform_interface: ^1.1.1 17 | js: ^0.6.3 18 | uuid: ^3.0.5 19 | 20 | dev_dependencies: 21 | flutter_test: 22 | sdk: flutter 23 | flutter_lints: ^1.0.0 24 | 25 | # For information on the generic Dart part of this file, see the 26 | # following page: https://dart.dev/tools/pub/pubspec 27 | 28 | # The following section is specific to Flutter. 29 | flutter: 30 | # This section identifies this Flutter project as a plugin project. 31 | # The 'pluginClass' and Android 'package' identifiers should not ordinarily 32 | # be modified. They are used by the tooling to maintain consistency when 33 | # adding or updating assets for this project. 34 | plugin: 35 | implements: pusher_beams 36 | platforms: 37 | web: 38 | pluginClass: PusherBeams 39 | fileName: pusher_beams_web.dart 40 | 41 | # To add assets to your plugin package, add an assets section, like this: 42 | # assets: 43 | # - assets/service-worker.js 44 | # 45 | # For details regarding assets in packages, see 46 | # https://flutter.dev/assets-and-images/#from-packages 47 | # 48 | # An image asset can refer to one or more resolution-specific "variants", see 49 | # https://flutter.dev/assets-and-images/#resolution-aware. 50 | 51 | # To add custom fonts to your plugin package, add a fonts section here, 52 | # in this "flutter" section. Each entry in this list should have a 53 | # "family" key with the font family name, and a "fonts" key with a 54 | # list giving the asset and other descriptors for the font. For 55 | # example: 56 | # fonts: 57 | # - family: Schyler 58 | # fonts: 59 | # - asset: fonts/Schyler-Regular.ttf 60 | # - asset: fonts/Schyler-Italic.ttf 61 | # style: italic 62 | # - family: Trajan Pro 63 | # fonts: 64 | # - asset: fonts/TrajanPro.ttf 65 | # - asset: fonts/TrajanPro_Bold.ttf 66 | # weight: 700 67 | # 68 | # For details regarding fonts in packages, see 69 | # https://flutter.dev/custom-fonts/#from-packages 70 | -------------------------------------------------------------------------------- /packages/pusher_beams_web/pusher_beams_web.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | --------------------------------------------------------------------------------