Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
joeljfischer committed Oct 27, 2021
2 parents 316e234 + df41b36 commit 3c7e7f3
Show file tree
Hide file tree
Showing 53 changed files with 146 additions and 499 deletions.
14 changes: 10 additions & 4 deletions MobileWeather.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
6E04EAC41CF4E55900115C2F /* Forecast.m in Sources */ = {isa = PBXBuildFile; fileRef = E48C4D9219FE7CAF00A90448 /* Forecast.m */; };
6EF1FC581CF5EF3F009BE8E9 /* SmartDeviceLinkService.m in Sources */ = {isa = PBXBuildFile; fileRef = 6EF1FC571CF5EF3F009BE8E9 /* SmartDeviceLinkService.m */; };
AA62726DBC705DF2AB93C537 /* Pods_MobileWeather.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E5FAE7A71ACD04B5A73D580C /* Pods_MobileWeather.framework */; };
C9BE3596268A5B6D001D9EED /* ImageSize.m in Sources */ = {isa = PBXBuildFile; fileRef = C9BE3595268A5B6D001D9EED /* ImageSize.m */; };
E4059D6219FF7D4800C9996D /* WeatherDataManager.m in Sources */ = {isa = PBXBuildFile; fileRef = E4059D6119FF7D4800C9996D /* WeatherDataManager.m */; };
E4059D6519FF7DA900C9996D /* WeatherService.m in Sources */ = {isa = PBXBuildFile; fileRef = E4059D6419FF7DA900C9996D /* WeatherService.m */; };
E4059D6819FF8AF500C9996D /* DarkSkyService.m in Sources */ = {isa = PBXBuildFile; fileRef = E4059D6719FF8AF500C9996D /* DarkSkyService.m */; };
Expand Down Expand Up @@ -76,6 +77,8 @@
6EF1FC561CF5EF3F009BE8E9 /* SmartDeviceLinkService.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SmartDeviceLinkService.h; sourceTree = "<group>"; };
6EF1FC571CF5EF3F009BE8E9 /* SmartDeviceLinkService.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SmartDeviceLinkService.m; sourceTree = "<group>"; };
C407ED364EBBDDB306D541A8 /* Pods-MobileWeather.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-MobileWeather.debug.xcconfig"; path = "Pods/Target Support Files/Pods-MobileWeather/Pods-MobileWeather.debug.xcconfig"; sourceTree = "<group>"; };
C9BE3594268A5B6D001D9EED /* ImageSize.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ImageSize.h; sourceTree = "<group>"; };
C9BE3595268A5B6D001D9EED /* ImageSize.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ImageSize.m; sourceTree = "<group>"; };
E4059D6019FF7D4800C9996D /* WeatherDataManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WeatherDataManager.h; sourceTree = "<group>"; };
E4059D6119FF7D4800C9996D /* WeatherDataManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WeatherDataManager.m; sourceTree = "<group>"; };
E4059D6319FF7DA900C9996D /* WeatherService.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WeatherService.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -260,6 +263,8 @@
E4059D6119FF7D4800C9996D /* WeatherDataManager.m */,
E4C5B2DF1AEE24AC0056E934 /* WeatherLanguage.h */,
E4C5B2E01AEE24AC0056E934 /* WeatherLanguage.m */,
C9BE3594268A5B6D001D9EED /* ImageSize.h */,
C9BE3595268A5B6D001D9EED /* ImageSize.m */,
);
name = Data;
sourceTree = "<group>";
Expand Down Expand Up @@ -499,6 +504,7 @@
6E04EAC31CF4E52A00115C2F /* Localization.m in Sources */,
E4059D7A19FFC21500C9996D /* DarkSkyProcessor.m in Sources */,
E4059D6219FF7D4800C9996D /* WeatherDataManager.m in Sources */,
C9BE3596268A5B6D001D9EED /* ImageSize.m in Sources */,
E477F2611A8B79020028B59C /* PercentageNumber.m in Sources */,
E44F82451A7F86D20055AD77 /* RoadConditions.m in Sources */,
E48C4DA719FE840800A90448 /* ImageProcessor.m in Sources */,
Expand Down Expand Up @@ -609,7 +615,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
VALIDATE_PRODUCT = YES;
Expand Down Expand Up @@ -652,7 +658,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
SDKROOT = iphoneos;
VALIDATE_PRODUCT = YES;
};
Expand All @@ -672,7 +678,7 @@
DEVELOPMENT_TEAM = NCVC2MHU7M;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
INFOPLIST_FILE = MobileWeather/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = 5.6.0;
PRODUCT_BUNDLE_IDENTIFIER = com.sdl.sdlweather;
Expand All @@ -695,7 +701,7 @@
DEVELOPMENT_TEAM = NCVC2MHU7M;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
INFOPLIST_FILE = MobileWeather/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = 5.6.0;
PRODUCT_BUNDLE_IDENTIFIER = com.sdl.sdlweather;
Expand Down
6 changes: 4 additions & 2 deletions MobileWeather/ImageProcessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@
//

@import UIKit;
@import SmartDeviceLink;
#include "ImageSize.h"

@interface ImageProcessor : NSObject

+ (ImageProcessor *)sharedProcessor;

- (UIImage *)imageFromConditionImage:(NSString *)conditionImage;
- (UIImage *)imageFromConditionImage:(NSString *)conditionImage imageSize:(ImageSize)imageSize;

- (NSData *)dataFromConditionImage:(NSString *)conditionImage;
- (SDLArtwork *)artworkFromConditionImage:(NSString *)conditionImage imageSize:(ImageSize)imageSize isPersistent:(BOOL)isPersistent;

@end
61 changes: 52 additions & 9 deletions MobileWeather/ImageProcessor.m
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,64 @@ - (instancetype)init {
return self;
}

- (UIImage *)imageFromConditionImage:(NSString *)conditionImage {
UIImage *image = [UIImage imageNamed:conditionImage];
- (UIImage *)imageFromConditionImage:(NSString *)conditionImage imageSize:(ImageSize)imageSize {
UIImage *image = [UIImage systemImageNamed:[self mw_systemImageFromAssetsImage:conditionImage] withConfiguration:[UIImageSymbolConfiguration configurationWithPointSize:[ImageSizeHelper floatForImageSize:imageSize] weight:UIImageSymbolWeightMedium]];

if (image == nil) {
image = [UIImage imageNamed:@"unknown"];
}

return image;
}

- (NSData *)dataFromConditionImage:(NSString *)conditionImage {
UIImage *image = [self imageFromConditionImage:conditionImage];
NSData *data = UIImagePNGRepresentation(image);

return data;
- (SDLArtwork *)artworkFromConditionImage:(NSString *)conditionImage imageSize:(ImageSize)imageSize isPersistent:(BOOL)isPersistent {
return [[SDLArtwork alloc] initWithImage:[[self imageFromConditionImage:conditionImage imageSize:imageSize] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate] persistent:isPersistent asImageFormat:SDLArtworkImageFormatPNG];
}

- (NSString *)mw_systemImageFromAssetsImage:(NSString *)imageName {
NSString *newImageName = imageName;
if ([imageName isEqualToString:@"chancerain"]) {
newImageName = @"cloud.drizzle";
} else if ([imageName isEqualToString:@"chancesnow"]) {
newImageName = @"cloud.snow";
} else if ([imageName isEqualToString:@"clear-day"]) {
newImageName = @"sun.max";
} else if ([imageName isEqualToString:@"clear-night"]) {
newImageName = @"moon";
} else if ([imageName isEqualToString:@"cloudy"]) {
newImageName = @"smoke";
} else if ([imageName isEqualToString:@"flurries"]) {
newImageName = @"snow";
} else if ([imageName isEqualToString:@"fog"]) {
newImageName = @"cloud.fog";
} else if ([imageName isEqualToString:@"hazy"]) {
newImageName = @"sun.haze";
} else if ([imageName isEqualToString:@"partly-cloudy-day"]) {
newImageName = @"cloud.sun";
} else if ([imageName isEqualToString:@"partly-cloudy-night"]) {
newImageName = @"cloud.moon";
} else if ([imageName isEqualToString:@"partlycloudy"]) {
newImageName = @"cloud";
} else if ([imageName isEqualToString:@"partlysunny"]) {
newImageName = @"cloud.sun";
} else if ([imageName isEqualToString:@"rain"]) {
newImageName = @"cloud.rain";
} else if ([imageName isEqualToString:@"sleet"]) {
newImageName = @"cloud.sleet";
} else if ([imageName isEqualToString:@"snow"]) {
newImageName = @"cloud.snow";
} else if ([imageName isEqualToString:@"sunny"]) {
newImageName = @"sun.max";
} else if ([imageName isEqualToString:@"tstorms"]) {
newImageName = @"cloud.bolt";
} else if ([imageName isEqualToString:@"menu-alert"]) {
newImageName = @"exclamationmark.triangle";
} else if ([imageName isEqualToString:@"menu-day"]) {
newImageName = @"calendar";
} else if ([imageName isEqualToString:@"menu-time"]) {
newImageName = @"clock";
}
return newImageName;
}

@end
20 changes: 20 additions & 0 deletions MobileWeather/ImageSize.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//
// ImageSize.h
// MobileWeather
//
// Created by Frank Elias on 6/28/21.
// Copyright © 2021 Ford. All rights reserved.
//

@import UIKit;

typedef NS_ENUM(NSUInteger, ImageSize) {
ImageSizeLarge,
ImageSizeSmall
};

@interface ImageSizeHelper : NSObject

+ (CGFloat)floatForImageSize:(ImageSize)imageSize;

@end
21 changes: 21 additions & 0 deletions MobileWeather/ImageSize.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//
// ImageSize.m
// MobileWeather
//
// Created by Frank Elias on 6/28/21.
// Copyright © 2021 Ford. All rights reserved.
//

#import "ImageSize.h"

@implementation ImageSizeHelper

+ (CGFloat)floatForImageSize:(ImageSize)imageSize {
if (imageSize == ImageSizeLarge) {
return 256;
} else {
return 64;
}
}

@end
6 changes: 3 additions & 3 deletions MobileWeather/Images.xcassets/Images/Contents.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
"author" : "xcode",
"version" : 1
}
}
}

This file was deleted.

Binary file not shown.

This file was deleted.

Binary file not shown.

This file was deleted.

Binary file not shown.

This file was deleted.

Binary file not shown.
21 changes: 0 additions & 21 deletions MobileWeather/Images.xcassets/Images/cloudy.imageset/Contents.json

This file was deleted.

Binary file not shown.

This file was deleted.

Binary file not shown.
21 changes: 0 additions & 21 deletions MobileWeather/Images.xcassets/Images/fog.imageset/Contents.json

This file was deleted.

Binary file not shown.
21 changes: 0 additions & 21 deletions MobileWeather/Images.xcassets/Images/hazy.imageset/Contents.json

This file was deleted.

Binary file not shown.
Loading

0 comments on commit 3c7e7f3

Please sign in to comment.