Skip to content

Commit

Permalink
Build 1.0 (9)
Browse files Browse the repository at this point in the history
- Fixes crashing with 100k+ photo libraries
- Fixes TabView scrolling issues
- Improves Home Screen animations
- Fixes Camera not stopping after exiting app
- Fixes Home Screen for iPhone 8 sized devices
- Fixes game center
- Improves shadows
- Adds unlock sound
  • Loading branch information
zzanehip committed Jun 12, 2021
1 parent e142a62 commit 85de870
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 5 deletions.
4 changes: 4 additions & 0 deletions OldOS/OldOS.xcodeproj/project.pbxproj
Expand Up @@ -82,6 +82,7 @@
0D818C802600500B00824F8E /* AppStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0D818C7F2600500B00824F8E /* AppStore.swift */; };
0D818C862603FCDA00824F8E /* FeedKit in Frameworks */ = {isa = PBXBuildFile; productRef = 0D818C852603FCDA00824F8E /* FeedKit */; };
0D818C8C26059B4500824F8E /* SDWebImageSwiftUI in Frameworks */ = {isa = PBXBuildFile; productRef = 0D818C8B26059B4500824F8E /* SDWebImageSwiftUI */; };
0DD19EEF2675418600A3EEF8 /* unlock.aiff in Resources */ = {isa = PBXBuildFile; fileRef = 0DD19EEE2675418600A3EEF8 /* unlock.aiff */; };
0DDBD2142624FF6600106345 /* cities.json in Resources */ = {isa = PBXBuildFile; fileRef = 0DDBD2132624FF6600106345 /* cities.json */; };
0DEF66F6260CFBF800341037 /* iTunes.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0DEF66F5260CFBF800341037 /* iTunes.swift */; };
0DEF66FB2610240F00341037 /* style.css in Resources */ = {isa = PBXBuildFile; fileRef = 0DEF66FA2610240F00341037 /* style.css */; };
Expand Down Expand Up @@ -191,6 +192,7 @@
0D818C2D25F7308300824F8E /* Hackensack.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = Hackensack.ttf; sourceTree = "<group>"; };
0D818C3525F92A9200824F8E /* GameKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GameKit.framework; path = System/Library/Frameworks/GameKit.framework; sourceTree = SDKROOT; };
0D818C7F2600500B00824F8E /* AppStore.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppStore.swift; sourceTree = "<group>"; };
0DD19EEE2675418600A3EEF8 /* unlock.aiff */ = {isa = PBXFileReference; lastKnownFileType = audio.aiff; path = unlock.aiff; sourceTree = "<group>"; };
0DDBD2132624FF6600106345 /* cities.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = cities.json; sourceTree = "<group>"; };
0DE37D4B267058C9001196E3 /* Camera-SwiftUI-main */ = {isa = PBXFileReference; lastKnownFileType = folder; path = "Camera-SwiftUI-main"; sourceTree = "<group>"; };
0DEF66F5260CFBF800341037 /* iTunes.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = iTunes.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -385,6 +387,7 @@
0D818BD225EDF89100824F8E /* Tones */ = {
isa = PBXGroup;
children = (
0DD19EEE2675418600A3EEF8 /* unlock.aiff */,
0D80447B26628BF000000171 /* begin_video_record.caf */,
0D80447C26628BF100000171 /* end_video_record.caf */,
0D818BCA25EDDF0700824F8E /* dtmf-0.caf */,
Expand Down Expand Up @@ -575,6 +578,7 @@
0D818C2925F7307F00824F8E /* Superclarendon Bold.ttf in Resources */,
0D39B3F625AA9EB700B42A84 /* Assets.xcassets in Resources */,
0D0FB50B262A75F4008AE4C5 /* NextPageNoTextureFragmentShader.glsl in Resources */,
0DD19EEF2675418600A3EEF8 /* unlock.aiff in Resources */,
0DDBD2142624FF6600106345 /* cities.json in Resources */,
0D818BE725EDF98300824F8E /* dtmf-4.caf in Resources */,
0D818BE325EDF98300824F8E /* dtmf-star.caf in Resources */,
Expand Down
5 changes: 5 additions & 0 deletions OldOS/OldOS/Camera.swift
Expand Up @@ -31,6 +31,8 @@ struct Camera: View {
}

}
}.onDisappear() {
model.end_session()
}
}
}
Expand Down Expand Up @@ -320,4 +322,7 @@ final class CameraModel: ObservableObject {
func record() {
service.record()
}
func end_session() {
service.session.stopRunning()
}
}
11 changes: 7 additions & 4 deletions OldOS/OldOS/HomeScreen.swift
Expand Up @@ -167,9 +167,7 @@ struct HomeScreen: View {
LinearGradient(gradient:Gradient(colors: [Color(red: 34/255, green: 34/255, blue: 34/255).opacity(0.0), Color(red: 24/255, green: 24/255, blue: 24/255).opacity(0.85)]), startPoint: .top, endPoint: .bottom).frame(minWidth: geometry.size.width, maxWidth:geometry.size.width, minHeight: geometry.size.height/4.25, maxHeight: geometry.size.height/4.25, alignment: .center).clipped()
}
}
if selectedPage == 0 {
Color.black.opacity(0.65).padding(.top, 24)
}
Color.black.opacity(selectedPage == 0 ? 0.65 : 0).padding(.top, 24)
VStack {
status_bar().frame(minHeight: 24, maxHeight:24).zIndex(1)
Spacer().frame(height: 30)
Expand Down Expand Up @@ -231,6 +229,11 @@ struct HomeScreen: View {
}.padding(.bottom, 110).offset(y:dock_offset).offset(y:bottom_indicator_offset)
}
}.onAppear() {
//MARK — iPhone 8
if UIScreen.main.bounds.width == 375 && UIScreen.main.bounds.height == 667 {
bottom_indicator_offset = 17.5
icon_scaler = 0.55
}
//MARK — iPhone 8 Plus
if UIScreen.main.bounds.width == 414 && UIScreen.main.bounds.height == 736 {
bottom_indicator_offset = 10
Expand Down Expand Up @@ -319,7 +322,7 @@ struct search_results_view: View {
}.frame(height: geometry.size.height).background(Color(red: 228/255, green: 229/255, blue: 230/255)).cornerRadius(12)
}
}.onAppear() {
UIScrollView.appearance().bounces = true
//UIScrollView.appearance().bounces = true -> There's something weird going on where we can't readily modify the bounce value of our scrollviews in the TabView. Therefore, our app pages bounce, when they shouldn't. For now, we'll compromise and have the search not bounce, instead of the apps bouncing.
}.onDisappear() {
UIScrollView.appearance().bounces = false
}
Expand Down
19 changes: 19 additions & 0 deletions OldOS/OldOS/LockScreen.swift
Expand Up @@ -8,6 +8,7 @@
import SwiftUI
import CoreTelephony
import PureSwiftUITools
import AVKit

struct LockScreen: View {
@Binding var current_view: String
Expand Down Expand Up @@ -208,6 +209,7 @@ extension View {
}
}
struct DraggableView: ViewModifier {
@State var audioPlayer: AVAudioPlayer!
@Binding var offset: CGPoint
@Binding var current_view: String
@Binding var out_slides: CGFloat
Expand All @@ -232,6 +234,7 @@ struct DraggableView: ViewModifier {
}.onEnded { value in
if self.offset.x >= width - (50+81) {
//unlock
playSounds("unlock.aiff")
self.offset.x = width - (50+81)
withAnimation(.easeIn(duration: 0.15)) {
out_slides = 120
Expand All @@ -255,4 +258,20 @@ struct DraggableView: ViewModifier {
})
.offset(x: offset.x > 0 ? offset.x : 0, y: 0)
}

func playSounds(_ soundFileName : String) {
DispatchQueue.global(qos: .background).async {
guard let soundURL = Bundle.main.url(forResource: soundFileName, withExtension: nil) else {
return
}

do {
audioPlayer = try AVAudioPlayer(contentsOf: soundURL)
} catch {
print(error.localizedDescription)
}
audioPlayer.setVolume(0.05, fadeDuration: 1.0)
audioPlayer.play()
}
}
}
1 change: 1 addition & 0 deletions OldOS/OldOS/Photos.swift
Expand Up @@ -554,6 +554,7 @@ class PhotosObserver: ObservableObject {
fetchOptions.predicate = NSPredicate(format: "mediaType == %d || mediaType == %d",
PHAssetMediaType.image.rawValue,
PHAssetMediaType.video.rawValue)
fetchOptions.fetchLimit = 50000 //Let's try limiting to 50k to avoid crashing...some people have libraries over 100k and that is just somthing we can't handle.
let assets = PHAsset.fetchAssets(with: fetchOptions)
assets.enumerateObjects({ (object, count, stop) in
DispatchQueue.main.async() {
Expand Down
2 changes: 1 addition & 1 deletion OldOS/OldOS/Settings.swift
Expand Up @@ -1724,7 +1724,7 @@ struct photos_view: View {
}
Spacer().frame(height:15)
HStack {
Text("HDR blens the best parts of three\nseparate exposures into a single photo.").multilineTextAlignment(.leading).lineLimit(nil).fixedSize(horizontal: false, vertical: true).foregroundColor(Color(red: 76/255, green: 86/255, blue: 108/255)).font(.custom("Helvetica Neue Regular", size: 15)).shadow(color: Color.white.opacity(0.9), radius: 0, x: 0.0, y: 0.9).padding([.leading, .trailing], 24).frame(maxHeight: .infinity)
Text("HDR blends the best parts of three\nseparate exposures into a single photo.").multilineTextAlignment(.leading).lineLimit(nil).fixedSize(horizontal: false, vertical: true).foregroundColor(Color(red: 76/255, green: 86/255, blue: 108/255)).font(.custom("Helvetica Neue Regular", size: 15)).shadow(color: Color.white.opacity(0.9), radius: 0, x: 0.0, y: 0.9).padding([.leading, .trailing], 24).frame(maxHeight: .infinity)
Spacer()
}
Spacer().frame(height: 15)
Expand Down
Binary file added OldOS/OldOS/Tones/unlock.aiff
Binary file not shown.

0 comments on commit 85de870

Please sign in to comment.