"Fossies" - the Fresh Open Source Software Archive

Member "jitsi-meet-7688/ios/sdk/src/InfoPlistUtil.m" (1 Dec 2023, 1579 Bytes) of package /linux/misc/jitsi-meet-7688.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Matlab source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 /*
    2 * Copyright @ 2019-present 8x8, Inc.
    3 *
    4 * Licensed under the Apache License, Version 2.0 (the "License");
    5 * you may not use this file except in compliance with the License.
    6 * You may obtain a copy of the License at
    7 *
    8 *     http://www.apache.org/licenses/LICENSE-2.0
    9 *
   10 * Unless required by applicable law or agreed to in writing, software
   11 * distributed under the License is distributed on an "AS IS" BASIS,
   12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   13 * See the License for the specific language governing permissions and
   14 * limitations under the License.
   15 */
   16 
   17 #import "InfoPlistUtil.h"
   18 
   19 // Plist file name.
   20 NSString *const kGoogleServiceInfoFileName = @"GoogleService-Info";
   21 // Plist file type.
   22 NSString *const kGoogleServiceInfoFileType = @"plist";
   23 NSString *const kGoogleAppIDPlistKey = @"GOOGLE_APP_ID";
   24 
   25 @implementation InfoPlistUtil
   26 
   27 + (BOOL)containsRealServiceInfoPlistInBundle:(NSBundle *)bundle {
   28   NSString *bundlePath = bundle.bundlePath;
   29   if (!bundlePath.length) {
   30     return NO;
   31   }
   32 
   33   NSString *plistFilePath = [bundle pathForResource:kGoogleServiceInfoFileName
   34                                              ofType:kGoogleServiceInfoFileType];
   35   if (!plistFilePath.length) {
   36     return NO;
   37   }
   38 
   39   NSDictionary *plist = [NSDictionary dictionaryWithContentsOfFile:plistFilePath];
   40   if (!plist) {
   41     return NO;
   42   }
   43 
   44   // Perform a very naive validation by checking to see if the plist has the dummy google app id
   45   NSString *googleAppID = plist[kGoogleAppIDPlistKey];
   46   if (!googleAppID.length) {
   47     return NO;
   48   }
   49 
   50   return YES;
   51 }
   52 @end