@@ -54,3 +54,4 @@ buck-out/ | |||
# Bundle artifact | |||
*.jsbundle | |||
/yarn.lock |
@@ -10,7 +10,6 @@ export default class HttpUtil { | |||
fetch(url) | |||
.then(response => response.json()) | |||
.then(result => resolve(result)) | |||
.catch(error => reject(error)) | |||
}) | |||
} | |||
@@ -32,7 +31,6 @@ export default class HttpUtil { | |||
}) | |||
.then(response => response.json()) | |||
.then(result => resolve(result)) | |||
.catch(error => reject(error)) | |||
}) | |||
} | |||
} | |||
@@ -116,7 +116,7 @@ android { | |||
android.applicationVariants.all { variant -> | |||
variant.outputs.all { | |||
outputFileName = "screenad_" + variant.buildType.name + "_v" + defaultConfig.versionName + ".apk" | |||
outputFileName = "screenad_" + variant.buildType.name + "_" + defaultConfig.versionCode + ".apk" | |||
} | |||
} | |||
@@ -131,16 +131,24 @@ android { | |||
buildTypes { | |||
debug { | |||
buildConfigField "String", "API_HOST", "\"https://mall.youlane.cn/\"" | |||
buildConfigField "String", "CODEPUSH_HOST", "\"http://202.165.179.86:3333/\"" | |||
buildConfigField "String", "CODEPUSH_HOST", "\"http://mall.youlane.cn:3333/\"" | |||
buildConfigField "String", "CODEPUSH_KEY", "\"8snO1yoHlvhEtBjr02zTr3g1comw4ksvOXqog\"" | |||
} | |||
release { | |||
buildConfigField "String", "API_HOST", "\"https://admin.malls.iformall.com/\"" | |||
buildConfigField "String", "CODEPUSH_HOST", "\"http://202.165.179.86:3333/\"" | |||
buildConfigField "String", "API_HOST", "\"https://admintest.malls.iformall.com/\"" | |||
buildConfigField "String", "CODEPUSH_HOST", "\"http://mall.youlane.cn:3333/\"" | |||
buildConfigField "String", "CODEPUSH_KEY", "\"9rYZYySFD0ryN5wCD9YmjJkT55Kf4ksvOXqog\"" | |||
minifyEnabled enableProguardInReleaseBuilds | |||
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" | |||
} | |||
product.initWith(release) | |||
product { | |||
buildConfigField "String", "API_HOST", "\"https://admin.malls.iformall.com/\"" | |||
buildConfigField "String", "CODEPUSH_HOST", "\"http://admin.malls.iformall.com:3333/\"" | |||
buildConfigField "String", "CODEPUSH_KEY", "\"9rYZYySFD0ryN5wCD9YmjJkT55Kf4ksvOXqog\"" | |||
matchingFallbacks = ['product', 'release'] | |||
} | |||
} | |||
// applicationVariants are e.g. debug, release | |||
applicationVariants.all { variant -> | |||
@@ -158,6 +166,8 @@ android { | |||
} | |||
dependencies { | |||
implementation project(':react-native-camera') | |||
implementation project(':react-native-device-info') | |||
implementation project(':react-native-code-push') | |||
implementation fileTree(dir: "libs", include: ["*.jar"]) | |||
implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}" | |||
@@ -3,6 +3,8 @@ | |||
<uses-permission android:name="android.permission.INTERNET" /> | |||
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/> | |||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/> | |||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> | |||
<application | |||
android:name=".MainApplication" | |||
@@ -24,6 +26,12 @@ | |||
</intent-filter> | |||
</activity> | |||
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" /> | |||
<receiver android:name=".AutoStartBroadcastReceiver" > | |||
<intent-filter> | |||
<action android:name="android.intent.action.BOOT_COMPLETED" /> | |||
<category android:name="android.intent.category.HOME"/> | |||
</intent-filter> | |||
</receiver> | |||
</application> | |||
</manifest> |
@@ -0,0 +1,22 @@ | |||
package com.screenad; | |||
import android.content.BroadcastReceiver; | |||
import android.content.Context; | |||
import android.content.Intent; | |||
//开机自启动广播接受 | |||
public class AutoStartBroadcastReceiver extends BroadcastReceiver { | |||
static final String action_boot ="android.intent.action.BOOT_COMPLETED"; | |||
@Override | |||
public void onReceive(Context context, Intent intent) { | |||
if (intent.getAction().equals(action_boot) && !BuildConfig.BUILD_TYPE.equals("debug")){ | |||
Intent sayHelloIntent=new Intent(context,MainActivity.class); | |||
sayHelloIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | |||
context.startActivity(sayHelloIntent); | |||
} | |||
} | |||
} |
@@ -1,5 +1,10 @@ | |||
package com.screenad; | |||
import android.graphics.Color; | |||
import android.os.Build; | |||
import android.os.Bundle; | |||
import android.view.View; | |||
import com.facebook.react.ReactActivity; | |||
public class MainActivity extends ReactActivity { | |||
@@ -8,6 +13,22 @@ public class MainActivity extends ReactActivity { | |||
* Returns the name of the main component registered from JavaScript. | |||
* This is used to schedule rendering of the component. | |||
*/ | |||
protected void onCreate(Bundle savedInstanceState) { | |||
super.onCreate(savedInstanceState); | |||
View decorView = getWindow().getDecorView(); | |||
int option = View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | |||
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | |||
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE | |||
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | |||
| View.SYSTEM_UI_FLAG_FULLSCREEN; | |||
decorView.setSystemUiVisibility(option); | |||
getWindow().setNavigationBarColor(Color.TRANSPARENT); | |||
getWindow().setStatusBarColor(Color.TRANSPARENT); | |||
} | |||
@Override | |||
protected String getMainComponentName() { | |||
return "screenAd"; | |||
@@ -3,6 +3,11 @@ package com.screenad; | |||
import android.app.Application; | |||
import com.facebook.react.ReactApplication; | |||
import org.reactnative.camera.RNCameraPackage; | |||
import com.facebook.react.bridge.ReactApplicationContext; | |||
import com.facebook.react.bridge.ReactContextBaseJavaModule; | |||
import com.learnium.RNDeviceInfo.RNDeviceInfo; | |||
import com.microsoft.codepush.react.CodePush; | |||
import com.facebook.react.ReactNativeHost; | |||
import com.facebook.react.ReactPackage; | |||
@@ -12,14 +17,16 @@ import com.facebook.soloader.SoLoader; | |||
import java.util.Arrays; | |||
import java.util.List; | |||
public class MainApplication extends Application implements ReactApplication { | |||
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) { | |||
@Override | |||
protected String getJSBundleFile() { | |||
return CodePush.getJSBundleFile(); | |||
} | |||
@Override | |||
protected String getJSBundleFile() { | |||
return CodePush.getJSBundleFile(); | |||
} | |||
@Override | |||
public boolean getUseDeveloperSupport() { | |||
@@ -29,13 +36,16 @@ public class MainApplication extends Application implements ReactApplication { | |||
@Override | |||
protected List<ReactPackage> getPackages() { | |||
return Arrays.<ReactPackage>asList( | |||
new MainReactPackage(), | |||
new CodePush( | |||
BuildConfig.CODEPUSH_KEY, | |||
getApplicationContext(), | |||
BuildConfig.DEBUG, | |||
BuildConfig.CODEPUSH_HOST | |||
) | |||
new MainReactPackage(), | |||
new RNCameraPackage(), | |||
new RNBuildConfigPackage(), | |||
new RNDeviceInfo(), | |||
new CodePush( | |||
BuildConfig.CODEPUSH_KEY, | |||
getApplicationContext(), | |||
BuildConfig.DEBUG, | |||
BuildConfig.CODEPUSH_HOST | |||
) | |||
); | |||
} | |||
@@ -0,0 +1,36 @@ | |||
package com.screenad; | |||
import android.content.pm.PackageManager; | |||
import com.facebook.react.bridge.ReactApplicationContext; | |||
import com.facebook.react.bridge.ReactContextBaseJavaModule; | |||
import com.facebook.react.bridge.ReactMethod; | |||
import java.util.HashMap; | |||
import java.util.Map; | |||
import javax.annotation.Nullable; | |||
public class RNBuildConfig extends ReactContextBaseJavaModule { | |||
public RNBuildConfig(ReactApplicationContext reactContext) { | |||
super(reactContext); | |||
} | |||
@Override | |||
public String getName() { | |||
return "BuildConfig"; | |||
} | |||
@Override | |||
public @Nullable | |||
Map<String, Object> getConstants() { | |||
HashMap<String, Object> constants = new HashMap<String, Object>(); | |||
constants.put("apiHost", BuildConfig.API_HOST); | |||
constants.put("buildType", BuildConfig.BUILD_TYPE); | |||
constants.put("versionCode", BuildConfig.VERSION_CODE); | |||
constants.put("versionName", BuildConfig.VERSION_NAME); | |||
return constants; | |||
} | |||
} |
@@ -0,0 +1,31 @@ | |||
package com.screenad; | |||
import com.facebook.react.ReactPackage; | |||
import com.facebook.react.bridge.JavaScriptModule; | |||
import com.facebook.react.bridge.NativeModule; | |||
import com.facebook.react.bridge.ReactApplicationContext; | |||
import com.facebook.react.uimanager.ViewManager; | |||
import java.util.ArrayList; | |||
import java.util.Collections; | |||
import java.util.List; | |||
public class RNBuildConfigPackage implements ReactPackage { | |||
@Override | |||
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) { | |||
return Collections.emptyList(); | |||
} | |||
@Override | |||
public List<NativeModule> createNativeModules( | |||
ReactApplicationContext reactContext) { | |||
List<NativeModule> modules = new ArrayList<>(); | |||
modules.add(new RNBuildConfig(reactContext)); | |||
return modules; | |||
} | |||
// Deprecated RN 0.47 | |||
public List<Class<? extends JavaScriptModule>> createJSModules() { | |||
return Collections.emptyList(); | |||
} | |||
} |
@@ -1,4 +1,8 @@ | |||
rootProject.name = 'screenAd' | |||
include ':react-native-camera' | |||
project(':react-native-camera').projectDir = new File(rootProject.projectDir, '..\\node_modules\\react-native-camera\\android') | |||
include ':react-native-device-info' | |||
project(':react-native-device-info').projectDir = new File(rootProject.projectDir, '..\\node_modules\\react-native-device-info\\android') | |||
include ':react-native-code-push' | |||
project(':react-native-code-push').projectDir = new File(rootProject.projectDir, '..\\node_modules\\react-native-code-push\\android\\app') | |||
@@ -41,6 +41,9 @@ | |||
ED2971652150620600B7C4FE /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ED2971642150620600B7C4FE /* JavaScriptCore.framework */; }; | |||
84325BCA939E4E4E8090435C /* libCodePush.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 928B0784CE244B05BADC60D9 /* libCodePush.a */; }; | |||
1D9B977EF02A4A4889A3DB8D /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 66D0C7202A274329A44896AF /* libz.tbd */; }; | |||
87AC1C7FBD2D486A8496775D /* libRNDeviceInfo.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DEA1E60B1E4C4CF08017D6C7 /* libRNDeviceInfo.a */; }; | |||
603338A972BC497CB13A8E7E /* libRNDeviceInfo-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 145DB45C59D944B7BC067032 /* libRNDeviceInfo-tvOS.a */; }; | |||
34AFC50E88444884839918E1 /* libRNCamera.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 7847EE6DABE74D92BBD93F0A /* libRNCamera.a */; }; | |||
/* End PBXBuildFile section */ | |||
/* Begin PBXContainerItemProxy section */ | |||
@@ -351,6 +354,11 @@ | |||
0CB64B19BE27429888B0F5FA /* CodePush.xcodeproj */ = {isa = PBXFileReference; name = "CodePush.xcodeproj"; path = "../node_modules/react-native-code-push/ios/CodePush.xcodeproj"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = wrapper.pb-project; explicitFileType = undefined; includeInIndex = 0; }; | |||
928B0784CE244B05BADC60D9 /* libCodePush.a */ = {isa = PBXFileReference; name = "libCodePush.a"; path = "libCodePush.a"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = archive.ar; explicitFileType = undefined; includeInIndex = 0; }; | |||
66D0C7202A274329A44896AF /* libz.tbd */ = {isa = PBXFileReference; name = "libz.tbd"; path = "usr/lib/libz.tbd"; sourceTree = SDKROOT; fileEncoding = undefined; lastKnownFileType = sourcecode.text-based-dylib-definition; explicitFileType = undefined; includeInIndex = 0; }; | |||
D7C737D4F5674419B8D2A7F0 /* RNDeviceInfo.xcodeproj */ = {isa = PBXFileReference; name = "RNDeviceInfo.xcodeproj"; path = "../node_modules/react-native-device-info/ios/RNDeviceInfo.xcodeproj"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = wrapper.pb-project; explicitFileType = undefined; includeInIndex = 0; }; | |||
DEA1E60B1E4C4CF08017D6C7 /* libRNDeviceInfo.a */ = {isa = PBXFileReference; name = "libRNDeviceInfo.a"; path = "libRNDeviceInfo.a"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = archive.ar; explicitFileType = undefined; includeInIndex = 0; }; | |||
145DB45C59D944B7BC067032 /* libRNDeviceInfo-tvOS.a */ = {isa = PBXFileReference; name = "libRNDeviceInfo-tvOS.a"; path = "libRNDeviceInfo-tvOS.a"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = archive.ar; explicitFileType = undefined; includeInIndex = 0; }; | |||
00A674D206BA447C9B2B9CBA /* RNCamera.xcodeproj */ = {isa = PBXFileReference; name = "RNCamera.xcodeproj"; path = "../node_modules/react-native-camera/ios/RNCamera.xcodeproj"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = wrapper.pb-project; explicitFileType = undefined; includeInIndex = 0; }; | |||
7847EE6DABE74D92BBD93F0A /* libRNCamera.a */ = {isa = PBXFileReference; name = "libRNCamera.a"; path = "libRNCamera.a"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = archive.ar; explicitFileType = undefined; includeInIndex = 0; }; | |||
/* End PBXFileReference section */ | |||
/* Begin PBXFrameworksBuildPhase section */ | |||
@@ -381,6 +389,8 @@ | |||
139FDEF61B0652A700C62182 /* libRCTWebSocket.a in Frameworks */, | |||
84325BCA939E4E4E8090435C /* libCodePush.a in Frameworks */, | |||
1D9B977EF02A4A4889A3DB8D /* libz.tbd in Frameworks */, | |||
87AC1C7FBD2D486A8496775D /* libRNDeviceInfo.a in Frameworks */, | |||
34AFC50E88444884839918E1 /* libRNCamera.a in Frameworks */, | |||
); | |||
runOnlyForDeploymentPostprocessing = 0; | |||
}; | |||
@@ -397,6 +407,7 @@ | |||
2D02E4C61E0B4AEC006451C7 /* libRCTSettings-tvOS.a in Frameworks */, | |||
2D02E4C71E0B4AEC006451C7 /* libRCTText-tvOS.a in Frameworks */, | |||
2D02E4C81E0B4AEC006451C7 /* libRCTWebSocket-tvOS.a in Frameworks */, | |||
603338A972BC497CB13A8E7E /* libRNDeviceInfo-tvOS.a in Frameworks */, | |||
); | |||
runOnlyForDeploymentPostprocessing = 0; | |||
}; | |||
@@ -572,6 +583,8 @@ | |||
00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */, | |||
139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */, | |||
0CB64B19BE27429888B0F5FA /* CodePush.xcodeproj */, | |||
D7C737D4F5674419B8D2A7F0 /* RNDeviceInfo.xcodeproj */, | |||
00A674D206BA447C9B2B9CBA /* RNCamera.xcodeproj */, | |||
); | |||
name = Libraries; | |||
sourceTree = "<group>"; | |||
@@ -1200,10 +1213,15 @@ | |||
LIBRARY_SEARCH_PATHS = ( | |||
"$(inherited)", | |||
"\"$(SRCROOT)/$(TARGET_NAME)\"", | |||
"\"$(SRCROOT)/$(TARGET_NAME)\"", | |||
"\"$(SRCROOT)/$(TARGET_NAME)\"", | |||
"\"$(SRCROOT)/$(TARGET_NAME)\"", | |||
); | |||
HEADER_SEARCH_PATHS = ( | |||
"$(inherited)", | |||
"$(SRCROOT)\..\node_modules\react-native-code-push\ios\CodePush/**", | |||
"$(SRCROOT)\..\node_modules\react-native-device-info\ios\RNDeviceInfo", | |||
"$(SRCROOT)\..\node_modules\react-native-camera\ios/**", | |||
); | |||
}; | |||
name = Debug; | |||
@@ -1226,10 +1244,15 @@ | |||
LIBRARY_SEARCH_PATHS = ( | |||
"$(inherited)", | |||
"\"$(SRCROOT)/$(TARGET_NAME)\"", | |||
"\"$(SRCROOT)/$(TARGET_NAME)\"", | |||
"\"$(SRCROOT)/$(TARGET_NAME)\"", | |||
"\"$(SRCROOT)/$(TARGET_NAME)\"", | |||
); | |||
HEADER_SEARCH_PATHS = ( | |||
"$(inherited)", | |||
"$(SRCROOT)\..\node_modules\react-native-code-push\ios\CodePush/**", | |||
"$(SRCROOT)\..\node_modules\react-native-device-info\ios\RNDeviceInfo", | |||
"$(SRCROOT)\..\node_modules\react-native-camera\ios/**", | |||
); | |||
}; | |||
name = Release; | |||
@@ -1253,6 +1276,8 @@ | |||
HEADER_SEARCH_PATHS = ( | |||
"$(inherited)", | |||
"$(SRCROOT)\..\node_modules\react-native-code-push\ios\CodePush/**", | |||
"$(SRCROOT)\..\node_modules\react-native-device-info\ios\RNDeviceInfo", | |||
"$(SRCROOT)\..\node_modules\react-native-camera\ios/**", | |||
); | |||
}; | |||
name = Debug; | |||
@@ -1275,6 +1300,8 @@ | |||
HEADER_SEARCH_PATHS = ( | |||
"$(inherited)", | |||
"$(SRCROOT)\..\node_modules\react-native-code-push\ios\CodePush/**", | |||
"$(SRCROOT)\..\node_modules\react-native-device-info\ios\RNDeviceInfo", | |||
"$(SRCROOT)\..\node_modules\react-native-camera\ios/**", | |||
); | |||
}; | |||
name = Release; | |||
@@ -1305,10 +1332,15 @@ | |||
LIBRARY_SEARCH_PATHS = ( | |||
"$(inherited)", | |||
"\"$(SRCROOT)/$(TARGET_NAME)\"", | |||
"\"$(SRCROOT)/$(TARGET_NAME)\"", | |||
"\"$(SRCROOT)/$(TARGET_NAME)\"", | |||
"\"$(SRCROOT)/$(TARGET_NAME)\"", | |||
); | |||
HEADER_SEARCH_PATHS = ( | |||
"$(inherited)", | |||
"$(SRCROOT)\..\node_modules\react-native-code-push\ios\CodePush/**", | |||
"$(SRCROOT)\..\node_modules\react-native-device-info\ios\RNDeviceInfo", | |||
"$(SRCROOT)\..\node_modules\react-native-camera\ios/**", | |||
); | |||
}; | |||
name = Debug; | |||
@@ -1339,10 +1371,15 @@ | |||
LIBRARY_SEARCH_PATHS = ( | |||
"$(inherited)", | |||
"\"$(SRCROOT)/$(TARGET_NAME)\"", | |||
"\"$(SRCROOT)/$(TARGET_NAME)\"", | |||
"\"$(SRCROOT)/$(TARGET_NAME)\"", | |||
"\"$(SRCROOT)/$(TARGET_NAME)\"", | |||
); | |||
HEADER_SEARCH_PATHS = ( | |||
"$(inherited)", | |||
"$(SRCROOT)\..\node_modules\react-native-code-push\ios\CodePush/**", | |||
"$(SRCROOT)\..\node_modules\react-native-device-info\ios\RNDeviceInfo", | |||
"$(SRCROOT)\..\node_modules\react-native-camera\ios/**", | |||
); | |||
}; | |||
name = Release; | |||
@@ -1372,10 +1409,15 @@ | |||
LIBRARY_SEARCH_PATHS = ( | |||
"$(inherited)", | |||
"\"$(SRCROOT)/$(TARGET_NAME)\"", | |||
"\"$(SRCROOT)/$(TARGET_NAME)\"", | |||
"\"$(SRCROOT)/$(TARGET_NAME)\"", | |||
"\"$(SRCROOT)/$(TARGET_NAME)\"", | |||
); | |||
HEADER_SEARCH_PATHS = ( | |||
"$(inherited)", | |||
"$(SRCROOT)\..\node_modules\react-native-code-push\ios\CodePush/**", | |||
"$(SRCROOT)\..\node_modules\react-native-device-info\ios\RNDeviceInfo", | |||
"$(SRCROOT)\..\node_modules\react-native-camera\ios/**", | |||
); | |||
}; | |||
name = Debug; | |||
@@ -1405,10 +1447,15 @@ | |||
LIBRARY_SEARCH_PATHS = ( | |||
"$(inherited)", | |||
"\"$(SRCROOT)/$(TARGET_NAME)\"", | |||
"\"$(SRCROOT)/$(TARGET_NAME)\"", | |||
"\"$(SRCROOT)/$(TARGET_NAME)\"", | |||
"\"$(SRCROOT)/$(TARGET_NAME)\"", | |||
); | |||
HEADER_SEARCH_PATHS = ( | |||
"$(inherited)", | |||
"$(SRCROOT)\..\node_modules\react-native-code-push\ios\CodePush/**", | |||
"$(SRCROOT)\..\node_modules\react-native-device-info\ios\RNDeviceInfo", | |||
"$(SRCROOT)\..\node_modules\react-native-camera\ios/**", | |||
); | |||
}; | |||
name = Release; | |||
@@ -9,7 +9,10 @@ | |||
"dependencies": { | |||
"react": "16.6.3", | |||
"react-native": "0.58.4", | |||
"react-native-animatable": "^1.3.1", | |||
"react-native-camera": "^1.12.0", | |||
"react-native-code-push": "^5.5.2", | |||
"react-native-device-info": "^0.26.4", | |||
"react-native-swiper": "^1.5.14" | |||
}, | |||
"devDependencies": { | |||