Skip to content

Commit dda84ed

Browse files
iamsivinimhafeezsojan-official
authored
fix: pubsub_token is null (#20)
* optional pub_sub_tokken in contact * model updates * dummy tokken * Fix: Build issue * test fix * Minor build fixes * chore: test fixes * chore: build fix * chore: fix analyze Co-authored-by: Hafeez Ahmed <[email protected]> Co-authored-by: Sojan <[email protected]>
1 parent 1bacef7 commit dda84ed

32 files changed

+592
-363
lines changed

analysis_options.yaml

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
analyzer:
2+
exclude:
3+
- "**.g.dart"
4+
- "**.mocks.dart"

example/ios/Flutter/AppFrameworkInfo.plist

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@
2121
<key>CFBundleVersion</key>
2222
<string>1.0</string>
2323
<key>MinimumOSVersion</key>
24-
<string>8.0</string>
24+
<string>9.0</string>
2525
</dict>
2626
</plist>

example/ios/Flutter/Debug.xcconfig

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
12
#include "Generated.xcconfig"

example/ios/Flutter/Release.xcconfig

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
12
#include "Generated.xcconfig"

example/ios/Podfile

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
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

example/ios/Runner.xcodeproj/project.pbxproj

+68
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
1414
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
1515
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
16+
E655466E3E55916FCC0D4552 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C0265FDFC938C8EF1E62D4B4 /* Pods_Runner.framework */; };
1617
/* End PBXBuildFile section */
1718

1819
/* Begin PBXCopyFilesBuildPhase section */
@@ -32,23 +33,28 @@
3233
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; };
3334
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
3435
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
36+
5EDC788723A887E604449269 /* 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>"; };
3537
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = "<group>"; };
3638
74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
3739
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
40+
8C82488414029CF16C0B29CA /* 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>"; };
3841
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = "<group>"; };
3942
9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = "<group>"; };
4043
97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; };
4144
97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
4245
97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
4346
97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
4447
97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
48+
C0265FDFC938C8EF1E62D4B4 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
49+
C5F767305D74F8551439F7C5 /* 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>"; };
4550
/* End PBXFileReference section */
4651

4752
/* Begin PBXFrameworksBuildPhase section */
4853
97C146EB1CF9000F007C117D /* Frameworks */ = {
4954
isa = PBXFrameworksBuildPhase;
5055
buildActionMask = 2147483647;
5156
files = (
57+
E655466E3E55916FCC0D4552 /* Pods_Runner.framework in Frameworks */,
5258
);
5359
runOnlyForDeploymentPostprocessing = 0;
5460
};
@@ -72,6 +78,8 @@
7278
9740EEB11CF90186004384FC /* Flutter */,
7379
97C146F01CF9000F007C117D /* Runner */,
7480
97C146EF1CF9000F007C117D /* Products */,
81+
EA5ED100840243C4D193AA67 /* Pods */,
82+
AD4D11F959286DF91441ADFA /* Frameworks */,
7583
);
7684
sourceTree = "<group>";
7785
};
@@ -98,19 +106,40 @@
98106
path = Runner;
99107
sourceTree = "<group>";
100108
};
109+
AD4D11F959286DF91441ADFA /* Frameworks */ = {
110+
isa = PBXGroup;
111+
children = (
112+
C0265FDFC938C8EF1E62D4B4 /* Pods_Runner.framework */,
113+
);
114+
name = Frameworks;
115+
sourceTree = "<group>";
116+
};
117+
EA5ED100840243C4D193AA67 /* Pods */ = {
118+
isa = PBXGroup;
119+
children = (
120+
C5F767305D74F8551439F7C5 /* Pods-Runner.debug.xcconfig */,
121+
8C82488414029CF16C0B29CA /* Pods-Runner.release.xcconfig */,
122+
5EDC788723A887E604449269 /* Pods-Runner.profile.xcconfig */,
123+
);
124+
name = Pods;
125+
path = Pods;
126+
sourceTree = "<group>";
127+
};
101128
/* End PBXGroup section */
102129

103130
/* Begin PBXNativeTarget section */
104131
97C146ED1CF9000F007C117D /* Runner */ = {
105132
isa = PBXNativeTarget;
106133
buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
107134
buildPhases = (
135+
D291A2AEFD494FC3CD22B3A4 /* [CP] Check Pods Manifest.lock */,
108136
9740EEB61CF901F6004384FC /* Run Script */,
109137
97C146EA1CF9000F007C117D /* Sources */,
110138
97C146EB1CF9000F007C117D /* Frameworks */,
111139
97C146EC1CF9000F007C117D /* Resources */,
112140
9705A1C41CF9048500538489 /* Embed Frameworks */,
113141
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
142+
7157BE01F33ABD3ADB84F6ED /* [CP] Embed Pods Frameworks */,
114143
);
115144
buildRules = (
116145
);
@@ -183,6 +212,23 @@
183212
shellPath = /bin/sh;
184213
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin";
185214
};
215+
7157BE01F33ABD3ADB84F6ED /* [CP] Embed Pods Frameworks */ = {
216+
isa = PBXShellScriptBuildPhase;
217+
buildActionMask = 2147483647;
218+
files = (
219+
);
220+
inputFileListPaths = (
221+
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist",
222+
);
223+
name = "[CP] Embed Pods Frameworks";
224+
outputFileListPaths = (
225+
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist",
226+
);
227+
runOnlyForDeploymentPostprocessing = 0;
228+
shellPath = /bin/sh;
229+
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
230+
showEnvVarsInLog = 0;
231+
};
186232
9740EEB61CF901F6004384FC /* Run Script */ = {
187233
isa = PBXShellScriptBuildPhase;
188234
buildActionMask = 2147483647;
@@ -197,6 +243,28 @@
197243
shellPath = /bin/sh;
198244
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
199245
};
246+
D291A2AEFD494FC3CD22B3A4 /* [CP] Check Pods Manifest.lock */ = {
247+
isa = PBXShellScriptBuildPhase;
248+
buildActionMask = 2147483647;
249+
files = (
250+
);
251+
inputFileListPaths = (
252+
);
253+
inputPaths = (
254+
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
255+
"${PODS_ROOT}/Manifest.lock",
256+
);
257+
name = "[CP] Check Pods Manifest.lock";
258+
outputFileListPaths = (
259+
);
260+
outputPaths = (
261+
"$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt",
262+
);
263+
runOnlyForDeploymentPostprocessing = 0;
264+
shellPath = /bin/sh;
265+
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";
266+
showEnvVarsInLog = 0;
267+
};
200268
/* End PBXShellScriptBuildPhase section */
201269

202270
/* Begin PBXSourcesBuildPhase section */

example/ios/Runner.xcworkspace/contents.xcworkspacedata

+3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example/lib/main.dart

+7-7
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ class _MyHomePageState extends State<MyHomePage> {
3838
_showChatwootDialog() {
3939
ChatwootChatDialog.show(
4040
context,
41-
baseUrl: "<<<your-chatwoot-base-url-here>>>",
42-
inboxIdentifier: "<<<your-inbox-identifier-here>>>",
41+
baseUrl: "https://app.chatwoot.com",
42+
inboxIdentifier: "xxxxxxxxxxxxxxxxxxx",
4343
title: "Chatwoot Support",
4444
user: ChatwootUser(
4545
identifier: "[email protected]",
@@ -52,12 +52,12 @@ class _MyHomePageState extends State<MyHomePage> {
5252
@override
5353
Widget build(BuildContext context) {
5454
return ChatwootChat(
55-
baseUrl: "<<<your-chatwoot-base-url-here>>>",
56-
inboxIdentifier: "<<<your-inbox-identifier-here>>>",
55+
baseUrl: "https://app.chatwoot.com",
56+
inboxIdentifier: "xxxxxxxxxxxxxxxxxxx",
5757
user: ChatwootUser(
58-
identifier: "test@test.com",
59-
name: "Tester test",
60-
email: "test@test.com",
58+
identifier: "test1@test.com",
59+
name: "Tester test1",
60+
email: "test1@test.com",
6161
),
6262
appBar: AppBar(
6363
title: Text(

example/pubspec.lock

+16-9
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ packages:
77
name: async
88
url: "https://pub.dartlang.org"
99
source: hosted
10-
version: "2.6.1"
10+
version: "2.8.2"
1111
boolean_selector:
1212
dependency: transitive
1313
description:
@@ -21,21 +21,21 @@ packages:
2121
name: characters
2222
url: "https://pub.dartlang.org"
2323
source: hosted
24-
version: "1.1.0"
24+
version: "1.2.0"
2525
charcode:
2626
dependency: transitive
2727
description:
2828
name: charcode
2929
url: "https://pub.dartlang.org"
3030
source: hosted
31-
version: "1.2.0"
31+
version: "1.3.1"
3232
chatwoot_client_sdk:
3333
dependency: "direct main"
3434
description:
3535
path: ".."
3636
relative: true
3737
source: path
38-
version: "0.0.6"
38+
version: "0.0.8"
3939
clock:
4040
dependency: transitive
4141
description:
@@ -232,14 +232,21 @@ packages:
232232
name: matcher
233233
url: "https://pub.dartlang.org"
234234
source: hosted
235-
version: "0.12.10"
235+
version: "0.12.11"
236+
material_color_utilities:
237+
dependency: transitive
238+
description:
239+
name: material_color_utilities
240+
url: "https://pub.dartlang.org"
241+
source: hosted
242+
version: "0.1.3"
236243
meta:
237244
dependency: transitive
238245
description:
239246
name: meta
240247
url: "https://pub.dartlang.org"
241248
source: hosted
242-
version: "1.3.0"
249+
version: "1.7.0"
243250
path:
244251
dependency: transitive
245252
description:
@@ -384,7 +391,7 @@ packages:
384391
name: test_api
385392
url: "https://pub.dartlang.org"
386393
source: hosted
387-
version: "0.3.0"
394+
version: "0.4.8"
388395
typed_data:
389396
dependency: transitive
390397
description:
@@ -447,7 +454,7 @@ packages:
447454
name: vector_math
448455
url: "https://pub.dartlang.org"
449456
source: hosted
450-
version: "2.1.0"
457+
version: "2.1.1"
451458
web_socket_channel:
452459
dependency: transitive
453460
description:
@@ -470,5 +477,5 @@ packages:
470477
source: hosted
471478
version: "0.2.0"
472479
sdks:
473-
dart: ">=2.12.0 <3.0.0"
480+
dart: ">=2.14.0 <3.0.0"
474481
flutter: ">=2.0.0"

example/test/widget_test.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import 'package:flutter/material.dart';
99
import 'package:flutter_test/flutter_test.dart';
1010

11-
import 'package:example/main.dart';
11+
import '../lib/main.dart';
1212

1313
void main() {
1414
testWidgets('Counter increments smoke test', (WidgetTester tester) async {

lib/chatwoot_client.dart

-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
import 'package:chatwoot_client_sdk/chatwoot_callbacks.dart';
21
import 'package:chatwoot_client_sdk/chatwoot_client_sdk.dart';
32
import 'package:chatwoot_client_sdk/data/chatwoot_repository.dart';
43
import 'package:chatwoot_client_sdk/data/local/entity/chatwoot_contact.dart';
54
import 'package:chatwoot_client_sdk/data/local/entity/chatwoot_conversation.dart';
6-
import 'package:chatwoot_client_sdk/data/local/entity/chatwoot_user.dart';
75
import 'package:chatwoot_client_sdk/data/remote/requests/chatwoot_action_data.dart';
86
import 'package:chatwoot_client_sdk/data/remote/requests/chatwoot_new_message_request.dart';
97
import 'package:chatwoot_client_sdk/di/modules.dart';

lib/data/chatwoot_repository.dart

+2-2
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ class ChatwootRepositoryImpl extends ChatwootRepository {
136136
return;
137137
}
138138
clientService.startWebSocketConnection(
139-
localStorage.contactDao.getContact()!.pubsubToken);
139+
localStorage.contactDao.getContact()!.pubsubToken ?? "");
140140

141141
final newSubscription = clientService.connection!.stream.listen((event) {
142142
ChatwootEvent chatwootEvent = ChatwootEvent.fromJson(jsonDecode(event));
@@ -226,7 +226,7 @@ class ChatwootRepositoryImpl extends ChatwootRepository {
226226
@override
227227
void sendAction(ChatwootActionType action) {
228228
clientService.sendAction(
229-
localStorage.contactDao.getContact()!.pubsubToken, action);
229+
localStorage.contactDao.getContact()!.pubsubToken ?? "", action);
230230
}
231231

232232
///Publishes presence update to websocket channel at a 30 second interval

lib/data/local/entity/chatwoot_contact.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class ChatwootContact extends Equatable {
2222
///Token for subscribing to websocket stream events
2323
@JsonKey(name: "pubsub_token")
2424
@HiveField(2)
25-
final String pubsubToken;
25+
final String? pubsubToken;
2626

2727
///Full name of contact
2828
@JsonKey()

lib/data/local/entity/chatwoot_contact.g.dart

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/ui/chatwoot_chat_dialog.dart

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import 'package:chatwoot_client_sdk/data/local/entity/chatwoot_user.dart';
22
import 'package:chatwoot_client_sdk/ui/chatwoot_chat_theme.dart';
33
import 'package:chatwoot_client_sdk/ui/chatwoot_l10n.dart';
44
import 'package:flutter/material.dart';
5-
import 'package:flutter/widgets.dart';
65
import 'package:flutter_chat_ui/flutter_chat_ui.dart';
76
import 'package:intl/intl.dart';
87

0 commit comments

Comments
 (0)