Compare commits
14 Commits
56dc31ace5
...
c0d9447183
Author | SHA1 | Date | |
---|---|---|---|
c0d9447183 | |||
64f588a819 | |||
871c52f54d | |||
18fffa09fb | |||
51efc56ced | |||
f4972e629d | |||
2b0fa4b578 | |||
1be187b83d | |||
18e8d1c754 | |||
bcc5c0f268 | |||
68ace8e39f | |||
d32bf9a38f | |||
bbfbf40126 | |||
![]() |
792c3f774e |
@ -0,0 +1,4 @@
|
||||
include: package:wyatt_analysis/analysis_options.flutter.yaml
|
||||
|
||||
analyzer:
|
||||
exclude: "!example/**"
|
@ -22,6 +22,9 @@ if (flutterVersionName == null) {
|
||||
}
|
||||
|
||||
apply plugin: 'com.android.application'
|
||||
// START: FlutterFire Configuration
|
||||
apply plugin: 'com.google.gms.google-services'
|
||||
// END: FlutterFire Configuration
|
||||
apply plugin: 'kotlin-android'
|
||||
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
|
||||
|
Before Width: | Height: | Size: 544 B After Width: | Height: | Size: 544 B |
Before Width: | Height: | Size: 442 B After Width: | Height: | Size: 442 B |
Before Width: | Height: | Size: 721 B After Width: | Height: | Size: 721 B |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
@ -7,6 +7,9 @@ buildscript {
|
||||
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:7.1.2'
|
||||
// START: FlutterFire Configuration
|
||||
classpath 'com.google.gms:google-services:4.3.10'
|
||||
// END: FlutterFire Configuration
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
}
|
||||
}
|
@ -0,0 +1,2 @@
|
||||
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
|
||||
#include "Generated.xcconfig"
|
@ -0,0 +1,2 @@
|
||||
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
|
||||
#include "Generated.xcconfig"
|
41
packages/wyatt_cloud_messaging_bloc_base/example/ios/Podfile
Normal file
@ -0,0 +1,41 @@
|
||||
# Uncomment this line to define a global platform for your project
|
||||
platform :ios, '13.0'
|
||||
|
||||
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
|
||||
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
|
||||
|
||||
project 'Runner', {
|
||||
'Debug' => :debug,
|
||||
'Profile' => :release,
|
||||
'Release' => :release,
|
||||
}
|
||||
|
||||
def flutter_root
|
||||
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
|
||||
unless File.exist?(generated_xcode_build_settings_path)
|
||||
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
|
||||
end
|
||||
|
||||
File.foreach(generated_xcode_build_settings_path) do |line|
|
||||
matches = line.match(/FLUTTER_ROOT\=(.*)/)
|
||||
return matches[1].strip if matches
|
||||
end
|
||||
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
|
||||
end
|
||||
|
||||
require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
|
||||
|
||||
flutter_ios_podfile_setup
|
||||
|
||||
target 'Runner' do
|
||||
use_frameworks!
|
||||
use_modular_headers!
|
||||
|
||||
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
|
||||
end
|
||||
|
||||
post_install do |installer|
|
||||
installer.pods_project.targets.each do |target|
|
||||
flutter_additional_ios_build_settings(target)
|
||||
end
|
||||
end
|
@ -0,0 +1,104 @@
|
||||
PODS:
|
||||
- Firebase/CoreOnly (10.2.0):
|
||||
- FirebaseCore (= 10.2.0)
|
||||
- Firebase/Messaging (10.2.0):
|
||||
- Firebase/CoreOnly
|
||||
- FirebaseMessaging (~> 10.2.0)
|
||||
- firebase_core (2.3.0):
|
||||
- Firebase/CoreOnly (= 10.2.0)
|
||||
- Flutter
|
||||
- firebase_messaging (14.1.1):
|
||||
- Firebase/Messaging (= 10.2.0)
|
||||
- firebase_core
|
||||
- Flutter
|
||||
- FirebaseCore (10.2.0):
|
||||
- FirebaseCoreInternal (~> 10.0)
|
||||
- GoogleUtilities/Environment (~> 7.8)
|
||||
- GoogleUtilities/Logger (~> 7.8)
|
||||
- FirebaseCoreInternal (10.2.0):
|
||||
- "GoogleUtilities/NSData+zlib (~> 7.8)"
|
||||
- FirebaseInstallations (10.2.0):
|
||||
- FirebaseCore (~> 10.0)
|
||||
- GoogleUtilities/Environment (~> 7.8)
|
||||
- GoogleUtilities/UserDefaults (~> 7.8)
|
||||
- PromisesObjC (~> 2.1)
|
||||
- FirebaseMessaging (10.2.0):
|
||||
- FirebaseCore (~> 10.0)
|
||||
- FirebaseInstallations (~> 10.0)
|
||||
- GoogleDataTransport (~> 9.2)
|
||||
- GoogleUtilities/AppDelegateSwizzler (~> 7.8)
|
||||
- GoogleUtilities/Environment (~> 7.8)
|
||||
- GoogleUtilities/Reachability (~> 7.8)
|
||||
- GoogleUtilities/UserDefaults (~> 7.8)
|
||||
- nanopb (< 2.30910.0, >= 2.30908.0)
|
||||
- Flutter (1.0.0)
|
||||
- GoogleDataTransport (9.2.0):
|
||||
- GoogleUtilities/Environment (~> 7.7)
|
||||
- nanopb (< 2.30910.0, >= 2.30908.0)
|
||||
- PromisesObjC (< 3.0, >= 1.2)
|
||||
- GoogleUtilities/AppDelegateSwizzler (7.10.0):
|
||||
- GoogleUtilities/Environment
|
||||
- GoogleUtilities/Logger
|
||||
- GoogleUtilities/Network
|
||||
- GoogleUtilities/Environment (7.10.0):
|
||||
- PromisesObjC (< 3.0, >= 1.2)
|
||||
- GoogleUtilities/Logger (7.10.0):
|
||||
- GoogleUtilities/Environment
|
||||
- GoogleUtilities/Network (7.10.0):
|
||||
- GoogleUtilities/Logger
|
||||
- "GoogleUtilities/NSData+zlib"
|
||||
- GoogleUtilities/Reachability
|
||||
- "GoogleUtilities/NSData+zlib (7.10.0)"
|
||||
- GoogleUtilities/Reachability (7.10.0):
|
||||
- GoogleUtilities/Logger
|
||||
- GoogleUtilities/UserDefaults (7.10.0):
|
||||
- GoogleUtilities/Logger
|
||||
- nanopb (2.30909.0):
|
||||
- nanopb/decode (= 2.30909.0)
|
||||
- nanopb/encode (= 2.30909.0)
|
||||
- nanopb/decode (2.30909.0)
|
||||
- nanopb/encode (2.30909.0)
|
||||
- PromisesObjC (2.1.1)
|
||||
|
||||
DEPENDENCIES:
|
||||
- firebase_core (from `.symlinks/plugins/firebase_core/ios`)
|
||||
- firebase_messaging (from `.symlinks/plugins/firebase_messaging/ios`)
|
||||
- Flutter (from `Flutter`)
|
||||
|
||||
SPEC REPOS:
|
||||
trunk:
|
||||
- Firebase
|
||||
- FirebaseCore
|
||||
- FirebaseCoreInternal
|
||||
- FirebaseInstallations
|
||||
- FirebaseMessaging
|
||||
- GoogleDataTransport
|
||||
- GoogleUtilities
|
||||
- nanopb
|
||||
- PromisesObjC
|
||||
|
||||
EXTERNAL SOURCES:
|
||||
firebase_core:
|
||||
:path: ".symlinks/plugins/firebase_core/ios"
|
||||
firebase_messaging:
|
||||
:path: ".symlinks/plugins/firebase_messaging/ios"
|
||||
Flutter:
|
||||
:path: Flutter
|
||||
|
||||
SPEC CHECKSUMS:
|
||||
Firebase: a3ea7eba4382afd83808376edb99acdaff078dcf
|
||||
firebase_core: db1432de826785171029b7c1a26e5b22ce1dd477
|
||||
firebase_messaging: 5babce6fa9ce1e0c63a854dabba227f23dc68b1b
|
||||
FirebaseCore: 813838072b797b64f529f3c2ee35e696e5641dd1
|
||||
FirebaseCoreInternal: 091bde13e47bb1c5e9fe397634f3593dc390430f
|
||||
FirebaseInstallations: 004915af170935e3a583faefd5f8bc851afc220f
|
||||
FirebaseMessaging: cc9f40f5b7494680f3844d08e517e92aa4e8d9f7
|
||||
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
|
||||
GoogleDataTransport: 1c8145da7117bd68bbbed00cf304edb6a24de00f
|
||||
GoogleUtilities: bad72cb363809015b1f7f19beb1f1cd23c589f95
|
||||
nanopb: b552cce312b6c8484180ef47159bc0f65a1f0431
|
||||
PromisesObjC: ab77feca74fa2823e7af4249b8326368e61014cb
|
||||
|
||||
PODFILE CHECKSUM: cc1f88378b4bfcf93a6ce00d2c587857c6008d3b
|
||||
|
||||
COCOAPODS: 1.11.3
|
@ -3,11 +3,12 @@
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 50;
|
||||
objectVersion = 51;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
|
||||
2B18E3453BA17FB610231460 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F3EE6554D2B040AC98E4B97B /* Pods_Runner.framework */; };
|
||||
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
|
||||
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; };
|
||||
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
|
||||
@ -32,6 +33,10 @@
|
||||
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; };
|
||||
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
|
||||
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
|
||||
431CF649C456E9102214DF1B /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; };
|
||||
4734890851F5CD8D7662D3A7 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
|
||||
65CA93E1AF53B6CE22140295 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; };
|
||||
7416F07B292EF3D9000E6D63 /* Runner.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Runner.entitlements; sourceTree = "<group>"; };
|
||||
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = "<group>"; };
|
||||
74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
|
||||
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
|
||||
@ -42,6 +47,7 @@
|
||||
97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
|
||||
97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
|
||||
97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
F3EE6554D2B040AC98E4B97B /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
@ -49,12 +55,21 @@
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
2B18E3453BA17FB610231460 /* Pods_Runner.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
673258A1CE39C904DEEA90CB /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
F3EE6554D2B040AC98E4B97B /* Pods_Runner.framework */,
|
||||
);
|
||||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
9740EEB11CF90186004384FC /* Flutter */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
@ -72,6 +87,8 @@
|
||||
9740EEB11CF90186004384FC /* Flutter */,
|
||||
97C146F01CF9000F007C117D /* Runner */,
|
||||
97C146EF1CF9000F007C117D /* Products */,
|
||||
9D4FFD0723D599C94D20F644 /* Pods */,
|
||||
673258A1CE39C904DEEA90CB /* Frameworks */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
@ -86,6 +103,7 @@
|
||||
97C146F01CF9000F007C117D /* Runner */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
7416F07B292EF3D9000E6D63 /* Runner.entitlements */,
|
||||
97C146FA1CF9000F007C117D /* Main.storyboard */,
|
||||
97C146FD1CF9000F007C117D /* Assets.xcassets */,
|
||||
97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */,
|
||||
@ -98,6 +116,16 @@
|
||||
path = Runner;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
9D4FFD0723D599C94D20F644 /* Pods */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
4734890851F5CD8D7662D3A7 /* Pods-Runner.debug.xcconfig */,
|
||||
431CF649C456E9102214DF1B /* Pods-Runner.release.xcconfig */,
|
||||
65CA93E1AF53B6CE22140295 /* Pods-Runner.profile.xcconfig */,
|
||||
);
|
||||
path = Pods;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
@ -105,12 +133,14 @@
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
|
||||
buildPhases = (
|
||||
9374433038A75598AD754534 /* [CP] Check Pods Manifest.lock */,
|
||||
9740EEB61CF901F6004384FC /* Run Script */,
|
||||
97C146EA1CF9000F007C117D /* Sources */,
|
||||
97C146EB1CF9000F007C117D /* Frameworks */,
|
||||
97C146EC1CF9000F007C117D /* Resources */,
|
||||
9705A1C41CF9048500538489 /* Embed Frameworks */,
|
||||
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
|
||||
4BFFB06ADC6A6C0A0D2913CB /* [CP] Embed Pods Frameworks */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
@ -183,6 +213,45 @@
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin";
|
||||
};
|
||||
4BFFB06ADC6A6C0A0D2913CB /* [CP] Embed Pods Frameworks */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputFileListPaths = (
|
||||
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist",
|
||||
);
|
||||
name = "[CP] Embed Pods Frameworks";
|
||||
outputFileListPaths = (
|
||||
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist",
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
9374433038A75598AD754534 /* [CP] Check Pods Manifest.lock */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputFileListPaths = (
|
||||
);
|
||||
inputPaths = (
|
||||
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
|
||||
"${PODS_ROOT}/Manifest.lock",
|
||||
);
|
||||
name = "[CP] Check Pods Manifest.lock";
|
||||
outputFileListPaths = (
|
||||
);
|
||||
outputPaths = (
|
||||
"$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt",
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
9740EEB61CF901F6004384FC /* Run Script */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
@ -287,8 +356,10 @@
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
||||
CODE_SIGN_STYLE = Manual;
|
||||
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
|
||||
DEVELOPMENT_TEAM = W6464PZ8CJ;
|
||||
DEVELOPMENT_TEAM = "";
|
||||
ENABLE_BITCODE = NO;
|
||||
INFOPLIST_FILE = Runner/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
@ -297,6 +368,7 @@
|
||||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.example.notificationBlocExample;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||
SWIFT_VERSION = 5.0;
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
@ -416,8 +488,10 @@
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
||||
CODE_SIGN_STYLE = Manual;
|
||||
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
|
||||
DEVELOPMENT_TEAM = W6464PZ8CJ;
|
||||
DEVELOPMENT_TEAM = "";
|
||||
ENABLE_BITCODE = NO;
|
||||
INFOPLIST_FILE = Runner/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
@ -426,6 +500,7 @@
|
||||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.example.notificationBlocExample;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
SWIFT_VERSION = 5.0;
|
||||
@ -439,8 +514,10 @@
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
||||
CODE_SIGN_STYLE = Manual;
|
||||
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
|
||||
DEVELOPMENT_TEAM = W6464PZ8CJ;
|
||||
DEVELOPMENT_TEAM = "";
|
||||
ENABLE_BITCODE = NO;
|
||||
INFOPLIST_FILE = Runner/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
@ -449,6 +526,7 @@
|
||||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.example.notificationBlocExample;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||
SWIFT_VERSION = 5.0;
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
@ -4,4 +4,7 @@
|
||||
<FileRef
|
||||
location = "group:Runner.xcodeproj">
|
||||
</FileRef>
|
||||
<FileRef
|
||||
location = "group:Pods/Pods.xcodeproj">
|
||||
</FileRef>
|
||||
</Workspace>
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 564 B After Width: | Height: | Size: 564 B |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.7 KiB |
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 3.2 KiB |
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 3.5 KiB |
Before Width: | Height: | Size: 68 B After Width: | Height: | Size: 68 B |
Before Width: | Height: | Size: 68 B After Width: | Height: | Size: 68 B |
Before Width: | Height: | Size: 68 B After Width: | Height: | Size: 68 B |
@ -0,0 +1,55 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CADisableMinimumFrameDurationOnPhone</key>
|
||||
<true/>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
||||
<key>CFBundleDisplayName</key>
|
||||
<string>Notification Bloc Example</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>notification_bloc_example</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>$(FLUTTER_BUILD_NAME)</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>$(FLUTTER_BUILD_NUMBER)</string>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
<true/>
|
||||
<key>UIApplicationSupportsIndirectInputEvents</key>
|
||||
<true/>
|
||||
<key>UIBackgroundModes</key>
|
||||
<array>
|
||||
<string>remote-notification</string>
|
||||
</array>
|
||||
<key>UILaunchStoryboardName</key>
|
||||
<string>LaunchScreen</string>
|
||||
<key>UIMainStoryboardFile</key>
|
||||
<string>Main</string>
|
||||
<key>UISupportedInterfaceOrientations</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>UISupportedInterfaceOrientations~ipad</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationPortraitUpsideDown</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>UIViewControllerBasedStatusBarAppearance</key>
|
||||
<false/>
|
||||
</dict>
|
||||
</plist>
|
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>aps-environment</key>
|
||||
<string>development</string>
|
||||
</dict>
|
||||
</plist>
|
@ -0,0 +1,7 @@
|
||||
{
|
||||
"file_generated_by": "FlutterFire CLI",
|
||||
"purpose": "FirebaseAppID & ProjectID for this Firebase app in this directory",
|
||||
"GOOGLE_APP_ID": "1:100151285458:ios:d1f6f7861c3c6fa7c07f0b",
|
||||
"FIREBASE_PROJECT_ID": "wyatt-notification-example",
|
||||
"GCM_SENDER_ID": "100151285458"
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
// File generated by FlutterFire CLI.
|
||||
// ignore_for_file: lines_longer_than_80_chars, avoid_classes_with_only_static_members
|
||||
import 'package:firebase_core/firebase_core.dart' show FirebaseOptions;
|
||||
import 'package:flutter/foundation.dart'
|
||||
show defaultTargetPlatform, kIsWeb, TargetPlatform;
|
||||
|
||||
/// Default [FirebaseOptions] for use with your Firebase apps.
|
||||
///
|
||||
/// Example:
|
||||
/// ```dart
|
||||
/// import 'firebase_options.dart';
|
||||
/// // ...
|
||||
/// await Firebase.initializeApp(
|
||||
/// options: DefaultFirebaseOptions.currentPlatform,
|
||||
/// );
|
||||
/// ```
|
||||
class DefaultFirebaseOptions {
|
||||
static FirebaseOptions get currentPlatform {
|
||||
if (kIsWeb) {
|
||||
throw UnsupportedError(
|
||||
'DefaultFirebaseOptions have not been configured for web - '
|
||||
'you can reconfigure this by running the FlutterFire CLI again.',
|
||||
);
|
||||
}
|
||||
switch (defaultTargetPlatform) {
|
||||
case TargetPlatform.android:
|
||||
return android;
|
||||
case TargetPlatform.iOS:
|
||||
return ios;
|
||||
case TargetPlatform.macOS:
|
||||
throw UnsupportedError(
|
||||
'DefaultFirebaseOptions have not been configured for macos - '
|
||||
'you can reconfigure this by running the FlutterFire CLI again.',
|
||||
);
|
||||
default:
|
||||
throw UnsupportedError(
|
||||
'DefaultFirebaseOptions are not supported for this platform.',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
static const FirebaseOptions android = FirebaseOptions(
|
||||
apiKey: 'AIzaSyCbccibm2XZqeCIQ2_YQXRDMxUNkEBxCjY',
|
||||
appId: '1:100151285458:android:a0da0cf8db22caf5c07f0b',
|
||||
messagingSenderId: '100151285458',
|
||||
projectId: 'wyatt-notification-example',
|
||||
storageBucket: 'wyatt-notification-example.appspot.com',
|
||||
);
|
||||
|
||||
static const FirebaseOptions ios = FirebaseOptions(
|
||||
apiKey: 'AIzaSyApVqPAYLHRMNFIDNqbD-GA-gX7bheRs5o',
|
||||
appId: '1:100151285458:ios:d1f6f7861c3c6fa7c07f0b',
|
||||
messagingSenderId: '100151285458',
|
||||
projectId: 'wyatt-notification-example',
|
||||
storageBucket: 'wyatt-notification-example.appspot.com',
|
||||
iosClientId: '100151285458-a9notq1k1padf0vk9ove8ll3amjgi7mn.apps.googleusercontent.com',
|
||||
iosBundleId: 'com.example.notificationBlocExample',
|
||||
);
|
||||
}
|
@ -1,6 +1,12 @@
|
||||
import 'package:firebase_core/firebase_core.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:notification_bloc_example/firebase_options.dart';
|
||||
|
||||
void main() {
|
||||
void main() async {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
await Firebase.initializeApp(
|
||||
options: DefaultFirebaseOptions.currentPlatform,
|
||||
);
|
||||
runApp(const MyApp());
|
||||
}
|
||||
|
||||
@ -48,21 +54,11 @@ class MyHomePage extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _MyHomePageState extends State<MyHomePage> {
|
||||
int _counter = 0;
|
||||
|
||||
void _incrementCounter() {
|
||||
setState(() {
|
||||
// This call to setState tells the Flutter framework that something has
|
||||
// changed in this State, which causes it to rerun the build method below
|
||||
// so that the display can reflect the updated values. If we changed
|
||||
// _counter without calling setState(), then the build method would not be
|
||||
// called again, and so nothing would appear to happen.
|
||||
_counter++;
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// final notificationFirebaseDataSource = FirebaseMessagingDataSourceImpl();
|
||||
// final notificationRepository = NotificationRepositoryImpl(
|
||||
// notificationRemoteDataSource: notificationFirebaseDataSource);
|
||||
// This method is rerun every time setState is called, for instance as done
|
||||
// by the _incrementCounter method above.
|
||||
//
|
||||
@ -75,7 +71,7 @@ class _MyHomePageState extends State<MyHomePage> {
|
||||
// the App.build method, and use it to set our appbar title.
|
||||
title: Text(widget.title),
|
||||
),
|
||||
body: Center(
|
||||
body: const Center(
|
||||
// Center is a layout widget. It takes a single child and positions it
|
||||
// in the middle of the parent.
|
||||
child: Column(
|
||||
@ -95,21 +91,15 @@ class _MyHomePageState extends State<MyHomePage> {
|
||||
// horizontal).
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
const Text(
|
||||
Text(
|
||||
'You have pushed the button this many times:',
|
||||
),
|
||||
Text(
|
||||
'$_counter',
|
||||
style: Theme.of(context).textTheme.headlineMedium,
|
||||
'Notif',
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
floatingActionButton: FloatingActionButton(
|
||||
onPressed: _incrementCounter,
|
||||
tooltip: 'Increment',
|
||||
child: const Icon(Icons.add),
|
||||
), // This trailing comma makes auto-formatting nicer for build methods.
|
||||
);
|
||||
}
|
||||
}
|
@ -32,14 +32,24 @@ dependencies:
|
||||
flutter:
|
||||
sdk: flutter
|
||||
|
||||
flutter_bloc: ^8.1.1
|
||||
wyatt_cloud_messaging_bloc_base:
|
||||
path: ../
|
||||
|
||||
|
||||
# The following adds the Cupertino Icons font to your application.
|
||||
# Use with the CupertinoIcons class for iOS style icons.
|
||||
cupertino_icons: ^1.0.2
|
||||
firebase_core: ^2.3.0
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
sdk: flutter
|
||||
wyatt_analysis:
|
||||
git:
|
||||
url: https://git.wyatt-studio.fr/Wyatt-FOSS/wyatt-packages
|
||||
ref: wyatt_analysis-v2.2.2
|
||||
path: packages/wyatt_analysis
|
||||
|
||||
# The "flutter_lints" package below contains a set of recommended lints to
|
||||
# encourage good coding practices. The lint set provided by the package is
|
@ -0,0 +1,9 @@
|
||||
{
|
||||
"aps": {
|
||||
"alert": {
|
||||
"title": "Wyatt Studio raised 1M$",
|
||||
"subtitle": "Letz goo",
|
||||
"body": "They can afford a mac"
|
||||
}
|
||||
}
|
||||
}
|
3832
packages/wyatt_cloud_messaging_bloc_base/example/scripts/package-lock.json
generated
Normal file
@ -0,0 +1,10 @@
|
||||
{
|
||||
"name": "firebase-messaging-scripts",
|
||||
"description": "Used to demonstrate sending a RemoteMessage to a client.",
|
||||
"scripts": {
|
||||
"send-message": "node send-message.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"firebase-admin": "^11.0.1"
|
||||
}
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
//
|
||||
var admin = require('firebase-admin');
|
||||
// 1. Download a service account key (JSON file) from your Firebase console and add to the example/scripts directory
|
||||
var serviceAccount = require('./wyatt-notification-example-firebase-adminsdk-aji7z-d74c5eb58d.json');
|
||||
admin.initializeApp({
|
||||
credential: admin.credential.cert(serviceAccount),
|
||||
});
|
||||
|
||||
// 2. Copy the token for your device that is printed in the console on app start (`flutter run`) for the FirebaseMessaging example
|
||||
const token = 'd3gPMU4qfEXLtWuOt0yigw:APA91bF-q1Y36Lz-eb9JrKPR6A7QJHXdwSFN5CN18m3YUQJDD3Km57HWvCjQRFAjA-0vUM507bXQkD4sjI_YmsKyGJsepwViat_ik4_1ra0rh2dv3GVxW9QRr84R_COMG5339IQ3Qitw';
|
||||
|
||||
|
||||
// 3. From your terminal, root to example/scripts directory & run `npm install`.
|
||||
// 4. Run `npm run send-message` in the example/scripts directory and your app will receive messages in any state; foreground, background, terminated.
|
||||
// If you find your messages have stopped arriving, it is extremely likely they are being throttled by the platform. iOS in particular
|
||||
// are aggressive with their throttling policy.
|
||||
admin
|
||||
.messaging()
|
||||
.sendToDevice(
|
||||
[token],
|
||||
{
|
||||
data: {
|
||||
foo:'bar',
|
||||
},
|
||||
notification: {
|
||||
title: 'A great title',
|
||||
body: 'Great content',
|
||||
},
|
||||
},
|
||||
{
|
||||
// Required for background/terminated app state messages on iOS
|
||||
contentAvailable: true,
|
||||
// Required for background/terminated app state messages on Android
|
||||
priority: 'high',
|
||||
}
|
||||
)
|
||||
.then((res) => {
|
||||
if (res.failureCount) {
|
||||
console.log('Failed', res.results[0].error);
|
||||
} else {
|
||||
console.log('Success');
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log('Error:', err);
|
||||
});
|
@ -0,0 +1,12 @@
|
||||
{
|
||||
"type": "service_account",
|
||||
"project_id": "wyatt-notification-example",
|
||||
"private_key_id": "d74c5eb58d43805986a1eadfab77951e9fd9b7a4",
|
||||
"private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQC6EjAUdxDTF3dB\nmkdIE/RlyHEzKYekWj9s8qGxhz9u4X2betC3doxrQSrFNsVgg1pbAXReyvBQyHz6\nyC1rdMQDUCE6IgM1WjlnOJOhKvf4OJExtr2kwy4LTjYg/UJI32lOwpaL8CE5JJ+J\n94cqyNpRuoL1rFMzP4zReeeKVKnroWUTxTLR3wskOBCuEvlmMHjxTB2kJnkuaLLz\nG32gCuO4yPxUo0itVLGAk0a17lZMQ5glt+VSGk9w8S9ixDIs53Uj2pjj6ip4bjmb\n3tMiE5GnLWJFLafqA5JoprPAgCAz0f69LKZFjxAev335ogMCl5UcWG7qeU76Iw3b\nsKbtJsFTAgMBAAECggEAOCHFfF8A5dVl5hX/G/jdGRlzQM5t+4A4MwstCSu2UKJY\nrJ9LuJTcPnzdxLnFqFxn1R1muDP7dDtPLK5XuVtzyFYTeACLvDwYJhH0w0F9pdWW\nw4sPwdUZnlJ9VM1iAi7Xi2l7VgLeWuk38byI+7i018PuvuM6BDNPLWBbn6jzy7+T\nvCVcv9iTM3nyGb+Lx4oFzget+orJazGUjwfcHLAS+Lft2o7CN+y3V3UrAadoKX7J\nbY6fs9aT0rRIfLCd54cz3HZH9MwPbTs/VC4jDbbF2yI8x6IzfXSFpodkIweF/Itl\n3uE4FwigVMKbPd5rU95jliy/jftdDEZrw8hcBXN3MQKBgQDwcbVc4HBS6P4mG8go\ne5nbiZO7UnEjdyMjopu0fJt8nWIt+bF3dzE/YeyF7PpON5neGjodO1beiXLVnnV3\n0Auqy/sxzeuv/25H56FBQIWOtnU1qGvJbbohape6jKKnOB++5ROg77i6PAqsWB2j\nsMwq+HMKJkI2dD8ld5bLEMj0cQKBgQDGG/BsflxWqcDihyKY8EMrc1DfejHz2CKf\nC6i4hlcshHLBtgyko9vws+3UDF1dPQSWhBgCQsxGvxsFAyBRq+otfrJ43qofOF8D\nCwxbEK7wV0O458tqxLiahjtToUxK+DH4BxZFCFf41QBFLzYbyfYMZEJXkaH0H2wK\nzkPNRSwkAwKBgQCwgtkgUIdE5lREx5pd1bbySoIQPwpdfcVnEKV7jwpaJfOAStB0\nIiUeIZYQDxMFvp2PRfOpp/kyrvaFSal0hl86SDqkqkW+UyazVKC1lVc2mE1dUcGn\nAo1koKq4QSva1EHB0sthFvqmhRNUx+8iTtTjKrbRGZr7/MSqjas+cZkEkQKBgA9p\n3xPh5PdNL9ewIe36S4+W4kTw8fAB8fej5ZWtxhyNlYwiyOsKYLNinG9yItV9SN0Z\nG/EZF2GtvsFuE9am5IpzoBktYdkZ/rJy6pwvOR0z/O3nAvmkoqRLK1R/aTswAltE\n2eO3GXkfwWyglrokxYMDTfIYP5yJ0VMp5zaSWjPXAoGADuWdXwtVLJgLPz/XXXi1\nQC33xUQ1YOSTxL7eYvHsxqxnQGgZ9E3w4ciHpnS4//Tjin1U8ElmKQ9TrZqvOA2+\n9lqBPskwzvc8bh6dfVf1K8vOKUk4cOP/aPFFGT1k0THJhvC2FG7FGWfS9AEXRN3I\nNlnLpWR48wtq0Yom9X+S0io=\n-----END PRIVATE KEY-----\n",
|
||||
"client_email": "firebase-adminsdk-aji7z@wyatt-notification-example.iam.gserviceaccount.com",
|
||||
"client_id": "104485519296221532664",
|
||||
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
|
||||
"token_uri": "https://oauth2.googleapis.com/token",
|
||||
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
|
||||
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/firebase-adminsdk-aji7z%40wyatt-notification-example.iam.gserviceaccount.com"
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
// Copyright (C) 2023 WYATT GROUP
|
||||
// Please see the AUTHORS file for details.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
export './exceptions/notification_exeption.dart';
|
||||
export './extensions/build_context_extension.dart';
|
@ -0,0 +1,21 @@
|
||||
// Copyright (C) 2023 WYATT GROUP
|
||||
// Please see the AUTHORS file for details.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
import 'package:wyatt_architecture/wyatt_architecture.dart';
|
||||
|
||||
class NotificationException extends AppException {
|
||||
const NotificationException([super.message]);
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
// Copyright (C) 2023 WYATT GROUP
|
||||
// Please see the AUTHORS file for details.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:wyatt_cloud_messaging_bloc_base/wyatt_cloud_messaging_bloc.dart';
|
||||
|
||||
extension BuildContextExtension on BuildContext {
|
||||
CloudMessagingCubit get cloudMessaging => read<CloudMessagingCubit>();
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
// Copyright (C) 2023 WYATT GROUP
|
||||
// Please see the AUTHORS file for details.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
export 'repositories/cloud_messaging_repository_impl.dart';
|
@ -0,0 +1,98 @@
|
||||
// Copyright (C) 2023 WYATT GROUP
|
||||
// Please see the AUTHORS file for details.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
import 'package:wyatt_architecture/wyatt_architecture.dart';
|
||||
import 'package:wyatt_cloud_messaging_bloc_base/src/core/exceptions/notification_exeption.dart';
|
||||
import 'package:wyatt_cloud_messaging_bloc_base/src/domain/data_sources/remote/cloud_messaging_remote_data_source.dart';
|
||||
import 'package:wyatt_cloud_messaging_bloc_base/src/domain/entities/remote_notifications.dart';
|
||||
import 'package:wyatt_cloud_messaging_bloc_base/src/domain/repositories/cloud_messaging_repository.dart';
|
||||
import 'package:wyatt_type_utils/wyatt_type_utils.dart';
|
||||
|
||||
class CloudMessagingRepositoryImpl extends CloudMessagingRepository {
|
||||
final CloudMessagingRemoteDataSource _notificationRemoteDataSource;
|
||||
|
||||
CloudMessagingRepositoryImpl({
|
||||
required CloudMessagingRemoteDataSource notificationRemoteDataSource,
|
||||
}) : _notificationRemoteDataSource = notificationRemoteDataSource;
|
||||
|
||||
@override
|
||||
FutureOrResult<String?> getToken() => Result.tryCatchAsync(
|
||||
_notificationRemoteDataSource.getToken,
|
||||
(error) => error is AppException
|
||||
? error
|
||||
: NotificationException(error.toString()),
|
||||
);
|
||||
|
||||
@override
|
||||
FutureOrResult<void> subscribeToTopic(String topic) => Result.tryCatchAsync(
|
||||
() => _notificationRemoteDataSource.subscribeToTopic(topic),
|
||||
(error) => error is AppException
|
||||
? error
|
||||
: NotificationException(error.toString()),
|
||||
);
|
||||
|
||||
@override
|
||||
FutureOrResult<void> unsubscribeFromTopic(String topic) =>
|
||||
Result.tryCatchAsync(
|
||||
() => _notificationRemoteDataSource.unsubscribeFromTopic(topic),
|
||||
(error) => error is AppException
|
||||
? error
|
||||
: NotificationException(error.toString()),
|
||||
);
|
||||
|
||||
@override
|
||||
FutureOrResult<void> requestPermissions() => Result.tryCatchAsync(
|
||||
_notificationRemoteDataSource.requestPermissions,
|
||||
(error) => error is AppException
|
||||
? error
|
||||
: NotificationException(error.toString()),
|
||||
);
|
||||
|
||||
@override
|
||||
FutureOrResult<Stream<RemoteNotification>> onNotification() =>
|
||||
Result.tryCatchAsync(
|
||||
_notificationRemoteDataSource.onNotification,
|
||||
(error) => error is AppException
|
||||
? error
|
||||
: NotificationException(error.toString()),
|
||||
);
|
||||
|
||||
@override
|
||||
FutureOrResult<Stream<RemoteNotification>> onNotificationBackground() =>
|
||||
Result.tryCatchAsync(
|
||||
_notificationRemoteDataSource.onNotificationBackground,
|
||||
(error) => error is AppException
|
||||
? error
|
||||
: NotificationException(error.toString()),
|
||||
);
|
||||
|
||||
@override
|
||||
FutureOrResult<Stream<RemoteNotification>> onNotificationForeground() =>
|
||||
Result.tryCatchAsync(
|
||||
_notificationRemoteDataSource.onNotificationForeground,
|
||||
(error) => error is AppException
|
||||
? error
|
||||
: NotificationException(error.toString()),
|
||||
);
|
||||
|
||||
@override
|
||||
FutureOrResult<void> init() => Result.tryCatchAsync(
|
||||
_notificationRemoteDataSource.init,
|
||||
(error) => error is AppException
|
||||
? error
|
||||
: NotificationException(error.toString()),
|
||||
);
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
// Copyright (C) 2023 WYATT GROUP
|
||||
// Please see the AUTHORS file for details.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
export './remote/cloud_messaging_remote_data_source.dart';
|
@ -0,0 +1,36 @@
|
||||
// Copyright (C) 2023 WYATT GROUP
|
||||
// Please see the AUTHORS file for details.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
import 'package:wyatt_architecture/wyatt_architecture.dart';
|
||||
import 'package:wyatt_cloud_messaging_bloc_base/src/domain/entities/remote_notifications.dart';
|
||||
|
||||
abstract class CloudMessagingRemoteDataSource extends BaseRepository {
|
||||
Future<void> init() async {}
|
||||
|
||||
Future<Stream<RemoteNotification>> onNotification();
|
||||
|
||||
Future<Stream<RemoteNotification>> onNotificationBackground();
|
||||
|
||||
Future<Stream<RemoteNotification>> onNotificationForeground();
|
||||
|
||||
Future<void> requestPermissions();
|
||||
|
||||
Future<String?> getToken();
|
||||
|
||||
Future<void> subscribeToTopic(String topic);
|
||||
|
||||
Future<void> unsubscribeFromTopic(String topic);
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
// Copyright (C) 2023 WYATT GROUP
|
||||
// Please see the AUTHORS file for details.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
export 'data_sources/data_sources.dart';
|
||||
export 'entities/entities.dart';
|
||||
export 'repositories/repositories.dart';
|
||||
export 'usecases/usecases.dart';
|
@ -0,0 +1,17 @@
|
||||
// Copyright (C) 2023 WYATT GROUP
|
||||
// Please see the AUTHORS file for details.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
export 'remote_notifications.dart';
|
@ -0,0 +1,29 @@
|
||||
// Copyright (C) 2023 WYATT GROUP
|
||||
// Please see the AUTHORS file for details.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
import 'package:wyatt_architecture/wyatt_architecture.dart';
|
||||
|
||||
class RemoteNotification extends Entity {
|
||||
const RemoteNotification({
|
||||
this.title,
|
||||
this.body,
|
||||
this.data,
|
||||
});
|
||||
|
||||
final String? title;
|
||||
final String? body;
|
||||
final Map<String, dynamic>? data;
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
// Copyright (C) 2023 WYATT GROUP
|
||||
// Please see the AUTHORS file for details.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:wyatt_architecture/wyatt_architecture.dart';
|
||||
import 'package:wyatt_cloud_messaging_bloc_base/src/domain/entities/remote_notifications.dart';
|
||||
|
||||
abstract class CloudMessagingRepository extends BaseRepository {
|
||||
FutureOrResult<void> init();
|
||||
|
||||
FutureOrResult<Stream<RemoteNotification>> onNotification();
|
||||
|
||||
FutureOrResult<Stream<RemoteNotification>> onNotificationBackground();
|
||||
|
||||
FutureOrResult<Stream<RemoteNotification>> onNotificationForeground();
|
||||
|
||||
FutureOrResult<void> requestPermissions();
|
||||
|
||||
FutureOrResult<String?> getToken();
|
||||
|
||||
FutureOrResult<void> subscribeToTopic(String topic);
|
||||
|
||||
FutureOrResult<void> unsubscribeFromTopic(String topic);
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
// Copyright (C) 2023 WYATT GROUP
|
||||
// Please see the AUTHORS file for details.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
export 'cloud_messaging_repository.dart';
|
@ -0,0 +1,30 @@
|
||||
// Copyright (C) 2023 WYATT GROUP
|
||||
// Please see the AUTHORS file for details.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
import 'package:wyatt_architecture/wyatt_architecture.dart';
|
||||
import 'package:wyatt_cloud_messaging_bloc_base/src/domain/repositories/cloud_messaging_repository.dart';
|
||||
|
||||
class GetCloudMessagingTokenUseCase extends AsyncUseCase<void, String?> {
|
||||
final CloudMessagingRepository _notificationRepository;
|
||||
|
||||
GetCloudMessagingTokenUseCase({
|
||||
required CloudMessagingRepository notificationRepository,
|
||||
}) : _notificationRepository = notificationRepository;
|
||||
|
||||
@override
|
||||
FutureOrResult<String?> execute(void params) =>
|
||||
_notificationRepository.getToken();
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
// Copyright (C) 2023 WYATT GROUP
|
||||
// Please see the AUTHORS file for details.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
import 'package:wyatt_architecture/wyatt_architecture.dart';
|
||||
import 'package:wyatt_cloud_messaging_bloc_base/src/domain/repositories/cloud_messaging_repository.dart';
|
||||
|
||||
class InitCloudmessagingUseCase extends AsyncUseCase<NoParam, void> {
|
||||
final CloudMessagingRepository _notificationRepository;
|
||||
|
||||
InitCloudmessagingUseCase({
|
||||
required CloudMessagingRepository notificationRepository,
|
||||
}) : _notificationRepository = notificationRepository;
|
||||
@override
|
||||
FutureOrResult<void> execute(NoParam? params) =>
|
||||
_notificationRepository.init();
|
||||
}
|
@ -0,0 +1,73 @@
|
||||
// Copyright (C) 2023 WYATT GROUP
|
||||
// Please see the AUTHORS file for details.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:rxdart/rxdart.dart';
|
||||
import 'package:wyatt_architecture/wyatt_architecture.dart';
|
||||
import 'package:wyatt_cloud_messaging_bloc_base/src/core/exceptions/notification_exeption.dart';
|
||||
import 'package:wyatt_cloud_messaging_bloc_base/src/domain/entities/remote_notifications.dart';
|
||||
import 'package:wyatt_cloud_messaging_bloc_base/src/domain/repositories/cloud_messaging_repository.dart';
|
||||
import 'package:wyatt_type_utils/wyatt_type_utils.dart';
|
||||
|
||||
class ListenNotificationUseCase
|
||||
extends StreamUseCase<NoParam, RemoteNotification> {
|
||||
final CloudMessagingRepository _notificationRepository;
|
||||
|
||||
ListenNotificationUseCase({
|
||||
required CloudMessagingRepository notificationRepository,
|
||||
}) : _notificationRepository = notificationRepository;
|
||||
@override
|
||||
FutureOrResult<Stream<RemoteNotification>> execute(NoParam? params) async {
|
||||
Stream<RemoteNotification>? notificationStream;
|
||||
|
||||
final notificationStreamResponse =
|
||||
await _notificationRepository.onNotification();
|
||||
|
||||
if (notificationStreamResponse.isOk) {
|
||||
notificationStream = notificationStreamResponse.ok;
|
||||
} else if (notificationStreamResponse.isErr) {
|
||||
if (notificationStreamResponse.err! is UnimplementedError) {
|
||||
return Err(notificationStreamResponse.err!);
|
||||
}
|
||||
|
||||
final notificationBackgroundStreamResponse =
|
||||
await _notificationRepository.onNotificationBackground();
|
||||
|
||||
if (notificationBackgroundStreamResponse.isErr) {
|
||||
return Err(notificationBackgroundStreamResponse.err!);
|
||||
}
|
||||
|
||||
final notificationForegroundStreamResponse =
|
||||
await _notificationRepository.onNotificationForeground();
|
||||
|
||||
if (notificationForegroundStreamResponse.isErr) {
|
||||
return Err(notificationForegroundStreamResponse.err!);
|
||||
}
|
||||
|
||||
notificationStream = Rx.merge([
|
||||
notificationForegroundStreamResponse.ok!,
|
||||
notificationBackgroundStreamResponse.ok!,
|
||||
]);
|
||||
}
|
||||
|
||||
if (notificationStream == null) {
|
||||
return const Err(NotificationException('Cannot listen notifications'));
|
||||
}
|
||||
|
||||
return Ok(notificationStream);
|
||||
}
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
// Copyright (C) 2023 WYATT GROUP
|
||||
// Please see the AUTHORS file for details.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
import 'package:wyatt_architecture/wyatt_architecture.dart';
|
||||
import 'package:wyatt_cloud_messaging_bloc_base/src/domain/repositories/cloud_messaging_repository.dart';
|
||||
|
||||
class RequestCloudMessagingPermissionUseCase extends AsyncUseCase<void, void> {
|
||||
final CloudMessagingRepository _notificationRepository;
|
||||
|
||||
RequestCloudMessagingPermissionUseCase({
|
||||
required CloudMessagingRepository notificationRepository,
|
||||
}) : _notificationRepository = notificationRepository;
|
||||
|
||||
@override
|
||||
FutureOrResult<void> execute(void params) =>
|
||||
_notificationRepository.requestPermissions();
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
// Copyright (C) 2023 WYATT GROUP
|
||||
// Please see the AUTHORS file for details.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:wyatt_architecture/wyatt_architecture.dart';
|
||||
import 'package:wyatt_cloud_messaging_bloc_base/src/domain/repositories/cloud_messaging_repository.dart';
|
||||
|
||||
class SubscribeToNotificationTopicUseCase extends AsyncUseCase<String, void> {
|
||||
final CloudMessagingRepository _notificationRepository;
|
||||
|
||||
SubscribeToNotificationTopicUseCase({
|
||||
required CloudMessagingRepository notificationRepository,
|
||||
}) : _notificationRepository = notificationRepository;
|
||||
|
||||
@override
|
||||
FutureOr<void> onStart(String? params) {
|
||||
if (params == null) {
|
||||
throw const ClientException('Topic is not valid');
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
FutureOrResult<void> execute(String? params) =>
|
||||
_notificationRepository.subscribeToTopic(params!);
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
// Copyright (C) 2023 WYATT GROUP
|
||||
// Please see the AUTHORS file for details.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:wyatt_architecture/wyatt_architecture.dart';
|
||||
import 'package:wyatt_cloud_messaging_bloc_base/src/domain/repositories/cloud_messaging_repository.dart';
|
||||
|
||||
class UnsubscribeFromNotificationTopicUseCase
|
||||
extends AsyncUseCase<String, void> {
|
||||
final CloudMessagingRepository _notificationRepository;
|
||||
|
||||
UnsubscribeFromNotificationTopicUseCase({
|
||||
required CloudMessagingRepository notificationRepository,
|
||||
}) : _notificationRepository = notificationRepository;
|
||||
|
||||
@override
|
||||
FutureOr<void> onStart(String? params) {
|
||||
if (params == null) {
|
||||
throw const ClientException('Topic is not valid');
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
FutureOrResult<void> execute(String? params) =>
|
||||
_notificationRepository.unsubscribeFromTopic(params!);
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
// Copyright (C) 2023 WYATT GROUP
|
||||
// Please see the AUTHORS file for details.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
export './get_cloud_messaging_token_use_case.dart';
|
||||
export './init_cloud_messaging_use_case.dart';
|
||||
export './listen_notification_use_case.dart';
|
||||
export './request_cloud_messaging_permission_use_case.dart';
|
||||
export 'subscribe_to_notification_topic_use_case.dart';
|
||||
export 'unsubscribe_from_notification_topic_use_case.dart';
|
@ -0,0 +1,18 @@
|
||||
// Copyright (C) 2023 WYATT GROUP
|
||||
// Please see the AUTHORS file for details.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
export './notifications/bloc/cloud_messaging_cubit.dart';
|
||||
export './notifications/screens/cloud_messaging_screen.dart';
|
@ -0,0 +1,60 @@
|
||||
// Copyright (C) 2023 WYATT GROUP
|
||||
// Please see the AUTHORS file for details.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:wyatt_architecture/wyatt_architecture.dart';
|
||||
import 'package:wyatt_cloud_messaging_bloc_base/src/domain/entities/remote_notifications.dart';
|
||||
import 'package:wyatt_cloud_messaging_bloc_base/src/domain/usecases/listen_notification_use_case.dart';
|
||||
import 'package:wyatt_cloud_messaging_bloc_base/src/domain/usecases/subscribe_to_notification_topic_use_case.dart';
|
||||
|
||||
import 'package:wyatt_cloud_messaging_bloc_base/src/domain/usecases/unsubscribe_from_notification_topic_use_case.dart';
|
||||
|
||||
part 'cloud_messaging_state.dart';
|
||||
|
||||
typedef OnNotification = void Function(RemoteNotification);
|
||||
|
||||
class CloudMessagingCubit extends Cubit<CloudmessagingState> {
|
||||
final ListenNotificationUseCase _listenNotification;
|
||||
final SubscribeToNotificationTopicUseCase? _subscribe;
|
||||
final UnsubscribeFromNotificationTopicUseCase? _unsubscribe;
|
||||
|
||||
final OnNotification? handleNotification;
|
||||
CloudMessagingCubit({
|
||||
required ListenNotificationUseCase listenNotification,
|
||||
SubscribeToNotificationTopicUseCase? subscribe,
|
||||
UnsubscribeFromNotificationTopicUseCase? unsubscribe,
|
||||
this.handleNotification,
|
||||
}) : _listenNotification = listenNotification,
|
||||
_subscribe = subscribe,
|
||||
_unsubscribe = unsubscribe,
|
||||
super(const CloudmessagingState());
|
||||
|
||||
Future<void> listenNotification() async {
|
||||
final notificaitons = await _listenNotification.execute(const NoParam());
|
||||
if (notificaitons.isOk) {
|
||||
notificaitons.ok?.listen((notification) {
|
||||
emit(CloudmessagingState(notification));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
FutureOr<void> subscribe(String topic) => _subscribe?.execute(topic);
|
||||
|
||||
FutureOr<void> unsubscribe(String topic) => _unsubscribe?.execute(topic);
|
||||
}
|