mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-07-18 07:26:23 +00:00
* ios: notifications service extension * create notifications in NSE (WIP) * refactor notifications to use in NSE * prepend team ID to shared defaults name to silence the warning * remove whitespace
31 lines
684 B
Swift
31 lines
684 B
Swift
//
|
|
// GroupDefaults.swift
|
|
// SimpleX (iOS)
|
|
//
|
|
// Created by Evgeny on 26/04/2022.
|
|
// Copyright © 2022 SimpleX Chat. All rights reserved.
|
|
//
|
|
|
|
import Foundation
|
|
import SwiftUI
|
|
|
|
func getGroupDefaults() -> UserDefaults? {
|
|
UserDefaults(suiteName: "5NN7GUYB6T.group.chat.simplex.app")
|
|
}
|
|
|
|
func setAppState(_ phase: ScenePhase) {
|
|
if let defaults = getGroupDefaults() {
|
|
defaults.set(phase == .background, forKey: "appInBackground")
|
|
defaults.synchronize()
|
|
}
|
|
}
|
|
|
|
func getAppState() -> ScenePhase {
|
|
if let defaults = getGroupDefaults() {
|
|
if defaults.bool(forKey: "appInBackground") {
|
|
return .background
|
|
}
|
|
}
|
|
return .active
|
|
}
|