Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
whoscall
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Wei Han
whoscall
Commits
501198d0
Commit
501198d0
authored
Sep 03, 2025
by
Wei Han
Committed by
alep
Sep 04, 2025
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ios progress (need to test on physical device)
parent
7a905f79
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
111 additions
and
4 deletions
+111
-4
App.tsx
App.tsx
+58
-4
CallDirectoryManager.m
ios/CallDirectoryManager.m
+13
-0
CallDirectoryManager.swift
ios/CallDirectoryManager.swift
+38
-0
project.pbxproj
ios/whoscall.xcodeproj/project.pbxproj
+0
-0
CallDirectoryHandler.swift
ios/whoscallDirectoryExtension/CallDirectoryHandler.swift
+2
-0
No files found.
App.tsx
View file @
501198d0
...
@@ -119,14 +119,18 @@ export default function App() {
...
@@ -119,14 +119,18 @@ export default function App() {
setStatuses
(
prev
=>
({
...
prev
,
[
perm
.
key
]:
result
}));
setStatuses
(
prev
=>
({
...
prev
,
[
perm
.
key
]:
result
}));
}
}
}
}
if
(
Platform
.
OS
as
string
===
'ios'
)
{
}
}
if
(
Platform
.
OS
===
'ios'
)
{
Alert
.
alert
(
Alert
.
alert
(
"Enable Caller ID"
,
"Enable Caller ID"
,
"Go to Settings → Phone → Call Blocking & Identification and enable [Your App] to see caller ID labels."
"Go to Settings → Phone → Call Blocking & Identification and enable [Your App] to see caller ID labels."
,
[
{
text
:
"Open Settings"
,
onPress
:
()
=>
Linking
.
openURL
(
"app-settings:"
)
},
{
text
:
"Cancel"
,
style
:
"cancel"
}
]
);
);
}
}
}
}
},
[]);
},
[]);
useEffect
(()
=>
{
useEffect
(()
=>
{
...
@@ -141,6 +145,49 @@ export default function App() {
...
@@ -141,6 +145,49 @@ export default function App() {
const
allGranted
=
Object
.
values
(
statuses
).
every
(
s
=>
s
===
RESULTS
.
GRANTED
);
const
allGranted
=
Object
.
values
(
statuses
).
every
(
s
=>
s
===
RESULTS
.
GRANTED
);
// --- iOS: Call Directory management ---
const
checkCallDirectoryStatus
=
async
()
=>
{
if
(
Platform
.
OS
!==
"ios"
||
!
CallDirectoryManager
)
{
console
.
warn
(
"CallDirectoryManager not available on this platform"
);
return
;
}
try
{
const
status
=
await
CallDirectoryManager
.
getEnabledStatusForExtension
(
"com.whoscall.app.CallDirectoryExtension"
// <-- must match your extension bundle ID
);
console
.
log
(
"Call Directory status:"
,
status
);
if
(
status
===
2
)
{
Alert
.
alert
(
"✅ Enabled"
,
"Call Directory Extension is enabled"
);
}
else
{
Alert
.
alert
(
"⚠️ Not Enabled"
,
"Go to Settings → Phone → Call Blocking & Identification and enable Whoscall."
);
}
}
catch
(
e
)
{
console
.
error
(
"Error checking Call Directory status:"
,
e
);
}
};
const
reloadCallDirectory
=
async
()
=>
{
if
(
Platform
.
OS
!==
"ios"
||
!
CallDirectoryManager
)
{
console
.
warn
(
"CallDirectoryManager not available on this platform"
);
return
;
}
try
{
const
success
=
await
CallDirectoryManager
.
reloadExtension
(
"com.whoscall.app.CallDirectoryExtension"
);
console
.
log
(
"Reload result:"
,
success
);
if
(
success
)
{
Alert
.
alert
(
"🔄 Reloaded"
,
"Extension reloaded successfully"
);
}
}
catch
(
e
)
{
console
.
error
(
"Error reloading Call Directory:"
,
e
);
Alert
.
alert
(
"❌ Reload Failed"
,
String
(
e
));
}
};
return
(
return
(
<
View
style=
{
styles
.
container
}
>
<
View
style=
{
styles
.
container
}
>
<
Text
style=
{
styles
.
title
}
>
Permissions Status
</
Text
>
<
Text
style=
{
styles
.
title
}
>
Permissions Status
</
Text
>
...
@@ -158,6 +205,13 @@ export default function App() {
...
@@ -158,6 +205,13 @@ export default function App() {
))
}
))
}
{
allGranted
&&
<
Text
style=
{
styles
.
granted
}
>
All permissions granted ✅
</
Text
>
}
{
allGranted
&&
<
Text
style=
{
styles
.
granted
}
>
All permissions granted ✅
</
Text
>
}
<
Button
title=
"Check Again"
onPress=
{
checkAllPermissions
}
/>
<
Button
title=
"Check Again"
onPress=
{
checkAllPermissions
}
/>
{
Platform
.
OS
===
"ios"
&&
(
<>
<
Button
title=
"Check Call Directory Status"
onPress=
{
checkCallDirectoryStatus
}
/>
<
View
style=
{
{
height
:
10
}
}
/>
<
Button
title=
"Reload Call Directory"
onPress=
{
reloadCallDirectory
}
/>
</>
)
}
</
View
>
</
View
>
);
);
}
}
...
...
ios/CallDirectoryManager.m
0 → 100644
View file @
501198d0
#import <React/RCTBridgeModule.h>
@interface
RCT_EXTERN_MODULE
(
CallDirectoryManager
,
NSObject
)
RCT_EXTERN_METHOD
(
getEnabledStatusForExtension
:
(
NSString
*
)
identifier
resolver
:
(
RCTPromiseResolveBlock
)
resolve
rejecter
:
(
RCTPromiseRejectBlock
)
reject
)
RCT_EXTERN_METHOD
(
reloadExtension
:
(
NSString
*
)
identifier
resolver
:
(
RCTPromiseResolveBlock
)
resolve
rejecter
:
(
RCTPromiseRejectBlock
)
reject
)
@end
ios/CallDirectoryManager.swift
0 → 100644
View file @
501198d0
import
Foundation
import
CallKit
@objc(CallDirectoryManager)
class
CallDirectoryManager
:
NSObject
{
@objc
func
getEnabledStatusForExtension
(
_
identifier
:
String
,
resolver
resolve
:
@escaping
RCTPromiseResolveBlock
,
rejecter
reject
:
@escaping
RCTPromiseRejectBlock
)
{
let
manager
=
CXCallDirectoryManager
.
sharedInstance
manager
.
getEnabledStatusForExtension
(
withIdentifier
:
identifier
)
{
status
,
error
in
if
let
error
=
error
{
reject
(
"E_STATUS"
,
"Failed to get status:
\(
error
.
localizedDescription
)
"
,
error
)
return
}
resolve
(
status
.
rawValue
)
// 0 = unknown, 1 = disabled, 2 = enabled
}
}
@objc
func
reloadExtension
(
_
identifier
:
String
,
resolver
resolve
:
@escaping
RCTPromiseResolveBlock
,
rejecter
reject
:
@escaping
RCTPromiseRejectBlock
)
{
let
manager
=
CXCallDirectoryManager
.
sharedInstance
manager
.
reloadExtension
(
withIdentifier
:
identifier
)
{
error
in
if
let
error
=
error
{
reject
(
"E_RELOAD"
,
"Failed to reload:
\(
error
.
localizedDescription
)
"
,
error
)
}
else
{
resolve
(
true
)
}
}
}
@objc
static
func
requiresMainQueueSetup
()
->
Bool
{
return
false
}
}
ios/whoscall.xcodeproj/project.pbxproj
View file @
501198d0
This diff is collapsed.
Click to expand it.
ios/whoscallDirectoryExtension/CallDirectoryHandler.swift
View file @
501198d0
...
@@ -21,6 +21,8 @@ class CallDirectoryHandler: CXCallDirectoryProvider {
...
@@ -21,6 +21,8 @@ class CallDirectoryHandler: CXCallDirectoryProvider {
let
vipNumbers
:
[(
number
:
Int64
,
label
:
String
)]
=
[
let
vipNumbers
:
[(
number
:
Int64
,
label
:
String
)]
=
[
(
60189884118
,
"Wei Yi"
),
(
60189884118
,
"Wei Yi"
),
(
60123456789
,
"Spam Caller"
),
(
60123456789
,
"Spam Caller"
),
(
60122553372
,
"Someone Else"
),
(
60123456789
,
"Scam Caller"
),
]
]
for
entry
in
vipNumbers
{
for
entry
in
vipNumbers
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment