Skip to content

Commit 28c9ba1

Browse files
authored
Add user id and PusherEvent (#227)
* WIP user-id implementation * Add tests for event object * Add tests for data passed to callback * Add test for events without channel name * Simplify global callback code * Add tests for unbinding event callbacks * Consistent documentation * Tidy up code and comments * Refactor jsonize variable * Add documentation to PusherEvent * Use conditional cast rather than forced * Refactor event name * Documentation changes * Documentation fixes * Remove check for presence of data * Don't parse the event data multiple times * Rename channel and name properties in PusherEvent * Minor refactoring * Add test for non-string value in websocket JSON * Change PusherEvent to Class from Struct for ObjC compatibility * Add Objective-C tests * Remove unnecessary event name variable * Use PusherEvent throughout library and provide jsonData * Tidy up * An array is valid json too * Correct check for data encoding. Fix comments * Update tests * Ensure jsonData is read only * Ensure parsing is only attempted once * Fix comment * Stop reference cycle * Stop reference cycle * Refactor PusherEvent tests and add new tests * Add Objective-C tests for global binds * Start readme changes * Change 'jsonData' to 'dataAsJSON' * Begin documentation * Fix docs * Fix docs * Update labels * Try adding a table * Fix tables * Clarify table * Clarify table * Clarify documentation * Clarify legacy dropdown * Clarify table * Remove parser * Remove parsing helper. Return errors to delegate * Update readme * Add new section about parsing * Update Swift example * Update Objective-C example * Add objc initializer without 'attemptToReturnJSONObject' * Refactor function name * Remove xcscheme file * Reset activity count when error is received to match previous behaviour * Update README.md Co-Authored-By: Will Sewell <me@willsewell.com> * Add newline Co-Authored-By: Will Sewell <me@willsewell.com> * Fix the error message * Rename QueuedEvent to QueueClientEvent * Fix inconsistent spaces around brackets * Rename shouldParseJSON to shouldParseJSONForLegacyCallbacks * Use consistent test names * Update comment to match example * Add extra comment * Change class methods to static * Update comments * getProperty -> property * Change PusherParser to a struct * Update readme * Style updates * Remove convenience constructor and replace with function * Restructure documentation comments * Make parameter of legacy callback optional to match passed callback * dataToJSONObject etc should not be accessible in ObjC
1 parent c30c6c7 commit 28c9ba1

23 files changed

+1158
-245
lines changed

PusherSwift.xcodeproj/project.pbxproj

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@
3232
33BB997C1D21230100B25C2A /* PusherTopLevelAPITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33BB99661D21226C00B25C2A /* PusherTopLevelAPITests.swift */; };
3333
33C1FD6F1D81BFC300921AD7 /* ObjectiveC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33C1FD6E1D81BFC300921AD7 /* ObjectiveC.swift */; };
3434
33C40CB91C1DFC9C008A54E3 /* PusherSwift.h in Headers */ = {isa = PBXBuildFile; fileRef = 33831CD61A9CFFF200B124F1 /* PusherSwift.h */; settings = {ATTRIBUTES = (Public, ); }; };
35+
E2498293231E612700CFBBD6 /* PusherError.swift in Sources */ = {isa = PBXBuildFile; fileRef = E2498292231E612700CFBBD6 /* PusherError.swift */; };
36+
E24D0AA522D798C8009DE31B /* PusherEvent.swift in Sources */ = {isa = PBXBuildFile; fileRef = E24D0AA422D798C8009DE31B /* PusherEvent.swift */; };
37+
E29A4CBC2301BA31000BC499 /* PusherEventTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E29A4CBB2301BA31000BC499 /* PusherEventTests.swift */; };
38+
E2CAFF0322FB09EF007915A7 /* PusherObjectiveCAPITests.m in Sources */ = {isa = PBXBuildFile; fileRef = E2CAFEFD22FB084B007915A7 /* PusherObjectiveCAPITests.m */; };
39+
E2CFE43122D79CA7004187C3 /* PusherParser.swift in Sources */ = {isa = PBXBuildFile; fileRef = E2CFE43022D79CA7004187C3 /* PusherParser.swift */; };
3540
/* End PBXBuildFile section */
3641

3742
/* Begin PBXContainerItemProxy section */
@@ -74,6 +79,11 @@
7479
33BB99661D21226C00B25C2A /* PusherTopLevelAPITests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = PusherTopLevelAPITests.swift; path = ../Tests/PusherTopLevelAPITests.swift; sourceTree = "<group>"; };
7580
33BB99671D21226C00B25C2A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = ../Tests/Info.plist; sourceTree = "<group>"; };
7681
33C1FD6E1D81BFC300921AD7 /* ObjectiveC.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ObjectiveC.swift; sourceTree = "<group>"; };
82+
E2498292231E612700CFBBD6 /* PusherError.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PusherError.swift; sourceTree = "<group>"; };
83+
E24D0AA422D798C8009DE31B /* PusherEvent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PusherEvent.swift; sourceTree = "<group>"; };
84+
E29A4CBB2301BA31000BC499 /* PusherEventTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PusherEventTests.swift; sourceTree = "<group>"; };
85+
E2CAFEFD22FB084B007915A7 /* PusherObjectiveCAPITests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PusherObjectiveCAPITests.m; sourceTree = "<group>"; };
86+
E2CFE43022D79CA7004187C3 /* PusherParser.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PusherParser.swift; sourceTree = "<group>"; };
7787
/* End PBXFileReference section */
7888

7989
/* Begin PBXFrameworksBuildPhase section */
@@ -120,16 +130,19 @@
120130
3389F5791CAEDEC800563F49 /* PusherClientOptions.swift */,
121131
33BA541F1D9035BD00CD853B /* PusherDelegate.swift */,
122132
3389F5651CAEDD5F00563F49 /* PusherConnection.swift */,
133+
E2CFE43022D79CA7004187C3 /* PusherParser.swift */,
123134
3389F5691CAEDD9100563F49 /* PusherWebsocketDelegate.swift */,
124135
3384C1B81CAECD9C00F10796 /* PusherChannel.swift */,
125136
3389F56D1CAEDDD800563F49 /* PusherPresenceChannel.swift */,
137+
3390D1E71F054D1E00E1944D /* Authorizer.swift */,
126138
3389F5751CAEDE2800563F49 /* PusherGlobalChannel.swift */,
127139
3389F5711CAEDDF300563F49 /* PusherChannels.swift */,
128140
3390D1E51F054D0400E1944D /* AuthRequestBuilderProtocol.swift */,
129-
3390D1E71F054D1E00E1944D /* Authorizer.swift */,
130141
33C1FD6E1D81BFC300921AD7 /* ObjectiveC.swift */,
131142
33831C8C1A9CF61600B124F1 /* Supporting Files */,
132143
33831CD61A9CFFF200B124F1 /* PusherSwift.h */,
144+
E24D0AA422D798C8009DE31B /* PusherEvent.swift */,
145+
E2498292231E612700CFBBD6 /* PusherError.swift */,
133146
);
134147
path = Sources;
135148
sourceTree = "<group>";
@@ -157,7 +170,9 @@
157170
33A962751D8943CA00DA421E /* PusherConnectionDelegateTests.swift */,
158171
33BB99651D21226C00B25C2A /* PusherIncomingEventHandlingTests.swift */,
159172
33BB99661D21226C00B25C2A /* PusherTopLevelAPITests.swift */,
173+
E2CAFEFD22FB084B007915A7 /* PusherObjectiveCAPITests.m */,
160174
33BB99671D21226C00B25C2A /* Info.plist */,
175+
E29A4CBB2301BA31000BC499 /* PusherEventTests.swift */,
161176
);
162177
path = Tests;
163178
sourceTree = "<group>";
@@ -311,10 +326,13 @@
311326
files = (
312327
3389F5661CAEDD5F00563F49 /* PusherConnection.swift in Sources */,
313328
33BA54201D9035BD00CD853B /* PusherDelegate.swift in Sources */,
329+
E2498293231E612700CFBBD6 /* PusherError.swift in Sources */,
330+
E24D0AA522D798C8009DE31B /* PusherEvent.swift in Sources */,
314331
3389F56A1CAEDD9100563F49 /* PusherWebsocketDelegate.swift in Sources */,
315332
330D7A6D1CAEDA750032FF2C /* PusherChannel.swift in Sources */,
316333
3390D1E81F054D1E00E1944D /* Authorizer.swift in Sources */,
317334
3389F5721CAEDDF300563F49 /* PusherChannels.swift in Sources */,
335+
E2CFE43122D79CA7004187C3 /* PusherParser.swift in Sources */,
318336
3389F5761CAEDE2800563F49 /* PusherGlobalChannel.swift in Sources */,
319337
3389F57A1CAEDEC800563F49 /* PusherClientOptions.swift in Sources */,
320338
3389F56E1CAEDDD800563F49 /* PusherPresenceChannel.swift in Sources */,
@@ -337,8 +355,10 @@
337355
33BB99751D21230100B25C2A /* Helpers.swift in Sources */,
338356
33BB99731D21230100B25C2A /* AuthenticationTests.swift in Sources */,
339357
33BB99781D21230100B25C2A /* PusherChannelTests.swift in Sources */,
358+
E29A4CBC2301BA31000BC499 /* PusherEventTests.swift in Sources */,
340359
33BB99761D21230100B25C2A /* Mocks.swift in Sources */,
341360
33A962771D89483600DA421E /* PusherConnectionDelegateTests.swift in Sources */,
361+
E2CAFF0322FB09EF007915A7 /* PusherObjectiveCAPITests.m in Sources */,
342362
);
343363
runOnlyForDeploymentPostprocessing = 0;
344364
};

0 commit comments

Comments
 (0)