Add UserId methods to NotificationHub class (#86)
* Initial commit
* Updating MSNotification.m
* Deleting bad files
* Update commands
* Test app refresh swift (#42)
Swift Test App Refresh
* Move tests to common folder
* Update links at test project
* Fix tests
* Add Sample App using NH iOS SDK V3 (#44)
* Add HttpClient and all dependencies from AppCenter
* Add tests for http client
* Update test schema
* Back schema to static from library for tests
* Remove separate project for tests
* Update commands for CIT and BVT
* Add frameworks for testings
* Intermediate state for fixing tests for http client
* Fix reference for OHHTTPStubs
* Fix tests for http client
* Rename AppCenter components to NotificationHub
* Add custom MSNotificationHubMessage (#51)
Add custom MSNotificationHubMessage
* Add Swizzling for AppDelegate lifecycle methods (#49)
Add Swizzling for AppDelegate lifecycle methods
* Fixing BVT tests (#53)
* Update targets for Framework
* Fixing BVT (add required frameworks for new SDK)
* Create custom delegate for intercepting remote notifications (#52)
Create custom delegate for intercepting remote notifications
* Update sample app for Objective-C for receiving pushes
* Update sample app for Swift for receiving pushes
* fix
* Installation manager (#55)
Installation manager
* Add support for adding and removing tags (#56)
Add support for adding and removing tags
* Add clang formatting
* Add debouncer for adding/removing tags (#58)
debouncer for installation manager
* Final updates before new release
* Add templates to MSInstallation
* Fix formatting for clang-format
* Add templates operations in MSNotificationHub
* Added tests for installation template.
* Fix headers and spacing
* Removing templates and changed tags to Set
* Update the installation manager
* Fix some headers
* Fixing equality
* Fix pch issues
* Add unit tests setup
* Fix get tags
* Code cleanup
* Fix sample apps (#60)
Fix sample apps
* Fixing unit tests
* Add enable/disable SDK
* Combine upsert/install
* Fixed tests.
* Refactored to use nsset instead of nsarray. Fixed to json logic.
* Refactored toJson logic
* Fixed save installation test.
* Fix CIT (#62)
Fix CIT
* mutable to non-mutable dictionary for data
* Fixed merge.
* Adding 3rd party notice
* Fix project file and gitignore
* Move setHttpClient to private
* Update third party notices
* Addressing LocalStorage constants
* Adds user-agent
* Fixing tests for header checks
* Cleanup the MSNotificationHubMessage interface. Don't hide the
underlying notification data. Add unit tests for the class.
* Cleanup HTTP code imported from App Center.
* Remove usage from MSNotificationHubMessage.data from Swift sample.
* Resolved cr comments.
* Resolved cr comments.
* Fixed styling with clang-format.
* Fixup pod with license
* Change back new version number
* Update podspec to include the correct frameworks.
* Proper error handling for pod
* Adding UIKit for the build
* Add UIKit to frameworks
* Add weak framework for user notifications
* Update to build only active architecture
* Refine Installation Templates (#66)
* Change back new version number
* Update podspec to include the correct frameworks.
* Proper error handling for pod
* Adding UIKit for the build
* Add UIKit to frameworks
* Add weak framework for user notifications
* Update to build only active architecture
* Updating tests for templates/tags
Co-authored-by: Brannon Jones <brannon@iterator.net>
* Final touches on the SDK for Preview 2
* Fix regressions with deprecated APIs
* Bump version
* Update as per comments
* Rename addTemplate to setTemplate
* Fix indentation
* Clang format cleanup
* Installation management (#69)
* Added enrichment delegate.
* Update samples
* Fixed installation manager unit tests.
* Formatted affected files.
* Added installation management delegate. Updated samples.
* Fixed misprint.
* fix samples
* Added installation lifecycle delegate.
* Update samples
* Formatted.
* Fixed tests.
* Added test for installation equality.
* Fixed comment.
Co-authored-by: Artem Egorov <toysruss89@gmail.com>
* Fix Swift protocol implementations
* Fixup Swift again
* Adding notification to global error handler
* Update status code for 403
* Changing ms to seconds for retry-after
* Added defining sdk version in config file and dynamic assigning of api-origin based on it. (#71)
* SPM support for sdk-v3 (#47)
* Added SPM manifest
* Added include folder for public headers and created SPM manifest
* Reduce duplication of sources folders in SPM manifest
* rename(init): rename init function to start (#72)
* rename(init): rename init function to setup
* fix(tests): Fixing tests and include headers
* chore(BVTs): change to 13.5 for simulator
* Rename setup to start
* feat(tags): Add tags samples (#74)
* macOS and Mac Catalyst support (#78)
* Initial commit
* Removing old src
* Updating swift project
* Updating scripts for archives
* Updating scripts for archives
* Update WindowsAzureMessaging/WindowsAzureMessaging/Support/iOS WindowsAzureMessaging.xcconfig
Co-authored-by: Ivan Matkov <v-ivmatk@microsoft.com>
* Update WindowsAzureMessaging/WindowsAzureMessaging/Support/WindowsAzureMessaging.xcconfig
Co-authored-by: Ivan Matkov <v-ivmatk@microsoft.com>
* Updating scripts for archives
* Updating as per warnings
* Add headers for SPM
* Add more interfaces
Co-authored-by: Ivan Matkov <v-ivmatk@microsoft.com>
* Updating variables for build
* Updating reachability
* Rename scheme
* Updating reachability in tests
* Update paths for builds
* Adding AllFrameworks scheme
* Updating build archive
* Removing iOS Tests from macOS
* Adding installation expiration time
* Adding new samples
* Adding initial commit for testing
* Undo dev settings
* Adding entitlements to all apps
* Updating for macOS
* Reimplement Sample Apps iOS (#80)
* Reimplement Sample App for ObjC iOS
* Reimplement Sample App for Swift iOS
* Implement Sample App for ObjC macOS
* Implement Sample App for Swift macOS
* Revert "Implement Sample App for ObjC macOS"
This reverts commit 1d5b6865a6
.
* add extended tags
* Add xcconfig
* refactoring xcconfig
* refactoring xcconfig
* check for creds
* typo
* refactoring xcconfig
* Version bump
* Update API version
* Update tests with API version
* Update tests with API version
* Change version from 13.1 to 10.0
* Updating apps with proper configs
* Update plist key
* Updating podspec
* Add UserNotifications for macOS
* Implement macos objective c sample (#81)
* add labels and list of tags
* add adding and removing tags in tag table
* add notification details table
* fix notifications, add some configs to xcconfig files
* fix xcconfigs
* fix review issues
* fix config issue
* Implement macos swift sample (#82)
* add labels and list of tags
* add adding and removing tags in tag table
* add notification details table
* fix notifications, add some configs to xcconfig files
* fix xcconfigs
* move build configs to xcconfig file
* implement swift sample for macos
* fix review issues
* move macOS configs to swift sample config file
* fix config issue
* fix congig issues
* fix review issues
* Way to appcenter (#83)
* Add shared schemes
* fix configs
* fix configs 2
* setup dev team
* clean embed frameworks
* struggle with embed framework
* add appcenter-pre-build.sh
* update appcenter-pre-build.sh
* add CopyableLabel
* Migrate MS to ANH for internal APIs that might collide with AppCenter (#84)
* Change AppCenter MS to ANH
* Updating settings
* Update urlEncode not to use deprecated API
* Version bump
* Update expiration time
* version bump to 3.0.0
* Fix expiration date logic
* Adding expiration unit tests
* Update README
* Update README
* Updating README
* Adding tvOS support for pushes
* Add tvOS to archive
* Updating with schemes
* Adding schemes for testing
* Adding tvOS support for cocoapods
* Updating build all frameworks
* Updating PodSpec
* add userID as a tag to NotificationHub
* fix missprints
* Creates GitHub Actions workflows for CI (#87)
* Create analyze-test.yml
* Update analyze-test.yml
* Update analyze-test.yml
* Update analyze-test.yml
* Update analyze-test.yml
* Update analyze-test.yml
* Create framework-docs.yml GitHub Workflow (#88)
* Create framework-docs.yml
* Update framework-docs.yml
* Updating symlinks
* Add reachability header
* add userId to installation
* add UserId to isEqual method
* add and fix unit tests
* Updating sample apps
* Adding templates for issues/PR (#90)
* Adding templates for issues/PR
* Updating with versions
* SwiftUI Notification Hubs Sample Apps for iOS and MacOS (#89)
* SwiftUI Notification Hubs Sample App for iOS
* SwiftUI Notification Hubs Sample App for MacOS
* update workspace
Co-authored-by: Matthew Podwysocki <matthewp@microsoft.com>
* Adding icons/splashscreen to SwiftUI
* Updating README with new samples
* update swiftui samples to use user id
* update storyboard samples to use user id
* update mac storyboard samples to use user id
* rerun pipeline
* revert endline
* fix tests
Co-authored-by: Matthew Podwysocki <matthewp@microsoft.com>
Co-authored-by: Evgenii Karpov <evkarp@microsoft.com>
Co-authored-by: Artem Egorov <v-aregor@microsoft.com>
Co-authored-by: Artem Egorov <toysruss89@gmail.com>
Co-authored-by: Olga Chistyakova <v-olchi@microsoft.com>
Co-authored-by: Brannon Jones <brannon@iterator.net>
Co-authored-by: olga chistyakova <57174200+olgaakv@users.noreply.github.com>
Co-authored-by: James Power <heathen79@gmail.com>
Co-authored-by: Ivan Matkov <v-ivmatk@microsoft.com>
This commit is contained in:
Родитель
b97622e5fa
Коммит
8ee6570b06
|
@ -706,11 +706,11 @@
|
|||
<objects>
|
||||
<viewController id="XfG-lQ-9wD" customClass="ViewController" sceneMemberID="viewController">
|
||||
<view key="view" id="m2S-Jp-Qdl">
|
||||
<rect key="frame" x="0.0" y="0.0" width="676" height="496"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="676" height="508"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="8SN-6i-shT">
|
||||
<rect key="frame" x="18" y="460" width="89" height="16"/>
|
||||
<rect key="frame" x="18" y="472" width="90" height="16"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<textFieldCell key="cell" lineBreakMode="clipping" title="Device Token:" id="5Ek-2M-En6">
|
||||
<font key="font" usesAppearanceFont="YES"/>
|
||||
|
@ -719,7 +719,7 @@
|
|||
</textFieldCell>
|
||||
</textField>
|
||||
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="ht4-Em-cYD">
|
||||
<rect key="frame" x="18" y="436" width="90" height="16"/>
|
||||
<rect key="frame" x="18" y="448" width="90" height="16"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<textFieldCell key="cell" lineBreakMode="clipping" title="Installation ID:" id="IAy-qC-pkE">
|
||||
<font key="font" metaFont="system"/>
|
||||
|
@ -728,7 +728,7 @@
|
|||
</textFieldCell>
|
||||
</textField>
|
||||
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="gYf-hZ-w4b">
|
||||
<rect key="frame" x="123" y="460" width="535" height="16"/>
|
||||
<rect key="frame" x="123" y="472" width="535" height="16"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<textFieldCell key="cell" lineBreakMode="clipping" id="f0p-16-6ud">
|
||||
<font key="font" metaFont="system"/>
|
||||
|
@ -737,7 +737,7 @@
|
|||
</textFieldCell>
|
||||
</textField>
|
||||
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="qpa-Nv-YYW">
|
||||
<rect key="frame" x="123" y="436" width="535" height="16"/>
|
||||
<rect key="frame" x="123" y="448" width="535" height="16"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<textFieldCell key="cell" lineBreakMode="clipping" id="7oz-mU-S2X">
|
||||
<font key="font" metaFont="system"/>
|
||||
|
@ -746,7 +746,7 @@
|
|||
</textFieldCell>
|
||||
</textField>
|
||||
<scrollView fixedFrame="YES" autohidesScrollers="YES" horizontalLineScroll="19" horizontalPageScroll="10" verticalLineScroll="19" verticalPageScroll="10" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="2cD-gx-xHo">
|
||||
<rect key="frame" x="20" y="197" width="636" height="178"/>
|
||||
<rect key="frame" x="20" y="184" width="636" height="178"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<clipView key="contentView" id="qfd-CR-ipA">
|
||||
<rect key="frame" x="1" y="0.0" width="634" height="177"/>
|
||||
|
@ -809,16 +809,34 @@
|
|||
</tableHeaderView>
|
||||
</scrollView>
|
||||
<textField verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="i6p-AP-9qX">
|
||||
<rect key="frame" x="20" y="394" width="636" height="21"/>
|
||||
<rect key="frame" x="20" y="382" width="636" height="21"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" borderStyle="bezel" drawsBackground="YES" id="0Zb-af-2tU">
|
||||
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" borderStyle="bezel" placeholderString="Enter tag to add" drawsBackground="YES" id="0Zb-af-2tU">
|
||||
<font key="font" metaFont="system"/>
|
||||
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="v6h-al-Lrb">
|
||||
<rect key="frame" x="18" y="424" width="90" height="16"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<textFieldCell key="cell" lineBreakMode="clipping" alignment="right" title="User Id:" id="IAW-84-RTC">
|
||||
<font key="font" metaFont="system"/>
|
||||
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
<textField verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Vee-ha-Jyg">
|
||||
<rect key="frame" x="125" y="421" width="531" height="21"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" borderStyle="bezel" placeholderString="Enter UserId" drawsBackground="YES" id="uhH-wQ-ySq">
|
||||
<font key="font" metaFont="system"/>
|
||||
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
<scrollView fixedFrame="YES" autohidesScrollers="YES" horizontalLineScroll="19" horizontalPageScroll="10" verticalLineScroll="19" verticalPageScroll="10" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="D4W-b8-bMx">
|
||||
<rect key="frame" x="20" y="28" width="636" height="135"/>
|
||||
<rect key="frame" x="20" y="26" width="636" height="135"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<clipView key="contentView" id="XxY-G9-GiW">
|
||||
<rect key="frame" x="1" y="0.0" width="634" height="134"/>
|
||||
|
@ -924,11 +942,12 @@
|
|||
<outlet property="notificationsTable" destination="Y6E-jc-4ED" id="wcc-ef-AtD"/>
|
||||
<outlet property="tagsTable" destination="6vd-tb-rzf" id="HkQ-dj-8YP"/>
|
||||
<outlet property="tagsTextField" destination="i6p-AP-9qX" id="9ZE-MH-Lko"/>
|
||||
<outlet property="userIdTextField" destination="Vee-ha-Jyg" id="4HT-fH-bYb"/>
|
||||
</connections>
|
||||
</viewController>
|
||||
<customObject id="rPt-NT-nkU" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="173" y="768"/>
|
||||
<point key="canvasLocation" x="173" y="774"/>
|
||||
</scene>
|
||||
</scenes>
|
||||
</document>
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
@property (weak) IBOutlet NSTableView *tagsTable;
|
||||
@property (weak) IBOutlet NSTextField *tagsTextField;
|
||||
@property (weak) IBOutlet NSTableView *notificationsTable;
|
||||
@property (weak) IBOutlet NSTextField *userIdTextField;
|
||||
|
||||
@end
|
||||
|
||||
|
|
|
@ -15,9 +15,11 @@
|
|||
self.tagsTable.delegate = self;
|
||||
self.tagsTable.dataSource = self;
|
||||
self.tagsTextField.delegate = self;
|
||||
self.userIdTextField.delegate = self;
|
||||
|
||||
self.notificationsTableViewController = [[NotificationsTableViewController alloc] initWithTableView: self.notificationsTable];
|
||||
|
||||
self.userIdTextField.placeholderString = [MSNotificationHub getUserId];
|
||||
_tags = [MSNotificationHub getTags];
|
||||
|
||||
[_deviceTokenTextField setStringValue:[MSNotificationHub getPushChannel]];
|
||||
|
@ -45,14 +47,13 @@
|
|||
|
||||
- (BOOL)control:(NSControl *)control textView:(NSTextField *)fieldEditor doCommandBySelector:(SEL)commandSelector {
|
||||
if (commandSelector == @selector(insertNewline:)) {
|
||||
NSString *tag = self.tagsTextField.stringValue;
|
||||
if ([tag isEqual:@""]) {
|
||||
[MSNotificationHub addTag:tag];
|
||||
self.tagsTextField.stringValue = @"";
|
||||
if (control == self.tagsTextField) {
|
||||
[self updateTag];
|
||||
}
|
||||
|
||||
if (control == self.userIdTextField) {
|
||||
[self updateUserId];
|
||||
}
|
||||
|
||||
_tags = [MSNotificationHub getTags];
|
||||
[self.tagsTable reloadData];
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
@ -60,6 +61,25 @@
|
|||
return NO;
|
||||
}
|
||||
|
||||
- (void) updateTag {
|
||||
NSString *tag = self.tagsTextField.stringValue;
|
||||
if (![tag isEqual:@""]) {
|
||||
[MSNotificationHub addTag:tag];
|
||||
self.tagsTextField.stringValue = @"";
|
||||
}
|
||||
|
||||
_tags = [MSNotificationHub getTags];
|
||||
[self.tagsTable reloadData];
|
||||
}
|
||||
|
||||
- (void) updateUserId {
|
||||
if (![self.userIdTextField.stringValue isEqual:@""]) {
|
||||
[MSNotificationHub setUserId:self.userIdTextField.stringValue];
|
||||
self.userIdTextField.stringValue = @"";
|
||||
self.userIdTextField.placeholderString = [MSNotificationHub getUserId];
|
||||
}
|
||||
}
|
||||
|
||||
- (void) deleteSelectedItems: (NSTableView *)tableView {
|
||||
NSInteger row = [tableView selectedRow];
|
||||
if (row >= 0) {
|
||||
|
|
|
@ -706,11 +706,11 @@
|
|||
<objects>
|
||||
<viewController id="XfG-lQ-9wD" customClass="ViewController" customModule="SampleNHAppMacSwift" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<view key="view" id="m2S-Jp-Qdl">
|
||||
<rect key="frame" x="0.0" y="0.0" width="676" height="496"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="676" height="508"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="h0f-EB-i36">
|
||||
<rect key="frame" x="18" y="460" width="89" height="16"/>
|
||||
<rect key="frame" x="18" y="472" width="89" height="16"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<textFieldCell key="cell" lineBreakMode="clipping" title="Device Token:" id="G3f-9r-hFe">
|
||||
<font key="font" usesAppearanceFont="YES"/>
|
||||
|
@ -719,7 +719,7 @@
|
|||
</textFieldCell>
|
||||
</textField>
|
||||
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="JFw-7d-4ot">
|
||||
<rect key="frame" x="123" y="460" width="535" height="16"/>
|
||||
<rect key="frame" x="123" y="472" width="535" height="16"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<textFieldCell key="cell" lineBreakMode="clipping" id="ST8-s0-I7O">
|
||||
<font key="font" metaFont="system"/>
|
||||
|
@ -728,7 +728,7 @@
|
|||
</textFieldCell>
|
||||
</textField>
|
||||
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="L2m-eV-lDJ">
|
||||
<rect key="frame" x="18" y="436" width="90" height="16"/>
|
||||
<rect key="frame" x="18" y="448" width="90" height="16"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<textFieldCell key="cell" lineBreakMode="clipping" title="Installation ID:" id="dBA-Lu-TYi">
|
||||
<font key="font" metaFont="system"/>
|
||||
|
@ -737,7 +737,7 @@
|
|||
</textFieldCell>
|
||||
</textField>
|
||||
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="QFA-kZ-dEw">
|
||||
<rect key="frame" x="123" y="436" width="535" height="16"/>
|
||||
<rect key="frame" x="123" y="448" width="535" height="16"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<textFieldCell key="cell" lineBreakMode="clipping" id="Gwe-pB-wfa">
|
||||
<font key="font" metaFont="system"/>
|
||||
|
@ -746,22 +746,22 @@
|
|||
</textFieldCell>
|
||||
</textField>
|
||||
<textField verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="132-rB-sVJ">
|
||||
<rect key="frame" x="20" y="394" width="636" height="21"/>
|
||||
<rect key="frame" x="20" y="382" width="636" height="21"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" borderStyle="bezel" drawsBackground="YES" id="TtA-Q9-tsf">
|
||||
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" borderStyle="bezel" placeholderString="Enter tag to add" drawsBackground="YES" id="TtA-Q9-tsf">
|
||||
<font key="font" metaFont="system"/>
|
||||
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
<scrollView fixedFrame="YES" autohidesScrollers="YES" horizontalLineScroll="19" horizontalPageScroll="10" verticalLineScroll="19" verticalPageScroll="10" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Nm9-H6-pl0">
|
||||
<rect key="frame" x="20" y="197" width="636" height="178"/>
|
||||
<scrollView fixedFrame="YES" autohidesScrollers="YES" horizontalLineScroll="44" horizontalPageScroll="10" verticalLineScroll="44" verticalPageScroll="10" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Nm9-H6-pl0">
|
||||
<rect key="frame" x="20" y="184" width="636" height="178"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<clipView key="contentView" id="IpT-Dr-8j5">
|
||||
<rect key="frame" x="1" y="0.0" width="634" height="177"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" columnSelection="YES" multipleSelection="NO" autosaveColumns="NO" rowSizeStyle="automatic" headerView="pKA-dL-7lH" viewBased="YES" id="80N-DS-fMx">
|
||||
<tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" columnSelection="YES" multipleSelection="NO" autosaveColumns="NO" rowHeight="42" rowSizeStyle="automatic" headerView="pKA-dL-7lH" viewBased="YES" id="80N-DS-fMx">
|
||||
<rect key="frame" x="0.0" y="0.0" width="634" height="152"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<size key="intercellSpacing" width="3" height="2"/>
|
||||
|
@ -817,14 +817,14 @@
|
|||
<autoresizingMask key="autoresizingMask"/>
|
||||
</tableHeaderView>
|
||||
</scrollView>
|
||||
<scrollView fixedFrame="YES" autohidesScrollers="YES" horizontalLineScroll="19" horizontalPageScroll="10" verticalLineScroll="19" verticalPageScroll="10" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Lkz-oW-ubj">
|
||||
<rect key="frame" x="20" y="28" width="636" height="135"/>
|
||||
<scrollView fixedFrame="YES" autohidesScrollers="YES" horizontalLineScroll="44" horizontalPageScroll="10" verticalLineScroll="44" verticalPageScroll="10" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Lkz-oW-ubj">
|
||||
<rect key="frame" x="20" y="26" width="636" height="135"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<clipView key="contentView" id="CKd-DN-sk1">
|
||||
<rect key="frame" x="1" y="0.0" width="634" height="134"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" columnSelection="YES" multipleSelection="NO" autosaveColumns="NO" rowSizeStyle="automatic" headerView="qNO-Kb-oGU" viewBased="YES" id="8k1-bJ-Xia">
|
||||
<tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" columnSelection="YES" multipleSelection="NO" autosaveColumns="NO" rowHeight="42" rowSizeStyle="automatic" headerView="qNO-Kb-oGU" viewBased="YES" id="8k1-bJ-Xia">
|
||||
<rect key="frame" x="0.0" y="0.0" width="634" height="109"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<size key="intercellSpacing" width="3" height="2"/>
|
||||
|
@ -912,6 +912,24 @@
|
|||
<autoresizingMask key="autoresizingMask"/>
|
||||
</tableHeaderView>
|
||||
</scrollView>
|
||||
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="g3D-18-WUU">
|
||||
<rect key="frame" x="18" y="424" width="90" height="16"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<textFieldCell key="cell" lineBreakMode="clipping" alignment="right" title="User Id:" id="B1A-fQ-GL7">
|
||||
<font key="font" metaFont="system"/>
|
||||
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
<textField verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="2Qd-Hc-EZ5">
|
||||
<rect key="frame" x="125" y="421" width="531" height="21"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" borderStyle="bezel" placeholderString="Enter UserId" drawsBackground="YES" id="dBB-SM-7cf">
|
||||
<font key="font" metaFont="system"/>
|
||||
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
</subviews>
|
||||
</view>
|
||||
<connections>
|
||||
|
@ -920,6 +938,7 @@
|
|||
<outlet property="notificationsTable" destination="8k1-bJ-Xia" id="Ck9-iq-uqC"/>
|
||||
<outlet property="tagsTable" destination="80N-DS-fMx" id="pAa-Mv-iz5"/>
|
||||
<outlet property="tagsTextField" destination="132-rB-sVJ" id="BJR-5d-z0f"/>
|
||||
<outlet property="userIdTextField" destination="2Qd-Hc-EZ5" id="lEP-hT-iaD"/>
|
||||
</connections>
|
||||
</viewController>
|
||||
<customObject id="rPt-NT-nkU" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
|
||||
|
|
|
@ -13,18 +13,22 @@ class ViewController: NSViewController, NSTextFieldDelegate, MSNotificationHubDe
|
|||
@IBOutlet weak var tagsTextField: NSTextField!
|
||||
@IBOutlet weak var tagsTable: NSTableView!
|
||||
@IBOutlet weak var notificationsTable: NSTableView!
|
||||
@IBOutlet weak var userIdTextField: NSTextField!
|
||||
|
||||
var tagsTableViewController: TagsTableViewController!
|
||||
var notificationsTableViewController: NotificationsTableViewController!
|
||||
|
||||
override func viewDidLoad() {
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
MSNotificationHub.setDelegate(self)
|
||||
self.tagsTextField.delegate = self
|
||||
self.userIdTextField.delegate = self
|
||||
|
||||
deviceTokenTextField.stringValue = MSNotificationHub.getPushChannel()
|
||||
installationIdTextField.stringValue = MSNotificationHub.getInstallationId()
|
||||
|
||||
self.userIdTextField.placeholderString = MSNotificationHub.getUserId()
|
||||
|
||||
self.tagsTableViewController = TagsTableViewController(data: MSNotificationHub.getTags())
|
||||
self.tagsTable.delegate = self.tagsTableViewController
|
||||
self.tagsTable.dataSource = self.tagsTableViewController
|
||||
|
@ -45,15 +49,13 @@ class ViewController: NSViewController, NSTextFieldDelegate, MSNotificationHubDe
|
|||
|
||||
func control(_ control: NSControl, textView: NSTextView, doCommandBy commandSelector: Selector) -> Bool {
|
||||
if (commandSelector == #selector(NSResponder.insertNewline(_:))) {
|
||||
let tag = self.tagsTextField.stringValue;
|
||||
|
||||
if (tag != "") {
|
||||
MSNotificationHub.addTag(tag)
|
||||
self.tagsTextField.stringValue = ""
|
||||
if (control == self.tagsTextField) {
|
||||
updateTags()
|
||||
}
|
||||
|
||||
self.tagsTableViewController.addTags(newTags: MSNotificationHub.getTags())
|
||||
self.tagsTable.reloadData()
|
||||
if (control == self.userIdTextField) {
|
||||
updateUserId()
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
@ -61,6 +63,26 @@ class ViewController: NSViewController, NSTextFieldDelegate, MSNotificationHubDe
|
|||
return false
|
||||
}
|
||||
|
||||
func updateTags() {
|
||||
let tag = self.tagsTextField.stringValue;
|
||||
|
||||
if (tag != "") {
|
||||
MSNotificationHub.addTag(tag)
|
||||
self.tagsTextField.stringValue = ""
|
||||
}
|
||||
|
||||
self.tagsTableViewController.addTags(newTags: MSNotificationHub.getTags())
|
||||
self.tagsTable.reloadData()
|
||||
}
|
||||
|
||||
func updateUserId() {
|
||||
if (self.userIdTextField.stringValue != "") {
|
||||
MSNotificationHub.setUserId(self.userIdTextField.stringValue)
|
||||
self.userIdTextField.stringValue = "";
|
||||
self.userIdTextField.placeholderString = MSNotificationHub.getUserId()
|
||||
}
|
||||
}
|
||||
|
||||
override func keyDown(with event: NSEvent) {
|
||||
if(!event.modifierFlags.isEmpty) {
|
||||
if (event.keyCode == kVK_ForwardDelete || event.keyCode == kVK_Delete) {
|
||||
|
|
|
@ -6,48 +6,69 @@ import SwiftUI
|
|||
import WindowsAzureMessaging
|
||||
|
||||
struct ContentView: View {
|
||||
@State var tag: String = "";
|
||||
@State var tags: [String] = MSNotificationHub.getTags();
|
||||
@State var tag: String = ""
|
||||
@State var tags: [String] = MSNotificationHub.getTags()
|
||||
@State var userId: String = MSNotificationHub.getUserId()
|
||||
|
||||
@ObservedObject var notifications: ObservableMessagesList
|
||||
@ObservedObject var installation: ObservableInstallation
|
||||
|
||||
var body: some View {
|
||||
VStack(alignment: .leading) {
|
||||
Text("Device Token:")
|
||||
.font(.headline)
|
||||
Text(installation.pushChannel)
|
||||
.font(.footnote)
|
||||
.foregroundColor(Color.gray)
|
||||
.padding(.bottom)
|
||||
Group {
|
||||
Text("Device Token:")
|
||||
.font(.headline)
|
||||
Text(installation.pushChannel)
|
||||
.font(.footnote)
|
||||
.foregroundColor(Color.gray)
|
||||
.padding(.bottom)
|
||||
}
|
||||
|
||||
Text("Installation ID:")
|
||||
.font(.headline)
|
||||
Text(installation.installationId)
|
||||
.font(.footnote)
|
||||
.foregroundColor(Color.gray)
|
||||
.padding(.bottom)
|
||||
Group {
|
||||
Text("Installation ID:")
|
||||
.font(.headline)
|
||||
Text(installation.installationId)
|
||||
.font(.footnote)
|
||||
.foregroundColor(Color.gray)
|
||||
.padding(.bottom)
|
||||
}
|
||||
|
||||
Text("Tags:")
|
||||
.font(.headline)
|
||||
TextField("Add new tag", text: $tag, onCommit: {
|
||||
MSNotificationHub.addTag(self.tag)
|
||||
self.tags.append(self.tag)
|
||||
self.tag = ""
|
||||
})
|
||||
.textFieldStyle(RoundedBorderTextFieldStyle())
|
||||
Group {
|
||||
Text("User ID:")
|
||||
.font(.headline)
|
||||
TextField("Set User ID", text: $userId, onEditingChanged: {focus in
|
||||
if(!focus) {
|
||||
MSNotificationHub.setUserId(self.userId)
|
||||
}
|
||||
})
|
||||
.textFieldStyle(RoundedBorderTextFieldStyle())
|
||||
}
|
||||
|
||||
TagsList(tags: tags, onDelete: {
|
||||
if let idx = self.tags.firstIndex(of: $0) {
|
||||
self.tags.remove(at: idx)
|
||||
MSNotificationHub.removeTag($0);
|
||||
}
|
||||
})
|
||||
Group {
|
||||
Text("Tags:")
|
||||
.font(.headline)
|
||||
TextField("Add new tag", text: $tag, onCommit: {
|
||||
if(self.tag != "") {
|
||||
MSNotificationHub.addTag(self.tag)
|
||||
self.tags.append(self.tag)
|
||||
self.tag = ""
|
||||
}
|
||||
})
|
||||
.textFieldStyle(RoundedBorderTextFieldStyle())
|
||||
|
||||
TagsList(tags: tags, onDelete: {
|
||||
if let idx = self.tags.firstIndex(of: $0) {
|
||||
self.tags.remove(at: idx)
|
||||
MSNotificationHub.removeTag($0);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Text("Notifications:")
|
||||
.font(.headline)
|
||||
NotificationsList(notifications: notifications)
|
||||
Group {
|
||||
Text("Notifications:")
|
||||
.font(.headline)
|
||||
NotificationsList(notifications: notifications)
|
||||
}
|
||||
|
||||
Spacer()
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="16096" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="49e-Tb-3d3">
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="16097.2" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="49e-Tb-3d3">
|
||||
<device id="retina4_7" orientation="portrait" appearance="light"/>
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16087"/>
|
||||
|
@ -21,7 +21,7 @@
|
|||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Device Token:" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="dvb-aI-dP8">
|
||||
<rect key="frame" x="0.0" y="0.0" width="107" height="20.5"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="natural" lineBreakMode="characterWrap" numberOfLines="0" baselineAdjustment="alignBaselines" minimumScaleFactor="0.5" translatesAutoresizingMaskIntoConstraints="NO" id="tly-XT-JOt">
|
||||
|
@ -42,19 +42,30 @@
|
|||
<color key="textColor" white="0.66666666669999997" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Tags:" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="quy-h7-3Vz">
|
||||
<rect key="frame" x="0.0" y="143" width="41" height="20.5"/>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="User ID:" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="wn1-vi-Lzd">
|
||||
<rect key="frame" x="0.0" y="143" width="61.5" height="20.5"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="Add new tag" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="aOZ-SD-EOm">
|
||||
<rect key="frame" x="0.0" y="176.5" width="335" height="78.5"/>
|
||||
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="6dU-J8-Ln0">
|
||||
<rect key="frame" x="0.0" y="176.5" width="335" height="34"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="14"/>
|
||||
<textInputTraits key="textInputTraits" returnKeyType="done" enablesReturnKeyAutomatically="YES"/>
|
||||
</textField>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Tags:" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="quy-h7-3Vz">
|
||||
<rect key="frame" x="0.0" y="223.5" width="41" height="20.5"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<textField opaque="NO" tag="1" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="Add new tag" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="aOZ-SD-EOm">
|
||||
<rect key="frame" x="0.0" y="257" width="335" height="34"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="14"/>
|
||||
<textInputTraits key="textInputTraits" returnKeyType="done" enablesReturnKeyAutomatically="YES"/>
|
||||
</textField>
|
||||
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" allowsSelection="NO" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="InV-aJ-9ng">
|
||||
<rect key="frame" x="0.0" y="268" width="335" height="310"/>
|
||||
<rect key="frame" x="0.0" y="304" width="335" height="274"/>
|
||||
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
|
||||
<prototypes>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" reuseIdentifier="TagCell" id="TpY-aS-8i0" customClass="TagTableViewCell">
|
||||
|
@ -86,7 +97,9 @@
|
|||
<constraint firstAttribute="trailing" secondItem="tly-XT-JOt" secondAttribute="trailing" id="58r-SL-cn0"/>
|
||||
<constraint firstAttribute="trailing" secondItem="InV-aJ-9ng" secondAttribute="trailing" id="Q6A-0v-8rd"/>
|
||||
<constraint firstAttribute="trailing" secondItem="UEI-49-zCp" secondAttribute="trailing" id="UGB-gQ-0yU"/>
|
||||
<constraint firstItem="6dU-J8-Ln0" firstAttribute="leading" secondItem="CZM-Kj-lfG" secondAttribute="leading" id="btM-it-AH4"/>
|
||||
<constraint firstItem="tly-XT-JOt" firstAttribute="leading" secondItem="CZM-Kj-lfG" secondAttribute="leading" id="dR9-Hy-lxX"/>
|
||||
<constraint firstAttribute="trailing" secondItem="6dU-J8-Ln0" secondAttribute="trailing" id="k0m-5N-amS"/>
|
||||
<constraint firstAttribute="trailing" secondItem="aOZ-SD-EOm" secondAttribute="trailing" id="n9b-Ii-CrJ"/>
|
||||
<constraint firstItem="UEI-49-zCp" firstAttribute="leading" secondItem="CZM-Kj-lfG" secondAttribute="leading" id="sdR-Rm-Pgn"/>
|
||||
<constraint firstItem="InV-aJ-9ng" firstAttribute="leading" secondItem="CZM-Kj-lfG" secondAttribute="leading" id="vdJ-Y9-hsb"/>
|
||||
|
@ -109,6 +122,7 @@
|
|||
<outlet property="deviceTokenLabel" destination="tly-XT-JOt" id="lEf-3b-ZDo"/>
|
||||
<outlet property="installationIdLabel" destination="UEI-49-zCp" id="nXD-20-ntf"/>
|
||||
<outlet property="tagsTable" destination="InV-aJ-9ng" id="hGy-hn-3fA"/>
|
||||
<outlet property="userId" destination="6dU-J8-Ln0" id="5cQ-8L-E27"/>
|
||||
</connections>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="W5J-7L-Pyd" sceneMemberID="firstResponder"/>
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
@property (weak, nonatomic) IBOutlet UILabel *installationIdLabel;
|
||||
@property (weak, nonatomic) IBOutlet UITextField *addNewTagTextField;
|
||||
@property (weak, nonatomic) IBOutlet UITableView *tagsTable;
|
||||
@property (weak, nonatomic) IBOutlet UITextField *userId;
|
||||
|
||||
@property (nonatomic, copy) NSArray<NSString *> *tags;
|
||||
@property (weak, nonatomic) NotificationsTableViewController *notificationsTableView;
|
||||
|
|
|
@ -20,9 +20,11 @@
|
|||
self.tagsTable.delegate = self;
|
||||
self.tagsTable.dataSource = self;
|
||||
[self.tagsTable reloadData];
|
||||
self.userId.delegate = self;
|
||||
|
||||
self.deviceTokenLabel.text = [MSNotificationHub getPushChannel];
|
||||
self.installationIdLabel.text = [MSNotificationHub getInstallationId];
|
||||
self.userId.text = [MSNotificationHub getUserId];
|
||||
|
||||
self.notificationsTableView = (NotificationsTableViewController*) [[(UINavigationController*)[[self.tabBarController viewControllers] objectAtIndex:1] viewControllers] objectAtIndex:0];
|
||||
|
||||
|
@ -37,10 +39,14 @@
|
|||
}
|
||||
|
||||
- (void)textFieldDidEndEditing:(UITextField *)textField {
|
||||
[MSNotificationHub addTag:textField.text];
|
||||
self.tags = [MSNotificationHub getTags];
|
||||
textField.text = @"";
|
||||
[self.tagsTable reloadData];
|
||||
if(textField.tag == 0) {
|
||||
[MSNotificationHub setUserId:textField.text];
|
||||
} else if (![textField.text isEqual: @""]) {
|
||||
[MSNotificationHub addTag:textField.text];
|
||||
self.tags = [MSNotificationHub getTags];
|
||||
textField.text = @"";
|
||||
[self.tagsTable reloadData];
|
||||
}
|
||||
}
|
||||
|
||||
- (nonnull UITableViewCell *)tableView:(nonnull UITableView *)tableView cellForRowAtIndexPath:(nonnull NSIndexPath *)indexPath {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="16097" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="49e-Tb-3d3">
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="16097.2" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="49e-Tb-3d3">
|
||||
<device id="retina4_7" orientation="portrait" appearance="light"/>
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16087"/>
|
||||
|
@ -21,7 +21,7 @@
|
|||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Device Token:" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="dvb-aI-dP8">
|
||||
<rect key="frame" x="0.0" y="0.0" width="107" height="20.5"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="natural" lineBreakMode="characterWrap" numberOfLines="0" baselineAdjustment="alignBaselines" minimumScaleFactor="0.5" translatesAutoresizingMaskIntoConstraints="NO" id="tly-XT-JOt" customClass="CopyableLabel" customModule="SampleNHAppSwift" customModuleProvider="target">
|
||||
|
@ -42,19 +42,30 @@
|
|||
<color key="textColor" white="0.66666666669999997" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Tags:" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="quy-h7-3Vz">
|
||||
<rect key="frame" x="0.0" y="143" width="41" height="20.5"/>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="User ID:" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="JSW-jt-YB8">
|
||||
<rect key="frame" x="0.0" y="143" width="61.5" height="20.5"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="Add new tag" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="aOZ-SD-EOm">
|
||||
<rect key="frame" x="0.0" y="176.5" width="335" height="78.5"/>
|
||||
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="omM-x2-lY0">
|
||||
<rect key="frame" x="0.0" y="176.5" width="335" height="34"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="14"/>
|
||||
<textInputTraits key="textInputTraits" returnKeyType="done" enablesReturnKeyAutomatically="YES"/>
|
||||
</textField>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Tags:" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="quy-h7-3Vz">
|
||||
<rect key="frame" x="0.0" y="223.5" width="41" height="20.5"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<textField opaque="NO" tag="1" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="Add new tag" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="aOZ-SD-EOm">
|
||||
<rect key="frame" x="0.0" y="257" width="335" height="34"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="14"/>
|
||||
<textInputTraits key="textInputTraits" returnKeyType="done" enablesReturnKeyAutomatically="YES"/>
|
||||
</textField>
|
||||
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" allowsSelection="NO" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="InV-aJ-9ng">
|
||||
<rect key="frame" x="0.0" y="268" width="335" height="310"/>
|
||||
<rect key="frame" x="0.0" y="304" width="335" height="274"/>
|
||||
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
|
||||
<prototypes>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" reuseIdentifier="TagCell" id="TpY-aS-8i0" customClass="TagTableViewCell" customModule="SampleNHAppSwift" customModuleProvider="target">
|
||||
|
@ -84,8 +95,10 @@
|
|||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstAttribute="trailing" secondItem="tly-XT-JOt" secondAttribute="trailing" id="58r-SL-cn0"/>
|
||||
<constraint firstItem="omM-x2-lY0" firstAttribute="leading" secondItem="CZM-Kj-lfG" secondAttribute="leading" id="AgT-tc-nd4"/>
|
||||
<constraint firstAttribute="trailing" secondItem="InV-aJ-9ng" secondAttribute="trailing" id="Q6A-0v-8rd"/>
|
||||
<constraint firstAttribute="trailing" secondItem="UEI-49-zCp" secondAttribute="trailing" id="UGB-gQ-0yU"/>
|
||||
<constraint firstAttribute="trailing" secondItem="omM-x2-lY0" secondAttribute="trailing" id="aLT-iw-alC"/>
|
||||
<constraint firstItem="tly-XT-JOt" firstAttribute="leading" secondItem="CZM-Kj-lfG" secondAttribute="leading" id="dR9-Hy-lxX"/>
|
||||
<constraint firstAttribute="trailing" secondItem="aOZ-SD-EOm" secondAttribute="trailing" id="n9b-Ii-CrJ"/>
|
||||
<constraint firstItem="UEI-49-zCp" firstAttribute="leading" secondItem="CZM-Kj-lfG" secondAttribute="leading" id="sdR-Rm-Pgn"/>
|
||||
|
@ -109,6 +122,7 @@
|
|||
<outlet property="deviceTokenLabel" destination="tly-XT-JOt" id="wHF-t8-ioT"/>
|
||||
<outlet property="installationIdLabel" destination="UEI-49-zCp" id="auO-Xd-QCM"/>
|
||||
<outlet property="tagsTable" destination="InV-aJ-9ng" id="ZF6-11-ojI"/>
|
||||
<outlet property="userId" destination="omM-x2-lY0" id="PHX-2T-qdz"/>
|
||||
</connections>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="W5J-7L-Pyd" sceneMemberID="firstResponder"/>
|
||||
|
|
|
@ -10,6 +10,7 @@ class SetupViewController: UIViewController, UITextFieldDelegate, UITableViewDat
|
|||
@IBOutlet weak var installationIdLabel: UILabel!
|
||||
@IBOutlet weak var addNewTagTextField: UITextField!
|
||||
@IBOutlet weak var tagsTable: UITableView!
|
||||
@IBOutlet weak var userId: UITextField!
|
||||
|
||||
var tags = MSNotificationHub.getTags()
|
||||
var notificationsTableView:NotificationsTableViewController?
|
||||
|
@ -20,9 +21,11 @@ class SetupViewController: UIViewController, UITextFieldDelegate, UITableViewDat
|
|||
tagsTable.delegate = self
|
||||
tagsTable.dataSource = self
|
||||
tagsTable.reloadData()
|
||||
userId.delegate = self
|
||||
|
||||
deviceTokenLabel.text = MSNotificationHub.getPushChannel()
|
||||
installationIdLabel.text = MSNotificationHub.getInstallationId()
|
||||
userId.text = MSNotificationHub.getUserId()
|
||||
|
||||
notificationsTableView = (self.tabBarController?.viewControllers?[1] as! UINavigationController).viewControllers[0] as? NotificationsTableViewController
|
||||
|
||||
|
@ -36,10 +39,14 @@ class SetupViewController: UIViewController, UITextFieldDelegate, UITableViewDat
|
|||
}
|
||||
|
||||
func textFieldDidEndEditing(_ textField: UITextField) {
|
||||
MSNotificationHub.addTag(textField.text!)
|
||||
tags = MSNotificationHub.getTags()
|
||||
textField.text = ""
|
||||
tagsTable.reloadData()
|
||||
if(textField.tag == 0) {
|
||||
MSNotificationHub.setUserId(textField.text!)
|
||||
} else if (textField.text != "") {
|
||||
MSNotificationHub.addTag(textField.text!)
|
||||
tags = MSNotificationHub.getTags()
|
||||
textField.text = ""
|
||||
tagsTable.reloadData()
|
||||
}
|
||||
}
|
||||
|
||||
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
/* Begin PBXBuildFile section */
|
||||
4CB623C424D899DF001C0309 /* Splash.png in Resources */ = {isa = PBXBuildFile; fileRef = 4CB623C324D899DE001C0309 /* Splash.png */; };
|
||||
64234F4524D802DB00CFA10D /* ObservableInstallation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 64234F4424D802DB00CFA10D /* ObservableInstallation.swift */; };
|
||||
64234F4A24D80D5E00CFA10D /* SampleNHAppSwiftUI.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 64234F4924D80D5E00CFA10D /* SampleNHAppSwiftUI.xcconfig */; };
|
||||
6485C78E24D2B1F10026E41F /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6485C78D24D2B1F10026E41F /* AppDelegate.swift */; };
|
||||
6485C79024D2B1F10026E41F /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6485C78F24D2B1F10026E41F /* SceneDelegate.swift */; };
|
||||
6485C79224D2B1F10026E41F /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6485C79124D2B1F10026E41F /* ContentView.swift */; };
|
||||
|
@ -180,6 +181,7 @@
|
|||
6485C79A24D2B1F20026E41F /* LaunchScreen.storyboard in Resources */,
|
||||
6485C79424D2B1F20026E41F /* Assets.xcassets in Resources */,
|
||||
4CB623C424D899DF001C0309 /* Splash.png in Resources */,
|
||||
64234F4A24D80D5E00CFA10D /* SampleNHAppSwiftUI.xcconfig in Resources */,
|
||||
6485C7A824D2B37A0026E41F /* DevSettings.plist in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
|
|
|
@ -37,8 +37,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
|
|||
// Adds some basic tags such as language and country
|
||||
func addTags() {
|
||||
// Get language and country code for common tag values
|
||||
let language = Bundle.main.preferredLocalizations.first!
|
||||
let countryCode = NSLocale.current.regionCode!
|
||||
let language = Bundle.main.preferredLocalizations.first ?? "<indefined>"
|
||||
let countryCode = NSLocale.current.regionCode ?? "<indefined>"
|
||||
|
||||
// Create tags with type_value format
|
||||
let languageTag = "language_" + language
|
||||
|
|
|
@ -8,8 +8,9 @@ import WindowsAzureMessaging
|
|||
|
||||
struct SetupView: View {
|
||||
@State var tag: String = "";
|
||||
@State var tags: [String] = MSNotificationHub.getTags();
|
||||
@State var tags: [String] = MSNotificationHub.getTags()
|
||||
@ObservedObject var installation: ObservableInstallation
|
||||
@State var userId: String = MSNotificationHub.getUserId()
|
||||
|
||||
var body: some View {
|
||||
VStack(alignment: .leading) {
|
||||
|
@ -29,13 +30,26 @@ struct SetupView: View {
|
|||
.foregroundColor(Color.gray)
|
||||
.padding([.leading, .bottom, .trailing])
|
||||
|
||||
Text("User ID:")
|
||||
.font(.headline)
|
||||
.padding(.leading)
|
||||
TextField("Set User ID", text: $userId, onEditingChanged: {focus in
|
||||
if(!focus) {
|
||||
MSNotificationHub.setUserId(self.userId)
|
||||
}
|
||||
})
|
||||
.textFieldStyle(RoundedBorderTextFieldStyle())
|
||||
.padding([.leading, .bottom, .trailing])
|
||||
|
||||
Text("Tags:")
|
||||
.font(.headline)
|
||||
.padding(.leading)
|
||||
TextField("Add new tag", text: $tag, onCommit: {
|
||||
MSNotificationHub.addTag(self.tag)
|
||||
self.tags.append(self.tag)
|
||||
self.tag = ""
|
||||
if(self.tag != "") {
|
||||
MSNotificationHub.addTag(self.tag)
|
||||
self.tags.append(self.tag)
|
||||
self.tag = ""
|
||||
}
|
||||
})
|
||||
.textFieldStyle(RoundedBorderTextFieldStyle())
|
||||
.padding([.leading, .bottom, .trailing])
|
||||
|
|
|
@ -28,8 +28,7 @@ FRAMEWORK_SEARCH_PATHS = $(PROJECT_DIR)/../WindowsAzureMessaging-SDK-Apple/iOS/*
|
|||
LD_RUNPATH_SEARCH_PATHS = $(inherited) @executable_path/Frameworks
|
||||
|
||||
SWIFT_VERSION = 4.2
|
||||
SWIFT_OPTIMIZATION_LEVEL = -Owholemodule
|
||||
SWIFT_COMPILATION_MODE = wholemodule
|
||||
SWIFT_OPTIMIZATION_LEVEL = -Onone
|
||||
|
||||
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES
|
||||
CLANG_ANALYZER_NONNULL = YES
|
||||
|
@ -42,3 +41,4 @@ GCC_DYNAMIC_NO_PIC = NO
|
|||
GCC_NO_COMMON_BLOCKS = YES
|
||||
|
||||
DEVELOPMENT_TEAM = S4V3D7CHJR
|
||||
ENABLE_TESTABILITY = YES;
|
||||
|
|
|
@ -206,6 +206,22 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
*/
|
||||
+ (NSDictionary<NSString *, MSInstallationTemplate *> *)getTemplates;
|
||||
|
||||
#pragma mark UserID support
|
||||
|
||||
/**
|
||||
* Adds a userId to the current installation.
|
||||
*
|
||||
* @param userId The userId to add
|
||||
*/
|
||||
+ (void)setUserId:(NSString *)userId;
|
||||
|
||||
/**
|
||||
* Get the current User Id
|
||||
*
|
||||
* @returns the current User Id
|
||||
*/
|
||||
+ (NSString *)getUserId;
|
||||
|
||||
#pragma mark Installation management support
|
||||
|
||||
/**
|
||||
|
|
|
@ -512,6 +512,27 @@ static void *UserNotificationCenterDelegateContext = &UserNotificationCenterDele
|
|||
return [[self getInstallation] templates];
|
||||
}
|
||||
|
||||
#pragma mark UserID support
|
||||
|
||||
+ (void)setUserId:(NSString *)userId {
|
||||
[sharedInstance setUserId:userId];
|
||||
}
|
||||
|
||||
- (void)setUserId:(NSString *)userId {
|
||||
MSInstallation *installation = [self getInstallation];
|
||||
installation.userId = userId;
|
||||
[self upsertInstallation:installation];
|
||||
}
|
||||
|
||||
+ (NSString *)getUserId {
|
||||
return [sharedInstance getUserId];
|
||||
}
|
||||
|
||||
- (NSString *)getUserId {
|
||||
MSInstallation *installation = [self getInstallation];
|
||||
return installation.userId;
|
||||
}
|
||||
|
||||
#pragma mark Installation management support
|
||||
|
||||
+ (void)willSaveInstallation {
|
||||
|
|
|
@ -23,6 +23,11 @@
|
|||
*/
|
||||
@property(nonatomic, copy) NSString *pushChannel;
|
||||
|
||||
/**
|
||||
* The userID
|
||||
*/
|
||||
@property(nonatomic, copy) NSString *userId;
|
||||
|
||||
/**
|
||||
* The expiration for the installation
|
||||
*/
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
@synthesize expirationTime;
|
||||
@synthesize pushChannel;
|
||||
@synthesize tags;
|
||||
@synthesize userId;
|
||||
@synthesize templates;
|
||||
|
||||
- (void)encodeWithCoder:(nonnull NSCoder *)coder {
|
||||
|
@ -21,6 +22,7 @@
|
|||
[coder encodeObject:expirationTime forKey:@"expirationTime"];
|
||||
[coder encodeObject:pushChannel forKey:@"pushChannel"];
|
||||
[coder encodeObject:tags forKey:@"tags"];
|
||||
[coder encodeObject:userId forKey:@"userId"];
|
||||
[coder encodeObject:templates forKey:@"templates"];
|
||||
}
|
||||
|
||||
|
@ -30,6 +32,7 @@
|
|||
expirationTime = [coder decodeObjectForKey:@"expirationTime"];
|
||||
pushChannel = [coder decodeObjectForKey:@"pushChannel"];
|
||||
tags = [coder decodeObjectForKey:@"tags"];
|
||||
userId = [coder decodeObjectForKey:@"userId"];
|
||||
templates = [coder decodeObjectForKey:@"templates"];
|
||||
isDirty = NO;
|
||||
[self addObserver:self forKeyPath:@"isDirty" options:0 context:NULL];
|
||||
|
@ -70,6 +73,7 @@
|
|||
installation.installationId = json[@"installationId"];
|
||||
installation.pushChannel = json[@"pushChannel"];
|
||||
installation.tags = json[@"tags"];
|
||||
installation.userId = json[@"userId"];
|
||||
installation.templates = json[@"templates"];
|
||||
|
||||
NSString *expiration = json[@"expirationTime"];
|
||||
|
@ -87,6 +91,12 @@
|
|||
}
|
||||
|
||||
- (NSData *)toJsonData {
|
||||
NSMutableDictionary *resultTemplates = [NSMutableDictionary new];
|
||||
for (NSString *key in [templates allKeys]) {
|
||||
MSInstallationTemplate *template = [templates objectForKey:key];
|
||||
[resultTemplates setObject:[template toDictionary] forKey:key];
|
||||
}
|
||||
|
||||
NSMutableDictionary *dictionary = [NSMutableDictionary
|
||||
dictionaryWithDictionary:@{@"installationId" : self.installationId, @"platform" : @"apns", @"pushChannel" : self.pushChannel}];
|
||||
|
||||
|
@ -101,6 +111,10 @@
|
|||
if (tags && [tags count] > 0) {
|
||||
[dictionary setObject:[NSArray arrayWithArray:[self.tags allObjects]] forKey:@"tags"];
|
||||
}
|
||||
|
||||
if (userId && [userId length] > 0) {
|
||||
[dictionary setObject:userId forKey:@"userId"];
|
||||
}
|
||||
|
||||
if (templates && [templates count] > 0) {
|
||||
NSMutableDictionary *resultTemplates = [NSMutableDictionary new];
|
||||
|
@ -220,8 +234,9 @@
|
|||
BOOL isInstallationsIdEqual = [self.installationId isEqualToString:installation.installationId];
|
||||
BOOL isExpirationTimeEqual = ((!self.expirationTime && !installation.expirationTime) || [[NSCalendar currentCalendar] isDate:self.expirationTime equalToDate:installation.expirationTime toUnitGranularity:NSCalendarUnitDay]);
|
||||
BOOL isTagsSetEqual = ((!self.tags && !installation.tags) || [self.tags isEqualToSet:installation.tags]);
|
||||
BOOL isUserIdEqual = ((!self.userId && !installation.userId) || [self.userId isEqualToString:installation.userId]);
|
||||
BOOL isTemplatesDictionaryEqual = ((!self.templates && !installation.templates) || [self.templates isEqualToDictionary:installation.templates]);
|
||||
return isInstallationsIdEqual && isExpirationTimeEqual && isTagsSetEqual && isTemplatesDictionaryEqual;
|
||||
return isInstallationsIdEqual && isExpirationTimeEqual && isTagsSetEqual && isUserIdEqual && isTemplatesDictionaryEqual;
|
||||
}
|
||||
|
||||
- (BOOL)isEqual:(id)object {
|
||||
|
|
|
@ -128,12 +128,14 @@
|
|||
installation1.pushChannel = pushChannel;
|
||||
[installation1 addTags:@[ @"tag1", @"tag2", @"tag3" ]];
|
||||
[installation1 setTemplate:templateA forKey:key];
|
||||
installation1.userId = @"user";
|
||||
|
||||
MSInstallation *installation2 = [MSInstallation new];
|
||||
installation2.installationId = installationId;
|
||||
installation2.pushChannel = pushChannel;
|
||||
[installation2 addTags:@[ @"tag1", @"tag2", @"tag3" ]];
|
||||
[installation2 setTemplate:templateB forKey:key];
|
||||
installation2.userId = @"user";
|
||||
|
||||
// When
|
||||
NSData *installationData1 = [installation1 toJsonData];
|
||||
|
|
Загрузка…
Ссылка в новой задаче