Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug fix #5

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 0 additions & 91 deletions WhoCall/Src/3rd/MMPDeepSleepPreventer/MMPDeepSleepPreventer.h

This file was deleted.

218 changes: 0 additions & 218 deletions WhoCall/Src/3rd/MMPDeepSleepPreventer/MMPDeepSleepPreventer.m

This file was deleted.

Binary file not shown.
3 changes: 2 additions & 1 deletion WhoCall/Src/Telephony/WCAddressBook.m
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ - (void)reload:(ABAddressBookRef)addressBook
for (CFIndex idxNumber = 0; idxNumber < ABMultiValueGetCount(phoneNumbers); idxNumber++) {
NSString *phoneNumber = (__bridge_transfer NSString *)ABMultiValueCopyValueAtIndex(phoneNumbers, idxNumber);
phoneNumber = [phoneNumber normalizedPhoneNumber];
self.allPhoneNumbers[phoneNumber] = personName;
if(personName!=nil && phoneNumber!=nil)
self.allPhoneNumbers[phoneNumber] = personName;
}

CFRelease(phoneNumbers);
Expand Down
1 change: 1 addition & 0 deletions WhoCall/Src/Telephony/WCCall.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

// private API
typedef NS_ENUM(short, CTCallStatus) {
kCTCallStatusConnected = 1,
kCTCallStatusCallIn = 4,
kCTCallStatusHungUp = 5
};
Expand Down
4 changes: 4 additions & 0 deletions WhoCall/Src/Telephony/WCCallCenter.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
//

#import "WCCallCenter.h"
@import AudioToolbox;

// encrypted string's
#define ENCSTR_kCTCallStatusChangeNotification [@"n0AHD2SfoSA0LKE1p0AbLJ5aMH5iqTyznJAuqTyiot==" wcDecryptString]
Expand Down Expand Up @@ -138,6 +139,9 @@ static void callHandler(CFNotificationCenterRef center,
NSDictionary *info = (__bridge NSDictionary *)(userInfo);
CTCall *call = (CTCall *)info[ENCSTR_kCTCall];
CTCallStatus status = (CTCallStatus)[info[ENCSTR_kCTCallStatus] shortValue];
if (status == kCTCallStatusConnected) {
AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
}

WCCallCenter *wcCenter = (__bridge WCCallCenter*)observer;
[wcCenter handleCall:call withStatus:status];
Expand Down
5 changes: 5 additions & 0 deletions WhoCall/Src/Telephony/WCCallInspector.m
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,11 @@ - (void)notifyMessage:(NSString *)text forPhoneNumber:(NSString *)phoneNumber {
}

- (void)notifyMessage:(NSString *)text afterDealy:(NSTimeInterval)delay forPhoneNumber:(NSString *)phoneNumber {
UILocalNotification *notification=[[UILocalNotification alloc] init];
if (notification!=nil) {
notification.alertBody=[NSString stringWithFormat:@"%@-%@",text,phoneNumber];
[[UIApplication sharedApplication] presentLocalNotificationNow:notification];
}
// 循环提醒,直到电话号码不匹配(来电挂断)
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delay * NSEC_PER_SEC));
dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
Expand Down
4 changes: 2 additions & 2 deletions WhoCall/Src/Telephony/WCPhoneLocator.m
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ - (NSString *)locationForPhoneNumber:(NSString *)phoneNumber
// 国内长途,首位是1、2则区号为两位,否则区号为3位
NSString *areacode;
if ( phoneNumber.length > 3
&& [phoneNumber characterAtIndex:1] == '1'
&& [phoneNumber characterAtIndex:1] == '2') {
&& ([phoneNumber characterAtIndex:1] == '1'
|| [phoneNumber characterAtIndex:1] == '2')) {
areacode = [phoneNumber substringWithRange:NSMakeRange(1, 2)];
} else if (phoneNumber.length > 4) {
areacode = [phoneNumber substringWithRange:NSMakeRange(1, 3)];
Expand Down
12 changes: 12 additions & 0 deletions WhoCall/Src/WCAppDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,18 @@

#import <UIKit/UIKit.h>

#ifndef MMPDLog
#ifdef DEBUG
#define MMPDLog(format, ...) NSLog((@"%s [Line %d] " format), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__)
#else
#define MMPDLog(...) do { } while (0)
#endif
#endif

#ifndef MMPALog
#define MMPALog(format, ...) NSLog((@"%s [Line %d] " format), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__)
#endif

@interface WCAppDelegate : UIResponder <UIApplicationDelegate>

@property (strong, nonatomic) UIWindow *window;
Expand Down
Loading