Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- - (void)setupDataAdapter
- {
- NSArray<PTUMoreMenuActionItem *> *actionItems = [self actionItems];
- self.dataSource = [[PTUMoreTableViewDataSource alloc] initWithActionItems:actionItems middleLayerController:self.middleLayerController];
- self.dataSource.delegate = self;
- self.dataAdapter = [[PTUMoreTableViewDataAdapter alloc] initWithDataSource:self.dataSource
- delegate:self
- moreLayoutInfo:self.menuLayoutInfo
- layoutConfigController:self.layoutConfigController];
- self.moreTableView.dataSource = self.dataAdapter;
- self.moreTableView.delegate = self.dataAdapter;
- }
- - (NSArray<PTUMoreMenuActionItem *> *)actionItems
- {
- __weak typeof(self) weakSelf = self;
- NSArray<PTUMoreMenuActionItem *> *actionItems = [PTUMoreMenuActionItem actionsWithLayoutElements:self.menuLayoutInfo.content openURLBlock:^(PTUButtonLayoutInfo *buttonLayoutInfo) {
- weakSelf.selectedItem = buttonLayoutInfo;
- [weakSelf performSegueWithIdentifier:PTUPresentCommonWebViewControllerSegueIdentifier sender:weakSelf];
- } openMenuBlock:^(PTUButtonLayoutInfo *buttonLayoutInfo) {
- PTUMoreViewController *controller = [PTUMoreViewController controller];
- controller.menuLayoutInfo = buttonLayoutInfo.buttonActionData.screenLayoutInfo;
- controller.middleLayerController = weakSelf.middleLayerController;
- controller.layoutConfigController = weakSelf.layoutConfigController;
- controller.title = PTULocalizedString(buttonLayoutInfo.buttonTitle, nil);
- [weakSelf.navigationController pushViewController:controller animated:YES];
- } openGameManagementBlock:^(PTUButtonLayoutInfo *buttonLayoutInfo) {
- [weakSelf performSegueWithIdentifier:PTUPresentGamesManagementViewControllerSegueIdentifier sender:weakSelf];
- } openAboutBlock:^(PTUButtonLayoutInfo *buttonLayoutInfo) {
- [weakSelf performSegueWithIdentifier:PTUPresentAboutViewControllerSegueIdentifier sender:weakSelf];
- } logoutBlock:^(PTUButtonLayoutInfo *buttonLayoutInfo) {
- __strong typeof(self) strongSelf = weakSelf;
- if (!strongSelf)
- {
- return;
- }
- PTUNamedAction *confirmAction = [PTUNamedAction actionWithViewType:PTUNamedActionViewTypePositive
- title:[PTULocalizedString(@"LOBBY_MENU_LOGOUT", nil) uppercaseString]
- action:^(id sender){
- [strongSelf.mainLobbyTabBarController.middleLayerController.coreNetworkController logout];
- strongSelf.mainLobbyTabBarController.selectedIndex = 0;
- }];
- PTUNamedAction *cancelAction = [PTUNamedAction actionWithViewType:PTUNamedActionViewTypeNegative
- title:[PTULocalizedString(@"LOBBY_POPUP_NO", nil) uppercaseString]];
- PTUAlertViewController *alertController =
- [PTUAlertViewController alertViewControllerWithTitle:nil
- message:PTULocalizedString(@"LOBBY_LOGOUT_MESSAGE", nil)
- completion:nil];
- alertController.layoutConfigController = strongSelf.layoutConfigController;
- alertController.middleLayerController = strongSelf.middleLayerController;
- alertController.mainLobbyRouting = strongSelf.mainLobbyTabBarController.mainLobbyRouting;
- [alertController addActions:@[cancelAction, confirmAction]];
- [strongSelf.mainLobbyTabBarController.mainLobbyRouting showAlertController:alertController
- animated:YES
- completion:nil];
- }];
- return actionItems;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement