Coder Social home page Coder Social logo

geek-1001 / clue Goto Github PK

View Code? Open in Web Editor NEW
279.0 7.0 19.0 4.75 MB

Flexible bug report framework for iOS

License: MIT License

Ruby 0.24% Objective-C 49.37% C 45.71% C++ 3.83% Swift 0.85%
ios bug-reports objective-c framework cocoapods record-video clue-report video

clue's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

clue's Issues

Migrate CLUWritable to Swift

Description

We should create a Writable Swift protocol to replace CLUWritable. This would allow to migrate, over a period of time, all classes dependent on CLUWritable to Swift.

Depends on #11.

Create VideoWriter for writing video files

Description

Right now, we are using CLUVideoWriter to write video content to file. We'd like to create a specific writer for video content (VideoWriter) to better encapsulate this functionality.

Create JSONDataWriter for writing JSON files

Description

Right now, we are using CLUDataWriter to write JSON content to file. We'd like to create a specific writer for JSON data (JSONDataWriter) that allows to validate the content before writing to the file system. This new class should be used for all scenario where we are writing JSON data.

Main Thread Checker issues

Hy,

In our codebase we enabled the Main Thread Checker:
You can found it:
Edit schema > Run > diagnostics > Runtime API Checking > [✔] Main Thread Checker

Produces a lot of warning around UIKit component getter/setters.

Fail utils method in UIView (CLUViewRecordableAdditions) if arguments are invalid

Description

We need to fail some utils method in UIView (CLUViewRecordableAdditions) if input arguments are invalid.

For example:

- (NSDictionary *)clue_fontPropertyDictionaryForFont:(UIFont *)font {
    NSMutableDictionary *fontDictionary = [[NSMutableDictionary alloc] init];
    if (font) {
        [fontDictionary clue_setValidObject:font.familyName forKey:@"familyName"];
        [fontDictionary clue_setValidObject:font.fontName forKey:@"fontName"];
        [fontDictionary setObject:@(font.pointSize) forKey:@"pointSize"];
        [fontDictionary setObject:@(font.lineHeight) forKey:@"lineHeight"];
    }
    return fontDictionary;
}

If user will pass invalid font – this method will return empty dictionary. But if font is invalid, we don't need font dictionary at all.
Here are some utils method from UIView (CLUViewRecordableAdditions) which I think needs to be fixed (return nil if input argument is invalid)

  • -clue_fontPropertyDictionaryForFont:
  • -clue_attributedTextPropertyDictionaryForAttributedString:
  • -clue_colorPropertyDictionaryForColor:

Note : We need to check where those method used and ensure that we won't pass invalid object into dictionary for example.

Problem

We don't need empty dictionary if input argument is invalid.

Reference

Create DataWriter as a base class for JSONWriter

Description

Right now we are using JSONWriter to write JSON data into the file from recordable/info modules. We need to create DataWriter as a base class to leave an ability to write raw data into the file.
This will leave some flexibility and allow to encapsulate all low-level stream management code into DataWriter instead of JSONWriter.

Parse attributed string properties in UIView(CLUViewRecordableAdditions)

Description

There is a TODO comment in -clue_attributedTextPropertyDictionaryForAttributedString: method in UIView(CLUViewRecordableAdditions) to parse more useful properties from NSAttributedString.

- (NSDictionary *)clue_attributedTextPropertyDictionaryForAttributedString:(NSAttributedString *)attributedText {
    NSMutableDictionary *attributedTextDictionary = [[NSMutableDictionary alloc] init];
    if (attributedText) {
        [attributedTextDictionary clue_setValidObject:[attributedText string] forKey:@"string"];
    }
    // TODO: add Retrieving Attribute Information
    return attributedTextDictionary;
}

Right now Clue parse only string property which most of the time isn't enough.

References

Fix architectural issue with +[CLURecordIndicatorViewManager currentViewController]

Description

+[CLURecordIndicatorViewManager currentViewController] is a universal method which returns current top/active UIViewController instance. Based on this method Clue can show Record indicator view, record only current view controller's view structure and use it as a main overall context for Clue framework.
Right now this method is a part of CLURecordIndicatorViewManager class. But CLURecordIndicatorViewManager is responsible only for managing CLURecordIndicatorView.

Here are places, where Clue use -currentViewController method:

  1. In CLUViewStructureModule to get current view controller and view stature data from it
- (void)addNewFrameWithTimestamp:(CFTimeInterval)timestamp {
    @synchronized (self) {
        NSDictionary *currentViewStructure;
        UIViewController *rootViewController = [CLURecordIndicatorViewManager currentViewController];
        if (rootViewController && [rootViewController.view isKindOfClass:[UIView class]]) {
            currentViewStructure = [rootViewController.view clue_viewPropertiesDictionary];
        }
        if (!_lastRecordedViewStructure || ![_lastRecordedViewStructure isEqualToDictionary:currentViewStructure]) {
            [self addViewStructureProperties:currentViewStructure
                                      forKey:DEFAULT_VIEW_KEY
                            withTimeInterval:timestamp
                                      forKey:TIMESTAMP_KEY];
            _lastRecordedViewStructure = currentViewStructure;
        }
        [super addNewFrameWithTimestamp:timestamp];
    }
}
  1. In ClueController to get current view controller and show record indicator view and utils alert
- (void)startRecording {
    UIViewController *currentViewController = [CLURecordIndicatorViewManager currentViewController];
    // If user has previous report file (caused by exception) suggest him to resend it
    if ([[CLUReportFileManager sharedManager] isReportZipFileAvailable]) {
        [self showAlertWithTitle:@"Send Previous Clue Report"
                         message:@"Do you want to send your previous Clue Report caused by internal excpetion?"
              successActionTitle:@"Send Report"
              failureActionTitle:@"Delete Report"
                  successHandler:^{
                      [self sendReportWithEmailService];
                  } failureHandler:^{
                      [[CLUReportFileManager sharedManager] removeReportZipFile];
                  }
                inViewController:currentViewController];
        return;
    }
    
    if (!_isRecording) {
        _isRecording = YES;
        [_reportComposer startRecording];
        NSDateComponents *maxTime = [CLURecordIndicatorViewManager defaultMaxTime];
        [CLURecordIndicatorViewManager showRecordIndicatorInViewController:currentViewController
                                                               withMaxTime:maxTime
                                                                    target:self
                                                                 andAction:@selector(stopRecording)];
    }
}
  1. In ClueController to get current view controller and show modal mail window
- (void)sendReportWithEmailService {
    UIViewController *currentViewController = [CLURecordIndicatorViewManager currentViewController];
    CLUMailHelper *mailHelper = [[CLUMailHelper alloc] initWithOption:_options];
     [mailHelper setMailDelegate:_mailDelegate];
    // TODO: test it on real device. Mail isn't working on simulator
    if (currentViewController) {
        [mailHelper showMailComposeWindowWithViewController:currentViewController];
    }
}

Problem

+[CLURecordIndicatorViewManager currentViewController] method should not belong to CLURecordIndicatorViewManager. because it's universal method for getting current view controller across the framework

References

Fix possible memory leak in CLUUserInteractionModule because of connected gesture recognizer

Description

There is a #warning in CLUUserInteractionModule class in startRecording method

- (void)startRecording {
    if (!self.isRecording) {
        [super startRecording];
        [_gestureRecognizer setObserverDelegate:self];
        #warning If some window will be destroyed how to deattach gesture recognizer from it? Possible memory leak!
        [[[UIApplication sharedApplication] keyWindow] addGestureRecognizer:_gestureRecognizer];
    }
}

We're connecting gesture recognizer to specific window [[UIApplication sharedApplication] keyWindow].

Problems

  • Key window could change during the lifetime of the app.
  • What if current key window is different from current active window (in terms of touch events) at the moment

References

A window is considered the key window when it is currently receiving keyboard and non touch-related events. Whereas touch events are delivered to the window in which the touch occurred, events that don’t have an associated coordinate value are delivered to the key window. Only one window at a time can be key

Skip invalid recordable properties

Right now Clue records in final .clue file every property and if it's invalid – it just records an empty string.

For example if UIView doesn't have backgroundColor property – Clue will record background color as an empty dictionary. It isn't a good idea.

So we need to skip invalid properties at all.

[BUG] Crash when you instantiate Clue before window setup

Hi,

I've found a bug:
When I setup the Clue instance and I'm not setted up the UIApplication's window yet, then it occurs a crash.
The problem is in the ClueController.m:236 where you use the app's window bounds size and not the UIScreen.mainScreen...

Improve the readme.md or the above mentioned part of the code.

Thanks

PATCH /api/user can not be enabled, version 1.12

I would like to make use of the PATCH /api/user/ endpoint available for an 'API Key'. But the Fusionauth configuration only allows me to active POST,PUT,DELETE, and GET for a function. I'm using version 1.12. What I had to do is disable all endpoint, thus giving me access to all functions, but this seem like a security risk.

MFMailComposeViewController is not dismissed after user sent, saved, or canceled the mail.

After I shaken the phone to send the report, I find I'm trapped in the mail screen. I'd like to go back to the APP and continue what I was doing. But currently I have to kill the APP to quit the mail view.

I checked the code a little bit, it seems that CLUMailDelegate doesn't dismiss the mailComposeController in mailComposeController(_:didFinishWith:error:). I am not sure if it's by design or not. But by adding [controller dismissViewControllerAnimated:YES completion:nil]; after the switch solved my issue. Could you kindly fix this issue on your side? Or I can open a PR with my fix if you need. Thanks!

Migrate classes which use JSONWriter. appendWithJson to Swift to be able to use Result error type

Description

Result error type can't be used with Objective-C code. In particular, this applies to the following classes:

  • CLUObserveModule
  • CLUDeviceInfoModule
  • CLUExceptionInfoModule

Where the appendWithJson method from JSONWriter needs to be called. As this method is now returning a Result<Int, DataWriterError> type, it is not visible/available anymore from Objective-C.

So we need to migrate the above three classes to Swift so we can fully take advantage of the Result return type for writing JSON.

Refactor JSONDataWriter to support better error notification

Description

The append method in the JSONWriter class created for #9 doesn't provide a straightforward way to handle errors. A nice improvements would be to either:

  • Allow JSONWriter to throw a JSONWriterError as needed.
  • Return a Result<Bool, JSONWriterError> to encapsulate the semantics of the return value(s).

Personally, I prefer using Result. If we go down this path, we have two possible scenarios:

  • We create our own simple Result type (with limited functionality):
enum Result<T, ErrorType> {
  case success(T)
  case error(ErrorType)
}
  • We take advantage of the existing Result library, which provides a lot of useful additional functionality. This would require introducing third-party Cocoapod dependencies (with the related pros and cons).

All the suggested above enhancements are not compatible with Objective-C code. In order to start working on these improvements, we first need to migrate all writing functionality related classes to Swift.

Depends on #11 and #12.

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.