This commit is contained in:
Yamozha
2021-04-02 02:24:13 +03:00
parent c23950b545
commit 7256d79e2c
31493 changed files with 3036630 additions and 0 deletions

3
node_modules/expo-keep-awake/.babelrc generated vendored Normal file
View File

@ -0,0 +1,3 @@
{
"presets": ["babel-preset-expo"]
}

2
node_modules/expo-keep-awake/.eslintrc.js generated vendored Normal file
View File

@ -0,0 +1,2 @@
// @generated by expo-module-scripts
module.exports = require('expo-module-scripts/eslintrc.base.js');

27
node_modules/expo-keep-awake/CHANGELOG.md generated vendored Normal file
View File

@ -0,0 +1,27 @@
# Changelog
## Unpublished
### 🛠 Breaking changes
### 🎉 New features
### 🐛 Bug fixes
## 8.4.0 — 2020-11-17
_This version does not introduce any user-facing changes._
## 8.3.0 — 2020-08-18
_This version does not introduce any user-facing changes._
## 8.2.1 — 2020-05-29
*This version does not introduce any user-facing changes.*
## 8.2.0 — 2020-05-27
### 🐛 Bug fixes
- Fixed `KeepAwake.activateKeepAwake` not working with multiple tags on Android. ([#7197](https://github.com/expo/expo/pull/7197) by [@lukmccall](https://github.com/lukmccall))

34
node_modules/expo-keep-awake/README.md generated vendored Normal file
View File

@ -0,0 +1,34 @@
# expo-keep-awake
Provides a React component that prevents the screen sleeping when rendered. It also exposes static methods to control the behavior imperatively.
# API documentation
- [Documentation for the master branch](https://github.com/expo/expo/blob/master/docs/pages/versions/unversioned/sdk/keep-awake.md)
- [Documentation for the latest stable release](https://docs.expo.io/versions/latest/sdk/keep-awake/)
# Installation in managed Expo projects
For managed [managed](https://docs.expo.io/versions/latest/introduction/managed-vs-bare/) Expo projects, please follow the installation instructions in the [API documentation for the latest stable release](https://docs.expo.io/versions/latest/sdk/keep-awake/).
# Installation in bare React Native projects
For bare React Native projects, you must ensure that you have [installed and configured the `react-native-unimodules` package](https://github.com/expo/expo/tree/master/packages/react-native-unimodules) before continuing.
### Add the package to your npm dependencies
```
expo install expo-keep-awake
```
### Configure for iOS
Run `npx pod-install` after installing the npm package.
### Configure for Android
No additional set up necessary.
# Contributing
Contributions are very welcome! Please refer to guidelines described in the [contributing guide](https://github.com/expo/expo#contributing).

65
node_modules/expo-keep-awake/android/build.gradle generated vendored Normal file
View File

@ -0,0 +1,65 @@
apply plugin: 'com.android.library'
apply plugin: 'maven'
group = 'host.exp.exponent'
version = '8.4.0'
// Simple helper that allows the root project to override versions declared by this library.
def safeExtGet(prop, fallback) {
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
}
// Upload android library to maven with javadoc and android sources
configurations {
deployerJars
}
// Creating sources with comments
task androidSourcesJar(type: Jar) {
classifier = 'sources'
from android.sourceSets.main.java.srcDirs
}
// Put the androidSources and javadoc to the artifacts
artifacts {
archives androidSourcesJar
}
uploadArchives {
repositories {
mavenDeployer {
configuration = configurations.deployerJars
repository(url: mavenLocal().url)
}
}
}
android {
compileSdkVersion safeExtGet("compileSdkVersion", 29)
defaultConfig {
minSdkVersion safeExtGet("minSdkVersion", 21)
targetSdkVersion safeExtGet("targetSdkVersion", 29)
versionCode 15
versionName "8.4.0"
}
lintOptions {
abortOnError false
}
compileOptions {
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
}
}
if (new File(rootProject.projectDir.parentFile, 'package.json').exists()) {
apply from: project(":unimodules-core").file("../unimodules-core.gradle")
} else {
throw new GradleException(
"'unimodules-core.gradle' was not found in the usual React Native dependency location. " +
"This package can only be used in such projects. Are you sure you've installed the dependencies properly?")
}
dependencies {
unimodule "unimodules-core"
}

View File

@ -0,0 +1,5 @@
<manifest package="expo.modules.keepawake">
</manifest>

View File

@ -0,0 +1,69 @@
package expo.modules.keepawake;
import android.app.Activity;
import android.view.WindowManager;
import org.unimodules.core.ModuleRegistry;
import org.unimodules.core.errors.CurrentActivityNotFoundException;
import org.unimodules.core.interfaces.ActivityProvider;
import org.unimodules.core.interfaces.InternalModule;
import org.unimodules.core.interfaces.services.KeepAwakeManager;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
public class ExpoKeepAwakeManager implements KeepAwakeManager, InternalModule {
private ModuleRegistry mModuleRegistry;
private Set<String> mTags = new HashSet<>();
@Override
public void onCreate(ModuleRegistry moduleRegistry) {
mModuleRegistry = moduleRegistry;
}
private Activity getCurrentActivity() throws CurrentActivityNotFoundException {
ActivityProvider activityProvider = mModuleRegistry.getModule(ActivityProvider.class);
if (activityProvider.getCurrentActivity() != null) {
return activityProvider.getCurrentActivity();
} else {
throw new CurrentActivityNotFoundException();
}
}
@Override
public void activate(final String tag, final Runnable done) throws CurrentActivityNotFoundException {
final Activity activity = getCurrentActivity();
if (!isActivated()) {
if (activity != null) {
activity.runOnUiThread(() -> activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON));
}
}
mTags.add(tag);
done.run();
}
@Override
public void deactivate(final String tag, final Runnable done) throws CurrentActivityNotFoundException {
final Activity activity = getCurrentActivity();
if (mTags.size() == 1 && mTags.contains(tag) && activity != null) {
activity.runOnUiThread(() -> activity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON));
}
mTags.remove(tag);
done.run();
}
@Override
public boolean isActivated() {
return mTags.size() > 0;
}
@Override
public List<? extends Class> getExportedInterfaces() {
return Collections.singletonList(KeepAwakeManager.class);
}
}

View File

@ -0,0 +1,57 @@
// Copyright 2015-present 650 Industries. All rights reserved.
package expo.modules.keepawake;
import android.content.Context;
import org.unimodules.core.ExportedModule;
import org.unimodules.core.ModuleRegistry;
import org.unimodules.core.Promise;
import org.unimodules.core.errors.CurrentActivityNotFoundException;
import org.unimodules.core.interfaces.ExpoMethod;
import org.unimodules.core.interfaces.services.KeepAwakeManager;
public class KeepAwakeModule extends ExportedModule {
private static final String NAME = "ExpoKeepAwake";
private final static String NO_ACTIVITY_ERROR_CODE = "NO_CURRENT_ACTIVITY";
private KeepAwakeManager mKeepAwakeManager;
public KeepAwakeModule(Context context) {
super(context);
}
@Override
public String getName() {
return NAME;
}
@Override
public void onCreate(ModuleRegistry moduleRegistry) {
mKeepAwakeManager = moduleRegistry.getModule(KeepAwakeManager.class);
}
@ExpoMethod
public void activate(String tag, final Promise promise) {
try {
mKeepAwakeManager.activate(tag, () -> promise.resolve(true));
} catch (CurrentActivityNotFoundException ex) {
promise.reject(NO_ACTIVITY_ERROR_CODE, "Unable to activate keep awake");
}
}
@ExpoMethod
public void deactivate(String tag, Promise promise) {
try {
mKeepAwakeManager.deactivate(tag, () -> promise.resolve(true));
} catch (CurrentActivityNotFoundException ex) {
promise.reject(NO_ACTIVITY_ERROR_CODE, "Unable to deactivate keep awake. However, it probably is deactivated already.");
}
}
public boolean isActivated() {
return mKeepAwakeManager.isActivated();
}
}

View File

@ -0,0 +1,23 @@
package expo.modules.keepawake;
import android.content.Context;
import org.unimodules.core.ExportedModule;
import org.unimodules.core.interfaces.InternalModule;
import org.unimodules.core.interfaces.Package;
import java.util.Collections;
import java.util.List;
public class KeepAwakePackage implements Package {
@Override
public List<ExportedModule> createExportedModules(Context context) {
return Collections.<ExportedModule>singletonList(new KeepAwakeModule(context));
}
@Override
public List<? extends InternalModule> createInternalModules(Context context) {
return Collections.singletonList(new ExpoKeepAwakeManager());
}
}

View File

@ -0,0 +1,2 @@
declare const _default: import("@unimodules/core").ProxyNativeModule;
export default _default;

3
node_modules/expo-keep-awake/build/ExpoKeepAwake.js generated vendored Normal file
View File

@ -0,0 +1,3 @@
import { NativeModulesProxy } from '@unimodules/core';
export default NativeModulesProxy.ExpoKeepAwake;
//# sourceMappingURL=ExpoKeepAwake.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"ExpoKeepAwake.js","sourceRoot":"","sources":["../src/ExpoKeepAwake.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,eAAe,kBAAkB,CAAC,aAAa,CAAC","sourcesContent":["import { NativeModulesProxy } from '@unimodules/core';\nexport default NativeModulesProxy.ExpoKeepAwake;\n"]}

View File

@ -0,0 +1,2 @@
declare const _default: {};
export default _default;

View File

@ -0,0 +1,2 @@
export default {};
//# sourceMappingURL=ExpoKeepAwake.web.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"ExpoKeepAwake.web.js","sourceRoot":"","sources":["../src/ExpoKeepAwake.web.ts"],"names":[],"mappings":"AAAA,eAAe,EAAE,CAAC","sourcesContent":["export default {};\n"]}

3
node_modules/expo-keep-awake/build/index.d.ts generated vendored Normal file
View File

@ -0,0 +1,3 @@
export declare function useKeepAwake(tag?: string): void;
export declare function activateKeepAwake(tag?: string): void;
export declare function deactivateKeepAwake(tag?: string): void;

18
node_modules/expo-keep-awake/build/index.js generated vendored Normal file
View File

@ -0,0 +1,18 @@
import { useEffect } from 'react';
import ExpoKeepAwake from './ExpoKeepAwake';
const ExpoKeepAwakeTag = 'ExpoKeepAwakeDefaultTag';
export function useKeepAwake(tag = ExpoKeepAwakeTag) {
useEffect(() => {
activateKeepAwake(tag);
return () => deactivateKeepAwake(tag);
}, [tag]);
}
export function activateKeepAwake(tag = ExpoKeepAwakeTag) {
if (ExpoKeepAwake.activate)
ExpoKeepAwake.activate(tag);
}
export function deactivateKeepAwake(tag = ExpoKeepAwakeTag) {
if (ExpoKeepAwake.deactivate)
ExpoKeepAwake.deactivate(tag);
}
//# sourceMappingURL=index.js.map

1
node_modules/expo-keep-awake/build/index.js.map generated vendored Normal file
View File

@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAE5C,MAAM,gBAAgB,GAAG,yBAAyB,CAAC;AAEnD,MAAM,UAAU,YAAY,CAAC,MAAc,gBAAgB;IACzD,SAAS,CAAC,GAAG,EAAE;QACb,iBAAiB,CAAC,GAAG,CAAC,CAAC;QACvB,OAAO,GAAG,EAAE,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAC;IACxC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;AACZ,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,MAAc,gBAAgB;IAC9D,IAAI,aAAa,CAAC,QAAQ;QAAE,aAAa,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;AAC1D,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,MAAc,gBAAgB;IAChE,IAAI,aAAa,CAAC,UAAU;QAAE,aAAa,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;AAC9D,CAAC","sourcesContent":["import { useEffect } from 'react';\n\nimport ExpoKeepAwake from './ExpoKeepAwake';\n\nconst ExpoKeepAwakeTag = 'ExpoKeepAwakeDefaultTag';\n\nexport function useKeepAwake(tag: string = ExpoKeepAwakeTag): void {\n useEffect(() => {\n activateKeepAwake(tag);\n return () => deactivateKeepAwake(tag);\n }, [tag]);\n}\n\nexport function activateKeepAwake(tag: string = ExpoKeepAwakeTag): void {\n if (ExpoKeepAwake.activate) ExpoKeepAwake.activate(tag);\n}\n\nexport function deactivateKeepAwake(tag: string = ExpoKeepAwakeTag): void {\n if (ExpoKeepAwake.deactivate) ExpoKeepAwake.deactivate(tag);\n}\n"]}

23
node_modules/expo-keep-awake/ios/EXKeepAwake.podspec generated vendored Normal file
View File

@ -0,0 +1,23 @@
require 'json'
package = JSON.parse(File.read(File.join(__dir__, '..', 'package.json')))
Pod::Spec.new do |s|
s.name = 'EXKeepAwake'
s.version = package['version']
s.summary = package['description']
s.description = package['description']
s.license = package['license']
s.author = package['author']
s.homepage = package['homepage']
s.platform = :ios, '10.0'
s.source = { git: 'https://github.com/expo/expo.git' }
s.source_files = 'EXKeepAwake/**/*.{h,m}'
s.preserve_paths = 'EXKeepAwake/**/*.{h,m}'
s.requires_arc = true
s.dependency 'UMCore'
end

View File

@ -0,0 +1,7 @@
// Copyright 2018-present 650 Industries. All rights reserved.
#import <UMCore/UMExportedModule.h>
#import <UMCore/UMModuleRegistryConsumer.h>
@interface EXKeepAwake : UMExportedModule <UMModuleRegistryConsumer>
@end

View File

@ -0,0 +1,92 @@
// Copyright 2018-present 650 Industries. All rights reserved.
#import <UMCore/UMModuleRegistry.h>
#import <EXKeepAwake/EXKeepAwake.h>
#import <UMCore/UMAppLifecycleService.h>
#import <UMCore/UMUtilities.h>
@interface EXKeepAwake () <UMAppLifecycleListener>
@property (nonatomic, weak) id<UMAppLifecycleService> lifecycleManager;
@property (nonatomic, weak) UMModuleRegistry *moduleRegistry;
@end
@implementation EXKeepAwake {
NSMutableSet *_activeTags;
}
- (instancetype)init {
self = [super init];
_activeTags = [NSMutableSet set];
return self;
}
UM_EXPORT_MODULE(ExpoKeepAwake);
# pragma mark - UMModuleRegistryConsumer
- (void)setModuleRegistry:(UMModuleRegistry *)moduleRegistry
{
if (_moduleRegistry) {
[_lifecycleManager unregisterAppLifecycleListener:self];
}
_lifecycleManager = nil;
if (moduleRegistry) {
_lifecycleManager = [moduleRegistry getModuleImplementingProtocol:@protocol(UMAppLifecycleService)];
}
if (_lifecycleManager) {
[_lifecycleManager registerAppLifecycleListener:self];
}
}
UM_EXPORT_METHOD_AS(activate, activate:(NSString *)tag
resolve:(UMPromiseResolveBlock)resolve
reject:(UMPromiseRejectBlock)reject)
{
if(![self shouldBeActive]) {
[UMUtilities performSynchronouslyOnMainThread:^{
[[UIApplication sharedApplication] setIdleTimerDisabled:YES];
}];
}
[_activeTags addObject:tag];
resolve(@YES);
}
UM_EXPORT_METHOD_AS(deactivate, deactivate:(NSString *)tag
resolve:(UMPromiseResolveBlock)resolve
reject:(UMPromiseRejectBlock)reject)
{
[_activeTags removeObject:tag];
if (![self shouldBeActive]) {
[UMUtilities performSynchronouslyOnMainThread:^{
[[UIApplication sharedApplication] setIdleTimerDisabled:NO];
}];
}
resolve(@YES);
}
# pragma mark - UMAppLifecycleListener
- (void)onAppBackgrounded {
[UMUtilities performSynchronouslyOnMainThread:^{
[[UIApplication sharedApplication] setIdleTimerDisabled:NO];
}];
}
- (void)onAppForegrounded {
if ([self shouldBeActive]) {
[UMUtilities performSynchronouslyOnMainThread:^{
[[UIApplication sharedApplication] setIdleTimerDisabled:YES];
}];
}
}
- (BOOL)shouldBeActive {
return [_activeTags count] > 0;
}
@end

45
node_modules/expo-keep-awake/package.json generated vendored Normal file
View File

@ -0,0 +1,45 @@
{
"name": "expo-keep-awake",
"version": "8.4.0",
"description": "Provides a React component that prevents the screen sleeping when rendered. It also exposes static methods to control the behavior imperatively.",
"main": "build/index.js",
"types": "build/index.d.ts",
"sideEffects": false,
"scripts": {
"build": "expo-module build",
"clean": "expo-module clean",
"lint": "expo-module lint",
"test": "expo-module test",
"prepare": "expo-module prepare",
"prepublishOnly": "expo-module prepublishOnly",
"expo-module": "expo-module"
},
"keywords": [
"react-native",
"expo",
"awake",
"keep-awake"
],
"repository": {
"type": "git",
"url": "https://github.com/expo/expo.git",
"directory": "packages/expo-keep-awake"
},
"bugs": {
"url": "https://github.com/expo/expo/issues"
},
"author": "650 Industries, Inc.",
"license": "MIT",
"homepage": "https://docs.expo.io/versions/latest/sdk/keep-awake/",
"unimodulePeerDependencies": {
"@unimodules/core": "*"
},
"peerDependencies": {
"react": "*",
"react-native": "*"
},
"devDependencies": {
"expo-module-scripts": "~1.2.0"
},
"gitHead": "bc6b4b3bc3cb5e44e477f145c72c07ed09588651"
}

2
node_modules/expo-keep-awake/src/ExpoKeepAwake.ts generated vendored Normal file
View File

@ -0,0 +1,2 @@
import { NativeModulesProxy } from '@unimodules/core';
export default NativeModulesProxy.ExpoKeepAwake;

View File

@ -0,0 +1 @@
export default {};

20
node_modules/expo-keep-awake/src/index.ts generated vendored Normal file
View File

@ -0,0 +1,20 @@
import { useEffect } from 'react';
import ExpoKeepAwake from './ExpoKeepAwake';
const ExpoKeepAwakeTag = 'ExpoKeepAwakeDefaultTag';
export function useKeepAwake(tag: string = ExpoKeepAwakeTag): void {
useEffect(() => {
activateKeepAwake(tag);
return () => deactivateKeepAwake(tag);
}, [tag]);
}
export function activateKeepAwake(tag: string = ExpoKeepAwakeTag): void {
if (ExpoKeepAwake.activate) ExpoKeepAwake.activate(tag);
}
export function deactivateKeepAwake(tag: string = ExpoKeepAwakeTag): void {
if (ExpoKeepAwake.deactivate) ExpoKeepAwake.deactivate(tag);
}

9
node_modules/expo-keep-awake/tsconfig.json generated vendored Normal file
View File

@ -0,0 +1,9 @@
// @generated by expo-module-scripts
{
"extends": "expo-module-scripts/tsconfig.base",
"compilerOptions": {
"outDir": "./build"
},
"include": ["./src"],
"exclude": ["**/__mocks__/*", "**/__tests__/*"]
}

4
node_modules/expo-keep-awake/unimodule.json generated vendored Normal file
View File

@ -0,0 +1,4 @@
{
"name": "expo-keep-awake",
"platforms": ["ios", "android"]
}