Private
Public Access
1
0

Adds websocket updates via the /updates endpoint

This commit is contained in:
James Magahern
2023-01-17 16:16:23 -08:00
parent 56ae7982c6
commit 2f5d50188b
9 changed files with 181 additions and 53 deletions

View File

@@ -0,0 +1,17 @@
//
// MBIMURLUtilities.h
// kordophoned
//
// Created by James Magahern on 1/17/23.
// Copyright © 2023 James Magahern. All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface NSURL (MBIMURLUtilities)
- (nullable NSString *)valueForQueryItemWithName:(NSString *)queryItemName;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,28 @@
//
// MBIMURLUtilities.m
// kordophoned
//
// Created by James Magahern on 1/17/23.
// Copyright © 2023 James Magahern. All rights reserved.
//
#import "MBIMURLUtilities.h"
@implementation NSURL (MBIMURLUtilities)
- (nullable NSString *)valueForQueryItemWithName:(NSString *)queryItemName
{
NSURLComponents *urlComponents = [NSURLComponents componentsWithURL:self resolvingAgainstBaseURL:NO];
NSString *value = nil;
for (NSURLQueryItem *queryItem in [urlComponents queryItems]) {
if ([[queryItem name] isEqualToString:queryItemName]) {
value = [queryItem value];
break;
}
}
return value;
}
@end