@@ -63,6 +63,9 @@ - (NSArray *)subArrayWithNode:(DNode *)node
63
63
DNode *lastNode = self.nodeList .lastObject ;
64
64
if (lastNode) {
65
65
DStackLog (@" 被Replace的节点 === %@ " , lastNode);
66
+ [self sendPageLifeCicleToFlutterWithAppearNode: node
67
+ disappearNode: lastNode
68
+ actionType: node.actionTypeString];
66
69
[lastNode copyWithNode: node];
67
70
self.pageCount = self.nodeList .count ;
68
71
[self dStackDelegateSafeWithSEL: @selector (dStack:inStack: ) exe: ^(DStack *stack) {
@@ -170,7 +173,10 @@ - (NSArray *)popNodeToListWithNode:(DNode *)node
170
173
if (node.fromFlutter ) {
171
174
subArray = @[lastNode];
172
175
} else {
173
- subArray = [self checkRemovedNode: node needRemove: lastNode];
176
+ BOOL match = [node.identifier isEqualToString: lastNode.identifier];
177
+ if (match) {
178
+ subArray = @[lastNode];
179
+ }
174
180
}
175
181
}
176
182
}
@@ -266,7 +272,7 @@ - (NSArray *)inStackWithNode:(DNode *)node
266
272
}];
267
273
[self sendPageLifeCicleToFlutterWithAppearNode: node
268
274
disappearNode: self .preNode
269
- isPush: YES ];
275
+ actionType: node.actionTypeString ];
270
276
DStackLog (@" 来自【%@ 】的【%@ 】消息,入栈节点为 == %@ , 入栈后的节点列表 == %@ " , [self _page: node], node.actionTypeString , subArray, self.nodeList );
271
277
[self writeLogWithNode: node];
272
278
return subArray;
@@ -277,6 +283,14 @@ - (NSArray *)inStackWithNode:(DNode *)node
277
283
// / @param subArray 出栈列表
278
284
- (void )outStackWithNode : (DNode *)node nodeArray : (NSArray *)subArray
279
285
{
286
+ // 根节点不能出出栈
287
+ NSMutableArray *tempArray = [[NSMutableArray alloc ] init ];
288
+ for (DNode *x in subArray) {
289
+ if (!x.isRootPage ) {
290
+ [tempArray addObject: x];
291
+ }
292
+ }
293
+ subArray = [tempArray copy ];
280
294
if (!subArray.count ) { return ;}
281
295
[self .nodeList removeObjectsInArray: subArray];
282
296
self.removedNodes = [subArray copy ];
@@ -291,7 +305,7 @@ - (void)outStackWithNode:(DNode *)node nodeArray:(NSArray *)subArray
291
305
}];
292
306
[self sendPageLifeCicleToFlutterWithAppearNode: self .currentNode
293
307
disappearNode: subArray.lastObject
294
- isPush: NO ];
308
+ actionType: node.actionTypeString ];
295
309
[self writeLogWithNode: node];
296
310
if ([[DStack sharedInstance ] debugMode ]) {
297
311
// 加入节点检查
@@ -333,7 +347,7 @@ - (void)sendAppliccationLifeCicleToFlutter:(DStackApplicationState)state
333
347
334
348
- (void )sendPageLifeCicleToFlutterWithAppearNode : (DNode *)appear
335
349
disappearNode : (DNode *)disappear
336
- isPush : ( BOOL ) isPush
350
+ actionType : ( NSString *) actionType
337
351
{
338
352
DStack *stack = [DStack sharedInstance ];
339
353
DStackNode *stackAppearNode = [DActionManager stackNodeFromNode: appear];
@@ -345,7 +359,7 @@ - (void)sendPageLifeCicleToFlutterWithAppearNode:(DNode *)appear
345
359
NSString *disappearRoute = stackDisappearNode.route ? stackDisappearNode.route : @" " ;
346
360
NSDictionary *params = @{
347
361
@" page" : @{
348
- @" actionType" : isPush ? @" push " : @" pop " ,
362
+ @" actionType" : actionType ,
349
363
@" appearRoute" : appearRoute,
350
364
@" disappearRoute" : disappearRoute,
351
365
@" appearPageType" : appear.pageString ? appear.pageString : @" " ,
0 commit comments