소스 검색

[RN] Keep device screen on while in a conference

j8
Saúl Ibarra Corretgé 8 년 전
부모
커밋
acbfe5cb09

+ 1
- 0
android/app/build.gradle 파일 보기

153
     maven { url 'https://maven.fabric.io/public' }
153
     maven { url 'https://maven.fabric.io/public' }
154
 }
154
 }
155
 dependencies {
155
 dependencies {
156
+    compile project(':react-native-keep-awake')
156
     compile project(':react-native-vector-icons')
157
     compile project(':react-native-vector-icons')
157
     compile project(':react-native-webrtc')
158
     compile project(':react-native-webrtc')
158
     compile fileTree(dir: 'libs', include: ['*.jar'])
159
     compile fileTree(dir: 'libs', include: ['*.jar'])

+ 1
- 0
android/app/src/main/java/org/jitsi/meet/MainApplication.java 파일 보기

28
         @Override
28
         @Override
29
         protected List<ReactPackage> getPackages() {
29
         protected List<ReactPackage> getPackages() {
30
             return Arrays.<ReactPackage>asList(
30
             return Arrays.<ReactPackage>asList(
31
+                new com.corbt.keepawake.KCKeepAwakePackage(),
31
                 new com.facebook.react.shell.MainReactPackage(),
32
                 new com.facebook.react.shell.MainReactPackage(),
32
                 new com.oblador.vectoricons.VectorIconsPackage(),
33
                 new com.oblador.vectoricons.VectorIconsPackage(),
33
                 new com.oney.WebRTCModule.WebRTCModulePackage()
34
                 new com.oney.WebRTCModule.WebRTCModulePackage()

+ 2
- 0
android/settings.gradle 파일 보기

1
 rootProject.name = 'jitsi-meet-react'
1
 rootProject.name = 'jitsi-meet-react'
2
 
2
 
3
 include ':app'
3
 include ':app'
4
+include ':react-native-keep-awake'
5
+project(':react-native-keep-awake').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-keep-awake/android')
4
 include ':react-native-vector-icons'
6
 include ':react-native-vector-icons'
5
 project(':react-native-vector-icons').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-vector-icons/android')
7
 project(':react-native-vector-icons').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-vector-icons/android')
6
 include ':react-native-webrtc'
8
 include ':react-native-webrtc'

+ 35
- 0
ios/jitsi-meet-react.xcodeproj/project.pbxproj 파일 보기

24
 		2602576C1D0A7703001E3363 /* jitsi.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 2602576B1D0A7703001E3363 /* jitsi.ttf */; };
24
 		2602576C1D0A7703001E3363 /* jitsi.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 2602576B1D0A7703001E3363 /* jitsi.ttf */; };
25
 		3847F11906B4479A9162628F /* libRNVectorIcons.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 821D8ABD506944B4BDBB069B /* libRNVectorIcons.a */; };
25
 		3847F11906B4479A9162628F /* libRNVectorIcons.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 821D8ABD506944B4BDBB069B /* libRNVectorIcons.a */; };
26
 		832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 832341B51AAA6A8300B99B32 /* libRCTText.a */; };
26
 		832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 832341B51AAA6A8300B99B32 /* libRCTText.a */; };
27
+		901FE90FA5744B5B94DCDC41 /* libKCKeepAwake.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 0EA8C046B2BF46279796F07D /* libKCKeepAwake.a */; };
27
 		B30EF2311DC0ED7C00690F45 /* WebRTC.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B30EF2301DC0ED7C00690F45 /* WebRTC.framework */; };
28
 		B30EF2311DC0ED7C00690F45 /* WebRTC.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B30EF2301DC0ED7C00690F45 /* WebRTC.framework */; };
28
 		B30EF2331DC0EEA500690F45 /* WebRTC.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = B30EF2301DC0ED7C00690F45 /* WebRTC.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
29
 		B30EF2331DC0EEA500690F45 /* WebRTC.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = B30EF2301DC0ED7C00690F45 /* WebRTC.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
29
 		B3A9D0251E0481E10009343D /* POSIX.m in Sources */ = {isa = PBXBuildFile; fileRef = B3A9D0241E0481E10009343D /* POSIX.m */; };
30
 		B3A9D0251E0481E10009343D /* POSIX.m in Sources */ = {isa = PBXBuildFile; fileRef = B3A9D0241E0481E10009343D /* POSIX.m */; };
76
 			remoteGlobalIDString = 832C81801AAF6DEF007FA2F7;
77
 			remoteGlobalIDString = 832C81801AAF6DEF007FA2F7;
77
 			remoteInfo = RCTVibration;
78
 			remoteInfo = RCTVibration;
78
 		};
79
 		};
80
+		0B8752851E26E54A004C5CAB /* PBXContainerItemProxy */ = {
81
+			isa = PBXContainerItemProxy;
82
+			containerPortal = 5B09C20C78C74A548AAAC1FA /* KCKeepAwake.xcodeproj */;
83
+			proxyType = 2;
84
+			remoteGlobalIDString = 134814201AA4EA6300B7C361;
85
+			remoteInfo = KCKeepAwake;
86
+		};
79
 		139105C01AF99BAD00B5F7CC /* PBXContainerItemProxy */ = {
87
 		139105C01AF99BAD00B5F7CC /* PBXContainerItemProxy */ = {
80
 			isa = PBXContainerItemProxy;
88
 			isa = PBXContainerItemProxy;
81
 			containerPortal = 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */;
89
 			containerPortal = 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */;
197
 		00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTImage.xcodeproj; path = "../node_modules/react-native/Libraries/Image/RCTImage.xcodeproj"; sourceTree = "<group>"; };
205
 		00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTImage.xcodeproj; path = "../node_modules/react-native/Libraries/Image/RCTImage.xcodeproj"; sourceTree = "<group>"; };
198
 		00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTNetwork.xcodeproj; path = "../node_modules/react-native/Libraries/Network/RCTNetwork.xcodeproj"; sourceTree = "<group>"; };
206
 		00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTNetwork.xcodeproj; path = "../node_modules/react-native/Libraries/Network/RCTNetwork.xcodeproj"; sourceTree = "<group>"; };
199
 		00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTVibration.xcodeproj; path = "../node_modules/react-native/Libraries/Vibration/RCTVibration.xcodeproj"; sourceTree = "<group>"; };
207
 		00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTVibration.xcodeproj; path = "../node_modules/react-native/Libraries/Vibration/RCTVibration.xcodeproj"; sourceTree = "<group>"; };
208
+		0EA8C046B2BF46279796F07D /* libKCKeepAwake.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libKCKeepAwake.a; sourceTree = "<group>"; };
200
 		139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTSettings.xcodeproj; path = "../node_modules/react-native/Libraries/Settings/RCTSettings.xcodeproj"; sourceTree = "<group>"; };
209
 		139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTSettings.xcodeproj; path = "../node_modules/react-native/Libraries/Settings/RCTSettings.xcodeproj"; sourceTree = "<group>"; };
201
 		139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTWebSocket.xcodeproj; path = "../node_modules/react-native/Libraries/WebSocket/RCTWebSocket.xcodeproj"; sourceTree = "<group>"; };
210
 		139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTWebSocket.xcodeproj; path = "../node_modules/react-native/Libraries/WebSocket/RCTWebSocket.xcodeproj"; sourceTree = "<group>"; };
202
 		13B07F961A680F5B00A75B9A /* jitsi-meet-react.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "jitsi-meet-react.app"; sourceTree = BUILT_PRODUCTS_DIR; };
211
 		13B07F961A680F5B00A75B9A /* jitsi-meet-react.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "jitsi-meet-react.app"; sourceTree = BUILT_PRODUCTS_DIR; };
209
 		146833FF1AC3E56700842450 /* React.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = React.xcodeproj; path = "../node_modules/react-native/React/React.xcodeproj"; sourceTree = "<group>"; };
218
 		146833FF1AC3E56700842450 /* React.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = React.xcodeproj; path = "../node_modules/react-native/React/React.xcodeproj"; sourceTree = "<group>"; };
210
 		22418656B14845609F953A42 /* RNVectorIcons.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = RNVectorIcons.xcodeproj; path = "../node_modules/react-native-vector-icons/RNVectorIcons.xcodeproj"; sourceTree = "<group>"; };
219
 		22418656B14845609F953A42 /* RNVectorIcons.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = RNVectorIcons.xcodeproj; path = "../node_modules/react-native-vector-icons/RNVectorIcons.xcodeproj"; sourceTree = "<group>"; };
211
 		2602576B1D0A7703001E3363 /* jitsi.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = jitsi.ttf; path = ../android/app/src/main/assets/fonts/jitsi.ttf; sourceTree = "<group>"; };
220
 		2602576B1D0A7703001E3363 /* jitsi.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = jitsi.ttf; path = ../android/app/src/main/assets/fonts/jitsi.ttf; sourceTree = "<group>"; };
221
+		5B09C20C78C74A548AAAC1FA /* KCKeepAwake.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = KCKeepAwake.xcodeproj; path = "../node_modules/react-native-keep-awake/ios/KCKeepAwake.xcodeproj"; sourceTree = "<group>"; };
212
 		78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTLinking.xcodeproj; path = "../node_modules/react-native/Libraries/LinkingIOS/RCTLinking.xcodeproj"; sourceTree = "<group>"; };
222
 		78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTLinking.xcodeproj; path = "../node_modules/react-native/Libraries/LinkingIOS/RCTLinking.xcodeproj"; sourceTree = "<group>"; };
213
 		821D8ABD506944B4BDBB069B /* libRNVectorIcons.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libRNVectorIcons.a; sourceTree = "<group>"; };
223
 		821D8ABD506944B4BDBB069B /* libRNVectorIcons.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libRNVectorIcons.a; sourceTree = "<group>"; };
214
 		832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTText.xcodeproj; path = "../node_modules/react-native/Libraries/Text/RCTText.xcodeproj"; sourceTree = "<group>"; };
224
 		832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTText.xcodeproj; path = "../node_modules/react-native/Libraries/Text/RCTText.xcodeproj"; sourceTree = "<group>"; };
258
 				BFC745141CB829B300673F38 /* libRCTWebRTC.a in Frameworks */,
268
 				BFC745141CB829B300673F38 /* libRCTWebRTC.a in Frameworks */,
259
 				139FDEF61B0652A700C62182 /* libRCTWebSocket.a in Frameworks */,
269
 				139FDEF61B0652A700C62182 /* libRCTWebSocket.a in Frameworks */,
260
 				3847F11906B4479A9162628F /* libRNVectorIcons.a in Frameworks */,
270
 				3847F11906B4479A9162628F /* libRNVectorIcons.a in Frameworks */,
271
+				901FE90FA5744B5B94DCDC41 /* libKCKeepAwake.a in Frameworks */,
261
 			);
272
 			);
262
 			runOnlyForDeploymentPostprocessing = 0;
273
 			runOnlyForDeploymentPostprocessing = 0;
263
 		};
274
 		};
306
 			name = Products;
317
 			name = Products;
307
 			sourceTree = "<group>";
318
 			sourceTree = "<group>";
308
 		};
319
 		};
320
+		0B8752821E26E54A004C5CAB /* Products */ = {
321
+			isa = PBXGroup;
322
+			children = (
323
+				0B8752861E26E54A004C5CAB /* libKCKeepAwake.a */,
324
+			);
325
+			name = Products;
326
+			sourceTree = "<group>";
327
+		};
309
 		139105B71AF99BAD00B5F7CC /* Products */ = {
328
 		139105B71AF99BAD00B5F7CC /* Products */ = {
310
 			isa = PBXGroup;
329
 			isa = PBXGroup;
311
 			children = (
330
 			children = (
393
 				139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */,
412
 				139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */,
394
 				146833FF1AC3E56700842450 /* React.xcodeproj */,
413
 				146833FF1AC3E56700842450 /* React.xcodeproj */,
395
 				22418656B14845609F953A42 /* RNVectorIcons.xcodeproj */,
414
 				22418656B14845609F953A42 /* RNVectorIcons.xcodeproj */,
415
+				5B09C20C78C74A548AAAC1FA /* KCKeepAwake.xcodeproj */,
396
 			);
416
 			);
397
 			name = Libraries;
417
 			name = Libraries;
398
 			sourceTree = "<group>";
418
 			sourceTree = "<group>";
506
 			productRefGroup = 83CBBA001A601CBA00E9B192 /* Products */;
526
 			productRefGroup = 83CBBA001A601CBA00E9B192 /* Products */;
507
 			projectDirPath = "";
527
 			projectDirPath = "";
508
 			projectReferences = (
528
 			projectReferences = (
529
+				{
530
+					ProductGroup = 0B8752821E26E54A004C5CAB /* Products */;
531
+					ProjectRef = 5B09C20C78C74A548AAAC1FA /* KCKeepAwake.xcodeproj */;
532
+				},
509
 				{
533
 				{
510
 					ProductGroup = 00C302A81ABCB8CE00DB3ED1 /* Products */;
534
 					ProductGroup = 00C302A81ABCB8CE00DB3ED1 /* Products */;
511
 					ProjectRef = 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */;
535
 					ProjectRef = 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */;
598
 			remoteRef = 00C302E31ABCB9EE00DB3ED1 /* PBXContainerItemProxy */;
622
 			remoteRef = 00C302E31ABCB9EE00DB3ED1 /* PBXContainerItemProxy */;
599
 			sourceTree = BUILT_PRODUCTS_DIR;
623
 			sourceTree = BUILT_PRODUCTS_DIR;
600
 		};
624
 		};
625
+		0B8752861E26E54A004C5CAB /* libKCKeepAwake.a */ = {
626
+			isa = PBXReferenceProxy;
627
+			fileType = archive.ar;
628
+			path = libKCKeepAwake.a;
629
+			remoteRef = 0B8752851E26E54A004C5CAB /* PBXContainerItemProxy */;
630
+			sourceTree = BUILT_PRODUCTS_DIR;
631
+		};
601
 		139105C11AF99BAD00B5F7CC /* libRCTSettings.a */ = {
632
 		139105C11AF99BAD00B5F7CC /* libRCTSettings.a */ = {
602
 			isa = PBXReferenceProxy;
633
 			isa = PBXReferenceProxy;
603
 			fileType = archive.ar;
634
 			fileType = archive.ar;
798
 					/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
829
 					/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
799
 					"$(SRCROOT)/../node_modules/react-native/React/**",
830
 					"$(SRCROOT)/../node_modules/react-native/React/**",
800
 					"$(SRCROOT)/../node_modules/react-native/Libraries/LinkingIOS/**",
831
 					"$(SRCROOT)/../node_modules/react-native/Libraries/LinkingIOS/**",
832
+					"$(SRCROOT)/../node_modules/react-native-keep-awake/ios",
801
 					"$(SRCROOT)/../node_modules/react-native-vector-icons/RNVectorIconsManager",
833
 					"$(SRCROOT)/../node_modules/react-native-vector-icons/RNVectorIconsManager",
802
 				);
834
 				);
803
 				INFOPLIST_FILE = app/Info.plist;
835
 				INFOPLIST_FILE = app/Info.plist;
833
 					/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
865
 					/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
834
 					"$(SRCROOT)/../node_modules/react-native/React/**",
866
 					"$(SRCROOT)/../node_modules/react-native/React/**",
835
 					"$(SRCROOT)/../node_modules/react-native/Libraries/LinkingIOS/**",
867
 					"$(SRCROOT)/../node_modules/react-native/Libraries/LinkingIOS/**",
868
+					"$(SRCROOT)/../node_modules/react-native-keep-awake/ios",
836
 					"$(SRCROOT)/../node_modules/react-native-vector-icons/RNVectorIconsManager",
869
 					"$(SRCROOT)/../node_modules/react-native-vector-icons/RNVectorIconsManager",
837
 				);
870
 				);
838
 				INFOPLIST_FILE = app/Info.plist;
871
 				INFOPLIST_FILE = app/Info.plist;
890
 					"$(inherited)",
923
 					"$(inherited)",
891
 					/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
924
 					/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
892
 					"$(SRCROOT)/../node_modules/react-native/React/**",
925
 					"$(SRCROOT)/../node_modules/react-native/React/**",
926
+					"$(SRCROOT)/../node_modules/react-native-keep-awake/ios",
893
 					"$(SRCROOT)/../node_modules/react-native-vector-icons/RNVectorIconsManager",
927
 					"$(SRCROOT)/../node_modules/react-native-vector-icons/RNVectorIconsManager",
894
 				);
928
 				);
895
 				IPHONEOS_DEPLOYMENT_TARGET = 8.0;
929
 				IPHONEOS_DEPLOYMENT_TARGET = 8.0;
931
 					"$(inherited)",
965
 					"$(inherited)",
932
 					/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
966
 					/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
933
 					"$(SRCROOT)/../node_modules/react-native/React/**",
967
 					"$(SRCROOT)/../node_modules/react-native/React/**",
968
+					"$(SRCROOT)/../node_modules/react-native-keep-awake/ios",
934
 					"$(SRCROOT)/../node_modules/react-native-vector-icons/RNVectorIconsManager",
969
 					"$(SRCROOT)/../node_modules/react-native-vector-icons/RNVectorIconsManager",
935
 				);
970
 				);
936
 				IPHONEOS_DEPLOYMENT_TARGET = 8.0;
971
 				IPHONEOS_DEPLOYMENT_TARGET = 8.0;

+ 1
- 0
package.json 파일 보기

35
     "react": "15.4.2",
35
     "react": "15.4.2",
36
     "react-dom": "15.4.2",
36
     "react-dom": "15.4.2",
37
     "react-native": "0.39.2",
37
     "react-native": "0.39.2",
38
+    "react-native-keep-awake": "^1.0.7",
38
     "react-native-prompt": "^1.0.0",
39
     "react-native-prompt": "^1.0.0",
39
     "react-native-vector-icons": "^3.0.0",
40
     "react-native-vector-icons": "^3.0.0",
40
     "react-native-webrtc": "jitsi/react-native-webrtc",
41
     "react-native-webrtc": "jitsi/react-native-webrtc",

+ 1
- 0
react/features/app/components/App.native.js 파일 보기

3
 import { Linking } from 'react-native';
3
 import { Linking } from 'react-native';
4
 
4
 
5
 import { Platform } from '../../base/react';
5
 import { Platform } from '../../base/react';
6
+import '../../wake-lock';
6
 
7
 
7
 import { AbstractApp } from './AbstractApp';
8
 import { AbstractApp } from './AbstractApp';
8
 
9
 

+ 1
- 0
react/features/wake-lock/index.js 파일 보기

1
+import './middleware';

+ 53
- 0
react/features/wake-lock/middleware.js 파일 보기

1
+import KeepAwake from 'react-native-keep-awake';
2
+
3
+import {
4
+    CONFERENCE_FAILED,
5
+    CONFERENCE_JOINED,
6
+    CONFERENCE_LEFT
7
+} from '../base/conference';
8
+import { MiddlewareRegistry } from '../base/redux';
9
+
10
+/**
11
+ * Middleware that captures conference actions and activates or deactivates the
12
+ * wake lock accordingly. If the wake lock is active, it will prevent the screen
13
+ * from dimming.
14
+ *
15
+ * @param {Store} store - Redux store.
16
+ * @returns {Function}
17
+ */
18
+MiddlewareRegistry.register(store => next => action => {
19
+    switch (action.type) {
20
+    case CONFERENCE_JOINED: {
21
+        const state = store.getState()['features/base/conference'];
22
+
23
+        // TODO(saghul): Implement audio-only mode.
24
+        if (!state.audioOnly) {
25
+            setWakeLock(true);
26
+        }
27
+        break;
28
+    }
29
+
30
+    case CONFERENCE_FAILED:
31
+    case CONFERENCE_LEFT:
32
+        setWakeLock(false);
33
+        break;
34
+    }
35
+
36
+    return next(action);
37
+});
38
+
39
+/**
40
+ * Activates/deactivates the wake lock. If the wake lock is active, it will
41
+ * prevent the screen from dimming.
42
+ *
43
+ * @param {boolean} wakeLock - True to active the wake lock or false to
44
+ * deactivate it.
45
+ * @returns {void}
46
+ */
47
+function setWakeLock(wakeLock) {
48
+    if (wakeLock) {
49
+        KeepAwake.activate();
50
+    } else {
51
+        KeepAwake.deactivate();
52
+    }
53
+}

Loading…
취소
저장