/core/externals/update-engine/Core/KSPromptAction.m
Objective C | 50 lines | 22 code | 8 blank | 20 comment | 1 complexity | 6b62902284636342982cfe5c8fe306eb MD5 | raw file
1// Copyright 2008 Google Inc. 2// 3// Licensed under the Apache License, Version 2.0 (the "License"); 4// you may not use this file except in compliance with the License. 5// You may obtain a copy of the License at 6// 7// http://www.apache.org/licenses/LICENSE-2.0 8// 9// Unless required by applicable law or agreed to in writing, software 10// distributed under the License is distributed on an "AS IS" BASIS, 11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12// See the License for the specific language governing permissions and 13// limitations under the License. 14 15#import "KSPromptAction.h" 16#import "KSUpdateEngine.h" 17#import "KSActionProcessor.h" 18#import "KSActionPipe.h" 19#import "KSUpdateInfo.h" 20#import "KSUpdateAction.h" 21#import "KSFrameworkStats.h" 22 23 24@implementation KSPromptAction 25 26// A quick note about stats: 27// 28// We collect 3 stats in this method. 29// kStatPrompts - which is the number of times we send a list of avail updates 30// kStatPromptApps - which is the number of apps that we prompted about 31// kStatPromptUpdates - which is the number of apps that the user was prompted 32// for, and the user said "yes" to installing the update 33- (NSArray *)productsToUpdateFromAvailable:(NSArray *)availableUpdates { 34 int numUpdates = [availableUpdates count]; 35 if (numUpdates > 0) { 36 [[KSFrameworkStats sharedStats] incrementStat:kStatPrompts]; 37 [[KSFrameworkStats sharedStats] incrementStat:kStatPromptApps 38 by:numUpdates]; 39 } 40 41 NSArray *updatesToInstall = [[self engine] action:self 42 shouldUpdateProducts:availableUpdates]; 43 44 [[KSFrameworkStats sharedStats] incrementStat:kStatPromptUpdates 45 by:[updatesToInstall count]]; 46 47 return updatesToInstall; 48} 49 50@end