@robono/calling-react-native 0.2.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/README.md +108 -2
- package/RobonoCallingRuntime.podspec +1 -1
- package/SBOM.spdx.json +972 -156
- package/android/build.gradle +1 -1
- package/android/consumer-rules.pro +5 -0
- package/android/src/main/java/com/robono/calling/CallingRuntime.java +21 -0
- package/app.plugin.cjs +4 -2
- package/broadcast/SampleHandler.swift +92 -0
- package/dist/CallRecord.d.ts +19 -0
- package/dist/CallRecord.js +22 -0
- package/dist/appearance.d.ts +69 -4
- package/dist/appearance.js +70 -5
- package/dist/components.d.ts +135 -0
- package/dist/components.js +185 -0
- package/dist/controller.d.mts +1 -1
- package/dist/controller.mjs +59 -7
- package/dist/expo-notifications.d.ts +1 -1
- package/dist/expo-notifications.js +3 -3
- package/dist/group-phase.d.mts +4 -0
- package/dist/group-phase.mjs +26 -0
- package/dist/groups.d.ts +41 -0
- package/dist/groups.js +90 -0
- package/dist/history.d.ts +6 -15
- package/dist/history.js +3 -11
- package/dist/index.d.ts +4 -2
- package/dist/index.js +4 -2
- package/dist/native-video.d.ts +8 -0
- package/dist/native-video.js +10 -0
- package/dist/native.d.ts +2 -0
- package/dist/native.js +51 -2
- package/dist/notification-router.d.ts +2 -1
- package/dist/notification-router.js +4 -4
- package/dist/notifications.d.ts +5 -3
- package/dist/notifications.js +7 -5
- package/dist/runtime.d.ts +2 -1
- package/dist/runtime.js +2 -2
- package/dist/screens.d.ts +6 -54
- package/dist/screens.js +17 -42
- package/dist/types.d.ts +38 -1
- package/dist/versions.d.ts +2 -0
- package/dist/versions.js +3 -0
- package/dist/visual/RobonoIcon.d.ts +232 -0
- package/dist/visual/RobonoIcon.js +20 -0
- package/dist/visual/icon-nodes.d.ts +3 -0
- package/dist/visual/icon-nodes.js +2 -0
- package/dist/visual/icon-paths.d.ts +221 -0
- package/dist/visual/icon-paths.js +221 -0
- package/examples/CallingHost.tsx +27 -14
- package/examples/CustomCallingScreen.tsx +64 -0
- package/examples/ExpoGroupCallingHost.tsx +42 -0
- package/examples/GroupCallingHost.tsx +70 -0
- package/ios/RobonoCallingRuntime.m +24 -0
- package/licenses/robono-icons-lucide-license.txt +43 -0
- package/licenses/robono-icons-weather-attribution.txt +1 -0
- package/licenses/robono-icons-weather-license.txt +21 -0
- package/package.json +16 -4
- package/plugin/screensharing.cjs +39 -0
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {Pressable, Text, View} from 'react-native';
|
|
3
|
+
import {
|
|
4
|
+
CallingActionButton, CallingAudioControls, CallingAvatar, CallingBrand,
|
|
5
|
+
CallingContact, CallingIncomingControls, CallingLayout, CallingOverlay,
|
|
6
|
+
CallingStatus, CallingUIProvider, useCallingUI,
|
|
7
|
+
type CallingActionButtonProps, type CallingOverlayProps,
|
|
8
|
+
type CallingScreenComponents, type CallingScreenProps,
|
|
9
|
+
} from '@robono/calling-react-native';
|
|
10
|
+
|
|
11
|
+
/** Define replacements outside render so state changes do not remount them. */
|
|
12
|
+
export function CompactCallingIdentity() {
|
|
13
|
+
return <View style={{gap: 20, alignItems: 'center'}}>
|
|
14
|
+
<CallingBrand/>
|
|
15
|
+
<View style={{flexDirection: 'row', alignItems: 'center', gap: 20}}>
|
|
16
|
+
<CallingAvatar size={72}/>
|
|
17
|
+
<View style={{flex: 1, gap: 8}}><CallingContact nameStyle={{textAlign: 'left'}} descriptionStyle={{textAlign: 'left'}}/></View>
|
|
18
|
+
</View>
|
|
19
|
+
<CallingStatus/>
|
|
20
|
+
</View>;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** Compose controls without duplicating phase checks or permission checks. */
|
|
24
|
+
export function CompactCallingControls() {
|
|
25
|
+
return <View style={{alignItems: 'center', gap: 24}}>
|
|
26
|
+
<CallingAudioControls/>
|
|
27
|
+
<CallingIncomingControls/>
|
|
28
|
+
<CallingActionButton action="resume"/>
|
|
29
|
+
<CallingActionButton action="end"/>
|
|
30
|
+
<CallingActionButton action="close"/>
|
|
31
|
+
</View>;
|
|
32
|
+
}
|
|
33
|
+
export const compactCallingComponents: CallingScreenComponents = {
|
|
34
|
+
Identity: CompactCallingIdentity,
|
|
35
|
+
Controls: CompactCallingControls,
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
/** Keep Robono's call layer and controller, replace only selected sections. */
|
|
39
|
+
export function AppCallingOverlay(props: CallingOverlayProps) {
|
|
40
|
+
return <CallingOverlay {...props} components={{...compactCallingComponents, ...props.components}}/>;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** Use in a host that already owns its call layer and passes controller callbacks. */
|
|
44
|
+
export function ComposedCallingScreen(props: Omit<CallingScreenProps, 'components'>) {
|
|
45
|
+
return <CallingUIProvider {...props}>
|
|
46
|
+
<CallingLayout>
|
|
47
|
+
<CompactCallingIdentity/>
|
|
48
|
+
<CompactCallingControls/>
|
|
49
|
+
</CallingLayout>
|
|
50
|
+
</CallingUIProvider>;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** Optional replacement for the ActionButton slot using the shared action model. */
|
|
54
|
+
export function TextCallingAction({action}: CallingActionButtonProps) {
|
|
55
|
+
const {actions, theme, typography} = useCallingUI();
|
|
56
|
+
const button = actions[action];
|
|
57
|
+
if (!button.visible) return null;
|
|
58
|
+
return <Pressable accessibilityRole="button" accessibilityLabel={button.label}
|
|
59
|
+
accessibilityState={{disabled: button.disabled, selected: button.selected, busy: button.busy}}
|
|
60
|
+
disabled={button.disabled} onPress={button.onPress}
|
|
61
|
+
style={{minHeight: 48, padding: 16, opacity: button.disabled ? 0.4 : 1}}>
|
|
62
|
+
<Text style={[typography(17), {color: theme.foreground}]}>{button.label}</Text>
|
|
63
|
+
</Pressable>;
|
|
64
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React, {useCallback, useEffect, useRef, useState} from 'react';
|
|
2
|
+
import type {GroupCallingController} from '@robono/calling-react-native/groups';
|
|
3
|
+
import type {NotificationStore} from '@robono/calling-react-native/notifications';
|
|
4
|
+
import {connectExpoCallingNotifications} from '@robono/calling-react-native/expo-notifications';
|
|
5
|
+
import {GroupCallingHost, type GroupCallingHostProps} from './GroupCallingHost';
|
|
6
|
+
|
|
7
|
+
export interface ExpoGroupCallingHostProps extends Omit<GroupCallingHostProps, 'notificationCallId' | 'onNotificationConsumed' | 'onController'> {
|
|
8
|
+
notificationStore: NotificationStore;
|
|
9
|
+
/** Return the account identifier your backend attached to this push. */
|
|
10
|
+
recipientAccount(data: unknown): string | null;
|
|
11
|
+
onNotificationError(error: Error): void;
|
|
12
|
+
/** Use this readiness in withCallingNotificationPresentation's callback. */
|
|
13
|
+
onReadyChange?(ready: boolean): void;
|
|
14
|
+
}
|
|
15
|
+
/** Place above chat navigation after restoring the signed-in account. */
|
|
16
|
+
export function ExpoGroupCallingHost(props: ExpoGroupCallingHostProps) {
|
|
17
|
+
return <AccountNotifications key={props.accountId} {...props}/>;
|
|
18
|
+
}
|
|
19
|
+
function AccountNotifications(props: ExpoGroupCallingHostProps) {
|
|
20
|
+
const current = useRef<GroupCallingController | null>(null);
|
|
21
|
+
const pendingRefresh = useRef(false);
|
|
22
|
+
const [callId, setCallId] = useState<string>();
|
|
23
|
+
const onController = useCallback((controller: GroupCallingController | null) => {
|
|
24
|
+
current.current = controller;
|
|
25
|
+
props.onReadyChange?.(!!controller);
|
|
26
|
+
if (controller && pendingRefresh.current) {
|
|
27
|
+
pendingRefresh.current = false;
|
|
28
|
+
void controller.refresh().catch(props.onNotificationError);
|
|
29
|
+
}
|
|
30
|
+
}, [props.onNotificationError, props.onReadyChange]);
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
const notifications = connectExpoCallingNotifications({
|
|
33
|
+
group:true, accountKey:props.accountId, store:props.notificationStore,
|
|
34
|
+
recipientAccount:props.recipientAccount, open:setCallId,
|
|
35
|
+
refresh:async () => { if (current.current) await current.current.refresh(); else pendingRefresh.current = true; },
|
|
36
|
+
onError:props.onNotificationError,
|
|
37
|
+
});
|
|
38
|
+
return () => notifications.dispose();
|
|
39
|
+
}, [props.accountId, props.notificationStore, props.recipientAccount, props.onNotificationError]);
|
|
40
|
+
const consumed = useCallback((id: string) => setCallId(value => value === id ? undefined : value), []);
|
|
41
|
+
return <GroupCallingHost {...props} notificationCallId={callId} onController={onController} onNotificationConsumed={consumed}/>;
|
|
42
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import React,{useEffect,useRef,useState,useSyncExternalStore} from 'react';
|
|
2
|
+
import {AppState,Modal,Pressable,StatusBar,Text,View,useColorScheme} from 'react-native';
|
|
3
|
+
import {SafeAreaProvider} from 'react-native-safe-area-context';
|
|
4
|
+
import {setAudioModeAsync} from 'expo-audio';
|
|
5
|
+
import {createHttpTransport} from '@robono/calling';
|
|
6
|
+
import {CallingScreen,callingInk,resolveCallingDesign,validateCallingAppearance,type CallingAppearance,type CallingState,type Contact} from '@robono/calling-react-native';
|
|
7
|
+
import {createGroupCallingController,type GroupCallingController} from '@robono/calling-react-native/groups';
|
|
8
|
+
import {renderNativeCallVideo} from '@robono/calling-react-native/native-video';
|
|
9
|
+
import {createNativeCallAdapters} from '@robono/calling-react-native/native';
|
|
10
|
+
import {createNativeCallRuntime} from '@robono/calling-react-native/runtime';
|
|
11
|
+
export interface GroupCallingHostProps{
|
|
12
|
+
accountId:string;serviceOrigin:string;connectionId:string;kind:'voice'|'video';
|
|
13
|
+
getSession():Promise<{serviceUrl:string;token:string;expiresAt:number;appearance?:unknown;appearanceRevision?:number}>;
|
|
14
|
+
resolveGroup(id:string):Contact|null;resolveMember(appId:string,userId:string):Contact|null;
|
|
15
|
+
notificationCallId?:string;onNotificationConsumed?(id:string):void;
|
|
16
|
+
onController?(controller:GroupCallingController|null):void;
|
|
17
|
+
}
|
|
18
|
+
const idle:CallingState={group:true,phase:'idle',call:null,contact:null,speaker:false,muted:false,canMute:false,canSpeaker:true,connectedAt:null,error:null};
|
|
19
|
+
const idleSnapshot=()=>idle,emptySubscribe=()=>()=>{};
|
|
20
|
+
/** Mount once for the authenticated account; keep callbacks stable. */
|
|
21
|
+
export function GroupCallingHost(props:GroupCallingHostProps){
|
|
22
|
+
const cleanup=useRef(Promise.resolve());return <AccountHost key={props.accountId} {...props} cleanup={cleanup}/>;
|
|
23
|
+
}
|
|
24
|
+
function AccountHost(props:GroupCallingHostProps&{cleanup:React.MutableRefObject<Promise<void>>}){
|
|
25
|
+
const [controller,setController]=useState<GroupCallingController|null>(null),[appearance,setAppearance]=useState<CallingAppearance>(),[error,setError]=useState(''),[attempt,setAttempt]=useState(0);
|
|
26
|
+
const handled=useRef(new Set<string>()),deviceMode=useColorScheme();
|
|
27
|
+
const [booting,setBooting]=useState(true),[consumed,setConsumed]=useState<string>();
|
|
28
|
+
const state=useSyncExternalStore(controller?.subscribe||emptySubscribe,controller?.getSnapshot||idleSnapshot,idleSnapshot);
|
|
29
|
+
const pendingNotification=props.notificationCallId&&consumed!==props.notificationCallId;
|
|
30
|
+
useEffect(()=>{controller?.reportComponents(['screens']);},[controller]);
|
|
31
|
+
useEffect(()=>{props.onController?.(controller);return()=>props.onController?.(null);},[controller,props.onController]);
|
|
32
|
+
useEffect(()=>{
|
|
33
|
+
let cancelled=false,renewing=false,due=false,instance:GroupCallingController|undefined,runtime:ReturnType<typeof createNativeCallRuntime>|undefined;
|
|
34
|
+
let renewTimer:ReturnType<typeof setTimeout>|undefined,expiryTimer:ReturnType<typeof setTimeout>|undefined,unsubscribe:(()=>void)|undefined,foreground:ReturnType<typeof AppState.addEventListener>|undefined,disposal:Promise<void>|undefined;
|
|
35
|
+
const dispose=()=>disposal??=(async()=>{try{await instance?.dispose();}finally{await runtime?.dispose();}})().catch(()=>{});
|
|
36
|
+
const renew=()=>{if(!cancelled&&instance?.client.closed&&!renewing){renewing=true;clearTimeout(renewTimer);clearTimeout(expiryTimer);unsubscribe?.();foreground?.remove();setController(null);setError('Calling access ended. Reconnect to check your access.');props.cleanup.current=dispose();return;}if(!cancelled&&due&&!renewing&&instance?.getSnapshot().phase==='idle'){renewing=true;setAttempt(n=>n+1);}};
|
|
37
|
+
setBooting(true);setError('');
|
|
38
|
+
void(async()=>{
|
|
39
|
+
try{
|
|
40
|
+
await props.cleanup.current;if(cancelled)return;const session=await props.getSession();if(cancelled)return;
|
|
41
|
+
const url=new URL(session.serviceUrl);if(url.protocol!=='https:'||url.origin!==props.serviceOrigin||url.username||url.password||url.search||url.hash||!session.token||!Number.isFinite(session.expiresAt)||session.expiresAt<Date.now()+60000)throw Error('invalid_calling_session');
|
|
42
|
+
const design=session.appearance===undefined?undefined:validateCallingAppearance(session.appearance);setAppearance(design);
|
|
43
|
+
runtime=createNativeCallRuntime({notificationTitle:'Group call',notificationText:'Call in progress',channelName:'Ongoing calls',endLabel:'End call',onError:()=>{if(!cancelled)setError('The call was interrupted.');}});
|
|
44
|
+
const adapters=createNativeCallAdapters({runtime,appearance:design,ringtone:'robono',onError:()=>{if(!cancelled)setError('Call audio is unavailable.');},restoreAudio:()=>setAudioModeAsync({allowsRecording:false,playsInSilentMode:true,interruptionMode:'duckOthers',shouldPlayInBackground:false,shouldRouteThroughEarpiece:false})});
|
|
45
|
+
instance=createGroupCallingController({...adapters,request:createHttpTransport({baseUrl:session.serviceUrl,token:session.token}),appearanceRevision:session.appearanceRevision,resolveGroup:props.resolveGroup,resolveMember:props.resolveMember});
|
|
46
|
+
runtime.attach(instance);instance.setForeground(AppState.currentState==='active');unsubscribe=instance.subscribe(renew);
|
|
47
|
+
foreground=AppState.addEventListener('change',value=>{instance?.setForeground(value==='active');if(value==='active')void instance?.refresh();});
|
|
48
|
+
setController(instance);await instance.listen();if(cancelled)return;
|
|
49
|
+
renewTimer=setTimeout(()=>{due=true;renew();},session.expiresAt-Date.now()-30000);
|
|
50
|
+
expiryTimer=setTimeout(()=>{if(cancelled)return;renewing=true;clearTimeout(renewTimer);unsubscribe?.();foreground?.remove();setController(null);setError('Calling access expired. Reconnect to continue.');props.cleanup.current=dispose();},session.expiresAt-Date.now());
|
|
51
|
+
}catch{if(!cancelled){setController(null);setError('Calling is unavailable. Please try again.');props.cleanup.current=dispose();}}finally{if(!cancelled)setBooting(false);}
|
|
52
|
+
})();
|
|
53
|
+
return()=>{cancelled=true;clearTimeout(renewTimer);clearTimeout(expiryTimer);unsubscribe?.();foreground?.remove();setController(null);props.cleanup.current=dispose();};
|
|
54
|
+
},[attempt,props.getSession,props.serviceOrigin,props.resolveGroup,props.resolveMember,props.cleanup]);
|
|
55
|
+
useEffect(()=>{const id=props.notificationCallId;if(!id||!controller||handled.current.has(id))return;handled.current.add(id);void controller.openIncoming(id).catch(()=>{setError('This call could not be opened.');});setConsumed(id);props.onNotificationConsumed?.(id);},[controller,props.notificationCallId,props.onNotificationConsumed]);
|
|
56
|
+
const call=async()=>{if(!controller)return;setError('');try{await controller.client.availability(props.connectionId,props.kind);await controller.call(props.connectionId,{kind:props.kind});}catch{setError('This group cannot receive a call right now.');}};
|
|
57
|
+
const close=()=>{if(pendingNotification&&props.notificationCallId){handled.current.add(props.notificationCallId);setConsumed(props.notificationCallId);props.onNotificationConsumed?.(props.notificationCallId);return;}if(state.phase==='error')controller?.dismissError();else void controller?.hangUp().catch(()=>setError('The call could not be ended.'));};
|
|
58
|
+
const visible=state.phase!=='idle'||!!pendingNotification;
|
|
59
|
+
const screen=pendingNotification&&state.phase==='idle'?{...idle,phase:(!booting&&!controller?'error':'loading') as CallingState['phase'],error:!booting&&!controller?'call_unavailable':null}:state;
|
|
60
|
+
return <View>{!!error&&<Text accessibilityRole="alert">{error}</Text>}{!controller&&!booting&&<Pressable accessibilityRole="button" onPress={()=>setAttempt(n=>n+1)}><Text>Reconnect calling</Text></Pressable>}
|
|
61
|
+
<Pressable accessibilityRole="button" disabled={!controller} accessibilityState={{disabled:!controller}} onPress={()=>void call()}><Text>{props.kind==='video'?'Video call':'Call'} {props.resolveGroup(props.connectionId)?.name??'group'}</Text></Pressable>
|
|
62
|
+
<Modal visible={visible} presentationStyle="fullScreen" animationType="none" onRequestClose={close}>{visible&&<SafeAreaProvider>
|
|
63
|
+
<StatusBar barStyle={callingInk(resolveCallingDesign(appearance,deviceMode).colors.background)==='#000000'?'dark-content':'light-content'}/>
|
|
64
|
+
<CallingScreen state={screen} appearance={appearance} renderVideo={renderNativeCallVideo}
|
|
65
|
+
onAnswer={()=>{void controller?.answer().catch(()=>{});}} onHangUp={close} onClose={close}
|
|
66
|
+
onMute={v=>controller?.mute(v)} onSpeaker={v=>controller?.setSpeaker(v)} onCamera={v=>controller?.setCamera(v)}
|
|
67
|
+
onSwitchCamera={()=>{void controller?.switchCamera().catch(()=>{});}} onResume={()=>{void controller?.resume().catch(()=>{});}}
|
|
68
|
+
onScreenShare={()=>{void (state.screenSharing?controller?.stopScreenSharing():controller?.startScreenSharing())?.catch(()=>{});}}/>
|
|
69
|
+
</SafeAreaProvider>}</Modal></View>;
|
|
70
|
+
}
|
|
@@ -2,8 +2,10 @@
|
|
|
2
2
|
#import <React/RCTEventEmitter.h>
|
|
3
3
|
#import <AVFAudio/AVFAudio.h>
|
|
4
4
|
#import <UIKit/UIKit.h>
|
|
5
|
+
#import <ReplayKit/ReplayKit.h>
|
|
5
6
|
|
|
6
7
|
@interface RobonoCallingRuntime : RCTEventEmitter <RCTBridgeModule>
|
|
8
|
+
@property(nonatomic, strong) RPSystemBroadcastPickerView *screenPicker;
|
|
7
9
|
@property(nonatomic, copy) NSString *owner;
|
|
8
10
|
@property(nonatomic) BOOL observing;
|
|
9
11
|
@property(nonatomic, strong) NSTimer *clock;
|
|
@@ -81,4 +83,26 @@ RCT_REMAP_METHOD(end, end:(NSString *)token resolver:(RCTPromiseResolveBlock)res
|
|
|
81
83
|
resolve(nil);
|
|
82
84
|
}
|
|
83
85
|
- (void)invalidate { self.owner = nil; [self.clock invalidate]; self.clock = nil; [self finishInterruptionTask]; [self stopObserving]; [super invalidate]; }
|
|
86
|
+
- (NSURL *)screenStatusURL {
|
|
87
|
+
NSString *group = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"RTCAppGroupIdentifier"];
|
|
88
|
+
return group ? [[[NSFileManager defaultManager] containerURLForSecurityApplicationGroupIdentifier:group] URLByAppendingPathComponent:@"robono-screen-status.json"] : nil;
|
|
89
|
+
}
|
|
90
|
+
RCT_REMAP_METHOD(screenSharingPrepare, screenSharingPrepare:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
|
|
91
|
+
NSURL *url=[self screenStatusURL];
|
|
92
|
+
if (!url || ![[NSBundle mainBundle] objectForInfoDictionaryKey:@"RTCScreenSharingExtension"]) { reject(@"screen_sharing_not_configured", @"Enable screen sharing in the calling plugin.", nil); return; }
|
|
93
|
+
[[NSFileManager defaultManager] removeItemAtURL:url error:nil]; resolve(nil);
|
|
94
|
+
}
|
|
95
|
+
RCT_REMAP_METHOD(screenSharingStart, screenSharingStart:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
|
|
96
|
+
if (UIApplication.sharedApplication.applicationState != UIApplicationStateActive) { reject(@"open_app_to_share", @"Open the app to share your screen.", nil); return; }
|
|
97
|
+
self.screenPicker=[[RPSystemBroadcastPickerView alloc] initWithFrame:CGRectMake(0,0,44,44)];
|
|
98
|
+
self.screenPicker.preferredExtension=[[NSBundle mainBundle] objectForInfoDictionaryKey:@"RTCScreenSharingExtension"];
|
|
99
|
+
self.screenPicker.showsMicrophoneButton=NO;
|
|
100
|
+
for (UIView *view in self.screenPicker.subviews) if ([view isKindOfClass:UIButton.class]) { [(UIButton *)view sendActionsForControlEvents:UIControlEventTouchUpInside]; resolve(nil); return; }
|
|
101
|
+
reject(@"screen_picker_unavailable", @"Screen sharing could not start.", nil);
|
|
102
|
+
}
|
|
103
|
+
RCT_REMAP_METHOD(screenSharingStatus, screenSharingStatus:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
|
|
104
|
+
NSURL *url=[self screenStatusURL];NSData *data=url?[NSData dataWithContentsOfURL:url]:nil;
|
|
105
|
+
NSDictionary *value=data?[NSJSONSerialization JSONObjectWithData:data options:0 error:nil]:nil;
|
|
106
|
+
resolve(value?:@{@"active":@NO});
|
|
107
|
+
}
|
|
84
108
|
@end
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
ISC License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Lucide Icons and Contributors
|
|
4
|
+
|
|
5
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
6
|
+
purpose with or without fee is hereby granted, provided that the above
|
|
7
|
+
copyright notice and this permission notice appear in all copies.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
10
|
+
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
11
|
+
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
12
|
+
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
13
|
+
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
14
|
+
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
15
|
+
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
The following Lucide icons are derived from the Feather project:
|
|
20
|
+
|
|
21
|
+
airplay, alert-circle, alert-octagon, alert-triangle, aperture, arrow-down-circle, arrow-down-left, arrow-down-right, arrow-down, arrow-left-circle, arrow-left, arrow-right-circle, arrow-right, arrow-up-circle, arrow-up-left, arrow-up-right, arrow-up, at-sign, calendar, cast, check, chevron-down, chevron-left, chevron-right, chevron-up, chevrons-down, chevrons-left, chevrons-right, chevrons-up, circle, clipboard, clock, code, columns, command, compass, corner-down-left, corner-down-right, corner-left-down, corner-left-up, corner-right-down, corner-right-up, corner-up-left, corner-up-right, crosshair, database, divide-circle, divide-square, dollar-sign, download, external-link, feather, frown, hash, headphones, help-circle, info, italic, key, layout, life-buoy, link-2, link, loader, lock, log-in, log-out, maximize, meh, minimize, minimize-2, minus-circle, minus-square, minus, monitor, moon, more-horizontal, more-vertical, move, music, navigation-2, navigation, octagon, pause-circle, percent, plus-circle, plus-square, plus, power, radio, rss, search, server, share, shopping-bag, sidebar, smartphone, smile, square, table-2, tablet, target, terminal, trash-2, trash, triangle, tv, type, upload, x-circle, x-octagon, x-square, x, zoom-in, zoom-out
|
|
22
|
+
|
|
23
|
+
The MIT License (MIT) (for the icons listed above)
|
|
24
|
+
|
|
25
|
+
Copyright (c) 2013-present Cole Bemis
|
|
26
|
+
|
|
27
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
28
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
29
|
+
in the Software without restriction, including without limitation the rights
|
|
30
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
31
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
32
|
+
furnished to do so, subject to the following conditions:
|
|
33
|
+
|
|
34
|
+
The above copyright notice and this permission notice shall be included in all
|
|
35
|
+
copies or substantial portions of the Software.
|
|
36
|
+
|
|
37
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
38
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
39
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
40
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
41
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
42
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
43
|
+
SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Weather adapts the existing Ionicons partly-sunny-outline artwork: cloud filled, sun and rays retained. MIT license. Source: https://github.com/ionic-team/ionicons/blob/main/src/svg/partly-sunny-outline.svg
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2015-present Ionic (http://ionic.io/)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@robono/calling-react-native",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Optional branded calling screens, sounds and native audio adapters for Robono calling.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -38,7 +38,15 @@
|
|
|
38
38
|
"default": "./dist/appearance.js"
|
|
39
39
|
},
|
|
40
40
|
"./app.plugin.js": "./app.plugin.cjs",
|
|
41
|
-
"./app.plugin.cjs": "./app.plugin.cjs"
|
|
41
|
+
"./app.plugin.cjs": "./app.plugin.cjs",
|
|
42
|
+
"./native-video": {
|
|
43
|
+
"types": "./dist/native-video.d.ts",
|
|
44
|
+
"default": "./dist/native-video.js"
|
|
45
|
+
},
|
|
46
|
+
"./groups": {
|
|
47
|
+
"types": "./dist/groups.d.ts",
|
|
48
|
+
"default": "./dist/groups.js"
|
|
49
|
+
}
|
|
42
50
|
},
|
|
43
51
|
"files": [
|
|
44
52
|
"dist",
|
|
@@ -53,14 +61,18 @@
|
|
|
53
61
|
"LICENSE",
|
|
54
62
|
"SBOM.spdx.json",
|
|
55
63
|
"android/build.gradle",
|
|
56
|
-
"android/src/main"
|
|
64
|
+
"android/src/main",
|
|
65
|
+
"broadcast",
|
|
66
|
+
"plugin",
|
|
67
|
+
"android/consumer-rules.pro",
|
|
68
|
+
"licenses"
|
|
57
69
|
],
|
|
58
70
|
"devDependencies": {
|
|
59
71
|
"typescript": "~6.0.3",
|
|
60
72
|
"@types/react": "~19.2.2"
|
|
61
73
|
},
|
|
62
74
|
"peerDependencies": {
|
|
63
|
-
"@robono/calling": "^0.
|
|
75
|
+
"@robono/calling": "^0.2.0",
|
|
64
76
|
"react": ">=18.2 <20",
|
|
65
77
|
"react-native": ">=0.76 <1",
|
|
66
78
|
"react-native-svg": ">=15 <16",
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
const {withInfoPlist,withEntitlementsPlist,withXcodeProject}=require('expo/config-plugins');
|
|
2
|
+
const fs=require('node:fs');const path=require('node:path');const plist=require('@expo/plist').default;
|
|
3
|
+
const targetName='RobonoScreenBroadcast';
|
|
4
|
+
function configureTarget(project,{root,bundleId,group,version,buildNumber}){
|
|
5
|
+
const dir=path.join(root,targetName);fs.mkdirSync(dir,{recursive:true});
|
|
6
|
+
fs.copyFileSync(path.join(__dirname,'../broadcast/SampleHandler.swift'),path.join(dir,'SampleHandler.swift'));
|
|
7
|
+
fs.writeFileSync(path.join(dir,'Info.plist'),plist.build({CFBundleDisplayName:'Screen sharing',CFBundleExecutable:'$(EXECUTABLE_NAME)',CFBundleIdentifier:'$(PRODUCT_BUNDLE_IDENTIFIER)',CFBundleName:'$(PRODUCT_NAME)',CFBundlePackageType:'XPC!',CFBundleShortVersionString:version,CFBundleVersion:buildNumber,RTCAppGroupIdentifier:group,NSExtension:{NSExtensionPointIdentifier:'com.apple.broadcast-services-upload',NSExtensionPrincipalClass:'$(PRODUCT_MODULE_NAME).SampleHandler',RPBroadcastProcessMode:'RPBroadcastProcessModeSampleBuffer'}}));
|
|
8
|
+
fs.writeFileSync(path.join(dir,'Broadcast.entitlements'),plist.build({'com.apple.security.application-groups':[group]}));
|
|
9
|
+
let target=Object.entries(project.pbxNativeTargetSection()).find(([key,value])=>!key.endsWith('_comment')&&value.name?.replaceAll('"','')===targetName);
|
|
10
|
+
if(!target){
|
|
11
|
+
const t=project.addTarget(targetName,'app_extension',targetName,bundleId);target=[t.uuid,t.pbxNativeTarget];
|
|
12
|
+
project.addBuildPhase([`${targetName}/SampleHandler.swift`],'PBXSourcesBuildPhase','Sources',t.uuid);
|
|
13
|
+
project.addBuildPhase([],'PBXFrameworksBuildPhase','Frameworks',t.uuid);
|
|
14
|
+
}
|
|
15
|
+
const main=Object.values(project.pbxNativeTargetSection()).find(t=>t.productType==='"com.apple.product-type.application"');
|
|
16
|
+
const mainList=main&&project.pbxXCConfigurationList()[main.buildConfigurationList];
|
|
17
|
+
const mainConfigs=(mainList?.buildConfigurations||[]).map(e=>project.pbxXCBuildConfigurationSection()[e.value]);
|
|
18
|
+
for(const item of Object.values(project.pbxBuildFileSection()))if(item.fileRef===target[1].productReference)item.settings={...(item.settings||{}),ATTRIBUTES:['CodeSignOnCopy','RemoveHeadersOnCopy']};
|
|
19
|
+
const list=project.pbxXCConfigurationList()[target[1].buildConfigurationList];
|
|
20
|
+
for(const entry of list.buildConfigurations){const config=project.pbxXCBuildConfigurationSection()[entry.value],b=config.buildSettings;const inherited=mainConfigs.find(c=>c.name===config.name)?.buildSettings;if(inherited?.DEVELOPMENT_TEAM)b.DEVELOPMENT_TEAM=inherited.DEVELOPMENT_TEAM;
|
|
21
|
+
Object.assign(b,{INFOPLIST_FILE:`"${targetName}/Info.plist"`,CODE_SIGN_ENTITLEMENTS:`"${targetName}/Broadcast.entitlements"`,PRODUCT_BUNDLE_IDENTIFIER:`"${bundleId}"`,SWIFT_VERSION:'5.0',IPHONEOS_DEPLOYMENT_TARGET:'15.1',TARGETED_DEVICE_FAMILY:'"1,2"',APPLICATION_EXTENSION_API_ONLY:'YES',CODE_SIGN_STYLE:'Automatic',SKIP_INSTALL:'YES',GENERATE_INFOPLIST_FILE:'NO',CURRENT_PROJECT_VERSION:`"${buildNumber}"`,MARKETING_VERSION:`"${version}"`});
|
|
22
|
+
}
|
|
23
|
+
return project;
|
|
24
|
+
}
|
|
25
|
+
function withScreenSharing(config,options={}){
|
|
26
|
+
const app=config.ios?.bundleIdentifier;
|
|
27
|
+
// Android-only builds do not need Apple signing identifiers. Validate only when
|
|
28
|
+
// Xcode configuration actually runs.
|
|
29
|
+
if(!app)return withXcodeProject(config,()=>{throw Error('Set ios.bundleIdentifier before building iPhone screen sharing.');});
|
|
30
|
+
const group=options.appGroup||`group.${app}.calling`,bundleId=`${app}.screenbroadcast`;
|
|
31
|
+
if(!/^group\.[A-Za-z0-9.-]+$/.test(group))throw Error('Invalid screen sharing app group.');
|
|
32
|
+
config=withInfoPlist(config,c=>{c.modResults.RTCAppGroupIdentifier=group;c.modResults.RTCScreenSharingExtension=bundleId;return c;});
|
|
33
|
+
config=withEntitlementsPlist(config,c=>{c.modResults['com.apple.security.application-groups']=[...new Set([...(c.modResults['com.apple.security.application-groups']||[]),group])];return c;});
|
|
34
|
+
config.extra||={};config.extra.eas||={};config.extra.eas.build||={};config.extra.eas.build.experimental||={};config.extra.eas.build.experimental.ios||={};
|
|
35
|
+
const ios=config.extra.eas.build.experimental.ios;ios.appExtensions=(ios.appExtensions||[]).filter(e=>e.targetName!==targetName);
|
|
36
|
+
ios.appExtensions.push({targetName,bundleIdentifier:bundleId,entitlements:{'com.apple.security.application-groups':[group]}});
|
|
37
|
+
return withXcodeProject(config,c=>{configureTarget(c.modResults,{root:c.modRequest.platformProjectRoot,bundleId,group,version:config.version||'1.0.0',buildNumber:config.ios.buildNumber||'1'});return c;});
|
|
38
|
+
}
|
|
39
|
+
module.exports={withScreenSharing,configureTarget};
|