Skip to content

Commit

Permalink
Last commit before TestFlight!
Browse files Browse the repository at this point in the history
  • Loading branch information
xan-m committed Aug 21, 2021
1 parent 1535293 commit 70b2b87
Show file tree
Hide file tree
Showing 47 changed files with 75 additions and 58 deletions.
14 changes: 8 additions & 6 deletions Infini-iOS.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
264BFE7726BCAAC00050A223 /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = SOURCE_ROOT; };
264DB80A26C62ED600E812C3 /* SideMenu.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SideMenu.swift; sourceTree = "<group>"; };
264DB80C26C633CF00E812C3 /* PageSwitcher.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PageSwitcher.swift; sourceTree = "<group>"; };
2656FD9A26D1B30C001EF20C /* PrivacyPolicy.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = PrivacyPolicy.md; sourceTree = "<group>"; };
26A6314C26BEFD2C005AE404 /* MusicController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MusicController.swift; sourceTree = "<group>"; };
26A6315126BF45E0005AE404 /* BLEMusic.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BLEMusic.swift; sourceTree = "<group>"; };
26A6315426C0297A005AE404 /* Notifications.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Notifications.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -149,6 +150,7 @@
isa = PBXGroup;
children = (
264BFE7726BCAAC00050A223 /* README.md */,
2656FD9A26D1B30C001EF20C /* PrivacyPolicy.md */,
264BFE4026BC51CE0050A223 /* Infini-iOS */,
264BFE5726BC51CF0050A223 /* Infini-iOSTests */,
264BFE6226BC51CF0050A223 /* Infini-iOSUITests */,
Expand Down Expand Up @@ -611,16 +613,16 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_ASSET_PATHS = "\"Infini-iOS/Preview Content\"";
DEVELOPMENT_TEAM = T2VD6LADUL;
DEVELOPMENT_TEAM = 99BHY6DC82;
ENABLE_PREVIEWS = YES;
INFOPLIST_FILE = "Infini-iOS/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 0.0.1;
PRODUCT_BUNDLE_IDENTIFIER = "com.xan-m.Infini-iOS";
MARKETING_VERSION = 0.8;
PRODUCT_BUNDLE_IDENTIFIER = "com.alexemry.Infini-iOS";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
Expand All @@ -634,16 +636,16 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_ASSET_PATHS = "\"Infini-iOS/Preview Content\"";
DEVELOPMENT_TEAM = T2VD6LADUL;
DEVELOPMENT_TEAM = 99BHY6DC82;
ENABLE_PREVIEWS = YES;
INFOPLIST_FILE = "Infini-iOS/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 0.0.1;
PRODUCT_BUNDLE_IDENTIFIER = "com.xan-m.Infini-iOS";
MARKETING_VERSION = 0.8;
PRODUCT_BUNDLE_IDENTIFIER = "com.alexemry.Infini-iOS";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
Expand Down
Binary file modified Infini-iOS/Assets.xcassets/AppIcon.appiconset/Icon-1024.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Infini-iOS/Assets.xcassets/AppIcon.appiconset/Icon-120.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Infini-iOS/Assets.xcassets/AppIcon.appiconset/Icon-121.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Infini-iOS/Assets.xcassets/AppIcon.appiconset/Icon-152.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Infini-iOS/Assets.xcassets/AppIcon.appiconset/Icon-167.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Infini-iOS/Assets.xcassets/AppIcon.appiconset/Icon-180.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Infini-iOS/Assets.xcassets/AppIcon.appiconset/Icon-20.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Infini-iOS/Assets.xcassets/AppIcon.appiconset/Icon-29.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Infini-iOS/Assets.xcassets/AppIcon.appiconset/Icon-40.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Infini-iOS/Assets.xcassets/AppIcon.appiconset/Icon-41.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Infini-iOS/Assets.xcassets/AppIcon.appiconset/Icon-42.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Infini-iOS/Assets.xcassets/AppIcon.appiconset/Icon-58.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Infini-iOS/Assets.xcassets/AppIcon.appiconset/Icon-59.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Infini-iOS/Assets.xcassets/AppIcon.appiconset/Icon-60.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Infini-iOS/Assets.xcassets/AppIcon.appiconset/Icon-76.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Infini-iOS/Assets.xcassets/AppIcon.appiconset/Icon-80.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Infini-iOS/Assets.xcassets/AppIcon.appiconset/Icon-81.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Infini-iOS/Assets.xcassets/AppIcon.appiconset/Icon-87.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion Infini-iOS/BLE/BLEDelegates.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// BLEDelegates.swift
// Infini-iOS
//
// Created by xan-m on 8/15/21.
// Created by Alex Emry on 8/15/21.
//
//

Expand Down
2 changes: 1 addition & 1 deletion Infini-iOS/BLE/BLEManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// BLEManager.swift
// Infini-iOS
//
// Created by xan-m on 8/3/21.
// Created by Alex Emry on 8/3/21.
//

import Foundation
Expand Down
2 changes: 1 addition & 1 deletion Infini-iOS/BLE/BLEManagerExtensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// BLEManagerExtensions.swift
// Infini-iOS
//
// Created by xan-m on 8/15/21.
// Created by Alex Emry on 8/15/21.
//
//

Expand Down
19 changes: 9 additions & 10 deletions Infini-iOS/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// ContentView.swift
// Infini-iOS
//
// Created by xan-m on 8/5/21.
// Created by Alex Emry on 8/5/21.
//

import SwiftUI
Expand All @@ -13,9 +13,12 @@ struct ContentView: View {

@EnvironmentObject var pageSwitcher: PageSwitcher
@EnvironmentObject var bleManager: BLEManager
@ObservedObject var batteryNotifications = BatteryNotifications()

@AppStorage("autoconnect") var autoconnect: Bool = false
@AppStorage("autoconnectUUID") var autoconnectUUID: String = ""
@AppStorage("batteryNotification") var batteryNotification: Bool = false


init() {
UINavigationBar.appearance().setBackgroundImage(UIImage(), for: UIBarMetrics.default)
Expand All @@ -39,8 +42,7 @@ struct ContentView: View {
}
}
}
// let timer = Timer.publish(every: 60, on: .main, in: .common).autoconnect()


return NavigationView {
GeometryReader { geometry in
ZStack(alignment: .leading) {
Expand All @@ -49,6 +51,9 @@ struct ContentView: View {
// pop-up menu to connect to a device
Connect().environmentObject(self.bleManager)
})
.onChange(of: bleManager.batteryLevel) { bat in
batteryNotifications.notify(bat: Int(bat), bleManager: bleManager)
}
.frame(width: geometry.size.width, height: geometry.size.height)
.offset(x: self.pageSwitcher.showMenu ? geometry.size.width/2 : 0)
.disabled(self.pageSwitcher.showMenu ? true : false)
Expand All @@ -64,12 +69,7 @@ struct ContentView: View {
}
}
})
// TODO: decide if this matters? I want the graph to show up because I spent a lot of time on it, but is it important enough to pollute it with a ton of data at the expense of the phone's processing power?
// P.S. don't forget timer above the navigation view
//
//.onReceive(timer) { _ in
// bleManager.batChartDataPoints.append(bleManager.updateChartInfo(data: bleManager.batteryLevel, heart: false))
//}

.onAppear(){
// if autoconnect is set, start scan ASAP, but give bleManager half a second to start up
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5, execute: {
Expand Down Expand Up @@ -139,4 +139,3 @@ struct ContentView_Previews: PreviewProvider {
.environmentObject(BLEManager())
}
}

9 changes: 4 additions & 5 deletions Infini-iOS/DFU/DFU.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// DFU.swift
// Infini-iOS
//
// Created by xan-m on 8/11/21.
// Created by Alex Emry on 8/11/21.
//

import Foundation
Expand All @@ -15,9 +15,9 @@ class DFU_Updater: ObservableObject, DFUServiceDelegate, DFUProgressDelegate, Lo
var deviceToUpgrade: BLEManager.Peripheral!
var dfuController: DFUServiceController!

//@Published var dfuState: DFUState = DFUState.starting
@Published var dfuState: String = ""
@Published var transferFailed = false
@Published var percentComplete: Double!
@Published var percentComplete: Double = 0


func prepare(location: URL, device: BLEManager) {
Expand Down Expand Up @@ -50,8 +50,7 @@ class DFU_Updater: ObservableObject, DFUServiceDelegate, DFUProgressDelegate, Lo

// stubs added automatically.
func dfuStateDidChange(to state: DFUState) {
print(state.description())

dfuState = state.description()
}

func dfuError(_ error: DFUError, didOccurWithMessage message: String) {
Expand Down
2 changes: 1 addition & 1 deletion Infini-iOS/Infini_iOSApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Infini_iOSApp.swift
// Infini-iOS
//
// Created by xan-m on 8/5/21.
// Created by Alex Emry on 8/5/21.
//

import SwiftUI
Expand Down
2 changes: 1 addition & 1 deletion Infini-iOS/Music/BLEMusic.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// BLEMusic.swift
// Infini-iOS
//
// Created by xan-m on 8/7/21.
// Created by Alex Emry on 8/7/21.
//

import Foundation
Expand Down
2 changes: 1 addition & 1 deletion Infini-iOS/Music/MusicController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// MusicController.swift
// Infini-iOS
//
// Created by xan-m on 8/7/21.
// Created by Alex Emry on 8/7/21.
//

import Foundation
Expand Down
2 changes: 1 addition & 1 deletion Infini-iOS/Notifications/Notifications.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Notifications.swift
// Infini-iOS
//
// Created by xan-m on 8/8/21.
// Created by Alex Emry on 8/8/21.
//

import Foundation
Expand Down
2 changes: 1 addition & 1 deletion Infini-iOS/Persistence.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Persistence.swift
// Infini-iOS
//
// Created by xan-m on 8/5/21.
// Created by Alex Emry on 8/5/21.
//

import CoreData
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// PhoneNotificationsView.swift
// Infini-iOS
//
// Created by xan-m on 8/16/21.
// Created by Alex Emry on 8/16/21.
//
//

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// WatchNotificationsView.swift
// Infini-iOS
//
// Created by xan-m on 8/16/21.
// Created by Alex Emry on 8/16/21.
//
//

Expand Down
24 changes: 18 additions & 6 deletions Infini-iOS/Settings/SettingsFunctions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,30 @@
// SettingsFunctions.swift
// Infini-iOS
//
// Created by xan-m on 8/15/21.
// Created by Alex Emry on 8/15/21.
//
//


import Foundation

class SettingsFunctions {
func batteryNotification(bat: Int, bleManager: BLEManager) {
if bat == 20 {
print("test")
bleManager.sendNotification(notification: "Battery at 20%")
class BatteryNotifications: ObservableObject {

@Published var twenty: Bool = false
@Published var ten: Bool = false

func notify(bat: Int, bleManager: BLEManager) {
if UserDefaults.standard.object(forKey: "batteryNotifications") as! Bool? == true{
if bat > 20 {
twenty = false
ten = false
} else if (bat <= 20 && bat > 10) && twenty == false {
bleManager.sendNotification(notification: "Battery Low")
twenty = true
} else if (bat <= 10 && bat > 5) && ten == false {
bleManager.sendNotification(notification: "Battery Low")
ten = true
}
}
}
}
2 changes: 1 addition & 1 deletion Infini-iOS/Utilities/ColorPalette.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// ColorPalette.swift
// Infini-iOS
//
// Created by xan-m on 8/16/21.
// Created by Alex Emry on 8/16/21.
//
//

Expand Down
2 changes: 1 addition & 1 deletion Infini-iOS/Utilities/HexStringToData.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// HexStringToData.swift
// Infini-iOS
//
// Cloned by xan-m on 8/4/21 (with many thanks) from https://gist.github.com/gamako/94c8cb8873cabb97291b5a839ead50ca
// Cloned by Alex Emry on 8/4/21 (with many thanks) from https://gist.github.com/gamako/94c8cb8873cabb97291b5a839ead50ca
//
// extends String to add .hex and .hexData conversions to make my life a million times easier when writing to PineTime
//
Expand Down
2 changes: 1 addition & 1 deletion Infini-iOS/View Components/BLEConnectView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// BLEView.swift
// Infini-iOS
//
// Created by xan-m on 8/11/21.
// Created by Alex Emry on 8/11/21.
//

import Foundation
Expand Down
4 changes: 2 additions & 2 deletions Infini-iOS/View Components/BLEStatusView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// BLEStatusView.swift
// Infini-iOS
//
// Created by xan-m on 8/13/21.
// Created by Alex Emry on 8/13/21.
//

import Foundation
Expand Down Expand Up @@ -43,7 +43,7 @@ struct StatusView: View {
.padding(.vertical, 7)
.frame(maxWidth: .infinity, alignment: .center)
.background(colorScheme == .dark ? Color.gray : Color.lightGray)
.foregroundColor(colorScheme == .dark ? Color.gray : Color.white)
.foregroundColor(Color.white)
.cornerRadius(10)
.padding(.horizontal, 20)
.padding(.bottom)
Expand Down
8 changes: 6 additions & 2 deletions Infini-iOS/View Components/DFU/DFUProgressBar.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// DFUProgressBar.swift
// Infini-iOS
//
// Created by xan-m on 8/19/21.
// Created by Alex Emry on 8/19/21.
//
//

Expand All @@ -16,18 +16,22 @@ struct DFUProgressBar: View {
@EnvironmentObject var dfuUpdater: DFU_Updater

var body: some View {
VStack {
Text("DFU Status: " + dfuUpdater.dfuState)
Text("Progress:")
ZStack {
GeometryReader { geometry in
Capsule()
.frame(width: geometry.size.width * 0.9, height: 10, alignment: .center)
.foregroundColor(colorScheme == .dark ? Color.darkGray : Color.gray)
.padding(.horizontal)
Capsule()
.frame(width: (geometry.size.width * CGFloat((dfuUpdater.percentComplete ?? 0.0)/100)) * 0.9, height: 10)
.frame(width: (geometry.size.width * CGFloat((dfuUpdater.percentComplete)/100)) * 0.9, height: 10)
.foregroundColor(colorScheme == .dark ? Color.white : Color.black)
.padding(.horizontal)
.animation(.easeIn)
}
}
}
}
}
Expand Down
9 changes: 3 additions & 6 deletions Infini-iOS/View Components/DFU/DFUView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// DFUView.swift
// Infini-iOS
//
// Created by xan-m on 8/11/21.
// Created by Alex Emry on 8/11/21.
//

import Foundation
Expand Down Expand Up @@ -45,11 +45,8 @@ struct DFUView: View {
Spacer()

if updateStarted {
Text("Progress:")
.frame(maxWidth: .infinity, alignment: .center)
.padding(.horizontal)
DFUProgressBar().environmentObject(dfuUpdater)
.frame(height: 20 ,alignment: .center)
.frame(height: 40 ,alignment: .center)
.padding()
}

Expand All @@ -60,7 +57,7 @@ struct DFUView: View {
.padding()
.padding(.vertical, 7)
.frame(maxWidth: .infinity, alignment: .center)
.background(Color.gray)
.background(colorScheme == .dark ? Color.darkGray : Color.gray)
.foregroundColor(Color.white)
.cornerRadius(10)
.padding(.horizontal, 20)
Expand Down
2 changes: 1 addition & 1 deletion Infini-iOS/View Components/PageSwitcher.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// PageSwitcher.swift
// Infini-iOS
//
// Created by xan-m on 8/12/21.
// Created by Alex Emry on 8/12/21.
//

import Foundation
Expand Down
Loading

0 comments on commit 70b2b87

Please sign in to comment.