diff --git a/README.md b/README.md index c5538be..69cf91a 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,8 @@ swift build --configuration release sudo cp .build/x86_64-apple-macosx10.10/release/wallpapper /usr/local/bin ``` +If you are using swift in version 4.1, please edit `Package.swift` file and put there your version of swift (in first line). + Now in the console you can run `wallpapper -h` and you should got a response similar to the following one. ```bash @@ -39,6 +41,8 @@ If you have done above commands now you can build dynamic wallpaper. It's really { "fileName": "1.png", "isPrimary": true, + "isForLight": true, + "isForDark": false, "themeMode": 1, "altitude": 27.95, "azimuth": 279.66 @@ -46,6 +50,8 @@ If you have done above commands now you can build dynamic wallpaper. It's really { "fileName": "2.png", "isPrimary": false, + "isForLight": false, + "isForDark": false, "themeMode": 1, "altitude": -31.05, "azimuth": 4.16 @@ -54,6 +60,8 @@ If you have done above commands now you can build dynamic wallpaper. It's really { "fileName": "16.png", "isPrimary": false, + "isForLight": false, + "isForDark": true, "themeMode": 1, "altitude": -28.63, "azimuth": 340.41 @@ -65,7 +73,8 @@ Properties: - `fileName` - name of picture file name. - `isPrimary` - information about image which is primary image (it will be visible after creating `heic` file). Only one of the file can be primary. -- `themeMode` - information about mode which will display picture. 0 - picture will be displayed in both modes (light/dark). 1 - picture will be displayed only in light mode. +- `isForLight` - if `true` picture will be displayed when user chose "Light (static)" wallpaper +- `isForDark` - if `true` picture will be displayed when user chose "Dark (static)" wallpaper - `altitude` - is the angle between the Sun and the observer's local horizon. - `azimuth` - that is the angle of the Sun around the horizon. diff --git a/Sources/wallpapper/Generator.swift b/Sources/wallpapper/Generator.swift index f173799..99a0ad7 100644 --- a/Sources/wallpapper/Generator.swift +++ b/Sources/wallpapper/Generator.swift @@ -81,9 +81,16 @@ class Generator { let sequenceItem = SequenceItem() sequenceItem.a = item.altitude sequenceItem.z = item.azimuth - sequenceItem.o = item.themeMode == .both ? 0 : 1 sequenceItem.i = index + if item.isForLight { + sequenceInfo.ap.l = index + } + + if item.isForDark { + sequenceInfo.ap.d = index + } + sequenceInfo.si.append(sequenceItem) } diff --git a/Sources/wallpapper/Model/PictureInfo.swift b/Sources/wallpapper/Model/PictureInfo.swift index f6cdce2..9520b59 100644 --- a/Sources/wallpapper/Model/PictureInfo.swift +++ b/Sources/wallpapper/Model/PictureInfo.swift @@ -11,14 +11,16 @@ import Foundation class PictureInfo: Decodable { var fileName: String var isPrimary = false - var themeMode: ThemeMode = .both + var isForLight = false + var isForDark = false var altitude = 0.0 var azimuth = 0.0 - init(fileName: String, isPrimary: Bool, themeMode: ThemeMode, altitude: Double, azimuth: Double) { + init(fileName: String, isPrimary: Bool, isForLight: Bool, isForDark: Bool, altitude: Double, azimuth: Double) { self.fileName = fileName self.isPrimary = isPrimary - self.themeMode = themeMode + self.isForLight = isForLight + self.isForDark = isForDark self.altitude = altitude self.azimuth = azimuth } diff --git a/Sources/wallpapper/Model/ThemeMode.swift b/Sources/wallpapper/Model/ThemeMode.swift deleted file mode 100644 index 81c42a9..0000000 --- a/Sources/wallpapper/Model/ThemeMode.swift +++ /dev/null @@ -1,14 +0,0 @@ -// -// ThemeMode.swift -// wallpapper -// -// Created by Marcin Czachurski on 03/07/2018. -// Copyright © 2018 Marcin Czachurski. All rights reserved. -// - -import Foundation - -enum ThemeMode: Int, Decodable { - case both = 0 - case light = 1 -} diff --git a/Sources/wallpapper/PropertyList/Apperance.swift b/Sources/wallpapper/PropertyList/Apperance.swift new file mode 100644 index 0000000..7493901 --- /dev/null +++ b/Sources/wallpapper/PropertyList/Apperance.swift @@ -0,0 +1,13 @@ +// +// Apperance.swift +// wallpapper +// +// Created by Marcin Czachurski on 31/07/2018. +// + +import Foundation + +class Apperance: Codable { + var d: Int = 0 + var l: Int = 0 +} diff --git a/Sources/wallpapper/PropertyList/SequenceInfo.swift b/Sources/wallpapper/PropertyList/SequenceInfo.swift index d0cd0be..00caceb 100644 --- a/Sources/wallpapper/PropertyList/SequenceInfo.swift +++ b/Sources/wallpapper/PropertyList/SequenceInfo.swift @@ -10,4 +10,5 @@ import Foundation class SequenceInfo : Codable { var si: [SequenceItem] = [] + var ap = Apperance() } diff --git a/Sources/wallpapper/PropertyList/SequenceItem.swift b/Sources/wallpapper/PropertyList/SequenceItem.swift index daa1c37..2d7afac 100644 --- a/Sources/wallpapper/PropertyList/SequenceItem.swift +++ b/Sources/wallpapper/PropertyList/SequenceItem.swift @@ -12,5 +12,4 @@ class SequenceItem : Codable { var a: Double = 0.0 var z: Double = 0.0 var i: Int = 0 - var o: Int = 0 }