Code Monkey home page Code Monkey logo

oscen's Introduction

Oscen

Oscen is an iOS app that allows admins to deploy simple surveys via managed app configurations.

App Store: https://apps.apple.com/us/app/oscen/id1579957059#?platform=iphone

Requirements

This app must be deployed via an MDM since it requires a managed app configuration.

Installation

Option 1

  • Reserve licenses via Apple School Manager or Apple Business Manager
  • Deploy the app to devices
  • Deploy the managed app configuration to the devices

Option 2 (requires Apple Developer Enterprise Program)

  • Archive app via XCode and choose distribute > enterprise and create an enterprise build
  • Upload the app to MDM and deploy to devices
  • Deploy the managed app configuration to the devices

Configuration

The managed app configuration id is com.pirklator.Oscen

The configuration format:

Key: title
Format: String
Key: webhook
Format: url
Key: variables
Format: Dictionary of String, String
Key: questions
Format: Array of Dictionaries
  Key: questionId
  Format: String
  Key: questionText
  Format: String
  Key: questionType
  Format: Enum, enter either textInput or dropdown
  Key: questionAnswers
  Format: Array of strings - note the array can be empty if using textInput

I know it's complicated, a page to generate these will be coming shortly.

A sample managed app configuration:

<plist>
<dict>
    <key>questions</key>
    <array>
        <dict>
            <key>questionAnswers</key>
            <array/>
            <key>questionId</key>
            <string>anystringhere</string>
            <key>questionText</key>
            <string>Question text here</string>
            <key>questionType</key>
            <string>textInput</string>
        </dict>
        <dict>
            <key>questionAnswers</key>
            <array>
                <string>one</string>
                <string>two</string>
                <string>three</string>
            </array>
            <key>questionId</key>
            <string>2</string>
            <key>questionText</key>
            <string>Pick One</string>
            <key>questionType</key>
            <string>dropdown</string>
        </dict>
        <dict>
            <key>questionAnswers</key>
            <array>
                <string>blue</string>
                <string>cat</string>
                <string>green</string>
            </array>
            <key>questionId</key>
            <string>4</string>
            <key>questionText</key>
            <string>Choose a color</string>
            <key>questionType</key>
            <string>dropdown</string>
        </dict>
    </array>
    <key>title</key>
    <string>SurveyTitleHere</string>
    <key>variables</key>
    <dict>
        <key>variablenamehere</key>
        <string>variabletosendhere</string>
        <key>variable2</key>
        <string>%udid% %username% to fill values from Jamf School</string>
        <key>variable3</key>
        <string>something else</string>
    </dict>
    <key>webhook</key>
    <string>https://server.to.post.to.here</string>
</dict>
</plist>

Development

To start development clone the repo and in Targets > Oscen > Team > Choose a team. No developer program enrollment is required for this, it only allows the app to build locally.

All code is compatible with catalyst, but the menu items don't work and I didn't bother to figure out why. If that was fixed this could be built for macOS.

Note mocks are used when running debug builds, so questions will automatically fill and behavior is not identical to production.

oscen's People

Contributors

apirkl avatar pirkla avatar

Stargazers

Andreas Schmitt avatar Mike Matz avatar

Watchers

 avatar

oscen's Issues

Add ability to configure a banner image

Add an option to configure a banner image in the app. What would this look like? A few possibilities:

  • Add a new config option that provides Data then attempt to load the data as an image
  • Add a new config option that provides a url for a location to load an image

In all cases it should also:

  • Not show artifacts when the banner fails to load (i.e. if url has no image or is invalid then don't show. anything)
  • Autoformat itself - in the app the image shouldn't be distorted so it should maintain constraints. This means it is on the admin to make sure the image is the right size

Make error details configurable

Make details in error configurable to allow admins to enter a phone number or email for users to reach out to for assistance

Add macOS compatibility

Make the app compatible with macOS. It technically is, but the dropdown lists are unclickable.

Line up text for dropdown menus

The placeholder text for dropdown menus is all over the place and doesn't look very clean. They should be cleaned up to look nice, maybe aligned to the right, whatever works.

Example of misaligned menus:
Simulator Screen Shot - iPad Pro (12 9-inch) (5th generation) - 2021-08-05 at 18 03 05

Add unit tests

No tests! Well yeah, this was a POC but came out the other end cleaner than expected.

There isn't a ton to test so leaving this as a single issue. If ui tests are simple they could be added here too.

Hook into notification center to update on app config changes

Currently the app can almost get notifications for app config changes, but it causes questions to reload and lose answers. The app config also sends notifications for simple events like clicking on a button in the app so that causes issues.

So it would need to:

  • Separate answers and questions so questions can retain answers on app config reload
  • Make sure there aren't performance issues from getting spammed with notifications - so the hook has to be very lightweight

A simple hook and reload doesn't work because we see this behavior:

  1. Open app
  2. Click a dropdown menu
  3. Choose an answer
    At this point the answer is chosen on the backend, but then the app config reloads and the answer is set back to none. Any answers chosen after this work but it's a bad user experience.

At the moment this doesn't show up on local builds since it uses the mockAppConfigController which doesn't have hooks implemented yet.

Add authentication for posting to webhook

Currently if a user wants to use authentication it has to be done in the url which isn't great. The app should allow the managed app config to set authorization.

This is harder than it sounds. The authentication should be encrypted somehow, but there isn't a way to encrypt managed app configs that I know of, see step 3: https://www.appconfig.org/ios/ . This requires more research.

It's worth noting the app only posts to endpoints, so as long as the receiver is filtering the requests this is okay.

Some ideas:

  • Allow sign ins via SSO so end users can provide their credentials (doesn't this defeat the purpose? A little bit, but it doesn't make the app useless, device information still matters and the username could still be autofilled)
  • Send the authorization in the managed app config anyways, with the understanding the user will be able to see it. This is pretty much okay, other apps couldn't access it as long as the device is not jailbroken and it could even be unique per user with the use of variables. This is what every other app that takes a managed app config for auth is doing (spooky right? ๐Ÿ‘ป )

Allow manual configuration

Allow manual configuration:

  • If no app config is loaded then have another button in error message that gives the option to configure
  • Go through a series of pages to configure the app [title,webhook,questions,etc]
  • Store all options in UserDefaults
  • At the end allow setting a password
  • Once finished have an edit button that is protected by the password
  • If the password is unknown have a way to wipe it out - clearing app data maybe?

This has limited utility and offers no advantage over a web form, so this is not a priority at all

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.