remove blockupdate
This commit is contained in:
parent
71e5b947d3
commit
f2aec36705
@ -28,14 +28,7 @@ describe('测试Native模块的方法', () => {
|
|||||||
await element(by.id('done')).longPress();
|
await element(by.id('done')).longPress();
|
||||||
await expect(element(by.id('done'))).toBeNotVisible();
|
await expect(element(by.id('done'))).toBeNotVisible();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('setBlockUpdate', async () => {
|
|
||||||
await element(by.id('setBlockUpdate')).longPress();
|
|
||||||
await element(by.id('submit')).longPress();
|
|
||||||
await expect(element(by.text('done'))).toBeVisible();
|
|
||||||
await element(by.id('done')).longPress();
|
|
||||||
await expect(element(by.id('done'))).toBeNotVisible();
|
|
||||||
});
|
|
||||||
if (device.getPlatform() === 'android') {
|
if (device.getPlatform() === 'android') {
|
||||||
it('reloadUpdate', async () => {
|
it('reloadUpdate', async () => {
|
||||||
await element(by.id('reloadUpdate')).longPress();
|
await element(by.id('reloadUpdate')).longPress();
|
||||||
|
@ -66,13 +66,6 @@ export default function TestConsole({visible}) {
|
|||||||
setText(`setUuid\n${UUID}`);
|
setText(`setUuid\n${UUID}`);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
|
||||||
name: 'setBlockUpdate',
|
|
||||||
invoke: () => {
|
|
||||||
setText('setBlockUpdate');
|
|
||||||
setOptions({reason: 'application has been block', until: 1673082950});
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
name: 'reloadUpdate',
|
name: 'reloadUpdate',
|
||||||
invoke: () => {
|
invoke: () => {
|
||||||
|
@ -166,13 +166,6 @@ public class UpdateContext {
|
|||||||
return sp.getString(key, null);
|
return sp.getString(key, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBlockUpdate(int until, String reason) {
|
|
||||||
SharedPreferences.Editor editor = sp.edit();
|
|
||||||
editor.putInt("blockUntil", until);
|
|
||||||
editor.putString("blockReason", reason);
|
|
||||||
editor.apply();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCurrentVersion() {
|
public String getCurrentVersion() {
|
||||||
return sp.getString("currentVersion", null);
|
return sp.getString("currentVersion", null);
|
||||||
}
|
}
|
||||||
|
@ -192,23 +192,6 @@ public class UpdateModuleImpl {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setBlockUpdate(UpdateContext updateContext, ReadableMap options,Promise promise) {
|
|
||||||
try {
|
|
||||||
final int until = options.getInt("until");
|
|
||||||
final String reason = options.getString("reason");
|
|
||||||
UiThreadUtil.runOnUiThread(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
updateContext.setBlockUpdate(until, reason);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
promise.resolve(true);
|
|
||||||
}catch (Exception e){
|
|
||||||
promise.reject("执行报错:"+e.getMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void setUuid(UpdateContext updateContext, String uuid, Promise promise) {
|
public static void setUuid(UpdateContext updateContext, String uuid, Promise promise) {
|
||||||
try {
|
try {
|
||||||
UiThreadUtil.runOnUiThread(new Runnable() {
|
UiThreadUtil.runOnUiThread(new Runnable() {
|
||||||
|
@ -108,11 +108,6 @@ public class UpdateModule extends NativePushySpec {
|
|||||||
UpdateModuleImpl.markSuccess(updateContext,promise);
|
UpdateModuleImpl.markSuccess(updateContext,promise);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setBlockUpdate(ReadableMap options,Promise promise) {
|
|
||||||
UpdateModuleImpl.setBlockUpdate(updateContext,options,promise);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setUuid(final String uuid, Promise promise) {
|
public void setUuid(final String uuid, Promise promise) {
|
||||||
UpdateModuleImpl.setUuid(updateContext,uuid,promise);
|
UpdateModuleImpl.setUuid(updateContext,uuid,promise);
|
||||||
|
@ -239,18 +239,6 @@ public class UpdateModule extends ReactContextBaseJavaModule {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ReactMethod
|
|
||||||
public void setBlockUpdate(ReadableMap options) {
|
|
||||||
final int until = options.getInt("until");
|
|
||||||
final String reason = options.getString("reason");
|
|
||||||
UiThreadUtil.runOnUiThread(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
updateContext.setBlockUpdate(until, reason);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@ReactMethod
|
@ReactMethod
|
||||||
public void setUuid(final String uuid) {
|
public void setUuid(final String uuid) {
|
||||||
UiThreadUtil.runOnUiThread(new Runnable() {
|
UiThreadUtil.runOnUiThread(new Runnable() {
|
||||||
|
@ -192,24 +192,6 @@ RCT_EXPORT_MODULE(RCTPushy);
|
|||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
RCT_EXPORT_METHOD(setBlockUpdate:(NSDictionary *)options
|
|
||||||
resolver:(RCTPromiseResolveBlock)resolve
|
|
||||||
rejecter:(RCTPromiseRejectBlock)reject)
|
|
||||||
{
|
|
||||||
// NSMutableDictionary *blockUpdateInfo = [NSMutableDictionary new];
|
|
||||||
// blockUpdateInfo[@"reason"] = options[@"reason"];
|
|
||||||
// blockUpdateInfo[@"until"] = options[@"until"];
|
|
||||||
@try {
|
|
||||||
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
|
||||||
[defaults setObject:options forKey:keyBlockUpdate];
|
|
||||||
[defaults synchronize];
|
|
||||||
resolve(@true);
|
|
||||||
}
|
|
||||||
@catch (NSException *exception) {
|
|
||||||
reject(@"执行报错", nil, nil);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
RCT_EXPORT_METHOD(setUuid:(NSString *)uuid resolver:(RCTPromiseResolveBlock)resolve
|
RCT_EXPORT_METHOD(setUuid:(NSString *)uuid resolver:(RCTPromiseResolveBlock)resolve
|
||||||
rejecter:(RCTPromiseRejectBlock)reject)
|
rejecter:(RCTPromiseRejectBlock)reject)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user