Skip to content

Commit

Permalink
Update settings header with version, build number, branch name, commi…
Browse files Browse the repository at this point in the history
…t ID and copyright notice. (Artificial-Pancreas#541)
  • Loading branch information
bjornoleh authored Jan 5, 2023
1 parent fdb0ec2 commit 0ad0d84
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 18 deletions.
2 changes: 1 addition & 1 deletion Config.xcconfig
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
APP_DISPLAY_NAME = FreeAPS X
APP_VERSION = 0.6.1
APP_BUILD_NUMBER = 1
BRANCH = bdb
COPYRIGHT_NOTICE =
DEVELOPER_TEAM = ##TEAM_ID##
BUNDLE_IDENTIFIER = ru.artpancreas.$(DEVELOPMENT_TEAM).FreeAPS
APP_GROUP_ID = group.com.$(DEVELOPMENT_TEAM).loopkit.LoopGroup
Expand Down
40 changes: 31 additions & 9 deletions FreeAPS.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 52;
objectVersion = 54;
objects = {

/* Begin PBXBuildFile section */
Expand Down Expand Up @@ -1951,6 +1951,7 @@
388E595625AD948C0019842D /* Resources */,
3821ECD025DC703C00BC42AD /* Embed Frameworks */,
38E8753D27554D5900975559 /* Embed Watch Content */,
B99D8B8E295F34DB00420AB8 /* Run Script */,
);
buildRules = (
);
Expand Down Expand Up @@ -2160,6 +2161,25 @@
shellPath = /bin/sh;
shellScript = "source \"${SRCROOT}\"/scripts/swiftformat.sh\n\n";
};
B99D8B8E295F34DB00420AB8 /* Run Script */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
);
name = "Run Script";
outputFileListPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "#!/bin/sh\n\ngit_version=$(git log -1 --format=\"%h\")\ngit_branch=$(git symbolic-ref --short -q HEAD)\ngit_tag=$(git describe --tags --exact-match 2>/dev/null)\n\ngit_branch_or_tag=\"${git_branch:-${git_tag}}\"\ngit_branch_or_tag_version=\"${git_branch:-${git_tag}}-${git_version}\"\n\ninfo_plist=\"${BUILT_PRODUCTS_DIR}/${INFOPLIST_PATH}\"\n\n/usr/libexec/PlistBuddy -c \"Set :BuildBranch '${git_branch_or_tag_version}'\" \"${info_plist}\"\n";
};
/* End PBXShellScriptBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
Expand Down Expand Up @@ -2573,7 +2593,7 @@
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = $CURRENT_PROJECT_VERSION;
CURRENT_PROJECT_VERSION = "$(APP_BUILD_NUMBER)";
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
Expand All @@ -2592,6 +2612,7 @@
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 15.1;
MARKETING_VERSION = "$(APP_VERSION)";
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
Expand Down Expand Up @@ -2637,7 +2658,7 @@
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = $CURRENT_PROJECT_VERSION;
CURRENT_PROJECT_VERSION = "$(APP_BUILD_NUMBER)";
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
Expand All @@ -2650,6 +2671,7 @@
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 15.1;
MARKETING_VERSION = "$(APP_VERSION)";
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
SDKROOT = iphoneos;
Expand All @@ -2669,7 +2691,7 @@
BUNDLE_IDENTIFIER = "$(BUNDLE_IDENTIFIER)";
CODE_SIGN_ENTITLEMENTS = FreeAPS/Resources/FreeAPS.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 3;
CURRENT_PROJECT_VERSION = $APP_BUILD_NUMBER;
DEVELOPMENT_ASSET_PATHS = "";
DEVELOPMENT_TEAM = "$(DEVELOPER_TEAM)";
ENABLE_PREVIEWS = YES;
Expand Down Expand Up @@ -2705,7 +2727,7 @@
BUNDLE_IDENTIFIER = "$(BUNDLE_IDENTIFIER)";
CODE_SIGN_ENTITLEMENTS = FreeAPS/Resources/FreeAPS.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 3;
CURRENT_PROJECT_VERSION = $APP_BUILD_NUMBER;
DEVELOPMENT_ASSET_PATHS = "";
DEVELOPMENT_TEAM = "$(DEVELOPER_TEAM)";
ENABLE_PREVIEWS = YES;
Expand Down Expand Up @@ -2742,7 +2764,7 @@
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
CODE_SIGN_ENTITLEMENTS = FreeAPSWatch/FreeAPSWatch.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 3;
CURRENT_PROJECT_VERSION = $APP_BUILD_NUMBER;
DEVELOPMENT_TEAM = "$(DEVELOPER_TEAM)";
GENERATE_INFOPLIST_FILE = YES;
IBSC_MODULE = FreeAPSWatch_WatchKit_Extension;
Expand Down Expand Up @@ -2772,7 +2794,7 @@
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
CODE_SIGN_ENTITLEMENTS = FreeAPSWatch/FreeAPSWatch.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 3;
CURRENT_PROJECT_VERSION = $APP_BUILD_NUMBER;
DEVELOPMENT_TEAM = "$(DEVELOPER_TEAM)";
GENERATE_INFOPLIST_FILE = YES;
IBSC_MODULE = FreeAPSWatch_WatchKit_Extension;
Expand Down Expand Up @@ -2800,7 +2822,7 @@
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
CODE_SIGN_ENTITLEMENTS = "FreeAPSWatch WatchKit Extension/FreeAPSWatch WatchKit Extension.entitlements";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 3;
CURRENT_PROJECT_VERSION = $APP_BUILD_NUMBER;
DEVELOPMENT_ASSET_PATHS = "\"FreeAPSWatch WatchKit Extension/Preview Content\"";
DEVELOPMENT_TEAM = "${DEVELOPER_TEAM}";
ENABLE_PREVIEWS = YES;
Expand Down Expand Up @@ -2839,7 +2861,7 @@
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
CODE_SIGN_ENTITLEMENTS = "FreeAPSWatch WatchKit Extension/FreeAPSWatch WatchKit Extension.entitlements";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 3;
CURRENT_PROJECT_VERSION = $APP_BUILD_NUMBER;
DEVELOPMENT_ASSET_PATHS = "\"FreeAPSWatch WatchKit Extension/Preview Content\"";
DEVELOPMENT_TEAM = "${DEVELOPER_TEAM}";
ENABLE_PREVIEWS = YES;
Expand Down
4 changes: 3 additions & 1 deletion FreeAPS/Resources/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
<dict>
<key>AppGroupID</key>
<string>$(APP_GROUP_ID)</string>
<key>BuildBranch</key>
<string></string>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key>
Expand Down Expand Up @@ -68,7 +70,7 @@
<key>NSHealthUpdateUsageDescription</key>
<string>Health App is used to store blood glucose data</string>
<key>NSHumanReadableCopyright</key>
<string>$(BRANCH)</string>
<string>$(COPYRIGHT_NOTICE)</string>
<key>UIApplicationSceneManifest</key>
<dict>
<key>UIApplicationSupportsMultipleScenes</key>
Expand Down
2 changes: 1 addition & 1 deletion FreeAPS/Sources/APS/APSManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -805,7 +805,7 @@ final class BaseAPSManager: APSManager, Injectable {
let buildDate = Bundle.main.buildDate
let version = Bundle.main.releaseVersionNumber
let build = Bundle.main.buildVersionNumber
let branch = Bundle.main.infoDictionary?["NSHumanReadableCopyright"] as? String
let branch = Bundle.main.infoDictionary?["BuildBranch"] as? String
let pump_ = pumpManager?.localizedTitle ?? ""
let cgm = settingsManager.settings.cgm
let file = OpenAPS.Monitor.statistics
Expand Down
14 changes: 13 additions & 1 deletion FreeAPS/Sources/Modules/Settings/SettingsStateModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,25 @@ extension Settings {

private(set) var buildNumber = ""

private(set) var versionNumber = ""

private(set) var branch = ""

private(set) var copyrightNotice = ""

override func subscribe() {
subscribeSetting(\.debugOptions, on: $debugOptions) { debugOptions = $0 }
subscribeSetting(\.closedLoop, on: $closedLoop) { closedLoop = $0 }

broadcaster.register(SettingsObserver.self, observer: self)

buildNumber = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String ?? "Unknown"
buildNumber = Bundle.main.infoDictionary?["CFBundleVersion"] as? String ?? "Unknown"

versionNumber = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String ?? "Unknown"

branch = Bundle.main.infoDictionary?["BuildBranch"] as? String ?? "Unknown"

copyrightNotice = Bundle.main.infoDictionary?["NSHumanReadableCopyright"] as? String ?? ""

subscribeSetting(\.animatedBackground, on: $animatedBackground) { animatedBackground = $0 }
}
Expand Down
6 changes: 5 additions & 1 deletion FreeAPS/Sources/Modules/Settings/View/SettingsRootView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ extension Settings {

var body: some View {
Form {
Section(header: Text("FreeAPS X v\(state.buildNumber)")) {
Section(
header: Text(
"FreeAPS X v\(state.versionNumber) - \(state.buildNumber) \nBranch: \(state.branch) \(state.copyrightNotice) "
)
) {
Toggle("Closed loop", isOn: $state.closedLoop)
}

Expand Down
4 changes: 0 additions & 4 deletions FreeAPSTests/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,5 @@
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
</plist>

0 comments on commit 0ad0d84

Please sign in to comment.