mirror of
				https://gitcode.com/gh_mirrors/re/react-native-pushy.git
				synced 2025-10-31 13:23:12 +08:00 
			
		
		
		
	remove blockupdate
This commit is contained in:
		| @@ -28,14 +28,7 @@ describe('测试Native模块的方法', () => { | ||||
|     await element(by.id('done')).longPress(); | ||||
|     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') { | ||||
|     it('reloadUpdate', async () => { | ||||
|       await element(by.id('reloadUpdate')).longPress(); | ||||
|   | ||||
| @@ -66,13 +66,6 @@ export default function TestConsole({visible}) { | ||||
|           setText(`setUuid\n${UUID}`); | ||||
|         }, | ||||
|       }, | ||||
|       { | ||||
|         name: 'setBlockUpdate', | ||||
|         invoke: () => { | ||||
|           setText('setBlockUpdate'); | ||||
|           setOptions({reason: 'application has been block', until: 1673082950}); | ||||
|         }, | ||||
|       }, | ||||
|       { | ||||
|         name: 'reloadUpdate', | ||||
|         invoke: () => { | ||||
|   | ||||
| @@ -166,13 +166,6 @@ public class UpdateContext { | ||||
|         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() { | ||||
|         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) { | ||||
|         try { | ||||
|             UiThreadUtil.runOnUiThread(new Runnable() { | ||||
|   | ||||
| @@ -108,11 +108,6 @@ public class UpdateModule extends NativePushySpec { | ||||
|         UpdateModuleImpl.markSuccess(updateContext,promise); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public void setBlockUpdate(ReadableMap options,Promise promise) { | ||||
|         UpdateModuleImpl.setBlockUpdate(updateContext,options,promise); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public void setUuid(final String uuid, Promise 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 | ||||
|     public void setUuid(final String uuid) { | ||||
|         UiThreadUtil.runOnUiThread(new Runnable() { | ||||
|   | ||||
| @@ -192,24 +192,6 @@ RCT_EXPORT_MODULE(RCTPushy); | ||||
|     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 | ||||
|                   rejecter:(RCTPromiseRejectBlock)reject) | ||||
| { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 sunnylqm
					sunnylqm