Skip to content

Commit d751ab1

Browse files
kadhar03karthikeyan-se-contus
authored andcommitted
Merged in uat (pull request #197)
#MRN-765 #MRN-774
2 parents 2bff09e + 14dffff commit d751ab1

34 files changed

+1623
-1323
lines changed

android/app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ android {
8282
minSdkVersion rootProject.ext.minSdkVersion
8383
targetSdkVersion rootProject.ext.targetSdkVersion
8484
versionCode 1
85-
versionName "2.4.34"
85+
versionName "2.4.37"
8686
/** Add this for react-native-camera */
8787
missingDimensionStrategy 'react-native-camera', 'general'
8888
multiDexEnabled true

android/app/src/main/AndroidManifest.xml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2+
xmlns:tools="http://schemas.android.com/tools">
23

34
<uses-permission android:name="android.permission.INTERNET" />
45
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
@@ -30,6 +31,7 @@
3031
<uses-permission android:name="android.permission.BLUETOOTH" />
3132
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
3233
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
34+
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
3335

3436
<uses-feature
3537
android:name="android.hardware.camera"
@@ -103,6 +105,12 @@
103105
android:supportsPictureInPicture="true"
104106
android:turnScreenOn="true"
105107
android:windowSoftInputMode="stateHidden" />
108+
<service
109+
android:name="app.notifee.core.ForegroundService"
110+
android:exported="false"
111+
android:foregroundServiceType="location|camera|microphone|phoneCall"
112+
tools:replace="android:foregroundServiceType"
113+
/>
106114
</application>
107115
<queries>
108116
<intent>

android/app/src/main/java/com/mirrorfly_rn/CallScreenActivity.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import android.content.SharedPreferences;
1010
import android.content.res.Configuration;
1111
import android.graphics.Color;
12+
import android.graphics.Rect;
1213
import android.os.Build;
1314
import android.os.Bundle;
1415
import android.os.Process;
@@ -133,7 +134,10 @@ protected void onUserLeaveHint() {
133134
PictureInPictureParams.Builder pipBuilder = null;
134135

135136
pipBuilder = new PictureInPictureParams.Builder();
137+
final Rect sourceRectHint = new Rect();
138+
getWindow().getDecorView().getGlobalVisibleRect(sourceRectHint);
136139
pipBuilder.setAspectRatio(ratio).build();
140+
pipBuilder.setSourceRectHint(sourceRectHint);
137141
CallScreenActivity.this.enterPictureInPictureMode(pipBuilder.build());
138142
}
139143
} catch (Exception e) {

android/app/src/main/java/com/mirrorfly_rn/PipAndroidModule.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import android.app.PictureInPictureParams;
55
import android.content.Context;
66
import android.content.Intent;
7+
import android.graphics.Rect;
78
import android.net.Uri;
89
import android.os.Build;
910
import android.os.Process;
@@ -99,7 +100,10 @@ public void enterPipMode(int width, int height, boolean shouldOpenPermissionScre
99100
PictureInPictureParams.Builder pipBuilder = null;
100101

101102
pipBuilder = new PictureInPictureParams.Builder();
103+
final Rect sourceRectHint = new Rect();
104+
this.getCurrentActivity().getWindow().getDecorView().getGlobalVisibleRect(sourceRectHint);
102105
pipBuilder.setAspectRatio(ratio).build();
106+
pipBuilder.setSourceRectHint(sourceRectHint);
103107
reactApplicationContext.getCurrentActivity().enterPictureInPictureMode(pipBuilder.build());
104108
}
105109
} else if (shouldOpenPermissionScreenIfPipNotAllowed) {

android/fastlane/Fastfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ platform :android do
5454
firebase_app_distribution(
5555
app: "1:235373697524:android:8b3becf8d8ff9be3a0c1a1",
5656
groups: "reactnative",
57-
release_notes: "React-Native android build for bug-fixes MRN-756,MRN-758, MRN-744, MRN-729, MRN-699, MRN-690",
57+
release_notes: "React-Native android build for feature MRN-774",
5858
apk_path: "../android/app/build/outputs/apk/release/app-release.apk",
5959
firebase_cli_token: "1//0gfTJ_oWJ0mHNCgYIARAAGBASNwF-L9IrYZM4cUIV5EB8gVnSvtMC6Q7aAtgrgG8R1ybhSY1Np_5r5UuZu28N144_weOQDyONcW4",
6060
)

index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22
* @format
33
*/
44
import messaging from '@react-native-firebase/messaging';
5-
import { AppRegistry, Platform } from 'react-native';
5+
import { AppRegistry, AppState, Platform } from 'react-native';
66
import App from './App';
77
import { name as appName } from './app.json';
88
import config from './src/config/config';
9+
import { isPipModeEnabled } from './src/Helper/Calls/Utility';
910
import { MIRRORFLY_RN } from './src/helpers/constants';
1011
import { mirrorflyInitialize, mirrorflyNotificationHandler, setAppConfig, setupCallScreen } from './src/uikitMethods';
1112

@@ -31,7 +32,7 @@ messaging().setBackgroundMessageHandler(async remoteMessage => {
3132
});
3233

3334
messaging().onMessage(async remoteMessage => {
34-
if (remoteMessage?.data.type === 'mediacall') {
35+
if (remoteMessage?.data.type === 'mediacall' || (isPipModeEnabled() && AppState.currentState === 'background')) {
3536
mirrorflyNotificationHandler(remoteMessage);
3637
}
3738
});

ios/MediaConverter.m

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
#import <React/RCTBridgeModule.h>
2+
#import <Photos/Photos.h>
3+
#import <MobileCoreServices/MobileCoreServices.h>
4+
5+
@interface MediaConverter : NSObject <RCTBridgeModule>
6+
@end
7+
8+
@implementation MediaConverter
9+
10+
RCT_EXPORT_MODULE();
11+
12+
RCT_EXPORT_METHOD(convertMedia:(NSString *)uri
13+
resolver:(RCTPromiseResolveBlock)resolve
14+
rejecter:(RCTPromiseRejectBlock)reject)
15+
{
16+
if ([uri hasPrefix:@"ph://"]) {
17+
NSString *assetID = [uri stringByReplacingOccurrencesOfString:@"ph://" withString:@""];
18+
PHFetchResult<PHAsset *> *result = [PHAsset fetchAssetsWithLocalIdentifiers:@[assetID] options:nil];
19+
20+
if (result.count == 0) {
21+
reject(@"E_PHOTO_NOT_FOUND", @"Photo not found", nil);
22+
return;
23+
}
24+
25+
PHAsset *asset = result.firstObject;
26+
27+
if (asset.mediaType == PHAssetMediaTypeImage) {
28+
// Handle image conversion
29+
[self convertImageAsset:asset resolver:resolve rejecter:reject];
30+
} else if (asset.mediaType == PHAssetMediaTypeVideo) {
31+
// Handle video conversion
32+
[self convertVideoAsset:asset resolver:resolve rejecter:reject];
33+
} else {
34+
reject(@"E_UNSUPPORTED_MEDIA_TYPE", @"Unsupported media type", nil);
35+
}
36+
} else {
37+
reject(@"E_INVALID_URI", @"Invalid URI format", nil);
38+
}
39+
}
40+
41+
- (void)convertImageAsset:(PHAsset *)asset
42+
resolver:(RCTPromiseResolveBlock)resolve
43+
rejecter:(RCTPromiseRejectBlock)reject
44+
{
45+
PHImageRequestOptions *options = [[PHImageRequestOptions alloc] init];
46+
options.synchronous = YES;
47+
options.networkAccessAllowed = YES;
48+
49+
[[PHImageManager defaultManager] requestImageDataAndOrientationForAsset:asset options:options resultHandler:^(NSData * _Nullable imageData, NSString * _Nullable dataUTI, CGImagePropertyOrientation orientation, NSDictionary * _Nullable info) {
50+
if (imageData) {
51+
NSString *fileExtension = (__bridge_transfer NSString *)UTTypeCopyPreferredTagWithClass((__bridge CFStringRef)dataUTI, kUTTagClassFilenameExtension);
52+
NSString *filePath = [NSTemporaryDirectory() stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.%@", [[NSUUID UUID] UUIDString], fileExtension]];
53+
54+
NSError *error = nil;
55+
[imageData writeToFile:filePath options:NSDataWritingAtomic error:&error];
56+
57+
if (error) {
58+
reject(@"E_FILE_SAVE_FAILED", @"Failed to save image file", error);
59+
} else {
60+
resolve(filePath);
61+
}
62+
} else {
63+
reject(@"E_IMAGE_REQUEST_FAILED", @"Failed to get image data", nil);
64+
}
65+
}];
66+
}
67+
68+
- (void)convertVideoAsset:(PHAsset *)asset
69+
resolver:(RCTPromiseResolveBlock)resolve
70+
rejecter:(RCTPromiseRejectBlock)reject
71+
{
72+
PHVideoRequestOptions *options = [[PHVideoRequestOptions alloc] init];
73+
options.networkAccessAllowed = YES;
74+
75+
[[PHImageManager defaultManager] requestAVAssetForVideo:asset options:options resultHandler:^(AVAsset *avAsset, AVAudioMix *audioMix, NSDictionary *info) {
76+
if ([avAsset isKindOfClass:[AVURLAsset class]]) {
77+
AVURLAsset *urlAsset = (AVURLAsset *)avAsset;
78+
NSURL *url = urlAsset.URL;
79+
NSString *fileExtension = [url pathExtension];
80+
81+
NSString *filePath = [NSTemporaryDirectory() stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.%@", [[NSUUID UUID] UUIDString], fileExtension]];
82+
NSError *error = nil;
83+
[[NSFileManager defaultManager] copyItemAtURL:url toURL:[NSURL fileURLWithPath:filePath] error:&error];
84+
85+
if (error) {
86+
reject(@"E_VIDEO_SAVE_FAILED", @"Failed to save video file", error);
87+
} else {
88+
resolve(filePath);
89+
}
90+
} else {
91+
reject(@"E_VIDEO_REQUEST_FAILED", @"Failed to get video data", nil);
92+
}
93+
}];
94+
}
95+
96+
@end

ios/Podfile.lock

Lines changed: 34 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -392,14 +392,15 @@ PODS:
392392
- react-native-cameraroll (7.8.3):
393393
- RCT-Folly (= 2021.07.22.00)
394394
- React-Core
395-
- react-native-compressor (1.8.25):
395+
- react-native-compressor (1.9.0):
396396
- RCT-Folly (= 2021.07.22.00)
397397
- React-Core
398398
- react-native-contacts (7.0.8):
399399
- React-Core
400-
- react-native-create-thumbnail (1.6.4):
400+
- react-native-create-thumbnail (2.0.0):
401401
- React-Core
402-
- react-native-document-picker (9.3.0):
402+
- react-native-document-picker (9.3.1):
403+
- RCT-Folly (= 2021.07.22.00)
403404
- React-Core
404405
- react-native-geocoder (0.5.0):
405406
- React
@@ -417,12 +418,12 @@ PODS:
417418
- React
418419
- react-native-maps (1.7.1):
419420
- React-Core
420-
- react-native-netinfo (11.3.2):
421+
- react-native-netinfo (11.4.1):
421422
- React-Core
422-
- react-native-pager-view (6.3.3):
423+
- react-native-pager-view (6.4.1):
423424
- RCT-Folly (= 2021.07.22.00)
424425
- React-Core
425-
- react-native-safe-area-context (4.10.8):
426+
- react-native-safe-area-context (4.14.0):
426427
- React-Core
427428
- react-native-simple-toast (3.3.1):
428429
- React-Core
@@ -547,11 +548,11 @@ PODS:
547548
- React-perflogger (= 0.72.10)
548549
- ReactNativeIncallManager (4.1.0):
549550
- React-Core
550-
- RealmJS (11.10.2):
551+
- RealmJS (11.9.0):
551552
- React
552553
- rn-fetch-blob (0.12.0):
553554
- React-Core
554-
- RNAudioRecorderPlayer (3.6.10):
555+
- RNAudioRecorderPlayer (3.6.12):
555556
- React-Core
556557
- RNCCheckbox (0.5.17):
557558
- BEMCheckBox (~> 1.4)
@@ -560,10 +561,10 @@ PODS:
560561
- React-Core
561562
- RNConvertPhAsset (1.0.3):
562563
- React
563-
- RNFBApp (20.3.0):
564+
- RNFBApp (20.5.0):
564565
- Firebase/CoreOnly (= 10.29.0)
565566
- React-Core
566-
- RNFBMessaging (20.3.0):
567+
- RNFBMessaging (20.5.0):
567568
- Firebase/Messaging (= 10.29.0)
568569
- FirebaseCoreExtension
569570
- React-Core
@@ -572,26 +573,26 @@ PODS:
572573
- React-Core
573574
- RNFS (2.20.0):
574575
- React-Core
575-
- RNGestureHandler (2.17.1):
576+
- RNGestureHandler (2.20.2):
576577
- RCT-Folly (= 2021.07.22.00)
577578
- React-Core
578-
- RNImageCropPicker (0.41.2):
579+
- RNImageCropPicker (0.41.4):
579580
- React-Core
580581
- React-RCTImage
581-
- RNImageCropPicker/QBImagePickerController (= 0.41.2)
582+
- RNImageCropPicker/QBImagePickerController (= 0.41.4)
582583
- TOCropViewController (~> 2.7.4)
583-
- RNImageCropPicker/QBImagePickerController (0.41.2):
584+
- RNImageCropPicker/QBImagePickerController (0.41.4):
584585
- React-Core
585586
- React-RCTImage
586587
- TOCropViewController (~> 2.7.4)
587-
- RNNotifee (7.8.2):
588+
- RNNotifee (9.1.2):
588589
- React-Core
589-
- RNNotifee/NotifeeCore (= 7.8.2)
590-
- RNNotifee/NotifeeCore (7.8.2):
590+
- RNNotifee/NotifeeCore (= 9.1.2)
591+
- RNNotifee/NotifeeCore (9.1.2):
591592
- React-Core
592593
- RNPermissions (4.1.5):
593594
- React-Core
594-
- RNScreens (3.32.0):
595+
- RNScreens (3.35.0):
595596
- RCT-Folly (= 2021.07.22.00)
596597
- React-Core
597598
- React-RCTImage
@@ -911,10 +912,10 @@ SPEC CHECKSUMS:
911912
react-native-background-timer: 17ea5e06803401a379ebf1f20505b793ac44d0fe
912913
react-native-camera: 3eae183c1d111103963f3dd913b65d01aef8110f
913914
react-native-cameraroll: f067fd2a6b8e80b31307d145a118d4324a264c8a
914-
react-native-compressor: 3f05b3b6153f31ed5c4145ed293396a19f6ff52a
915+
react-native-compressor: d920e812f9f50edadd7ada05d80e9a4bd840094d
915916
react-native-contacts: cb4f3b823550adbce0802901b9e63bf1526ec0af
916-
react-native-create-thumbnail: e022bcdcba8a0b4529a50d3fa1a832ec921be39d
917-
react-native-document-picker: 5b97e24a7f1a1e4a50a72c540a043f32d29a70a2
917+
react-native-create-thumbnail: ab55d24aea01723cf386f18b0b542aabb1982f27
918+
react-native-document-picker: 844beb44fa84b8a8e173a01344dd072c05124ba2
918919
react-native-geocoder: 757427682892bb256f3b3745858cc90eba148a8e
919920
react-native-geolocation-service: 608e1da71a1ac31b4de64d9ef2815f697978c55b
920921
react-native-get-random-values: 21325b2244dfa6b58878f51f9aa42821e7ba3d06
@@ -923,9 +924,9 @@ SPEC CHECKSUMS:
923924
react-native-keep-awake: afad8a51dfef9fe9655a6344771be32c8596d774
924925
react-native-keyevent: 0babd7e275086da5386d831211e3283b624dc0b5
925926
react-native-maps: 667f9b975549c6fa9b1631bf859440f68ebd3b8f
926-
react-native-netinfo: 076df4f9b07f6670acf4ce9a75aac8d34c2e2ccc
927-
react-native-pager-view: 7ad123a253d73975a0e3518a52ef09361484cfa8
928-
react-native-safe-area-context: b7daa1a8df36095a032dff095a1ea8963cb48371
927+
react-native-netinfo: f0a9899081c185db1de5bb2fdc1c88c202a059ac
928+
react-native-pager-view: e1fd63f4913a3408d1a1d135700ebb0025877bf4
929+
react-native-safe-area-context: 4532f1a0c5d34a46b9324ccaaedcb5582a302b7d
929930
react-native-simple-toast: 1f1cc551d419bc0ab05dcb0136554006c274789d
930931
react-native-video: c26780b224543c62d5e1b2a7244a5cd1b50e8253
931932
react-native-webrtc: 8b024c7bb9a005d2b9efeba4c691172dbd00268d
@@ -947,21 +948,21 @@ SPEC CHECKSUMS:
947948
React-utils: a715392dfaaa383668566e400f40493093c08d7e
948949
ReactCommon: a655a8b61cc80c7cabd8db83f69e6f498d4d0894
949950
ReactNativeIncallManager: 2385505fa5dfdbbc78925e3b8d23b30ce0cde40e
950-
RealmJS: 73a36da3cbbe85e1bdcbf55683172b51f35070d3
951+
RealmJS: 64ae0907c1f21ce8e74bd480a8503032b19804fd
951952
rn-fetch-blob: f065bb7ab7fb48dd002629f8bdcb0336602d3cba
952-
RNAudioRecorderPlayer: f3b4f32d5581a44be0f9eb383dc87f98f941b08b
953+
RNAudioRecorderPlayer: 224c7de87722938aedce04000d09baa633148f5b
953954
RNCCheckbox: a3ca9978cb0846b981d28da4e9914bd437403d77
954955
RNCClipboard: 3f0451a8100393908bea5c5c5b16f96d45f30bfc
955956
RNConvertPhAsset: 9b366b8a1abc194b76572712c6f7dd89c9e4e37f
956-
RNFBApp: 793adb33298db7e67dc365dc1ec0dc8a55a7a044
957-
RNFBMessaging: 62b6c25f58225a73067c7aef25947f41aa6088c5
957+
RNFBApp: 017499cd7ea340963bfac43b4fcb28d2b0b21a09
958+
RNFBMessaging: 81f9447a3790df25c72753b446247ebeba95b182
958959
RNFileViewer: ce7ca3ac370e18554d35d6355cffd7c30437c592
959960
RNFS: 4ac0f0ea233904cb798630b3c077808c06931688
960-
RNGestureHandler: 972ca9d35b54c108637dd07055f718446b9276d4
961-
RNImageCropPicker: 771e2ca319d2cf92e04ebf334ece892ee9a6728f
962-
RNNotifee: 8e2d3df3f0e9ce8f5d1fe4c967431138190b6175
961+
RNGestureHandler: 303c811c364a7145301ce1e6cc510d45cf6c2e21
962+
RNImageCropPicker: 3d888d481c65776063556b72c19893a8b8344b1b
963+
RNNotifee: bc20a5e3d581f629db988075944fdd944d363dfe
963964
RNPermissions: 8d958bf0fd34aca7059a935110dca4ee9140d1b6
964-
RNScreens: 835807a1f3c74c8ea0d0b9e089bf14333141f17f
965+
RNScreens: 8339eaea29177ee61983ec4b7b5df3ac2658b41f
965966
RNSound: 6c156f925295bdc83e8e422e7d8b38d33bc71852
966967
RNSVG: 963a95f1f5d512a13d11ffd50d351c87fb5c6890
967968
RNVoipPushNotification: 543e18f83089134a35e7f1d2eba4c8b1f7776b08
@@ -972,4 +973,4 @@ SPEC CHECKSUMS:
972973

973974
PODFILE CHECKSUM: be6dfa6a5c091905d5d9e545be0aabb4e21598b7
974975

975-
COCOAPODS: 1.15.2
976+
COCOAPODS: 1.16.0

ios/mirrorfly_rn-Bridging-Header.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
//
22
// Use this file to import your target's public headers that you would like to expose to Swift.
33
//
4+
#import <React/RCTBridgeModule.h>
5+
#import <React/RCTViewManager.h>

0 commit comments

Comments
 (0)