Browse Source

版本升级维护

yyqxiaoyin 6 years ago
parent
commit
b75e30d8c8

+ 2 - 5
Example/MKRRadioManager/MKRViewController.m

@@ -25,11 +25,8 @@
 }
 
 - (void)searchDevice{
-    [_MKRWIFIDeviceManager searchDeviceWithSearchTime:20 timeBlock:^(NSInteger time, NSArray *devices) {
-        if (![self.dataSource isEqualToArray:devices]) {
-            self.dataSource = devices.mutableCopy;
-            [self.tableView reloadData];
-        }
+    [_MKRWIFIDeviceManager searchDeviceWithSearchTime:20 timeBlock:^(NSInteger time) {
+        [self.tableView reloadData];
     }];
 }
 

+ 1 - 3
MKRRadioManager/Classes/MKRRadioManager/MKRWIFIDeviceManager/MKRWIFIDeviceManager.h

@@ -15,8 +15,6 @@
 @protocol MKRWIFIDeviceManagerDelegate <NSObject>
 
 @optional
-/** 已经搜索到的设备数组发生改变 */
-- (void)currentDevicesChange:(NSArray <NSDictionary *> *)deviceArray;
 
 /** 搜索到新设备 */
 - (void)didSearchNewDevice:(NSDictionary *)newDecice;
@@ -45,7 +43,7 @@
  * @param timeBlock  搜索回调 每秒在主线程回调一次
  */
 - (void)searchDeviceWithSearchTime:(int)searchTime
-                         timeBlock:(void(^)(NSInteger time,NSArray <NSDictionary *>*devices))timeBlock;
+                         timeBlock:(void(^)(NSInteger time))timeBlock;
 
 /**
  * 生成m3u列表

+ 4 - 28
MKRRadioManager/Classes/MKRRadioManager/MKRWIFIDeviceManager/MKRWIFIDeviceManager.m

@@ -25,8 +25,6 @@ static inline void wd_main_queue(void (^block)(void)){
     dispatch_source_t _searchTimer;
 }
 
-@property (nonatomic, strong) NSMutableArray *currentDevices;
-
 @property (nonatomic, strong) NSHashTable *listeners;
 
 @end
@@ -83,7 +81,7 @@ static inline void wd_main_queue(void (^block)(void)){
 }
 
 - (void)searchDeviceWithSearchTime:(int)searchTime
-                         timeBlock:(void(^)(NSInteger time,NSArray <NSDictionary *>*devices))timeBlock {
+                         timeBlock:(void(^)(NSInteger time))timeBlock {
     if (_upnpErrorCode == 0) {//开始搜索设备
         [self checkBaseURL];
         libupnp_BuildFilesList();
@@ -91,14 +89,13 @@ static inline void wd_main_queue(void (^block)(void)){
     } else {
         [self startUpnp];
     }
-    [self.currentDevices removeAllObjects];
     __block int count = searchTime +1;
     _searchTimer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, dispatch_get_global_queue(0, 0));
     dispatch_source_set_timer(_searchTimer, DISPATCH_TIME_NOW, 1 * NSEC_PER_SEC, 0 * NSEC_PER_SEC);
     dispatch_source_set_event_handler(_searchTimer, ^{
         if (timeBlock) {
             wd_main_queue(^{
-                timeBlock(count,self.currentDevices);
+                timeBlock(count);
             });
         }
         count --;
@@ -279,26 +276,12 @@ static inline void wd_main_queue(void (^block)(void)){
         [deviceDict setObject:@"Unknown" forKey:@"devNowArtist"];
     }
     [deviceDict setObject:@"1" forKey:@"isOnLine"];
-    NSPredicate *predicate = [NSPredicate predicateWithFormat:@"deviceUUID = %@",array[1]];
-    BOOL isExist = [self.currentDevices filteredArrayUsingPredicate:predicate].count;
-    if (!isExist) {
-        id<MKRWIFIDeviceManagerDelegate> obj;
-        NSEnumerator *enumerator = [self.listeners objectEnumerator];
-        while ((obj = [enumerator nextObject]) != nil) {
-            wd_main_queue(^{
-                if ([obj respondsToSelector:@selector(didSearchNewDevice:)]) {
-                    [obj didSearchNewDevice:deviceDict];
-                }
-            });
-        }
-        [self.currentDevices addObject:deviceDict];
-    }
     id<MKRWIFIDeviceManagerDelegate> obj;
     NSEnumerator *enumerator = [self.listeners objectEnumerator];
     while ((obj = [enumerator nextObject]) != nil) {
         wd_main_queue(^{
-            if ([obj respondsToSelector:@selector(currentDevicesChange:)]) {
-                [obj currentDevicesChange:self.currentDevices];
+            if ([obj respondsToSelector:@selector(didSearchNewDevice:)]) {
+                [obj didSearchNewDevice:deviceDict];
             }
         });
     }
@@ -464,13 +447,6 @@ static inline void wd_main_queue(void (^block)(void)){
     return resource;
 }
 
-- (NSMutableArray *)currentDevices {
-    if (!_currentDevices) {
-        _currentDevices = [NSMutableArray array];
-    }
-    return _currentDevices;
-}
-
 - (NSHashTable *)listeners{
     if (!_listeners) {
         _listeners = [NSHashTable weakObjectsHashTable];

+ 1 - 0
upgrade.sh

@@ -0,0 +1 @@
+fastlane ManagerLib tag:0.0.1 target:MKRRadioManager