Read widget event types from NSE

This commit is contained in:
ismailgulek
2021-03-19 02:52:04 +03:00
parent f0f06cf2d0
commit dbb33a3f2d
7 changed files with 94 additions and 24 deletions

View File

@@ -0,0 +1,42 @@
//
// Copyright 2021 New Vector Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#import <Foundation/Foundation.h>
/**
The type of matrix event used for matrix widgets.
*/
FOUNDATION_EXPORT NSString *const kWidgetMatrixEventTypeString;
/**
The type of matrix event used for modular widgets.
TODO: It should be replaced by kWidgetMatrixEventTypeString.
*/
FOUNDATION_EXPORT NSString *const kWidgetModularEventTypeString;
/**
Known types widgets.
*/
FOUNDATION_EXPORT NSString *const kWidgetTypeJitsiV1;
FOUNDATION_EXPORT NSString *const kWidgetTypeJitsiV2;
FOUNDATION_EXPORT NSString *const kWidgetTypeStickerPicker;
@interface WidgetConstants : NSObject
- (instancetype)init NS_UNAVAILABLE;
+ (instancetype)new NS_UNAVAILABLE;
@end

View File

@@ -0,0 +1,27 @@
//
// Copyright 2021 New Vector Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#import "WidgetConstants.h"
NSString *const kWidgetMatrixEventTypeString = @"m.widget";
NSString *const kWidgetModularEventTypeString = @"im.vector.modular.widgets";
NSString *const kWidgetTypeJitsiV1 = @"jitsi";
NSString *const kWidgetTypeJitsiV2 = @"m.jitsi";
NSString *const kWidgetTypeStickerPicker = @"m.stickerpicker";
@implementation WidgetConstants
@end

View File

@@ -20,27 +20,10 @@
#import <MatrixSDK/MatrixSDK.h>
#import "Widget.h"
#import "WidgetConstants.h"
@class WidgetManagerConfig;
/**
The type of matrix event used for matrix widgets.
*/
FOUNDATION_EXPORT NSString *const kWidgetMatrixEventTypeString;
/**
The type of matrix event used for modular widgets.
TODO: It should be replaced by kWidgetMatrixEventTypeString.
*/
FOUNDATION_EXPORT NSString *const kWidgetModularEventTypeString;
/**
Known types widgets.
*/
FOUNDATION_EXPORT NSString *const kWidgetTypeJitsiV1;
FOUNDATION_EXPORT NSString *const kWidgetTypeJitsiV2;
FOUNDATION_EXPORT NSString *const kWidgetTypeStickerPicker;
/**
Posted when a widget has been created, updated or disabled.
The notification object is the `Widget` instance.

View File

@@ -24,12 +24,6 @@
#pragma mark - Contants
NSString *const kWidgetMatrixEventTypeString = @"m.widget";
NSString *const kWidgetModularEventTypeString = @"im.vector.modular.widgets";
NSString *const kWidgetTypeJitsiV1 = @"jitsi";
NSString *const kWidgetTypeJitsiV2 = @"m.jitsi";
NSString *const kWidgetTypeStickerPicker = @"m.stickerpicker";
NSString *const kWidgetManagerDidUpdateWidgetNotification = @"kWidgetManagerDidUpdateWidgetNotification";
NSString *const WidgetManagerErrorDomain = @"WidgetManagerErrorDomain";

View File

@@ -27,3 +27,4 @@ INFOPLIST_FILE = RiotNSE/Info.plist
CODE_SIGN_ENTITLEMENTS = RiotNSE/RiotNSE.entitlements
SKIP_INSTALL = YES
SWIFT_OBJC_BRIDGING_HEADER = $(SRCROOT)/$(PRODUCT_NAME)/SupportingFiles/RiotNSE-Bridging-Header.h

View File

@@ -0,0 +1,22 @@
//
// Copyright 2021 New Vector Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#ifndef RiotNSE_Bridging_Header_h
#define RiotNSE_Bridging_Header_h
#import "WidgetConstants.h"
#endif /* RiotNSE_Bridging_Header_h */

View File

@@ -58,3 +58,4 @@ targets:
- path: ../Riot/Utils/Constants.swift
- path: ../Riot/Categories/String.swift
- path: ../Riot/Categories/Character.swift
- path: ../Riot/Managers/Widgets/WidgetConstants.m