Skip to content

Instantly share code, notes, and snippets.

@weswit-team
weswit-team / watchOS-tutorial-PushNotificationPayload.apns
Created February 15, 2018 18:26
Sample APNS payload for the watchOS SDK tutorial.
{
"aps": {
"alert": {
"body": "Stock Anduct rised above 3.00"
},
"badge": "1",
"sound": "Default",
"category": "STOCK_PRICE_CATEGORY"
},
@weswit-team
weswit-team / watchOS-tutorial-NotificationController.m
Created February 15, 2018 17:55
Implementation file NotificationController.m for the watchOS SDK tutorial.
//
// NotificationController.m
// StockWatch Extension
//
#import <UserNotifications/UserNotifications.h>
#import "NotificationController.h"
@interface NotificationController ()
@weswit-team
weswit-team / watchOS-tutorial-NotificationController.h
Created February 15, 2018 17:53
Header file NotificationController.h for the watchOS SDK tutorial.
//
// NotificationController.h
// StockWatch Extension
//
#import <WatchKit/WatchKit.h>
#import <Foundation/Foundation.h>
@interface NotificationController : WKUserNotificationInterfaceController
@weswit-team
weswit-team / watchOS-tutorial-InterfaceController.m
Last active April 28, 2023 13:31
Implementation file InterfaceController.m for the watchOS SDK tutorial.
//
// InterfaceController.m
// StockWatch Extension
//
#import "InterfaceController.h"
#import "Constants.h"
@interface InterfaceController () {
@weswit-team
weswit-team / watchOS-tutorial-InterfaceController.h
Last active April 28, 2023 13:31
Header file InterfaceController.h for the watchOS SDK tutorial.
//
// InterfaceController.h
// StockWatch Extension
//
#import <WatchKit/WatchKit.h>
#import <Foundation/Foundation.h>
#import <Lightstreamer_watchOS_Client/Lightstreamer_watchOS_Client.h>
@weswit-team
weswit-team / fixup-framework.sh
Created February 15, 2018 15:24
This script gets executed from Xcode to fixup the embedded frameworks and bundle the necessary architectures.
#!/bin/bash
# This script gets executed from Xcode to fixup the embedded frameworks and
# bundle the necessary architectures.
# Original source:
# https://github.com/jitsi/jitsi-meet/commits/master/ios/scripts/fixup-frameworks.sh
APP_PATH="${TARGET_BUILD_DIR}/${WRAPPER_NAME}"
// Notification that a certain user is trying to access a certain device
public void notifyMpnDeviceAccess(String user, String sessionID, MpnDeviceInfo device)
throws CreditsException, NotificationException;
// Notification that a certain user is trying to activate an MPN subscription
public void notifyMpnSubscriptionActivation(String user, String sessionID, TableInfo table, MpnSubscriptionInfo mpnSubscription)
throws CreditsException, NotificationException;
// Notification that a certain user is trying to change the token of a certain device
public void notifyMpnDeviceTokenChange(String user, String sessionID, MpnDeviceInfo device, String newDeviceToken)
// Deactivate single subscription
client.unsubscribe(mpnSubscription);
// Deactivate all subscriptions in "TRIGGERED" state
client.unsubscribeMpnSubscriptions("TRIGGERED");
// Deactivate single subscription
[_client unsubscribeMPN:mpnSubscription];
// Deactivate all subscriptions in "TRIGGERED" state
[_client unsubscribeMultipleMPN:@"TRIGGERED"];
List<MpnSubscription> subs = client.getMpnSubscriptions();
for (MpnSubscription sub : subs) {
if (sub.getItemGroup().equals(thisGroup)) {
// Subscription found, copy it and add a trigger
MpnSubscription copy= new MpnSubscription(sub);
copy.setTriggerExpression("Double.parseDouble(${last_price}) > 100.0");
// Modify the subscription on the Server
client.subscribe(copy, false); // When modifying the coalescing flag is ignored